public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Mark Salter <msalter@redhat.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: "linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hanjun.guo@linaro.org" <hanjun.guo@linaro.org>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Will Deacon <Will.Deacon@arm.com>
Subject: Re: [PATCH] acpi: fix generic acpi_register_gsi() handling of shared interrupts
Date: Tue, 28 Apr 2015 18:08:44 +0100	[thread overview]
Message-ID: <553FBE9C.5070408@arm.com> (raw)
In-Reply-To: <1430239874-15928-1-git-send-email-msalter@redhat.com>

On 28/04/15 17:51, Mark Salter wrote:
> If there are devices sharing an interrupt, acpi_register_gsi() could
> be called multiple times for the same gsi. Currently, it just maps
> the gsi without checking for a previous mapping. This patch adds a
> check for an existing mapping and uses that if found.
> 
> Cc: Hanjun Guo <hanjun.guo@linaro.org>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> ---
>  drivers/acpi/gsi.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c
> index 38208f2..5698c4f 100644
> --- a/drivers/acpi/gsi.c
> +++ b/drivers/acpi/gsi.c
> @@ -76,6 +76,13 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
>  	unsigned int irq_type = acpi_gsi_get_irq_type(trigger, polarity);
>  
>  	/*
> +	 * The gsi may be shared with other devices, so check for a
> +	 * previous mapping and use that if found.
> +	 */
> +	if (acpi_gsi_to_irq(gsi, &irq) > 0)
> +		return irq;

I'm afraid that's completely racy, and doesn't prevent much (two CPUs
can execute this at the same time and still end up executing the rest of
the code).

Furthermore, irq_create_mapping is *designed* to handle that situation,
and returns the same virtual IRQ for a given hwirq (and it has the
proper locking...).

So maybe it would be worth explaining the actual problem you're seeing,
because the code as it stands should handle the problem you seem to
describe.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2015-04-28 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 16:51 [PATCH] acpi: fix generic acpi_register_gsi() handling of shared interrupts Mark Salter
2015-04-28 17:08 ` Marc Zyngier [this message]
2015-04-28 17:29   ` Mark Salter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553FBE9C.5070408@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=hanjun.guo@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msalter@redhat.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox