linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] opal-elog: Fix opal-elog interrupt handler
@ 2015-07-03  7:39 Alistair Popple
  2015-07-04  6:34 ` Aneesh Kumar K.V
  2015-07-07 10:38 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Alistair Popple @ 2015-07-03  7:39 UTC (permalink / raw)
  To: mpe; +Cc: linuxppc-dev, shreyas, aneesh.kumar, Alistair Popple

The conversion of opal events to a proper irqchip means that handlers
are called until the relevant opal event has been cleared by
processing it. Events that queue work should therefore use a threaded
handler to mask the event until processing is complete.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 arch/powerpc/platforms/powernv/opal-elog.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
index 4949ef0..37f959b 100644
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -237,7 +237,7 @@ static struct elog_obj *create_elog_obj(uint64_t id, size_t size, uint64_t type)
 	return elog;
 }
 
-static void elog_work_fn(struct work_struct *work)
+static irqreturn_t elog_event(int irq, void *data)
 {
 	__be64 size;
 	__be64 id;
@@ -251,7 +251,7 @@ static void elog_work_fn(struct work_struct *work)
 	rc = opal_get_elog_size(&id, &size, &type);
 	if (rc != OPAL_SUCCESS) {
 		pr_err("ELOG: OPAL log info read failed\n");
-		return;
+		return IRQ_HANDLED;
 	}
 
 	elog_size = be64_to_cpu(size);
@@ -270,16 +270,10 @@ static void elog_work_fn(struct work_struct *work)
 	 * entries.
 	 */
 	if (kset_find_obj(elog_kset, name))
-		return;
+		return IRQ_HANDLED;
 
 	create_elog_obj(log_id, elog_size, elog_type);
-}
-
-static DECLARE_WORK(elog_work, elog_work_fn);
 
-static irqreturn_t elog_event(int irq, void *data)
-{
-	schedule_work(&elog_work);
 	return IRQ_HANDLED;
 }
 
@@ -304,8 +298,8 @@ int __init opal_elog_init(void)
 		return irq;
 	}
 
-	rc = request_irq(irq, elog_event,
-			IRQ_TYPE_LEVEL_HIGH, "opal-elog", NULL);
+	rc = request_threaded_irq(irq, NULL, elog_event,
+			IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "opal-elog", NULL);
 	if (rc) {
 		pr_err("%s: Can't request OPAL event irq (%d)\n",
 		       __func__, rc);
-- 
2.1.4

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

* Re: [PATCH] opal-elog: Fix opal-elog interrupt handler
  2015-07-03  7:39 [PATCH] opal-elog: Fix opal-elog interrupt handler Alistair Popple
@ 2015-07-04  6:34 ` Aneesh Kumar K.V
  2015-07-07 10:38 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2015-07-04  6:34 UTC (permalink / raw)
  To: Alistair Popple, mpe; +Cc: linuxppc-dev, shreyas, Alistair Popple

Alistair Popple <alistair@popple.id.au> writes:

> The conversion of opal events to a proper irqchip means that handlers
> are called until the relevant opal event has been cleared by
> processing it. Events that queue work should therefore use a threaded
> handler to mask the event until processing is complete.
>
> Signed-off-by: Alistair Popple <alistair@popple.id.au>

Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

> ---
>  arch/powerpc/platforms/powernv/opal-elog.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
> index 4949ef0..37f959b 100644
> --- a/arch/powerpc/platforms/powernv/opal-elog.c
> +++ b/arch/powerpc/platforms/powernv/opal-elog.c
> @@ -237,7 +237,7 @@ static struct elog_obj *create_elog_obj(uint64_t id, size_t size, uint64_t type)
>  	return elog;
>  }
>
> -static void elog_work_fn(struct work_struct *work)
> +static irqreturn_t elog_event(int irq, void *data)
>  {
>  	__be64 size;
>  	__be64 id;
> @@ -251,7 +251,7 @@ static void elog_work_fn(struct work_struct *work)
>  	rc = opal_get_elog_size(&id, &size, &type);
>  	if (rc != OPAL_SUCCESS) {
>  		pr_err("ELOG: OPAL log info read failed\n");
> -		return;
> +		return IRQ_HANDLED;
>  	}
>
>  	elog_size = be64_to_cpu(size);
> @@ -270,16 +270,10 @@ static void elog_work_fn(struct work_struct *work)
>  	 * entries.
>  	 */
>  	if (kset_find_obj(elog_kset, name))
> -		return;
> +		return IRQ_HANDLED;
>
>  	create_elog_obj(log_id, elog_size, elog_type);
> -}
> -
> -static DECLARE_WORK(elog_work, elog_work_fn);
>
> -static irqreturn_t elog_event(int irq, void *data)
> -{
> -	schedule_work(&elog_work);
>  	return IRQ_HANDLED;
>  }
>
> @@ -304,8 +298,8 @@ int __init opal_elog_init(void)
>  		return irq;
>  	}
>
> -	rc = request_irq(irq, elog_event,
> -			IRQ_TYPE_LEVEL_HIGH, "opal-elog", NULL);
> +	rc = request_threaded_irq(irq, NULL, elog_event,
> +			IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "opal-elog", NULL);
>  	if (rc) {
>  		pr_err("%s: Can't request OPAL event irq (%d)\n",
>  		       __func__, rc);
> -- 
> 2.1.4

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

* Re: opal-elog: Fix opal-elog interrupt handler
  2015-07-03  7:39 [PATCH] opal-elog: Fix opal-elog interrupt handler Alistair Popple
  2015-07-04  6:34 ` Aneesh Kumar K.V
@ 2015-07-07 10:38 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2015-07-07 10:38 UTC (permalink / raw)
  To: Alistair Popple; +Cc: linuxppc-dev, Alistair Popple, aneesh.kumar, shreyas

On Fri, 2015-03-07 at 07:39:12 UTC, Alistair Popple wrote:
> The conversion of opal events to a proper irqchip means that handlers
> are called until the relevant opal event has been cleared by
> processing it. Events that queue work should therefore use a threaded
> handler to mask the event until processing is complete.
> 
> Signed-off-by: Alistair Popple <alistair@popple.id.au>
> Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/commit/?h=fixes&id=a8956a7b7232da5f4ce4a305c72a54cc5e4a8307

cheers

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

end of thread, other threads:[~2015-07-07 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-03  7:39 [PATCH] opal-elog: Fix opal-elog interrupt handler Alistair Popple
2015-07-04  6:34 ` Aneesh Kumar K.V
2015-07-07 10:38 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).