Re: [PATCH 15/15] block: Add FIXME comment to handle device_add_disk error

2016-08-17 Thread Sergey Senozhatsky
On (08/17/16 15:15), Fam Zheng wrote: [..] > ( > rc = device_add_disk(e1, e2, e3); > | > + /* FIXME: handle error. */ > device_add_disk(e1, e2, e3); or use __must_check for device_add_disk() function? /* which is _attribute__((warn_unused_result)) */ -ss

Re: [PATCH 11/15] zram: Pass attribute group to device_add_disk

2016-08-17 Thread Sergey Senozhatsky
On (08/18/16 10:59), Sergey Senozhatsky wrote: [..] > I like the previous "Error creating sysfs group for device" string better, > than "Error creating disk", because the latter one is much less informative. > > do you want to do something like below? > > int device_add_disk(struct device

Re: [PATCH 11/15] zram: Pass attribute group to device_add_disk

2016-08-17 Thread Sergey Senozhatsky
Hello, On (08/17/16 15:15), Fam Zheng wrote: [..] > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > index 20920a2..2331788 100644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -1298,13 +1298,10 @@ static int zram_add(void) >

Re: linux-next: build warnings after merge of the kbuild tree

2016-08-17 Thread Nicholas Piggin
On Wed, 17 Aug 2016 14:59:59 +0200 Michal Marek wrote: > On 2016-08-17 03:44, Stephen Rothwell wrote: > > Hi Michal, > > > > After merging the kbuild tree, today's linux-next build (powerpc > > ppc64_defconfig) produced these warnings: > > > > WARNING: 25 bad relocations > >

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Ed Cashin
On 08/17/2016 05:14 AM, Fam Zheng wrote: ... Of course, the plan is to write patches on top. I'm not cleaning up anything here because I'm concerned callers may double free (and I didn't look hard into that). Aside from Huck's concerns, the changes looked OK from aoe's perspective. -- Ed

Re: [PATCH kernel 14/15] vfio/spapr_tce: Export container API for external users

2016-08-17 Thread Alexey Kardashevskiy
On 17/08/16 13:17, David Gibson wrote: > On Fri, Aug 12, 2016 at 09:22:01AM -0600, Alex Williamson wrote: >> On Fri, 12 Aug 2016 15:46:01 +1000 >> David Gibson wrote: >> >>> On Wed, Aug 10, 2016 at 10:46:30AM -0600, Alex Williamson wrote: On Wed, 10 Aug 2016

Re: [PATCH 1/6] cxlflash: Avoid mutex when destroying context

2016-08-17 Thread Manoj Kumar
Acked-by: Manoj N. Kumar On 8/9/2016 6:39 PM, Matthew R. Ochs wrote: Context information structures are protected by a mutex that is held when accessing/manipulating the context. When the code that manages these structures was authored, a decision was made to include

[RFC v2 2/2] powerpc/mm: add radix__{create, remove}_section_mapping()

2016-08-17 Thread Reza Arbab
Add radix variants of the memory hotplug mapping functions. Signed-off-by: Reza Arbab --- arch/powerpc/include/asm/book3s/64/radix.h | 5 + arch/powerpc/include/asm/sparsemem.h | 8 arch/powerpc/mm/pgtable-radix.c| 23

[RFC v2 0/2] powerpc/mm: enable memory hotplug on radix

2016-08-17 Thread Reza Arbab
Memory hotplug is leading to hash page table calls, even on radix: ... arch_add_memory create_section_mapping htab_bolt_mapping BUG_ON(!ppc_md.hpte_insert); Refactor {create,remove}_section_mapping() into hash__ and

[RFC v2 1/2] powerpc/mm: refactor {create,remove}_section_mapping()

2016-08-17 Thread Reza Arbab
Change {create,remove}_section_mapping() to be inline wrappers around functions prefixed with "hash__". This is preparation for the addition of their "radix__" variants. No functional change. Signed-off-by: Reza Arbab --- arch/powerpc/include/asm/book3s/64/hash.h | 5

Re: debug problems on ppc 83xx target due to changed struct task_struct

2016-08-17 Thread Holger Brunck
On 16/08/16 19:27, christophe leroy wrote: > > > Le 15/08/2016 à 18:19, Dave Hansen a écrit : >> On 08/15/2016 07:35 AM, Holger Brunck wrote: >>> I tried this but unfortunately the error only occurs while remote debugging. >>> Locally with gdb everything works fine. BTW we double-checked with a

Re: debug problems on ppc 83xx target due to changed struct task_struct

2016-08-17 Thread Holger Brunck
On 17/08/16 00:13, Benjamin Herrenschmidt wrote: > On Mon, 2016-08-15 at 09:19 -0700, Dave Hansen wrote: >> >> Wow, thanks for all the debugging here! > > Yup, thanks, that's really odd... I wonder if one of those > structures is accessed beyond it's boundary, either the sigset > or the thread

Re: debug problems on ppc 83xx target due to changed struct task_struct

2016-08-17 Thread Holger Brunck
On 15/08/16 18:19, Dave Hansen wrote: > On 08/15/2016 07:35 AM, Holger Brunck wrote: >> I tried this but unfortunately the error only occurs while remote debugging. >> Locally with gdb everything works fine. BTW we double-checked with a 85xx ppc >> target which is also 32-bit and it ends up with

Re: [PATCH] ppc64: allow ptrace to set TM bits

2016-08-17 Thread Laurent Dufour
On 02/08/2016 07:43, Simon Guo wrote: > Hi Laurent, > On Fri, Jul 29, 2016 at 11:51:22AM +0200, Laurent Dufour wrote: >> static int set_user_msr(struct task_struct *task, unsigned long msr) >> { >> +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM >> +if (!(task->thread.regs->msr & MSR_TM)) { >> +

Re: linux-next: build warnings after merge of the kbuild tree

2016-08-17 Thread Michal Marek
On 2016-08-17 03:44, Stephen Rothwell wrote: > Hi Michal, > > After merging the kbuild tree, today's linux-next build (powerpc > ppc64_defconfig) produced these warnings: > > WARNING: 25 bad relocations > c0cf2570 R_PPC64_ADDR64__crc___arch_hweight16 [...] > Introduced by commit > >

[PATCH] powerpc/powernv/pci: fix iterator signedness

2016-08-17 Thread Andrzej Hajda
Unsigned type is always non-negative, so the loop could not end in case condition is never true. The problem has been detected using semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci Signed-off-by: Andrzej Hajda ---

[PATCH v2 2/2] perf/core: Fix the mask in perf_output_sample_regs

2016-08-17 Thread Madhavan Srinivasan
When decoding the perf_regs mask in perf_output_sample_regs(), we loop through the mask using find_first_bit and find_next_bit functions. While the exisitng code works fine in most of the case, the logic is broken for 32bit kernel (Big Endian). When reading u64 mask using (u32 *)()[0],

[PATCH v6 1/2] tools/perf: Fix the mask in regs_dump__printf and print_sample_iregs

2016-08-17 Thread Madhavan Srinivasan
When decoding the perf_regs mask in regs_dump__printf(), we loop through the mask using find_first_bit and find_next_bit functions. "mask" is of type "u64", but sent as a "unsigned long *" to lib functions along with sizeof(). While the exisitng code works fine in most of the case, the logic is

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Fam Zheng
On Wed, 08/17 11:06, Cornelia Huck wrote: > On Wed, 17 Aug 2016 16:48:23 +0800 > Fam Zheng wrote: > > > On Wed, 08/17 10:49, Cornelia Huck wrote: > > > On Wed, 17 Aug 2016 15:15:06 +0800 > > > Fam Zheng wrote: > > > > > > > @@ -613,10 +614,8 @@ void

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Cornelia Huck
On Wed, 17 Aug 2016 16:48:23 +0800 Fam Zheng wrote: > On Wed, 08/17 10:49, Cornelia Huck wrote: > > On Wed, 17 Aug 2016 15:15:06 +0800 > > Fam Zheng wrote: > > > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct > > > gendisk *disk)

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Fam Zheng
On Wed, 08/17 10:49, Cornelia Huck wrote: > On Wed, 17 Aug 2016 15:15:06 +0800 > Fam Zheng wrote: > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct > > gendisk *disk) > > disk->flags |= GENHD_FL_UP; > > > > retval = blk_alloc_devt(>part0, );

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Cornelia Huck
On Wed, 17 Aug 2016 15:15:06 +0800 Fam Zheng wrote: > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct > gendisk *disk) > disk->flags |= GENHD_FL_UP; > > retval = blk_alloc_devt(>part0, ); > - if (retval) { > - WARN_ON(1); > -

Re: [PATCH kernel 14/15] vfio/spapr_tce: Export container API for external users

2016-08-17 Thread Alexey Kardashevskiy
On 15/08/16 21:07, David Gibson wrote: > On Fri, Aug 12, 2016 at 04:12:17PM +1000, Alexey Kardashevskiy wrote: >> On 12/08/16 15:46, David Gibson wrote: >>> On Wed, Aug 10, 2016 at 10:46:30AM -0600, Alex Williamson wrote: On Wed, 10 Aug 2016 15:37:17 +1000 Alexey Kardashevskiy

Re: debug problems on ppc 83xx target due to changed struct task_struct

2016-08-17 Thread Christophe Leroy
Le 16/08/2016 à 19:36, Dave Hansen a écrit : On 08/16/2016 10:27 AM, christophe leroy wrote: If I debug a very small app, it gets stuck quickly after the app has stopped: indeed, the console seems ok but as soon as I try to execute something simple, like a ps or top, it get stuck. The target

Re: [PATCH 08/15] nvme: Pass attribute group to device_add_disk

2016-08-17 Thread kbuild test robot
Hi Fam, [auto build test WARNING on linus/master] [also build test WARNING on v4.8-rc2 next-20160817] [cannot apply to linux/master] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Fam-Zheng/Fix

Re: [PATCH V3 1/8] powerpc/firmware: Add definitions for new firmware features.

2016-08-17 Thread Bharata B Rao
On Tue, Aug 2, 2016 at 6:12 AM, Michael Bringmann wrote: > Firmware Features: Define new bit flags representing the presence of > new device tree properties "ibm,drc-info", and "ibm,dynamic-memory-v2". > These flags are used to tell the front end processor when the Linux

[PATCH 15/15] block: Add FIXME comment to handle device_add_disk error

2016-08-17 Thread Fam Zheng
Done with coccinelle: @@ expression e1, e2, e3; identifier rc; @@ ( rc = device_add_disk(e1, e2, e3); | + /* FIXME: handle error. */ device_add_disk(e1, e2, e3); ) Signed-off-by: Fam Zheng --- arch/m68k/emu/nfblock.c | 1 +

[PATCH 14/15] axonram: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries

[PATCH 13/15] aoeblk: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries

[PATCH 12/15] mtip: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries

[PATCH 11/15] zram: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries

[PATCH 10/15] mtd: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries

[PATCH 09/15] virtio-blk: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries

[PATCH 08/15] nvme: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries

[PATCH 07/15] genhd: Add attribute group parameter to device_add_disk

2016-08-17 Thread Fam Zheng
The added parameter attr_group, if not NULL, be added to the new disk. The callers are converted with coccinelle: @@ expression e1, e2; @@ - device_add_disk(e1, e2); + device_add_disk(e1, e2, NULL); So there is not behavior change yet. Signed-off-by: Fam Zheng ---

[PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Fam Zheng
There are a number of places in device_add_disk that can fail, and even more to come as we extend it. Switch the return type of the function, and return the error code when error happens. The WARN_ON is kept because callers are not updated to check the error yet. Signed-off-by: Fam Zheng

[PATCH 05/15] genhd: Return error from disk_{add,alloc}_events

2016-08-17 Thread Fam Zheng
disk_alloc_events and disk_add_events can fail, return the error code so the caller can handle it. Signed-off-by: Fam Zheng --- block/genhd.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index

[PATCH 04/15] block: Return error from blk_integrity_add

2016-08-17 Thread Fam Zheng
The kobject_init_and_add call in blk_integrity_add can fail, return the error code in this case, so that it can be handled in the caller. Signed-off-by: Fam Zheng --- block/blk-integrity.c | 12 include/linux/genhd.h | 4 ++-- 2 files changed, 10 insertions(+), 6

[PATCH 03/15] genhd: Return error from blk_register_region

2016-08-17 Thread Fam Zheng
blk_register_region can fail (-ENOMEM), return the error to the caller. Signed-off-by: Fam Zheng --- block/genhd.c | 4 ++-- include/linux/genhd.h | 10 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index

[PATCH 02/15] genhd: Return error from register_disk()

2016-08-17 Thread Fam Zheng
Several operations in register_disk can fail, but the caller currently cannot check for error due to missing return code. Change the function return type and return -errno if any error happens. Also add some documentation. Signed-off-by: Fam Zheng --- block/genhd.c | 27

[PATCH 01/15] disk: Drop add_disk in favor of device_add_disk

2016-08-17 Thread Fam Zheng
add_disk is now a "convenience" wrapper of device_add_disk. Unwrap it so that callers can be later converted to handle error and attribute group more easily. Callers are converted with coccinelle: @@ expression x; @@ - add_disk(x) + device_add_disk(NULL, x) Removal of add_disk and

[PATCH 00/15] Fix issue with KOBJ_ADD uevent versus disk attributes

2016-08-17 Thread Fam Zheng
This is an attempt to fix the issue that some disks' sysfs attributes are not ready at the time its KOBJ_ADD event is sent. The symptom is during device hotplug, udev may fail to find certain attributes, such as serial or wwn, of the disk. As a result the /dev/disk/by-id entries are not created.

Re: [PATCH kernel 14/15] vfio/spapr_tce: Export container API for external users

2016-08-17 Thread David Gibson
On Fri, Aug 12, 2016 at 09:22:01AM -0600, Alex Williamson wrote: > On Fri, 12 Aug 2016 15:46:01 +1000 > David Gibson wrote: > > > On Wed, Aug 10, 2016 at 10:46:30AM -0600, Alex Williamson wrote: > > > On Wed, 10 Aug 2016 15:37:17 +1000 > > > Alexey Kardashevskiy