linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Luo Jiaxing <luojiaxing@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	linuxarm@openeuler.org
Subject: Re: [PATCH v1 1/2] irqchip/gic-v3-its: don't set bitmap for LPI which user didn't allocate
Date: Mon, 08 Feb 2021 11:59:07 +0000	[thread overview]
Message-ID: <508c6c07a2c599ae1fc8b726fda69b44@kernel.org> (raw)
In-Reply-To: <1612781926-56206-2-git-send-email-luojiaxing@huawei.com>

On 2021-02-08 10:58, Luo Jiaxing wrote:
> The driver sets the LPI bitmap of device based on 
> get_count_order(nvecs).
> This means that when the number of LPI interrupts does not meet the 
> power
> of two, redundant bits are set in the LPI bitmap. However, when free
> interrupt, these redundant bits is not cleared. As a result, device 
> will
> fails to allocate the same numbers of interrupts next time.
> 
> Therefore, clear the redundant bits set in LPI bitmap.
> 
> Fixes: 4615fbc3788d ("genirq/irqdomain: Don't try to free an interrupt
> that has no mapping")
> 
> Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
> ---
>  drivers/irqchip/irq-gic-v3-its.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/irqchip/irq-gic-v3-its.c 
> b/drivers/irqchip/irq-gic-v3-its.c
> index ed46e60..027f7ef 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -3435,6 +3435,10 @@ static int its_alloc_device_irq(struct
> its_device *dev, int nvecs, irq_hw_number
> 
>  	*hwirq = dev->event_map.lpi_base + idx;
> 
> +	bitmap_clear(dev->event_map.lpi_map,
> +		     idx + nvecs,
> +		     roundup_pow_of_two(nvecs) - nvecs);
> +
>  	return 0;
>  }

What makes you think that the remaining LPIs are free to be released?
Even if the end-point has request a non-po2 number of MSIs, it could
very well rely on the the rest of it to be available (specially in the
case of PCI Multi-MSI).

Have a look at the thread pointed out by John for a potential fix.

Thanks,

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

  reply	other threads:[~2021-02-08 12:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 10:58 [PATCH v1 0/2] irqchip/gic-v3-its: don't set bitmap for LPI which user didn't allocate Luo Jiaxing
2021-02-08 10:58 ` [PATCH v1 1/2] " Luo Jiaxing
2021-02-08 11:59   ` Marc Zyngier [this message]
2021-02-09  7:25     ` luojiaxing
2021-02-08 10:58 ` [PATCH v1 2/2] genirq/msi: add an error print when __irq_domain_alloc_irqs() failed Luo Jiaxing
2021-02-08 11:14 ` [Linuxarm] [PATCH v1 0/2] irqchip/gic-v3-its: don't set bitmap for LPI which user didn't allocate John Garry

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=508c6c07a2c599ae1fc8b726fda69b44@kernel.org \
    --to=maz@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@openeuler.org \
    --cc=luojiaxing@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).