[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a6hof5sr.ffs@tglx>
Date: Sun, 28 Nov 2021 20:17:56 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Marc Zyngier <maz@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Bjorn Helgaas <helgaas@...nel.org>,
Alex Williamson <alex.williamson@...hat.com>,
Kevin Tian <kevin.tian@...el.com>,
Jason Gunthorpe <jgg@...dia.com>,
Megha Dey <megha.dey@...el.com>,
Ashok Raj <ashok.raj@...el.com>,
Michael Ellerman <mpe@...erman.id.au>,
Andrew Cooper <amc96@....ac.uk>,
Juergen Gross <jgross@...e.com>, linux-pci@...r.kernel.org,
xen-devel@...ts.xenproject.org
Subject: Re: [patch 03/10] genirq/msi: Make MSI descriptor alloc/free ready
for range allocations
On Sun, Nov 28 2021 at 15:57, Marc Zyngier wrote:
> On Sat, 27 Nov 2021 01:24:34 +0000,
> Thomas Gleixner <tglx@...utronix.de> wrote:
>
> The issue seems to be originating in the previous patch, where the
> following line was added:
>
> + struct msi_range range = { .first = 0, .last = UINT_MAX, .ndesc = nvec, };
>
> In that context, only 'ndesc' was used, and that was fine.
>
> However, in the current patch, ndesc use is removed, only first/last
> are considered, and UINT_MAX is... a lot of MSIs.
>
> This fixes it:
>
> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index bef5b74a7268..a520bfd94a56 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -975,7 +975,7 @@ int msi_domain_alloc_irqs_descs_locked(struct irq_domain *domain, struct device
> */
> int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev, int nvec)
> {
> - struct msi_range range = { .first = 0, .last = UINT_MAX, .ndesc = nvec, };
> + struct msi_range range = { .first = 0, .last = nvec - 1, .ndesc = nvec, };
> int ret;
>
> msi_lock_descs(dev);
>
> However, it'd be good to clarify the use of range->ndesc.
Hrm. The stupid search should terminated nevertheless. Let me stare at
it again.
>> -static int msi_add_simple_msi_descs(struct device *dev, unsigned int index, unsigned int ndesc)
>> +static int msi_add_simple_msi_descs(struct device *dev, struct msi_range *range)
>
> nit: most of the functions changed in this patch need to have their
> documentation tidied up.
Duh, yes.
Thanks,
tglx
Powered by blists - more mailing lists