* [PATCH] selftests: powerpc: Add test for execute-disabled pkeys
From: Sandipan Das @ 2020-05-08 16:23 UTC (permalink / raw)
To: mpe
Cc: fweimer, aneesh.kumar, linuxram, linux-mm, linux-kselftest,
linuxppc-dev, bauerman
Apart from read and write access, memory protection keys can
also be used for restricting execute permission of pages on
powerpc. This adds a test to verify if the feature works as
expected.
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
tools/testing/selftests/powerpc/mm/Makefile | 3 +-
.../selftests/powerpc/mm/pkey_exec_prot.c | 326 ++++++++++++++++++
2 files changed, 328 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
diff --git a/tools/testing/selftests/powerpc/mm/Makefile b/tools/testing/selftests/powerpc/mm/Makefile
index b9103c4bb414..2816229f648b 100644
--- a/tools/testing/selftests/powerpc/mm/Makefile
+++ b/tools/testing/selftests/powerpc/mm/Makefile
@@ -3,7 +3,7 @@ noarg:
$(MAKE) -C ../
TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors wild_bctr \
- large_vm_fork_separation bad_accesses
+ large_vm_fork_separation bad_accesses pkey_exec_prot
TEST_GEN_PROGS_EXTENDED := tlbie_test
TEST_GEN_FILES := tempfile
@@ -17,6 +17,7 @@ $(OUTPUT)/prot_sao: ../utils.c
$(OUTPUT)/wild_bctr: CFLAGS += -m64
$(OUTPUT)/large_vm_fork_separation: CFLAGS += -m64
$(OUTPUT)/bad_accesses: CFLAGS += -m64
+$(OUTPUT)/pkey_exec_prot: CFLAGS += -m64
$(OUTPUT)/tempfile:
dd if=/dev/zero of=$@ bs=64k count=1
diff --git a/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c b/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
new file mode 100644
index 000000000000..b346ad205e68
--- /dev/null
+++ b/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
@@ -0,0 +1,326 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * Copyright 2020, Sandipan Das, IBM Corp.
+ *
+ * Test if applying execute protection on pages using memory
+ * protection keys works as expected.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#include <time.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include "utils.h"
+
+/* Override definitions as they might be inconsistent */
+#undef PKEY_DISABLE_ACCESS
+#define PKEY_DISABLE_ACCESS 0x3
+
+#undef PKEY_DISABLE_WRITE
+#define PKEY_DISABLE_WRITE 0x2
+
+#undef PKEY_DISABLE_EXECUTE
+#define PKEY_DISABLE_EXECUTE 0x4
+
+/* Older distros might not define this */
+#ifndef SEGV_PKUERR
+#define SEGV_PKUERR 4
+#endif
+
+#define SYS_pkey_mprotect 386
+#define SYS_pkey_alloc 384
+#define SYS_pkey_free 385
+
+#define PKEY_BITS_PER_PKEY 2
+#define NR_PKEYS 32
+
+#define PKEY_BITS_MASK ((1UL << PKEY_BITS_PER_PKEY) - 1)
+
+static unsigned long pkeyreg_get(void)
+{
+ unsigned long uamr;
+
+ asm volatile("mfspr %0, 0xd" : "=r"(uamr));
+ return uamr;
+}
+
+static void pkeyreg_set(unsigned long uamr)
+{
+ asm volatile("isync; mtspr 0xd, %0; isync;" : : "r"(uamr));
+}
+
+static void pkey_set_rights(int pkey, unsigned long rights)
+{
+ unsigned long uamr, shift;
+
+ shift = (NR_PKEYS - pkey - 1) * PKEY_BITS_PER_PKEY;
+ uamr = pkeyreg_get();
+ uamr &= ~(PKEY_BITS_MASK << shift);
+ uamr |= (rights & PKEY_BITS_MASK) << shift;
+ pkeyreg_set(uamr);
+}
+
+static int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey)
+{
+ return syscall(SYS_pkey_mprotect, addr, len, prot, pkey);
+}
+
+static int sys_pkey_alloc(unsigned long flags, unsigned long rights)
+{
+ return syscall(SYS_pkey_alloc, flags, rights);
+}
+
+static int sys_pkey_free(int pkey)
+{
+ return syscall(SYS_pkey_free, pkey);
+}
+
+static volatile int fpkey, fcode, ftype, faults;
+static unsigned long pgsize, numinsns;
+static volatile unsigned int *faddr;
+static unsigned int *insns;
+
+static void segv_handler(int signum, siginfo_t *sinfo, void *ctx)
+{
+ /* Check if this fault originated because of the expected reasons */
+ if (sinfo->si_code != SEGV_ACCERR && sinfo->si_code != SEGV_PKUERR) {
+ printf("got an unexpected fault, code = %d\n",
+ sinfo->si_code);
+ goto fail;
+ }
+
+ /* Check if this fault originated from the expected address */
+ if (sinfo->si_addr != (void *) faddr) {
+ printf("got an unexpected fault, addr = %p\n",
+ sinfo->si_addr);
+ goto fail;
+ }
+
+ /* Check if the expected number of faults has been exceeded */
+ if (faults == 0)
+ goto fail;
+
+ fcode = sinfo->si_code;
+
+ /* Restore permissions in order to continue */
+ switch (fcode) {
+ case SEGV_ACCERR:
+ if (mprotect(insns, pgsize, PROT_READ | PROT_WRITE)) {
+ perror("mprotect");
+ goto fail;
+ }
+ break;
+ case SEGV_PKUERR:
+ if (sinfo->si_pkey != fpkey)
+ goto fail;
+
+ if (ftype == PKEY_DISABLE_ACCESS) {
+ pkey_set_rights(fpkey, 0);
+ } else if (ftype == PKEY_DISABLE_EXECUTE) {
+ /*
+ * Reassociate the exec-only pkey with the region
+ * to be able to continue. Unlike AMR, we cannot
+ * set IAMR directly from userspace to restore the
+ * permissions.
+ */
+ if (mprotect(insns, pgsize, PROT_EXEC)) {
+ perror("mprotect");
+ goto fail;
+ }
+ } else {
+ goto fail;
+ }
+ break;
+ }
+
+ faults--;
+ return;
+
+fail:
+ /* Restore all page permissions to avoid repetitive faults */
+ if (mprotect(insns, pgsize, PROT_READ | PROT_WRITE | PROT_EXEC))
+ perror("mprotect");
+ if (sinfo->si_code == SEGV_PKUERR)
+ pkey_set_rights(sinfo->si_pkey, 0);
+ faults = -1; /* Something unexpected happened */
+}
+
+static int pkeys_unsupported(void)
+{
+ bool using_hash = false;
+ char line[128];
+ int pkey;
+ FILE *f;
+
+ f = fopen("/proc/cpuinfo", "r");
+ FAIL_IF(!f);
+
+ /* Protection keys are currently supported on Hash MMU only */
+ while (fgets(line, sizeof(line), f)) {
+ if (strcmp(line, "MMU : Hash\n") == 0) {
+ using_hash = true;
+ break;
+ }
+ }
+
+ fclose(f);
+ SKIP_IF(!using_hash);
+
+ /* Check if the system call is supported */
+ pkey = sys_pkey_alloc(0, 0);
+ SKIP_IF(pkey < 0);
+ sys_pkey_free(pkey);
+
+ return 0;
+}
+
+static int test(void)
+{
+ struct sigaction act;
+ int pkey, ret, i;
+
+ ret = pkeys_unsupported();
+ if (ret)
+ return ret;
+
+ /* Setup signal handler */
+ act.sa_handler = 0;
+ act.sa_sigaction = segv_handler;
+ FAIL_IF(sigprocmask(SIG_SETMASK, 0, &act.sa_mask) != 0);
+ act.sa_flags = SA_SIGINFO;
+ act.sa_restorer = 0;
+ FAIL_IF(sigaction(SIGSEGV, &act, NULL) != 0);
+
+ /* Setup executable region */
+ pgsize = sysconf(_SC_PAGESIZE);
+ numinsns = pgsize / sizeof(unsigned int);
+ insns = (unsigned int *) mmap(NULL, pgsize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ FAIL_IF(insns == MAP_FAILED);
+
+ /* Write the instruction words */
+ for (i = 0; i < numinsns - 1; i++)
+ insns[i] = 0x60000000; /* nop */
+
+ /*
+ * Later, to jump to the executable region, we use a linked
+ * branch which sets the return address automatically in LR.
+ * Use that to return back.
+ */
+ insns[numinsns - 1] = 0x4e800020; /* blr */
+
+ /* Allocate a pkey that restricts execution */
+ pkey = sys_pkey_alloc(0, PKEY_DISABLE_EXECUTE);
+ FAIL_IF(pkey < 0);
+
+ /*
+ * Pick a random instruction address from the executable
+ * region.
+ */
+ srand(time(NULL));
+ faddr = &insns[rand() % (numinsns - 1)];
+
+ /* The following two cases will avoid SEGV_PKUERR */
+ ftype = -1;
+ fpkey = -1;
+
+ /*
+ * Read an instruction word from the address when AMR bits
+ * are not set.
+ *
+ * This should not generate a fault as having PROT_EXEC
+ * implicitly allows reads. The pkey currently restricts
+ * execution only based on the IAMR bits. The AMR bits are
+ * cleared.
+ */
+ faults = 0;
+ FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0);
+ printf("read from %p, pkey is execute-disabled\n", (void *) faddr);
+ i = *faddr;
+ FAIL_IF(faults != 0);
+
+ /*
+ * Write an instruction word to the address when AMR bits
+ * are not set.
+ *
+ * This should generate an access fault as having just
+ * PROT_EXEC also restricts writes. The pkey currently
+ * restricts execution only based on the IAMR bits. The
+ * AMR bits are cleared.
+ */
+ faults = 1;
+ FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0);
+ printf("write to %p, pkey is execute-disabled\n", (void *) faddr);
+ *faddr = 0x60000000; /* nop */
+ FAIL_IF(faults != 0 || fcode != SEGV_ACCERR);
+
+ /* The following three cases will generate SEGV_PKUERR */
+ ftype = PKEY_DISABLE_ACCESS;
+ fpkey = pkey;
+
+ /*
+ * Read an instruction word from the address when AMR bits
+ * are set.
+ *
+ * This should generate a pkey fault based on AMR bits only
+ * as having PROT_EXEC implicitly allows reads.
+ */
+ faults = 1;
+ FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0);
+ printf("read from %p, pkey is execute-disabled, access-disabled\n",
+ (void *) faddr);
+ pkey_set_rights(pkey, PKEY_DISABLE_ACCESS);
+ i = *faddr;
+ FAIL_IF(faults != 0 || fcode != SEGV_PKUERR);
+
+ /*
+ * Write an instruction word to the address when AMR bits
+ * are set.
+ *
+ * This should generate two faults. First, a pkey fault based
+ * on AMR bits and then an access fault based on PROT_EXEC.
+ */
+ faults = 2;
+ FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0);
+ printf("write to %p, pkey is execute-disabled, access-disabled\n",
+ (void *) faddr);
+ pkey_set_rights(pkey, PKEY_DISABLE_ACCESS);
+ *faddr = 0x60000000; /* nop */
+ FAIL_IF(faults != 0 || fcode != SEGV_ACCERR);
+
+ /*
+ * Jump to the executable region. This should generate a pkey
+ * fault based on IAMR bits. AMR bits will not affect execution.
+ */
+ faddr = insns;
+ ftype = PKEY_DISABLE_EXECUTE;
+ fpkey = pkey;
+ faults = 1;
+ FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0);
+ pkey_set_rights(pkey, PKEY_DISABLE_ACCESS);
+ printf("execute at %p, ", (void *) faddr);
+ printf("pkey is execute-disabled, access-disabled\n");
+
+ /* Branch into the executable region */
+ asm volatile("mtctr %0" : : "r"((unsigned long) insns));
+ asm volatile("bctrl");
+ FAIL_IF(faults != 0 || fcode != SEGV_PKUERR);
+
+ /* Cleanup */
+ munmap((void *) insns, pgsize);
+ sys_pkey_free(pkey);
+
+ return 0;
+}
+
+int main(void)
+{
+ test_harness(test, "pkey_exec_prot");
+}
--
2.17.1
^ permalink raw reply related
* [PATCH 15/15] nvdimm/pmem: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvdimm/pmem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 2df6994acf836..f8dc5941215bf 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -196,7 +196,7 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)
unsigned long start;
struct bio_vec bvec;
struct bvec_iter iter;
- struct pmem_device *pmem = q->queuedata;
+ struct pmem_device *pmem = bio->bi_disk->private_data;
struct nd_region *nd_region = to_region(pmem);
if (bio->bi_opf & REQ_PREFLUSH)
@@ -231,7 +231,7 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)
static int pmem_rw_page(struct block_device *bdev, sector_t sector,
struct page *page, unsigned int op)
{
- struct pmem_device *pmem = bdev->bd_queue->queuedata;
+ struct pmem_device *pmem = bdev->bd_disk->private_data;
blk_status_t rc;
if (op_is_write(op))
@@ -464,7 +464,6 @@ static int pmem_attach_disk(struct device *dev,
blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
if (pmem->pfn_flags & PFN_MAP)
blk_queue_flag_set(QUEUE_FLAG_DAX, q);
- q->queuedata = pmem;
disk = alloc_disk_node(0, nid);
if (!disk)
@@ -474,6 +473,7 @@ static int pmem_attach_disk(struct device *dev,
disk->fops = &pmem_fops;
disk->queue = q;
disk->flags = GENHD_FL_EXT_DEVT;
+ disk->private_data = pmem;
disk->queue->backing_dev_info->capabilities |= BDI_CAP_SYNCHRONOUS_IO;
nvdimm_namespace_disk_name(ndns, disk->disk_name);
set_capacity(disk, (pmem->size - pmem->pfn_pad - pmem->data_offset)
--
2.26.2
^ permalink raw reply related
* [PATCH 13/15] nvdimm/blk: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvdimm/blk.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c
index 43751fab9d36a..ffe4728bad8b1 100644
--- a/drivers/nvdimm/blk.c
+++ b/drivers/nvdimm/blk.c
@@ -165,7 +165,7 @@ static int nsblk_do_bvec(struct nd_namespace_blk *nsblk,
static blk_qc_t nd_blk_make_request(struct request_queue *q, struct bio *bio)
{
struct bio_integrity_payload *bip;
- struct nd_namespace_blk *nsblk;
+ struct nd_namespace_blk *nsblk = bio->bi_disk->private_data;
struct bvec_iter iter;
unsigned long start;
struct bio_vec bvec;
@@ -176,7 +176,6 @@ static blk_qc_t nd_blk_make_request(struct request_queue *q, struct bio *bio)
return BLK_QC_T_NONE;
bip = bio_integrity(bio);
- nsblk = q->queuedata;
rw = bio_data_dir(bio);
do_acct = nd_iostat_start(bio, &start);
bio_for_each_segment(bvec, bio, iter) {
@@ -258,7 +257,6 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk)
blk_queue_max_hw_sectors(q, UINT_MAX);
blk_queue_logical_block_size(q, nsblk_sector_size(nsblk));
blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
- q->queuedata = nsblk;
disk = alloc_disk(0);
if (!disk)
@@ -268,6 +266,7 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk)
disk->fops = &nd_blk_fops;
disk->queue = q;
disk->flags = GENHD_FL_EXT_DEVT;
+ disk->private_data = nsblk;
nvdimm_namespace_disk_name(&nsblk->common, disk->disk_name);
if (devm_add_action_or_reset(dev, nd_blk_release_disk, disk))
--
2.26.2
^ permalink raw reply related
* [PATCH 14/15] nvdimm/btt: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvdimm/btt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 3b09419218d6f..eca3e48fefda1 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1442,7 +1442,7 @@ static int btt_do_bvec(struct btt *btt, struct bio_integrity_payload *bip,
static blk_qc_t btt_make_request(struct request_queue *q, struct bio *bio)
{
struct bio_integrity_payload *bip = bio_integrity(bio);
- struct btt *btt = q->queuedata;
+ struct btt *btt = bio->bi_disk->private_data;
struct bvec_iter iter;
unsigned long start;
struct bio_vec bvec;
@@ -1543,7 +1543,6 @@ static int btt_blk_init(struct btt *btt)
blk_queue_logical_block_size(btt->btt_queue, btt->sector_size);
blk_queue_max_hw_sectors(btt->btt_queue, UINT_MAX);
blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_queue);
- btt->btt_queue->queuedata = btt;
if (btt_meta_size(btt)) {
int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt));
--
2.26.2
^ permalink raw reply related
* [PATCH 12/15] md: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/md/md.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 271e8a5873549..c079ecf77c564 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -466,7 +466,7 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio)
{
const int rw = bio_data_dir(bio);
const int sgrp = op_stat_group(bio_op(bio));
- struct mddev *mddev = q->queuedata;
+ struct mddev *mddev = bio->bi_disk->private_data;
unsigned int sectors;
if (unlikely(test_bit(MD_BROKEN, &mddev->flags)) && (rw == WRITE)) {
@@ -5626,7 +5626,6 @@ static int md_alloc(dev_t dev, char *name)
mddev->queue = blk_alloc_queue(md_make_request, NUMA_NO_NODE);
if (!mddev->queue)
goto abort;
- mddev->queue->queuedata = mddev;
blk_set_stacking_limits(&mddev->queue->limits);
--
2.26.2
^ permalink raw reply related
* [PATCH 11/15] dm: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/md/dm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 0eb93da44ea2a..2aaae6c1ed312 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1783,7 +1783,7 @@ static blk_qc_t dm_process_bio(struct mapped_device *md,
static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio)
{
- struct mapped_device *md = q->queuedata;
+ struct mapped_device *md = bio->bi_disk->private_data;
blk_qc_t ret = BLK_QC_T_NONE;
int srcu_idx;
struct dm_table *map;
@@ -1980,7 +1980,6 @@ static struct mapped_device *alloc_dev(int minor)
md->queue = blk_alloc_queue(dm_make_request, numa_node_id);
if (!md->queue)
goto bad;
- md->queue->queuedata = md;
md->disk = alloc_disk_node(1, md->numa_node_id);
if (!md->disk)
--
2.26.2
^ permalink raw reply related
* [PATCH 10/15] bcache: stop setting ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/md/bcache/super.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index d98354fa28e3e..a0fb5af2beeda 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -871,7 +871,6 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
return -ENOMEM;
d->disk->queue = q;
- q->queuedata = d;
q->backing_dev_info->congested_data = d;
q->limits.max_hw_sectors = UINT_MAX;
q->limits.max_sectors = UINT_MAX;
--
2.26.2
^ permalink raw reply related
* [PATCH 09/15] lightnvm: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/lightnvm/core.c | 1 -
drivers/lightnvm/pblk-init.c | 2 +-
drivers/lightnvm/pblk.h | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index db38a68abb6c0..85c5490cdfd2e 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -400,7 +400,6 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
}
tdisk->private_data = targetdata;
- tqueue->queuedata = targetdata;
mdts = (dev->geo.csecs >> 9) * NVM_MAX_VLBA;
if (dev->geo.mdts) {
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 9a967a2e83dd7..bec904ec0f7c0 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -49,7 +49,7 @@ struct bio_set pblk_bio_set;
static blk_qc_t pblk_make_rq(struct request_queue *q, struct bio *bio)
{
- struct pblk *pblk = q->queuedata;
+ struct pblk *pblk = bio->bi_disk->private_data;
if (bio_op(bio) == REQ_OP_DISCARD) {
pblk_discard(pblk, bio);
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 86ffa875bfe16..ed364afaed0d8 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -1255,7 +1255,7 @@ static inline int pblk_boundary_ppa_checks(struct nvm_tgt_dev *tgt_dev,
continue;
}
- print_ppa(tgt_dev->q->queuedata, ppa, "boundary", i);
+ print_ppa(tgt_dev->disk->private_data, ppa, "boundary", i);
return 1;
}
--
2.26.2
^ permalink raw reply related
* [PATCH 01/15] nfblock: use gendisk private_data
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/m68k/emu/nfblock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index c3a630440512e..5c6f04b00e866 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -61,7 +61,7 @@ struct nfhd_device {
static blk_qc_t nfhd_make_request(struct request_queue *queue, struct bio *bio)
{
- struct nfhd_device *dev = queue->queuedata;
+ struct nfhd_device *dev = bio->bi_disk->private_data;
struct bio_vec bvec;
struct bvec_iter iter;
int dir, len, shift;
@@ -122,7 +122,6 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
if (dev->queue == NULL)
goto free_dev;
- dev->queue->queuedata = dev;
blk_queue_logical_block_size(dev->queue, bsize);
dev->disk = alloc_disk(16);
@@ -136,6 +135,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
sprintf(dev->disk->disk_name, "nfhd%u", dev_id);
set_capacity(dev->disk, (sector_t)blocks * (bsize / 512));
dev->disk->queue = dev->queue;
+ dev->disk->private_data = dev;
add_disk(dev->disk);
--
2.26.2
^ permalink raw reply related
* [PATCH 04/15] null_blk: stop using ->queuedata for bio mode
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/null_blk_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 8efd8778e2095..d14df79feca89 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -1365,7 +1365,7 @@ static blk_qc_t null_queue_bio(struct request_queue *q, struct bio *bio)
{
sector_t sector = bio->bi_iter.bi_sector;
sector_t nr_sectors = bio_sectors(bio);
- struct nullb *nullb = q->queuedata;
+ struct nullb *nullb = bio->bi_disk->private_data;
struct nullb_queue *nq = nullb_to_queue(nullb);
struct nullb_cmd *cmd;
--
2.26.2
^ permalink raw reply related
* [PATCH 07/15] umem: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/umem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index d84e8a878df24..e59bff24e02cf 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -521,7 +521,8 @@ static int mm_check_plugged(struct cardinfo *card)
static blk_qc_t mm_make_request(struct request_queue *q, struct bio *bio)
{
- struct cardinfo *card = q->queuedata;
+ struct cardinfo *card = bio->bi_disk->private_data;
+
pr_debug("mm_make_request %llu %u\n",
(unsigned long long)bio->bi_iter.bi_sector,
bio->bi_iter.bi_size);
@@ -888,7 +889,6 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
card->queue = blk_alloc_queue(mm_make_request, NUMA_NO_NODE);
if (!card->queue)
goto failed_alloc;
- card->queue->queuedata = card;
tasklet_init(&card->tasklet, process_page, (unsigned long)card);
--
2.26.2
^ permalink raw reply related
* remove a few uses of ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
Hi all,
various bio based drivers use queue->queuedata despite already having
set up disk->private_data, which can be used just as easily. This
series cleans them up to only use a single private data pointer.
blk-mq based drivers that have code pathes that can't easily get at
the gendisk are unaffected by this series.
^ permalink raw reply
* [PATCH 03/15] drbd: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/drbd/drbd_main.c | 1 -
drivers/block/drbd/drbd_req.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index c094c3c2c5d4d..be787b268f044 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2805,7 +2805,6 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
if (!q)
goto out_no_q;
device->rq_queue = q;
- q->queuedata = device;
disk = alloc_disk(1);
if (!disk)
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 840c3aef3c5c9..02c104a0c45e0 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -1614,7 +1614,7 @@ void do_submit(struct work_struct *ws)
blk_qc_t drbd_make_request(struct request_queue *q, struct bio *bio)
{
- struct drbd_device *device = (struct drbd_device *) q->queuedata;
+ struct drbd_device *device = bio->bi_disk->private_data;
unsigned long start_jif;
blk_queue_split(q, &bio);
--
2.26.2
^ permalink raw reply related
* [PATCH 05/15] ps3vram: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/ps3vram.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index 821d4d8b1d763..5a1d1d137c724 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -587,7 +587,7 @@ static struct bio *ps3vram_do_bio(struct ps3_system_bus_device *dev,
static blk_qc_t ps3vram_make_request(struct request_queue *q, struct bio *bio)
{
- struct ps3_system_bus_device *dev = q->queuedata;
+ struct ps3_system_bus_device *dev = bio->bi_disk->private_data;
struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev);
int busy;
@@ -745,7 +745,6 @@ static int ps3vram_probe(struct ps3_system_bus_device *dev)
}
priv->queue = queue;
- queue->queuedata = dev;
blk_queue_max_segments(queue, BLK_MAX_SEGMENTS);
blk_queue_max_segment_size(queue, BLK_MAX_SEGMENT_SIZE);
blk_queue_max_hw_sectors(queue, BLK_SAFE_MAX_SECTORS);
--
2.26.2
^ permalink raw reply related
* [PATCH 08/15] zram: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/zram/zram_drv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index ebb234f36909c..e1a6c74c7a4ba 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1593,7 +1593,7 @@ static void __zram_make_request(struct zram *zram, struct bio *bio)
*/
static blk_qc_t zram_make_request(struct request_queue *queue, struct bio *bio)
{
- struct zram *zram = queue->queuedata;
+ struct zram *zram = bio->bi_disk->private_data;
if (!valid_io_request(zram, bio->bi_iter.bi_sector,
bio->bi_iter.bi_size)) {
@@ -1916,7 +1916,6 @@ static int zram_add(void)
zram->disk->first_minor = device_id;
zram->disk->fops = &zram_devops;
zram->disk->queue = queue;
- zram->disk->queue->queuedata = zram;
zram->disk->private_data = zram;
snprintf(zram->disk->disk_name, 16, "zram%d", device_id);
--
2.26.2
^ permalink raw reply related
* [PATCH 06/15] rsxx: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/rsxx/dev.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/block/rsxx/dev.c b/drivers/block/rsxx/dev.c
index 8ffa8260dcafe..6dde80b096c62 100644
--- a/drivers/block/rsxx/dev.c
+++ b/drivers/block/rsxx/dev.c
@@ -133,7 +133,7 @@ static void bio_dma_done_cb(struct rsxx_cardinfo *card,
static blk_qc_t rsxx_make_request(struct request_queue *q, struct bio *bio)
{
- struct rsxx_cardinfo *card = q->queuedata;
+ struct rsxx_cardinfo *card = bio->bi_disk->private_data;
struct rsxx_bio_meta *bio_meta;
blk_status_t st = BLK_STS_IOERR;
@@ -282,8 +282,6 @@ int rsxx_setup_dev(struct rsxx_cardinfo *card)
card->queue->limits.discard_alignment = RSXX_HW_BLK_SIZE;
}
- card->queue->queuedata = card;
-
snprintf(card->gendisk->disk_name, sizeof(card->gendisk->disk_name),
"rsxx%d", card->disk_id);
card->gendisk->major = card->major;
@@ -304,7 +302,6 @@ void rsxx_destroy_dev(struct rsxx_cardinfo *card)
card->gendisk = NULL;
blk_cleanup_queue(card->queue);
- card->queue->queuedata = NULL;
unregister_blkdev(card->major, DRIVER_NAME);
}
--
2.26.2
^ permalink raw reply related
* [PATCH 02/15] simdisk: stop using ->queuedata
From: Christoph Hellwig @ 2020-05-08 16:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-bcache, linux-xtensa, linux-raid, Sergey Senozhatsky,
linux-nvdimm, Geoff Levand, linux-kernel, Jim Paris, linux-block,
Minchan Kim, linux-m68k, Philip Kelleher, linuxppc-dev,
Joshua Morris, Nitin Gupta, drbd-dev
In-Reply-To: <20200508161517.252308-1-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/xtensa/platforms/iss/simdisk.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c
index 49322b66cda93..31b5020077a05 100644
--- a/arch/xtensa/platforms/iss/simdisk.c
+++ b/arch/xtensa/platforms/iss/simdisk.c
@@ -103,7 +103,7 @@ static void simdisk_transfer(struct simdisk *dev, unsigned long sector,
static blk_qc_t simdisk_make_request(struct request_queue *q, struct bio *bio)
{
- struct simdisk *dev = q->queuedata;
+ struct simdisk *dev = bio->bi_disk->private_data;
struct bio_vec bvec;
struct bvec_iter iter;
sector_t sector = bio->bi_iter.bi_sector;
@@ -273,8 +273,6 @@ static int __init simdisk_setup(struct simdisk *dev, int which,
goto out_alloc_queue;
}
- dev->queue->queuedata = dev;
-
dev->gd = alloc_disk(SIMDISK_MINORS);
if (dev->gd == NULL) {
pr_err("alloc_disk failed\n");
--
2.26.2
^ permalink raw reply related
* Re: [PATCH v7 2/5] seq_buf: Export seq_buf_printf() to external modules
From: Borislav Petkov @ 2020-05-08 16:09 UTC (permalink / raw)
To: Vaibhav Jain
Cc: Cezary Rojewski, linux-nvdimm, linux-kernel, Steven Rostedt,
Piotr Maziarz, Aneesh Kumar K . V, linuxppc-dev
In-Reply-To: <87blmy8wm8.fsf@linux.ibm.com>
On Fri, May 08, 2020 at 05:30:31PM +0530, Vaibhav Jain wrote:
> I am referring to Kernel Loadable Modules with MODULE_LICENSE("GPL")
> here.
And what does "external" refer to? Because if it is out-of-tree, we
don't export symbols for out-of-tree modules.
Looks like you're exporting it for that papr_scm.c thing, which is fine.
But that is not "external".
So?
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply
* Re: [PATCH v7 2/5] seq_buf: Export seq_buf_printf() to external modules
From: Joe Perches @ 2020-05-08 14:52 UTC (permalink / raw)
To: Vaibhav Jain, Borislav Petkov
Cc: Cezary Rojewski, linux-nvdimm, linux-kernel, Steven Rostedt,
Piotr Maziarz, Aneesh Kumar K . V, linuxppc-dev
In-Reply-To: <87blmy8wm8.fsf@linux.ibm.com>
On Fri, 2020-05-08 at 17:30 +0530, Vaibhav Jain wrote:
> Hi Boris,
>
> Borislav Petkov <bp@alien8.de> writes:
>
> > On Fri, May 08, 2020 at 04:19:19PM +0530, Vaibhav Jain wrote:
> > > 'seq_buf' provides a very useful abstraction for writing to a string
> > > buffer without needing to worry about it over-flowing. However even
> > > though the API has been stable for couple of years now its stills not
> > > exported to external modules limiting its usage.
> > >
> > > Hence this patch proposes update to 'seq_buf.c' to mark
> > > seq_buf_printf() which is part of the seq_buf API to be exported to
> > > external GPL modules. This symbol will be used in later parts of this
> >
> > What is "external GPL modules"?
> I am referring to Kernel Loadable Modules with MODULE_LICENSE("GPL")
> here.
Any reason why these Kernel Loadable Modules with MODULE_LICENSE("GPL")
are not in the kernel tree?
^ permalink raw reply
* [PATCH -next] soc: fsl: qbman: Remove unused inline function qm_eqcr_get_ci_stashing
From: YueHaibing @ 2020-05-08 14:08 UTC (permalink / raw)
To: leoyang.li, roy.pledge
Cc: YueHaibing, linuxppc-dev, linux-kernel, linux-arm-kernel
There's no callers in-tree anymore.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/soc/fsl/qbman/qman.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
index 1e164e03410a..9888a7061873 100644
--- a/drivers/soc/fsl/qbman/qman.c
+++ b/drivers/soc/fsl/qbman/qman.c
@@ -449,11 +449,6 @@ static inline int qm_eqcr_init(struct qm_portal *portal,
return 0;
}
-static inline unsigned int qm_eqcr_get_ci_stashing(struct qm_portal *portal)
-{
- return (qm_in(portal, QM_REG_CFG) >> 28) & 0x7;
-}
-
static inline void qm_eqcr_finish(struct qm_portal *portal)
{
struct qm_eqcr *eqcr = &portal->eqcr;
--
2.17.1
^ permalink raw reply related
* ioremap() called early from pnv_pci_init_ioda_phb()
From: Qian Cai @ 2020-05-08 14:39 UTC (permalink / raw)
To: Christophe Leroy, Michael Ellerman; +Cc: linuxppc-dev, LKML
Booting POWER9 PowerNV has this message,
"ioremap() called early from pnv_pci_init_ioda_phb+0x420/0xdfc. Use early_ioremap() instead”
but use the patch below will result in leaks because it will never call early_iounmap() anywhere. However, it looks me it was by design that phb->regs mapping would be there forever where it would be used in pnv_ioda_get_inval_reg(), so is just that check_early_ioremap_leak() initcall too strong?
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -36,6 +36,7 @@
#include <asm/firmware.h>
#include <asm/pnv-pci.h>
#include <asm/mmzone.h>
+#include <asm/early_ioremap.h>
#include <misc/cxl-base.h>
@@ -3827,7 +3828,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
/* Get registers */
if (!of_address_to_resource(np, 0, &r)) {
phb->regs_phys = r.start;
- phb->regs = ioremap(r.start, resource_size(&r));
+ phb->regs = early_ioremap(r.start, resource_size(&r));
if (phb->regs == NULL)
pr_err(" Failed to map registers !\n”);
[ 23.080069][ T1] ------------[ cut here ]------------
[ 23.080089][ T1] Debug warning: early ioremap leak of 10 areas detected.
[ 23.080089][ T1] please boot with early_ioremap_debug and report the dmesg.
[ 23.080157][ T1] WARNING: CPU: 4 PID: 1 at mm/early_ioremap.c:99 check_early_ioremap_leak+0xd4/0x108
[ 23.080171][ T1] Modules linked in:
[ 23.080192][ T1] CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.7.0-rc4-next-20200508+ #4
[ 23.080214][ T1] NIP: c00000000103f2d8 LR: c00000000103f2d4 CTR: 0000000000000000
[ 23.080226][ T1] REGS: c00000003df0f860 TRAP: 0700 Not tainted (5.7.0-rc4-next-20200508+)
[ 23.080259][ T1] MSR: 9000000000029033 <SF,HV,EE,ME,IR,DR,RI,LE> CR: 48000222 XER: 20040000
[ 23.080296][ T1] CFAR: c00000000010d5a8 IRQMASK: 0
[ 23.080296][ T1] GPR00: c00000000103f2d4 c00000003df0faf0 c000000001689400 0000000000000072
[ 23.080296][ T1] GPR04: 0000000000000006 0000000000000000 c00000003df0f7e4 0000000000000004
[ 23.080296][ T1] GPR08: 0000001ffbb60000 0000000000000000 c00000003dee6680 0000000000000002
[ 23.080296][ T1] GPR12: 0000000000000000 c000001fffffae00 c000000001057860 c0000000010578b0
[ 23.080296][ T1] GPR16: c000000001002d38 c0000000014f0660 c0000000014f0680 c0000000014f06a0
[ 23.080296][ T1] GPR20: c0000000014f06c0 c0000000014f06e0 c0000000014f0700 c0000000014f0720
[ 23.080296][ T1] GPR24: c000000000c4bc30 c000000486b82000 c0000000015a0fe0 c0000000015a0fc0
[ 23.080296][ T1] GPR28: 0000000000000010 0000000000000010 c000000001061e30 000000000000000a
[ 23.080507][ T1] NIP [c00000000103f2d8] check_early_ioremap_leak+0xd4/0x108
[ 23.080530][ T1] LR [c00000000103f2d4] check_early_ioremap_leak+0xd0/0x108
[ 23.080552][ T1] Call Trace:
[ 23.080571][ T1] [c00000003df0faf0] [c00000000103f2d4] check_early_ioremap_leak+0xd0/0x108 (unreliable)
[ 23.080607][ T1] [c00000003df0fb80] [c00000000001130c] do_one_initcall+0xcc/0x660
[ 23.080648][ T1] [c00000003df0fc80] [c000000001004c18] kernel_init_freeable+0x480/0x568
[ 23.080681][ T1] [c00000003df0fdb0] [c000000000012180] kernel_init+0x24/0x194
[ 23.080713][ T1] [c00000003df0fe20] [c00000000000cb28] ret_from_kernel_thread+0x5c/0x74
This is from the early_ioremap_debug dmesg.
[ 0.000000][ T0] ------------[ cut here ]------------
[ 0.000000][ T0] __early_ioremap(0x000600c3c0010000, 00010000) [0] => 00000000 + ffffffffffbe0000
[ 0.000000][ T0] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:162 __early_ioremap+0x2d8/0x408
[ 0.000000][ T0] Modules linked in:
[ 0.000000][ T0] CPU: 0 PID: 0 Comm: swapper Not tainted 5.7.0-rc4-next-20200508+ #4
[ 0.000000][ T0] NIP: c00000000103f5e4 LR: c00000000103f5e0 CTR: c0000000001e77f0
[ 0.000000][ T0] REGS: c00000000168f980 TRAP: 0700 Not tainted (5.7.0-rc4-next-20200508+)
[ 0.000000][ T0] MSR: 9000000000021033 <SF,HV,ME,IR,DR,RI,LE> CR: 28000248 XER: 20040000
[ 0.000000][ T0] CFAR: c00000000010d5a8 IRQMASK: 1
[ 0.000000][ T0] GPR00: c00000000103f5e0 c00000000168fc10 c000000001689400 0000000000000050
[ 0.000000][ T0] GPR04: c00000000152f6f8 0000000000000000 c00000000168f904 0000000000000000
[ 0.000000][ T0] GPR08: 0000000000000000 0000000000000000 c00000000162f600 0000000000000002
[ 0.000000][ T0] GPR12: c0000000001e77f0 c000000005b30000 0000000000000000 0000000000000000
[ 0.000000][ T0] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000001000
[ 0.000000][ T0] GPR20: 0000000000000000 80000000000001ae 0000000000000000 0000000000000000
[ 0.000000][ T0] GPR24: 0000000000010000 c000000001061da8 0000000000000008 0000000000000008
[ 0.000000][ T0] GPR28: 0000000000000000 c000000001061db0 0000000000000000 c000000001061eb8
[ 0.000000][ T0] NIP [c00000000103f5e4] __early_ioremap+0x2d8/0x408
[ 0.000000][ T0] LR [c00000000103f5e0] __early_ioremap+0x2d4/0x408
[ 0.000000][ T0] Call Trace:
[ 0.000000][ T0] [c00000000168fc10] [c00000000103f5e0] __early_ioremap+0x2d4/0x408 (unreliable)
[ 0.000000][ T0] [c00000000168fcf0] [c00000000101d010] pnv_pci_init_ioda_phb+0x420/0xdfc
[ 0.000000][ T0] [c00000000168fe10] [c00000000101c9b8] pnv_pci_init+0x12c/0x264
[ 0.000000][ T0] [c00000000168fe40] [c000000001016c40] pnv_setup_arch+0x2e4/0x330
[ 0.000000][ T0] [c00000000168fe80] [c000000001009dd0] setup_arch+0x3a0/0x3ec
[ 0.000000][ T0] [c00000000168fef0] [c000000001003ed0] start_kernel+0xb0/0x978
[ 0.000000][ T0] [c00000000168ff90] [c00000000000c790] start_here_common+0x1c/0x8c
[ 0.000000][ T0] Instruction dump:
[ 0.000000][ T0] 7d39ba14 3c82ff3c 3c62ff54 7f06c378 7f88e378 7fc7f378 38a10068 e9290110
[ 0.000000][ T0] 38849e90 3863e8f0 4b0cdf65 60000000 <0fe00000> 2bbe000f 409d0018 3c62fff1
[ 0.000000][ T0] irq event stamp: 0
[ 0.000000][ T0] hardirqs last enabled at (0): [<0000000000000000>] 0x0
[ 0.000000][ T0] hardirqs last disabled at (0): [<0000000000000000>] 0x0
[ 0.000000][ T0] softirqs last enabled at (0): [<0000000000000000>] 0x0
[ 0.000000][ T0] softirqs last disabled at (0): [<0000000000000000>] 0x0
^ permalink raw reply
* [PATCH -next] soc: fsl: dpio: remove set but not used variable 'addr_cena'
From: YueHaibing @ 2020-05-08 14:10 UTC (permalink / raw)
To: Roy.Pledge, leoyang.li, youri.querry_1
Cc: YueHaibing, linuxppc-dev, linux-kernel, linux-arm-kernel
drivers/soc/fsl/dpio//qbman-portal.c:650:11: warning: variable 'addr_cena' set but not used [-Wunused-but-set-variable]
uint64_t addr_cena;
^~~~~~~~~
It is never used, so remove it.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/soc/fsl/dpio/qbman-portal.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c
index e2e9fbb58a72..0ce859b60888 100644
--- a/drivers/soc/fsl/dpio/qbman-portal.c
+++ b/drivers/soc/fsl/dpio/qbman-portal.c
@@ -647,7 +647,6 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
const uint32_t *cl = (uint32_t *)d;
uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
int i, num_enqueued = 0;
- uint64_t addr_cena;
spin_lock(&s->access_spinlock);
half_mask = (s->eqcr.pi_ci_mask>>1);
@@ -700,7 +699,6 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
/* Flush all the cacheline without load/store in between */
eqcr_pi = s->eqcr.pi;
- addr_cena = (size_t)s->addr_cena;
for (i = 0; i < num_enqueued; i++)
eqcr_pi++;
s->eqcr.pi = eqcr_pi & full_mask;
--
2.17.1
^ permalink raw reply related
* [PATCH -next] soc: fsl: dpio: Remove unused inline function qbman_write_eqcr_am_rt_register
From: YueHaibing @ 2020-05-08 14:09 UTC (permalink / raw)
To: Roy.Pledge, leoyang.li, youri.querry_1
Cc: YueHaibing, linuxppc-dev, linux-kernel, linux-arm-kernel
There's no callers in-tree anymore since commit
3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring mode enqueue")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/soc/fsl/dpio/qbman-portal.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c
index 804b8ba9bf5c..e2e9fbb58a72 100644
--- a/drivers/soc/fsl/dpio/qbman-portal.c
+++ b/drivers/soc/fsl/dpio/qbman-portal.c
@@ -572,18 +572,6 @@ void qbman_eq_desc_set_qd(struct qbman_eq_desc *d, u32 qdid,
#define EQAR_VB(eqar) ((eqar) & 0x80)
#define EQAR_SUCCESS(eqar) ((eqar) & 0x100)
-static inline void qbman_write_eqcr_am_rt_register(struct qbman_swp *p,
- u8 idx)
-{
- if (idx < 16)
- qbman_write_register(p, QBMAN_CINH_SWP_EQCR_AM_RT + idx * 4,
- QMAN_RT_MODE);
- else
- qbman_write_register(p, QBMAN_CINH_SWP_EQCR_AM_RT2 +
- (idx - 16) * 4,
- QMAN_RT_MODE);
-}
-
#define QB_RT_BIT ((u32)0x100)
/**
* qbman_swp_enqueue_direct() - Issue an enqueue command
--
2.17.1
^ permalink raw reply related
* Re: [PATCH v7 2/5] seq_buf: Export seq_buf_printf() to external modules
From: Michael Ellerman @ 2020-05-08 13:44 UTC (permalink / raw)
To: Borislav Petkov, Vaibhav Jain
Cc: Santosh Sivaraj, linux-nvdimm, Aneesh Kumar K . V,
Cezary Rojewski, linux-kernel, Steven Rostedt, Piotr Maziarz,
Oliver O'Halloran, Dan Williams, linuxppc-dev
In-Reply-To: <20200508113100.GA19436@zn.tnic>
Borislav Petkov <bp@alien8.de> writes:
> On Fri, May 08, 2020 at 04:19:19PM +0530, Vaibhav Jain wrote:
>> 'seq_buf' provides a very useful abstraction for writing to a string
>> buffer without needing to worry about it over-flowing. However even
>> though the API has been stable for couple of years now its stills not
>> exported to external modules limiting its usage.
>>
>> Hence this patch proposes update to 'seq_buf.c' to mark
>> seq_buf_printf() which is part of the seq_buf API to be exported to
>> external GPL modules. This symbol will be used in later parts of this
>
> What is "external GPL modules"?
A module that has MODULE_LICENSE("GPL") ?
cheers
^ permalink raw reply
* Re: [PATCH v2 3/3] mm/page_alloc: Keep memoryless cpuless node 0 offline
From: David Hildenbrand @ 2020-05-08 13:42 UTC (permalink / raw)
To: Srikar Dronamraju, Michal Hocko
Cc: Linus Torvalds, linux-kernel, linux-mm, Mel Gorman,
Kirill A. Shutemov, Andrew Morton, linuxppc-dev,
Christopher Lameter, Vlastimil Babka
In-Reply-To: <3bfe7469-1d8c-baa4-6d9d-f4786492eaa8@redhat.com>
On 08.05.20 15:39, David Hildenbrand wrote:
> On 08.05.20 15:03, Srikar Dronamraju wrote:
>> * Michal Hocko <mhocko@kernel.org> [2020-05-04 11:37:12]:
>>
>>>>>
>>>>> Have you tested on something else than ppc? Each arch does the NUMA
>>>>> setup separately and this is a big mess. E.g. x86 marks even memory less
>>>>> nodes (see init_memory_less_node) as online.
>>>>>
>>>>
>>>> while I have predominantly tested on ppc, I did test on X86 with CONFIG_NUMA
>>>> enabled/disabled on both single node and multi node machines.
>>>> However, I dont have a cpuless/memoryless x86 system.
>>>
>>> This should be able to emulate inside kvm, I believe.
>>>
>>
>> I did try but somehow not able to get cpuless / memoryless node in a x86 kvm
>> guest.
>
> I use the following
>
> #! /bin/bash
> sudo x86_64-softmmu/qemu-system-x86_64 \
> --enable-kvm \
> -m 4G,maxmem=20G,slots=2 \
> -smp sockets=2,cores=2 \
> -numa node,nodeid=0,cpus=0-1,mem=4G -numa node,nodeid=1,cpus=2-3,mem=0G \
Sorry, this line has to be
-numa node,nodeid=0,cpus=0-3,mem=4G -numa node,nodeid=1,mem=0G \
> -kernel /home/dhildenb/git/linux/arch/x86_64/boot/bzImage \
> -append "console=ttyS0 rd.shell rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0" \
> -initrd /boot/initramfs-5.2.8-200.fc30.x86_64.img \
> -machine pc,nvdimm \
> -nographic \
> -nodefaults \
> -chardev stdio,id=serial \
> -device isa-serial,chardev=serial \
> -chardev socket,id=monitor,path=/var/tmp/monitor,server,nowait \
> -mon chardev=monitor,mode=readline
>
> to get a cpu-less and memory-less node 1. Never tried with node 0.
>
--
Thanks,
David / dhildenb
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox