Mailing List Archive

[PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC
From: Joerg Roedel <jroedel@suse.de>

No platform-device is required for IO(x)APICs, so don't even
create them.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
drivers/acpi/acpi_platform.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index b4c1a6a..03250e1 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -25,9 +25,11 @@
ACPI_MODULE_NAME("platform");

static const struct acpi_device_id forbidden_id_list[] = {
- {"PNP0000", 0}, /* PIC */
- {"PNP0100", 0}, /* Timer */
- {"PNP0200", 0}, /* AT DMA Controller */
+ {"PNP0000", 0}, /* PIC */
+ {"PNP0100", 0}, /* Timer */
+ {"PNP0200", 0}, /* AT DMA Controller */
+ {"ACPI0009", 0}, /* IOxAPIC */
+ {"ACPI000A", 0}, /* IOAPIC */
{"", 0},
};

--
1.9.1
Re: [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC [ In reply to ]
On Wednesday, March 22, 2017 06:33:25 PM Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
>
> No platform-device is required for IO(x)APICs, so don't even
> create them.
>
> Signed-off-by: Joerg Roedel <jroedel@suse.de>

If we do this, I'd prefer not to do [2/3], because we'll introduce code that
will be essentially dead then.

> ---
> drivers/acpi/acpi_platform.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
> index b4c1a6a..03250e1 100644
> --- a/drivers/acpi/acpi_platform.c
> +++ b/drivers/acpi/acpi_platform.c
> @@ -25,9 +25,11 @@
> ACPI_MODULE_NAME("platform");
>
> static const struct acpi_device_id forbidden_id_list[] = {
> - {"PNP0000", 0}, /* PIC */
> - {"PNP0100", 0}, /* Timer */
> - {"PNP0200", 0}, /* AT DMA Controller */

Why do you change the existing entries?

> + {"PNP0000", 0}, /* PIC */
> + {"PNP0100", 0}, /* Timer */
> + {"PNP0200", 0}, /* AT DMA Controller */
> + {"ACPI0009", 0}, /* IOxAPIC */
> + {"ACPI000A", 0}, /* IOAPIC */
> {"", 0},
> };
>
>

Thanks,
Rafael
Re: [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC [ In reply to ]
Hi Rafael,

On Wed, Mar 22, 2017 at 06:42:39PM +0100, Rafael J. Wysocki wrote:
> On Wednesday, March 22, 2017 06:33:25 PM Joerg Roedel wrote:
> > From: Joerg Roedel <jroedel@suse.de>
> >
> > No platform-device is required for IO(x)APICs, so don't even
> > create them.
> >
> > Signed-off-by: Joerg Roedel <jroedel@suse.de>
>
> If we do this, I'd prefer not to do [2/3], because we'll introduce code that
> will be essentially dead then.

In this case the code in acpi_bus_attach() adding platform_devices is also
dead. Could it be removed then?

>
> > ---
> > drivers/acpi/acpi_platform.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
> > index b4c1a6a..03250e1 100644
> > --- a/drivers/acpi/acpi_platform.c
> > +++ b/drivers/acpi/acpi_platform.c
> > @@ -25,9 +25,11 @@
> > ACPI_MODULE_NAME("platform");
> >
> > static const struct acpi_device_id forbidden_id_list[] = {
> > - {"PNP0000", 0}, /* PIC */
> > - {"PNP0100", 0}, /* Timer */
> > - {"PNP0200", 0}, /* AT DMA Controller */
>
> Why do you change the existing entries?

Just to align the '0's in one column :)


Joerg
Re: [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC [ In reply to ]
On Wed, Mar 22, 2017 at 11:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
> Hi Rafael,
>
> On Wed, Mar 22, 2017 at 06:42:39PM +0100, Rafael J. Wysocki wrote:
>> On Wednesday, March 22, 2017 06:33:25 PM Joerg Roedel wrote:
>> > From: Joerg Roedel <jroedel@suse.de>
>> >
>> > No platform-device is required for IO(x)APICs, so don't even
>> > create them.
>> >
>> > Signed-off-by: Joerg Roedel <jroedel@suse.de>
>>
>> If we do this, I'd prefer not to do [2/3], because we'll introduce code that
>> will be essentially dead then.
>
> In this case the code in acpi_bus_attach() adding platform_devices is also
> dead. Could it be removed then?

It is not dead.

Platform devices are actually created by it, but they never go away.

Thanks,
Rafael
Re: [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC [ In reply to ]
On Thu, Mar 23, 2017 at 12:41 AM, Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Wed, Mar 22, 2017 at 11:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
>> Hi Rafael,
>>
>> On Wed, Mar 22, 2017 at 06:42:39PM +0100, Rafael J. Wysocki wrote:
>>> On Wednesday, March 22, 2017 06:33:25 PM Joerg Roedel wrote:
>>> > From: Joerg Roedel <jroedel@suse.de>
>>> >
>>> > No platform-device is required for IO(x)APICs, so don't even
>>> > create them.
>>> >
>>> > Signed-off-by: Joerg Roedel <jroedel@suse.de>
>>>
>>> If we do this, I'd prefer not to do [2/3], because we'll introduce code that
>>> will be essentially dead then.
>>
>> In this case the code in acpi_bus_attach() adding platform_devices is also
>> dead. Could it be removed then?
>
> It is not dead.
>
> Platform devices are actually created by it, but they never go away.

IOW, they should never be created for anything hot-removable.

If they are, this is a bug (as you noticed).

Thanks,
Rafael
Re: [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC [ In reply to ]
On Thu, Mar 23, 2017 at 12:44:18AM +0100, Rafael J. Wysocki wrote:
> On Thu, Mar 23, 2017 at 12:41 AM, Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > It is not dead.
> >
> > Platform devices are actually created by it, but they never go away.
>
> IOW, they should never be created for anything hot-removable.
>
> If they are, this is a bug (as you noticed).

Okay, in this case patch 2 can be omitted.

But for my understanding, platform_devices created in acpi_bus_attach()
that are not hot-removable don't take a reference to the host_bridge,
right (at least when the host-bridge is hot-removable)?

Otherwise this would be a leak again in case the host-bridge gets
removed.


Joerg
Re: [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC [ In reply to ]
On Thu, Mar 23, 2017 at 12:58 AM, Joerg Roedel <joro@8bytes.org> wrote:
> On Thu, Mar 23, 2017 at 12:44:18AM +0100, Rafael J. Wysocki wrote:
>> On Thu, Mar 23, 2017 at 12:41 AM, Rafael J. Wysocki <rafael@kernel.org> wrote:
>> >
>> > It is not dead.
>> >
>> > Platform devices are actually created by it, but they never go away.
>>
>> IOW, they should never be created for anything hot-removable.
>>
>> If they are, this is a bug (as you noticed).
>
> Okay, in this case patch 2 can be omitted.
>
> But for my understanding, platform_devices created in acpi_bus_attach()
> that are not hot-removable don't take a reference to the host_bridge,
> right (at least when the host-bridge is hot-removable)?

They shouldn't.

> Otherwise this would be a leak again in case the host-bridge gets
> removed.

Right.

The main problem is that representing anything hot-removable as a
platform device is inherently fragile, as the platform bus type has no
idea whatever about things that may physically go away and platform
drivers don't expect that devices may vanish from under them in
general and so on. Unregistration alone doesn't help much with that,
so IMO at least for now it's better to avoid using platform_device for
hot-removable stuff.

Thanks,
Rafael
Re: [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC [ In reply to ]
On Thu, Mar 23, 2017 at 02:06:44AM +0100, Rafael J. Wysocki wrote:
> The main problem is that representing anything hot-removable as a
> platform device is inherently fragile, as the platform bus type has no
> idea whatever about things that may physically go away and platform
> drivers don't expect that devices may vanish from under them in
> general and so on. Unregistration alone doesn't help much with that,
> so IMO at least for now it's better to avoid using platform_device for
> hot-removable stuff.

Okay, thanks for the explanation. So patch 2 could be dropped, should I
resend without that patch or do you want to pick them up from this post?


Joerg
Re: [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC [ In reply to ]
On Thu, Mar 23, 2017 at 11:50 AM, Joerg Roedel <jroedel@suse.de> wrote:
> On Thu, Mar 23, 2017 at 02:06:44AM +0100, Rafael J. Wysocki wrote:
>> The main problem is that representing anything hot-removable as a
>> platform device is inherently fragile, as the platform bus type has no
>> idea whatever about things that may physically go away and platform
>> drivers don't expect that devices may vanish from under them in
>> general and so on. Unregistration alone doesn't help much with that,
>> so IMO at least for now it's better to avoid using platform_device for
>> hot-removable stuff.
>
> Okay, thanks for the explanation. So patch 2 could be dropped, should I
> resend without that patch or do you want to pick them up from this post?

I can pick them up easily enough, thanks!

Take care,
Rafael