[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeVhHhkzPVdGRa9inLJtW0QF=dDp3jB-U1xvKWRY_pbyw@mail.gmail.com>
Date: Mon, 22 Mar 2021 17:02:33 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:ACPI COMPONENT ARCHITECTURE (ACPICA)" <devel@...ica.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>,
Robert Moore <robert.moore@...el.com>,
Erik Kaneda <erik.kaneda@...el.com>
Subject: Re: [PATCH v3 1/1] ACPI: scan: Use unique number for instance_no
On Mon, Mar 22, 2021 at 4:57 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
>
> On Fri, Mar 19, 2021 at 8:21 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> >
> > The decrementation of acpi_device_bus_id->instance_no
> > in acpi_device_del() is incorrect, because it may cause
> > a duplicate instance number to be allocated next time
> > a device with the same acpi_device_bus_id is added.
> >
> > Replace above mentioned approach by using IDA framework.
...
> > + result = ida_simple_get(&acpi_device_bus_id->instance_ida, 0, 255, GFP_KERNEL);
>
> This is ida_alloc_range(ida, start, (end) - 1, gfp), so I think it
> should be 256 above, instead of 255.
Ah, good catch!
> While at it, though, there can be more than 256 CPU devices easily on
> contemporary systems, so I would use a greater number here. Maybe
> 4096 and define a symbol for it?
I was thinking about it, but there is a problem with the device name,
since it will break a lot of code,
And taking into account that currently we don't change the behaviour
it is good enough per se as a fix.
That said, we may extend by an additional patch with a logic like this:
res = ida_get(4096)
if (res < 0)
return res;
if (res >= 256)
use %04x
else
use %02x
Would it make sense to you?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists