2014-12-19 13:16:54

by Sander Eikelenboom

[permalink] [raw]
Subject: Bisected Linux regression: ACPI powerbutton events don't work under Xen since commit b81975eade8c6495f3c4d6746d22bdc95f617777

Hi,

When running under Xen, ACPI powerbutton events don't work anymore,
there is no reaction when pressing the powerbutton.

On baremetal everything works fine, acpid gets the event and the
machine powers down perfectly. The machine is an Intel NUC.

Bisection has lead to:

b81975eade8c6495f3c4d6746d22bdc95f617777 is the first bad commit
commit b81975eade8c6495f3c4d6746d22bdc95f617777
Author: Jiang Liu <[email protected]>
Date: Mon Jun 9 16:20:11 2014 +0800

x86, irq: Clean up irqdomain transition code

Now we have completely switched to irqdomain, so clean up transition code
in IOAPIC drivers.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: Yinghai Lu <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>

Reverting this specific commit on linux-tip (3.19-mw) gets things working again under Xen.
Kernel .config is attached.

--
Sander


Attachments:
dot-config (92.61 kB)

2014-12-19 13:22:31

by Jiang Liu

[permalink] [raw]
Subject: Re: Bisected Linux regression: ACPI powerbutton events don't work under Xen since commit b81975eade8c6495f3c4d6746d22bdc95f617777

Hi Sander,
Sorry for the trouble, I will investigate on next Monday.
Regards!
Gerry

On 2014/12/19 21:16, Sander Eikelenboom wrote:
> Hi,
>
> When running under Xen, ACPI powerbutton events don't work anymore,
> there is no reaction when pressing the powerbutton.
>
> On baremetal everything works fine, acpid gets the event and the
> machine powers down perfectly. The machine is an Intel NUC.
>
> Bisection has lead to:
>
> b81975eade8c6495f3c4d6746d22bdc95f617777 is the first bad commit
> commit b81975eade8c6495f3c4d6746d22bdc95f617777
> Author: Jiang Liu <[email protected]>
> Date: Mon Jun 9 16:20:11 2014 +0800
>
> x86, irq: Clean up irqdomain transition code
>
> Now we have completely switched to irqdomain, so clean up transition code
> in IOAPIC drivers.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Cc: Konrad Rzeszutek Wilk <[email protected]>
> Cc: Tony Luck <[email protected]>
> Cc: Joerg Roedel <[email protected]>
> Cc: Paul Gortmaker <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Benjamin Herrenschmidt <[email protected]>
> Cc: Grant Likely <[email protected]>
> Cc: Rafael J. Wysocki <[email protected]>
> Cc: Bjorn Helgaas <[email protected]>
> Cc: Randy Dunlap <[email protected]>
> Cc: Yinghai Lu <[email protected]>
> Link: http://lkml.kernel.org/r/[email protected]
> Signed-off-by: Thomas Gleixner <[email protected]>
>
> Reverting this specific commit on linux-tip (3.19-mw) gets things working again under Xen.
> Kernel .config is attached.
>
> --
> Sander
>

2014-12-19 13:44:18

by Jiang Liu

[permalink] [raw]
Subject: Re: Bisected Linux regression: ACPI powerbutton events don't work under Xen since commit b81975eade8c6495f3c4d6746d22bdc95f617777

Hi Sander,
Found the root cause now, but still need some time to find
a solution for this issue.
xen_smp_prepare_cpus() doesn't call:
smpboot_setup_io_apic()->setup_IO_APIC()
So no irqdomain structure for IOAPIC created, then mp_map_pin_to_irq()
fails at the very beginning.

The most simple solution is to revert following change, but it doesn't
seem the best solution. I will try to find a hook point to create
irqdomain for IOAPIC from xen_smp_prepare_cpus().
Regards!
Gerry

@@ -1034,13 +1035,8 @@ static int mp_map_pin_to_irq(u32 gsi, int idx,
int ioapic, int pin,
struct irq_domain *domain = mp_ioapic_irqdomain(ioapic);
struct mp_pin_info *info = mp_pin_info(ioapic, pin);

- if (!domain) {
- /*
- * Provide an identity mapping of gsi == irq except on truly
- * weird platforms that have non isa irqs in the first
16 gsis.
- */
- return gsi >= nr_legacy_irqs() ? gsi : gsi_top + gsi;
- }
+ if (!domain)
+ return -1;

mutex_lock(&ioapic_mutex);



On 2014/12/19 21:16, Sander Eikelenboom wrote:
> Hi,
>
> When running under Xen, ACPI powerbutton events don't work anymore,
> there is no reaction when pressing the powerbutton.
>
> On baremetal everything works fine, acpid gets the event and the
> machine powers down perfectly. The machine is an Intel NUC.
>
> Bisection has lead to:
>
> b81975eade8c6495f3c4d6746d22bdc95f617777 is the first bad commit
> commit b81975eade8c6495f3c4d6746d22bdc95f617777
> Author: Jiang Liu <[email protected]>
> Date: Mon Jun 9 16:20:11 2014 +0800
>
> x86, irq: Clean up irqdomain transition code
>
> Now we have completely switched to irqdomain, so clean up transition code
> in IOAPIC drivers.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Cc: Konrad Rzeszutek Wilk <[email protected]>
> Cc: Tony Luck <[email protected]>
> Cc: Joerg Roedel <[email protected]>
> Cc: Paul Gortmaker <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Benjamin Herrenschmidt <[email protected]>
> Cc: Grant Likely <[email protected]>
> Cc: Rafael J. Wysocki <[email protected]>
> Cc: Bjorn Helgaas <[email protected]>
> Cc: Randy Dunlap <[email protected]>
> Cc: Yinghai Lu <[email protected]>
> Link: http://lkml.kernel.org/r/[email protected]
> Signed-off-by: Thomas Gleixner <[email protected]>
>
> Reverting this specific commit on linux-tip (3.19-mw) gets things working again under Xen.
> Kernel .config is attached.
>
> --
> Sander
>

2014-12-19 14:55:19

by Jiang Liu

[permalink] [raw]
Subject: Re: Bisected Linux regression: ACPI powerbutton events don't work under Xen since commit b81975eade8c6495f3c4d6746d22bdc95f617777

Hi Sander,
Could you please help to test attached patch? It works
on native but I have no Xen environment at hand.
Thanks!
Gerry

On 2014/12/19 21:16, Sander Eikelenboom wrote:
> Hi,
>
> When running under Xen, ACPI powerbutton events don't work anymore,
> there is no reaction when pressing the powerbutton.
>
> On baremetal everything works fine, acpid gets the event and the
> machine powers down perfectly. The machine is an Intel NUC.
>
> Bisection has lead to:
>
> b81975eade8c6495f3c4d6746d22bdc95f617777 is the first bad commit
> commit b81975eade8c6495f3c4d6746d22bdc95f617777
> Author: Jiang Liu <[email protected]>
> Date: Mon Jun 9 16:20:11 2014 +0800
>
> x86, irq: Clean up irqdomain transition code
>
> Now we have completely switched to irqdomain, so clean up transition code
> in IOAPIC drivers.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Cc: Konrad Rzeszutek Wilk <[email protected]>
> Cc: Tony Luck <[email protected]>
> Cc: Joerg Roedel <[email protected]>
> Cc: Paul Gortmaker <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Benjamin Herrenschmidt <[email protected]>
> Cc: Grant Likely <[email protected]>
> Cc: Rafael J. Wysocki <[email protected]>
> Cc: Bjorn Helgaas <[email protected]>
> Cc: Randy Dunlap <[email protected]>
> Cc: Yinghai Lu <[email protected]>
> Link: http://lkml.kernel.org/r/[email protected]
> Signed-off-by: Thomas Gleixner <[email protected]>
>
> Reverting this specific commit on linux-tip (3.19-mw) gets things working again under Xen.
> Kernel .config is attached.
>
> --
> Sander
>


Attachments:
0001-x86-apic-Fix-xen-failure-caused-by-commit-b81975eade.patch (3.88 kB)

2014-12-19 15:31:41

by Sander Eikelenboom

[permalink] [raw]
Subject: Re: Bisected Linux regression: ACPI powerbutton events don't work under Xen since commit b81975eade8c6495f3c4d6746d22bdc95f617777


Friday, December 19, 2014, 3:55:00 PM, you wrote:

> Hi Sander,
> Could you please help to test attached patch? It works
> on native but I have no Xen environment at hand.
> Thanks!
> Gerry

Hi Gerry,

First of all thanks for the swift response !

Just tested this patch and i can report that it fixes my issue.

(i don't know if the xen-folks / Thomas have any comment on the way it is fixed.
But when this is final, it should probably be CC'd for -stable since it's broken
in both 3.17 and 3.18 afaik)

Thanks again,
--
Sander

> On 2014/12/19 21:16, Sander Eikelenboom wrote:
>> Hi,
>>
>> When running under Xen, ACPI powerbutton events don't work anymore,
>> there is no reaction when pressing the powerbutton.
>>
>> On baremetal everything works fine, acpid gets the event and the
>> machine powers down perfectly. The machine is an Intel NUC.
>>
>> Bisection has lead to:
>>
>> b81975eade8c6495f3c4d6746d22bdc95f617777 is the first bad commit
>> commit b81975eade8c6495f3c4d6746d22bdc95f617777
>> Author: Jiang Liu <[email protected]>
>> Date: Mon Jun 9 16:20:11 2014 +0800
>>
>> x86, irq: Clean up irqdomain transition code
>>
>> Now we have completely switched to irqdomain, so clean up transition code
>> in IOAPIC drivers.
>>
>> Signed-off-by: Jiang Liu <[email protected]>
>> Cc: Konrad Rzeszutek Wilk <[email protected]>
>> Cc: Tony Luck <[email protected]>
>> Cc: Joerg Roedel <[email protected]>
>> Cc: Paul Gortmaker <[email protected]>
>> Cc: Greg Kroah-Hartman <[email protected]>
>> Cc: Benjamin Herrenschmidt <[email protected]>
>> Cc: Grant Likely <[email protected]>
>> Cc: Rafael J. Wysocki <[email protected]>
>> Cc: Bjorn Helgaas <[email protected]>
>> Cc: Randy Dunlap <[email protected]>
>> Cc: Yinghai Lu <[email protected]>
>> Link: http://lkml.kernel.org/r/[email protected]
>> Signed-off-by: Thomas Gleixner <[email protected]>
>>
>> Reverting this specific commit on linux-tip (3.19-mw) gets things working again under Xen.
>> Kernel .config is attached.
>>
>> --
>> Sander
>>