public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* Patch "powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ" has been added to the 4.14-stable tree
@ 2018-02-28 15:26 gregkh
  2018-03-01  3:24 ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2018-02-28 15:26 UTC (permalink / raw)
  To: mpe, alexander.levin, danielhb, david, gregkh, joserz, mdeng
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     powerpc-pseries-make-ras-irq-explicitly-dependent-on-dlpar-wq.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From foo@baz Wed Feb 28 16:23:28 CET 2018
From: Michael Ellerman <mpe@ellerman.id.au>
Date: Mon, 8 Jan 2018 14:54:32 +1100
Subject: powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ

From: Michael Ellerman <mpe@ellerman.id.au>


[ Upstream commit e2d5915293ffdff977ddcfc12b817b08c53ffa7a ]

The hotplug code uses its own workqueue to handle IRQ requests
(pseries_hp_wq), however that workqueue is initialized after
init_ras_IRQ(). That can lead to a kernel panic if any hotplug
interrupts fire after init_ras_IRQ() but before pseries_hp_wq is
initialised. eg:

  UDP-Lite hash table entries: 2048 (order: 0, 65536 bytes)
  NET: Registered protocol family 1
  Unpacking initramfs...
  (qemu) object_add memory-backend-ram,id=mem1,size=10G
  (qemu) device_add pc-dimm,id=dimm1,memdev=mem1
  Unable to handle kernel paging request for data at address 0xf94d03007c421378
  Faulting instruction address: 0xc00000000012d744
  Oops: Kernel access of bad area, sig: 11 [#1]
  LE SMP NR_CPUS=2048 NUMA pSeries
  Modules linked in:
  CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2-ziviani+ #26
  task:         (ptrval) task.stack:         (ptrval)
  NIP:  c00000000012d744 LR: c00000000012d744 CTR: 0000000000000000
  REGS:         (ptrval) TRAP: 0380   Not tainted  (4.15.0-rc2-ziviani+)
  MSR:  8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 28088042  XER: 20040000
  CFAR: c00000000012d3c4 SOFTE: 0
  ...
  NIP [c00000000012d744] __queue_work+0xd4/0x5c0
  LR [c00000000012d744] __queue_work+0xd4/0x5c0
  Call Trace:
  [c0000000fffefb90] [c00000000012d744] __queue_work+0xd4/0x5c0 (unreliable)
  [c0000000fffefc70] [c00000000012dce4] queue_work_on+0xb4/0xf0

This commit makes the RAS IRQ registration explicitly dependent on the
creation of the pseries_hp_wq.

Reported-by: Min Deng <mdeng@redhat.com>
Reported-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Tested-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/platforms/pseries/dlpar.c   |   21 ++++++++++++++++++---
 arch/powerpc/platforms/pseries/pseries.h |    2 ++
 arch/powerpc/platforms/pseries/ras.c     |    3 ++-
 3 files changed, 22 insertions(+), 4 deletions(-)

--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -586,11 +586,26 @@ static ssize_t dlpar_show(struct class *
 
 static CLASS_ATTR_RW(dlpar);
 
-static int __init pseries_dlpar_init(void)
+int __init dlpar_workqueue_init(void)
 {
+	if (pseries_hp_wq)
+		return 0;
+
 	pseries_hp_wq = alloc_workqueue("pseries hotplug workqueue",
-					WQ_UNBOUND, 1);
+			WQ_UNBOUND, 1);
+
+	return pseries_hp_wq ? 0 : -ENOMEM;
+}
+
+static int __init dlpar_sysfs_init(void)
+{
+	int rc;
+
+	rc = dlpar_workqueue_init();
+	if (rc)
+		return rc;
+
 	return sysfs_create_file(kernel_kobj, &class_attr_dlpar.attr);
 }
-machine_device_initcall(pseries, pseries_dlpar_init);
+machine_device_initcall(pseries, dlpar_sysfs_init);
 
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -98,4 +98,6 @@ static inline unsigned long cmo_get_page
 	return CMO_PageSize;
 }
 
+int dlpar_workqueue_init(void);
+
 #endif /* _PSERIES_PSERIES_H */
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -69,7 +69,8 @@ static int __init init_ras_IRQ(void)
 	/* Hotplug Events */
 	np = of_find_node_by_path("/event-sources/hot-plug-events");
 	if (np != NULL) {
-		request_event_sources_irqs(np, ras_hotplug_interrupt,
+		if (dlpar_workqueue_init() == 0)
+			request_event_sources_irqs(np, ras_hotplug_interrupt,
 					   "RAS_HOTPLUG");
 		of_node_put(np);
 	}


Patches currently in stable-queue which might be from mpe@ellerman.id.au are

queue-4.14/powerpc-pseries-make-ras-irq-explicitly-dependent-on-dlpar-wq.patch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ" has been added to the 4.14-stable tree
  2018-02-28 15:26 Patch "powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ" has been added to the 4.14-stable tree gregkh
@ 2018-03-01  3:24 ` Michael Ellerman
  2018-03-01 15:26   ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2018-03-01  3:24 UTC (permalink / raw)
  To: gregkh, alexander.levin, danielhb, david, gregkh, joserz, mdeng
  Cc: stable, stable-commits

<gregkh@linuxfoundation.org> writes:

> This is a note to let you know that I've just added the patch titled
>
>     powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ
>
> to the 4.14-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
> The filename of the patch is:
>      powerpc-pseries-make-ras-irq-explicitly-dependent-on-dlpar-wq.patch
> and it can be found in the queue-4.14 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.

Did someone request this one?

I didn't Cc it to stable because I wasn't confident of the testing it'd
had, and in fact we found another related bug recently.

So if you take this you probably also want:

  c9dccf1d074a ("powerpc/pseries: Enable RAS hotplug events later")


But note that commit is only ~2-3 weeks old, so again I can't vouch 100%
for it's bullet-proof-ness.

cheers

> From foo@baz Wed Feb 28 16:23:28 CET 2018
> From: Michael Ellerman <mpe@ellerman.id.au>
> Date: Mon, 8 Jan 2018 14:54:32 +1100
> Subject: powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ
>
> From: Michael Ellerman <mpe@ellerman.id.au>
>
>
> [ Upstream commit e2d5915293ffdff977ddcfc12b817b08c53ffa7a ]
>
> The hotplug code uses its own workqueue to handle IRQ requests
> (pseries_hp_wq), however that workqueue is initialized after
> init_ras_IRQ(). That can lead to a kernel panic if any hotplug
> interrupts fire after init_ras_IRQ() but before pseries_hp_wq is
> initialised. eg:
>
>   UDP-Lite hash table entries: 2048 (order: 0, 65536 bytes)
>   NET: Registered protocol family 1
>   Unpacking initramfs...
>   (qemu) object_add memory-backend-ram,id=mem1,size=10G
>   (qemu) device_add pc-dimm,id=dimm1,memdev=mem1
>   Unable to handle kernel paging request for data at address 0xf94d03007c421378
>   Faulting instruction address: 0xc00000000012d744
>   Oops: Kernel access of bad area, sig: 11 [#1]
>   LE SMP NR_CPUS=2048 NUMA pSeries
>   Modules linked in:
>   CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2-ziviani+ #26
>   task:         (ptrval) task.stack:         (ptrval)
>   NIP:  c00000000012d744 LR: c00000000012d744 CTR: 0000000000000000
>   REGS:         (ptrval) TRAP: 0380   Not tainted  (4.15.0-rc2-ziviani+)
>   MSR:  8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 28088042  XER: 20040000
>   CFAR: c00000000012d3c4 SOFTE: 0
>   ...
>   NIP [c00000000012d744] __queue_work+0xd4/0x5c0
>   LR [c00000000012d744] __queue_work+0xd4/0x5c0
>   Call Trace:
>   [c0000000fffefb90] [c00000000012d744] __queue_work+0xd4/0x5c0 (unreliable)
>   [c0000000fffefc70] [c00000000012dce4] queue_work_on+0xb4/0xf0
>
> This commit makes the RAS IRQ registration explicitly dependent on the
> creation of the pseries_hp_wq.
>
> Reported-by: Min Deng <mdeng@redhat.com>
> Reported-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
> Tested-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/powerpc/platforms/pseries/dlpar.c   |   21 ++++++++++++++++++---
>  arch/powerpc/platforms/pseries/pseries.h |    2 ++
>  arch/powerpc/platforms/pseries/ras.c     |    3 ++-
>  3 files changed, 22 insertions(+), 4 deletions(-)
>
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -586,11 +586,26 @@ static ssize_t dlpar_show(struct class *
>  
>  static CLASS_ATTR_RW(dlpar);
>  
> -static int __init pseries_dlpar_init(void)
> +int __init dlpar_workqueue_init(void)
>  {
> +	if (pseries_hp_wq)
> +		return 0;
> +
>  	pseries_hp_wq = alloc_workqueue("pseries hotplug workqueue",
> -					WQ_UNBOUND, 1);
> +			WQ_UNBOUND, 1);
> +
> +	return pseries_hp_wq ? 0 : -ENOMEM;
> +}
> +
> +static int __init dlpar_sysfs_init(void)
> +{
> +	int rc;
> +
> +	rc = dlpar_workqueue_init();
> +	if (rc)
> +		return rc;
> +
>  	return sysfs_create_file(kernel_kobj, &class_attr_dlpar.attr);
>  }
> -machine_device_initcall(pseries, pseries_dlpar_init);
> +machine_device_initcall(pseries, dlpar_sysfs_init);
>  
> --- a/arch/powerpc/platforms/pseries/pseries.h
> +++ b/arch/powerpc/platforms/pseries/pseries.h
> @@ -98,4 +98,6 @@ static inline unsigned long cmo_get_page
>  	return CMO_PageSize;
>  }
>  
> +int dlpar_workqueue_init(void);
> +
>  #endif /* _PSERIES_PSERIES_H */
> --- a/arch/powerpc/platforms/pseries/ras.c
> +++ b/arch/powerpc/platforms/pseries/ras.c
> @@ -69,7 +69,8 @@ static int __init init_ras_IRQ(void)
>  	/* Hotplug Events */
>  	np = of_find_node_by_path("/event-sources/hot-plug-events");
>  	if (np != NULL) {
> -		request_event_sources_irqs(np, ras_hotplug_interrupt,
> +		if (dlpar_workqueue_init() == 0)
> +			request_event_sources_irqs(np, ras_hotplug_interrupt,
>  					   "RAS_HOTPLUG");
>  		of_node_put(np);
>  	}
>
>
> Patches currently in stable-queue which might be from mpe@ellerman.id.au are
>
> queue-4.14/powerpc-pseries-make-ras-irq-explicitly-dependent-on-dlpar-wq.patch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ" has been added to the 4.14-stable tree
  2018-03-01  3:24 ` Michael Ellerman
@ 2018-03-01 15:26   ` Greg KH
  2018-03-02  2:45     ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2018-03-01 15:26 UTC (permalink / raw)
  To: Michael Ellerman, Sasha Levin
  Cc: danielhb, david, joserz, mdeng, stable, stable-commits

On Thu, Mar 01, 2018 at 02:24:43PM +1100, Michael Ellerman wrote:
> <gregkh@linuxfoundation.org> writes:
> 
> > This is a note to let you know that I've just added the patch titled
> >
> >     powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ
> >
> > to the 4.14-stable tree which can be found at:
> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> >
> > The filename of the patch is:
> >      powerpc-pseries-make-ras-irq-explicitly-dependent-on-dlpar-wq.patch
> > and it can be found in the queue-4.14 subdirectory.
> >
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <stable@vger.kernel.org> know about it.
> 
> Did someone request this one?

Sasha did (his email now fixed...)

> I didn't Cc it to stable because I wasn't confident of the testing it'd
> had, and in fact we found another related bug recently.
> 
> So if you take this you probably also want:
> 
>   c9dccf1d074a ("powerpc/pseries: Enable RAS hotplug events later")
> 
> 
> But note that commit is only ~2-3 weeks old, so again I can't vouch 100%
> for it's bullet-proof-ness.

So do you want me to drop this one, or take both?  I can do either, it's
up to you...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ" has been added to the 4.14-stable tree
  2018-03-01 15:26   ` Greg KH
@ 2018-03-02  2:45     ` Michael Ellerman
  2018-03-02  6:27       ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2018-03-02  2:45 UTC (permalink / raw)
  To: Greg KH, Sasha Levin
  Cc: danielhb, david, joserz, mdeng, stable, stable-commits

Greg KH <gregkh@linuxfoundation.org> writes:

> On Thu, Mar 01, 2018 at 02:24:43PM +1100, Michael Ellerman wrote:
>> <gregkh@linuxfoundation.org> writes:
>> 
>> > This is a note to let you know that I've just added the patch titled
>> >
>> >     powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ
>> >
>> > to the 4.14-stable tree which can be found at:
>> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>> >
>> > The filename of the patch is:
>> >      powerpc-pseries-make-ras-irq-explicitly-dependent-on-dlpar-wq.patch
>> > and it can be found in the queue-4.14 subdirectory.
>> >
>> > If you, or anyone else, feels it should not be added to the stable tree,
>> > please let <stable@vger.kernel.org> know about it.
>> 
>> Did someone request this one?
>
> Sasha did (his email now fixed...)

Ah ok.

>> I didn't Cc it to stable because I wasn't confident of the testing it'd
>> had, and in fact we found another related bug recently.
>> 
>> So if you take this you probably also want:
>> 
>>   c9dccf1d074a ("powerpc/pseries: Enable RAS hotplug events later")
>> 
>> 
>> But note that commit is only ~2-3 weeks old, so again I can't vouch 100%
>> for it's bullet-proof-ness.
>
> So do you want me to drop this one, or take both?  I can do either, it's
> up to you...

OK, take both then please.

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ" has been added to the 4.14-stable tree
  2018-03-02  2:45     ` Michael Ellerman
@ 2018-03-02  6:27       ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2018-03-02  6:27 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Sasha Levin, danielhb, david, joserz, mdeng, stable,
	stable-commits

On Fri, Mar 02, 2018 at 01:45:13PM +1100, Michael Ellerman wrote:
> Greg KH <gregkh@linuxfoundation.org> writes:
> 
> > On Thu, Mar 01, 2018 at 02:24:43PM +1100, Michael Ellerman wrote:
> >> <gregkh@linuxfoundation.org> writes:
> >> 
> >> > This is a note to let you know that I've just added the patch titled
> >> >
> >> >     powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ
> >> >
> >> > to the 4.14-stable tree which can be found at:
> >> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> >> >
> >> > The filename of the patch is:
> >> >      powerpc-pseries-make-ras-irq-explicitly-dependent-on-dlpar-wq.patch
> >> > and it can be found in the queue-4.14 subdirectory.
> >> >
> >> > If you, or anyone else, feels it should not be added to the stable tree,
> >> > please let <stable@vger.kernel.org> know about it.
> >> 
> >> Did someone request this one?
> >
> > Sasha did (his email now fixed...)
> 
> Ah ok.
> 
> >> I didn't Cc it to stable because I wasn't confident of the testing it'd
> >> had, and in fact we found another related bug recently.
> >> 
> >> So if you take this you probably also want:
> >> 
> >>   c9dccf1d074a ("powerpc/pseries: Enable RAS hotplug events later")
> >> 
> >> 
> >> But note that commit is only ~2-3 weeks old, so again I can't vouch 100%
> >> for it's bullet-proof-ness.
> >
> > So do you want me to drop this one, or take both?  I can do either, it's
> > up to you...
> 
> OK, take both then please.

The second one now added to 4.15.y and 4.14.y, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-02  6:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-28 15:26 Patch "powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ" has been added to the 4.14-stable tree gregkh
2018-03-01  3:24 ` Michael Ellerman
2018-03-01 15:26   ` Greg KH
2018-03-02  2:45     ` Michael Ellerman
2018-03-02  6:27       ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox