Bisected Linux regression: ACPI powerbutton events don't work under Xen since commit b81975eade8c6495f3c4d6746d22bdc95f617777
Subsystems (2)
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.
Reverting this specific commit on linux-tip (3.19-mw) gets things working again under Xen. Kernel .config is attached.
--
Sander
Hi Sander,
Sorry for the trouble, I will investigate on next Monday.
Regards!
Gerry
Quoted 41 lines · Sander Eikelenboom
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:
b81975eade8c6495f3c4d6746d22bdc95f617777is the first bad commit commitb81975eade8c6495f3c4d6746d22bdc95f617777Author: Jiang Liu <[email protected]> Date: Mon Jun 9 16:20:11 2014 +0800x86, 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]>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
Hi Sander,
Sorry for the trouble, I will investigate on next Monday.
Regards!
Gerry
Quoted 41 lines · Sander Eikelenboom
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:
b81975eade8c6495f3c4d6746d22bdc95f617777is the first bad commit commitb81975eade8c6495f3c4d6746d22bdc95f617777Author: Jiang Liu <[email protected]> Date: Mon Jun 9 16:20:11 2014 +0800x86, 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]>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
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);
Quoted 41 lines · Sander Eikelenboom
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:
b81975eade8c6495f3c4d6746d22bdc95f617777is the first bad commit commitb81975eade8c6495f3c4d6746d22bdc95f617777Author: Jiang Liu <[email protected]> Date: Mon Jun 9 16:20:11 2014 +0800x86, 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]>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
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);
Quoted 41 lines · Sander Eikelenboom
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:
b81975eade8c6495f3c4d6746d22bdc95f617777is the first bad commit commitb81975eade8c6495f3c4d6746d22bdc95f617777Author: Jiang Liu <[email protected]> Date: Mon Jun 9 16:20:11 2014 +0800x86, 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]>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
Hi Sander,
Could you please help to test attached patch? It works
on native but I have no Xen environment at hand. Thanks!
Gerry
Quoted 35 lines · Sander Eikelenboom
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:
b81975eade8c6495f3c4d6746d22bdc95f617777is the first bad commit commitb81975eade8c6495f3c4d6746d22bdc95f617777Author: Jiang Liu <[email protected]> Date: Mon Jun 9 16:20:11 2014 +0800x86, 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]>Signed-off-by Thomas Gleixner <[email protected]>
Quoted 7 lines
Reverting this specific commit on linux-tip (3.19-mw) gets things working again under Xen. Kernel .config is attached.
--
SanderFrom
a6928b3c93a5119c79b8a7aec953579c87d2a4ccMon Sep 17 00:00:00 2001
From: Jiang Liu <[email protected]>
Date: Fri, 19 Dec 2014 22:33:56 +0800
Subject: [PATCH] x86/apic: Fix xen failure caused by commit b81975eade8c
Commit b81975eade8c "x86, irq: Clean up irqdomain transition code" breaks Xen because xen_smp_prepare_cpus() doesn't call setup_IO_APIC() so mp_map_pin_to_irq() fails at the very beginning.
--- arch/x86/include/asm/hw_irq.h | 2 +- arch/x86/include/asm/smpboot_hooks.h | 6 +++--- arch/x86/kernel/apic/apic.c | 6 +++--- arch/x86/kernel/apic/io_apic.c | 32 +++++++++++++++----------------- arch/x86/xen/smp.c | 3 +++ 5 files changed, 25 insertions(+), 24 deletions(-)
arch/x86/include/asm/hw_irq.h +1 -1
@@ -98,7 +98,7 @@ extern void trace_call_function_single_interrupt(void);#define IO_APIC_IRQ (x) (((x) >= NR_IRQS_LEGACY) || ((1<<(x)) & io_apic_irqs))extern unsigned long io_apic_irqs; -extern void setup_IO_APIC (void ); +extern void setup_IO_APIC (bool xen_smp);extern void disable_IO_APIC (void );struct io_apic_irq_attr {
arch/x86/include/asm/smpboot_hooks.h +3 -3
@@ -52,9 +52,9 @@ static inline void __init smpboot_setup_io_apic(void)* Here we can be sure that there is an IO-APIC in the system. Let's * go and set it up: */ -if (!skip_ioapic_setup && nr_ioapics) -setup_IO_APIC (); -else { +if (!skip_ioapic_setup && nr_ioapics) { +setup_IO_APIC (false); + }else { nr_ioapics =0 ; }#endif
arch/x86/kernel/apic/apic.c +3 -3
@@ -1912,9 +1912,9 @@ int __init APIC_init_uniprocessor(void)bsp_end_local_APIC_setup ();#ifdef CONFIG_X86_IO_APIC -if (smp_found_config && !skip_ioapic_setup && nr_ioapics) -setup_IO_APIC (); -else { +if (smp_found_config && !skip_ioapic_setup && nr_ioapics) { +setup_IO_APIC (false); + }else { nr_ioapics =0 ; }#endif
arch/x86/kernel/apic/io_apic.c +15 -17
@@ -2965,31 +2965,29 @@ static int mp_irqdomain_create(int ioapic)return 0 ; } -void __init setup_IO_APIC (void ) +void __init setup_IO_APIC (bool xen_smp) {int ioapic; -/* -* calling enable_IO_APIC() is moved to setup_local_APIC for BP -*/ - io_apic_irqs =nr_legacy_irqs () ? ~PIC_IRQS : ~0UL ; +if (!xen_smp) { +apic_printk (APIC_VERBOSE ,"ENABLING IO-APIC IRQs\n" ); + io_apic_irqs =nr_legacy_irqs () ? ~PIC_IRQS : ~0UL ; + +/* Set up IO-APIC IRQ routing. */ + x86_init.mpparse.setup_ioapic_ids (); +sync_Arb_IDs (); + } -apic_printk (APIC_VERBOSE ,"ENABLING IO-APIC IRQs\n" );for_each_ioapic (ioapic)BUG_ON (mp_irqdomain_create (ioapic)); - -/* -* Set up IO-APIC IRQ routing. -*/ - x86_init.mpparse.setup_ioapic_ids (); - -sync_Arb_IDs ();setup_IO_APIC_irqs (); -init_IO_APIC_traps (); -if (nr_legacy_irqs ()) -check_timer (); - ioapic_initialized =1 ; + +if (!xen_smp) { +init_IO_APIC_traps (); +if (nr_legacy_irqs ()) +check_timer (); + } }/*
arch/x86/xen/smp.c +3 -0
@@ -326,7 +326,10 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)xen_raw_printk (m);panic (m); + }else { +setup_IO_APIC (true); } +xen_init_lock_cpu (0 );smp_store_boot_cpu_info ();
Signature · 1 line
1.7.10.4
Quoted 5 lines · you
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
Quoted 42 lines · Sander Eikelenboom
Quoted 41 lines
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:
b81975eade8c6495f3c4d6746d22bdc95f617777is the first bad commit commitb81975eade8c6495f3c4d6746d22bdc95f617777Author: Jiang Liu <[email protected]> Date: Mon Jun 9 16:20:11 2014 +0800x86, 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]>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
Quoted 5 lines · you
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
Quoted 42 lines · Sander Eikelenboom
Quoted 41 lines
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:
b81975eade8c6495f3c4d6746d22bdc95f617777is the first bad commit commitb81975eade8c6495f3c4d6746d22bdc95f617777Author: Jiang Liu <[email protected]> Date: Mon Jun 9 16:20:11 2014 +0800x86, 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]>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
Hi Sander,
Could you please help to test attached patch? It works
on native but I have no Xen environment at hand. Thanks!
Gerry
Quoted 35 lines · Sander Eikelenboom
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:
b81975eade8c6495f3c4d6746d22bdc95f617777is the first bad commit commitb81975eade8c6495f3c4d6746d22bdc95f617777Author: Jiang Liu <[email protected]> Date: Mon Jun 9 16:20:11 2014 +0800x86, 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]>Signed-off-by Thomas Gleixner <[email protected]>
Quoted 7 lines
Reverting this specific commit on linux-tip (3.19-mw) gets things working again under Xen. Kernel .config is attached.
--
SanderFrom
a6928b3c93a5119c79b8a7aec953579c87d2a4ccMon Sep 17 00:00:00 2001
From: Jiang Liu <[email protected]>
Date: Fri, 19 Dec 2014 22:33:56 +0800
Subject: [PATCH] x86/apic: Fix xen failure caused by commit b81975eade8c
Commit b81975eade8c "x86, irq: Clean up irqdomain transition code" breaks Xen because xen_smp_prepare_cpus() doesn't call setup_IO_APIC() so mp_map_pin_to_irq() fails at the very beginning.
--- arch/x86/include/asm/hw_irq.h | 2 +- arch/x86/include/asm/smpboot_hooks.h | 6 +++--- arch/x86/kernel/apic/apic.c | 6 +++--- arch/x86/kernel/apic/io_apic.c | 32 +++++++++++++++----------------- arch/x86/xen/smp.c | 3 +++ 5 files changed, 25 insertions(+), 24 deletions(-)
arch/x86/include/asm/hw_irq.h +1 -1
@@ -98,7 +98,7 @@ extern void trace_call_function_single_interrupt(void);#define IO_APIC_IRQ (x) (((x) >= NR_IRQS_LEGACY) || ((1<<(x)) & io_apic_irqs))extern unsigned long io_apic_irqs; -extern void setup_IO_APIC (void ); +extern void setup_IO_APIC (bool xen_smp);extern void disable_IO_APIC (void );struct io_apic_irq_attr {
arch/x86/include/asm/smpboot_hooks.h +3 -3
@@ -52,9 +52,9 @@ static inline void __init smpboot_setup_io_apic(void)* Here we can be sure that there is an IO-APIC in the system. Let's * go and set it up: */ -if (!skip_ioapic_setup && nr_ioapics) -setup_IO_APIC (); -else { +if (!skip_ioapic_setup && nr_ioapics) { +setup_IO_APIC (false); + }else { nr_ioapics =0 ; }#endif
arch/x86/kernel/apic/apic.c +3 -3
@@ -1912,9 +1912,9 @@ int __init APIC_init_uniprocessor(void)bsp_end_local_APIC_setup ();#ifdef CONFIG_X86_IO_APIC -if (smp_found_config && !skip_ioapic_setup && nr_ioapics) -setup_IO_APIC (); -else { +if (smp_found_config && !skip_ioapic_setup && nr_ioapics) { +setup_IO_APIC (false); + }else { nr_ioapics =0 ; }#endif
arch/x86/kernel/apic/io_apic.c +15 -17
@@ -2965,31 +2965,29 @@ static int mp_irqdomain_create(int ioapic)return 0 ; } -void __init setup_IO_APIC (void ) +void __init setup_IO_APIC (bool xen_smp) {int ioapic; -/* -* calling enable_IO_APIC() is moved to setup_local_APIC for BP -*/ - io_apic_irqs =nr_legacy_irqs () ? ~PIC_IRQS : ~0UL ; +if (!xen_smp) { +apic_printk (APIC_VERBOSE ,"ENABLING IO-APIC IRQs\n" ); + io_apic_irqs =nr_legacy_irqs () ? ~PIC_IRQS : ~0UL ; + +/* Set up IO-APIC IRQ routing. */ + x86_init.mpparse.setup_ioapic_ids (); +sync_Arb_IDs (); + } -apic_printk (APIC_VERBOSE ,"ENABLING IO-APIC IRQs\n" );for_each_ioapic (ioapic)BUG_ON (mp_irqdomain_create (ioapic)); - -/* -* Set up IO-APIC IRQ routing. -*/ - x86_init.mpparse.setup_ioapic_ids (); - -sync_Arb_IDs ();setup_IO_APIC_irqs (); -init_IO_APIC_traps (); -if (nr_legacy_irqs ()) -check_timer (); - ioapic_initialized =1 ; + +if (!xen_smp) { +init_IO_APIC_traps (); +if (nr_legacy_irqs ()) +check_timer (); + } }/*
arch/x86/xen/smp.c +3 -0
@@ -326,7 +326,10 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)xen_raw_printk (m);panic (m); + }else { +setup_IO_APIC (true); } +xen_init_lock_cpu (0 );smp_store_boot_cpu_info ();
Signature · 1 line
1.7.10.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel