Fix bugs caused by "use irqdomain to dynamically allocate IRQ for IOAPIC"
PATCH 2/2 x86, irq: Keep balance of IOAPIC pin reference count
In reply to Jiang LiuTo keep balance of IOAPIC pin reference count, we need to protect pirq_enable_irq(), acpi_pci_irq_enable() and intel_mid_pci_irq_enable() from reentrance. There are two cases which will cause reentrance.
The first case is caused by suspend/hibernation. If pcibios_disable_irq is called during suspending/hibernating, we don't release the assigned IRQ number, otherwise it may break the suspend/hibernation. So late when pcibios_enable_irq is called during resume, we shouldn't allocate IRQ number again.
The second case is that function acpi_pci_irq_enable() may be called twice for PCI devices present at boot time as below:
1) pci_acpi_init()
--> acpi_pci_irq_enable() if pci_routeirq is true 2) pci_enable_device() --> pcibios_enable_device() --> acpi_pci_irq_enable()
We can't kill kernel parameter pci_routeirq yet because it's still needed for debugging purpose.
Flag irq_managed is introduced to track whether IRQ number is assigned by OS and to protect pirq_enable_irq(), acpi_pci_irq_enable() and intel_mid_pci_irq_enable() from reentrance.
--- arch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 7 ++++++- drivers/acpi/pci_irq.c | 11 +++++++++-- include/linux/pci.h | 1 + 4 files changed, 24 insertions(+), 4 deletions(-)
arch/x86/pci/intel_mid_pci.c +8 -1
@@ -210,6 +210,9 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev) {int polarity; +if (dev->irq_managed && dev->irq >0 ) +return 0 ; +if (intel_mid_identify_cpu () ==INTEL_MID_CPU_CHIP_TANGIER ) polarity =0 ;/* active high */ else
@@ -224,13 +227,17 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)if (mp_map_gsi_to_irq (dev->irq,IOAPIC_MAP_ALLOC ) <0 )return -EBUSY ; + dev->irq_managed =1 ; +return 0 ; }static void intel_mid_pci_irq_disable (struct pci_dev *dev) { -if (!dev->dev.power.is_prepared && dev->irq >0 ) +if (!dev->dev.power.is_prepared && dev->irq_managed && dev->irq >0 ) {mp_unmap_irq (dev->irq); + dev->irq_managed =0 ; + } }struct pci_ops intel_mid_pci_ops = {
arch/x86/pci/irq.c +6 -1
@@ -1202,6 +1202,9 @@ static int pirq_enable_irq(struct pci_dev *dev)int irq;struct io_apic_irq_attr irq_attr; +if (dev->irq_managed && dev->irq >0 ) +return 0 ; + irq =IO_APIC_get_PCI_irq_vector (dev->bus->number,PCI_SLOT (dev->devfn), pin -1 , &irq_attr);
@@ -1228,6 +1231,7 @@ static int pirq_enable_irq(struct pci_dev *dev) } dev = temp_dev;if (irq >=0 ) { + dev->irq_managed =1 ; dev->irq = irq;dev_info (&dev->dev,"PCI->APIC IRQ transform: " "INT %c -> IRQ %d\n" ,'A' + pin -1 , irq);
@@ -1257,8 +1261,9 @@ static int pirq_enable_irq(struct pci_dev *dev)static void pirq_disable_irq (struct pci_dev *dev) {if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared && - dev->irq) { + dev->irq_managed && dev->irq >0 ) {mp_unmap_irq (dev->irq); dev->irq =0 ; + dev->irq_managed =0 ; } }
drivers/acpi/pci_irq.c +9 -2
@@ -413,6 +413,9 @@ int acpi_pci_irq_enable(struct pci_dev *dev)return 0 ; } +if (dev->irq_managed && dev->irq >0 ) +return 0 ; + entry =acpi_pci_irq_lookup (dev, pin);if (!entry) {/*
@@ -456,6 +459,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)return rc; } dev->irq = rc; + dev->irq_managed =1 ;if (link)snprintf (link_desc,sizeof (link_desc)," -> Link[%s]" , link);
@@ -478,7 +482,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)u8 pin; pin = dev->pin; -if (!pin) +if (!pin || !dev->irq_managed || dev->irq <=0 )return ;/* Keep IOAPIC pin configuration when suspending */
@@ -502,6 +506,9 @@ void acpi_pci_irq_disable(struct pci_dev *dev)*/ dev_dbg (&dev->dev,"PCI INT %c disabled\n" ,pin_name (pin)); -if (gsi >=0 && dev->irq >0 ) +if (gsi >=0 ) {acpi_unregister_gsi (gsi); + dev->irq =0 ; + dev->irq_managed =0 ; + } }
include/linux/pci.h +1 -0
@@ -347,6 +347,7 @@ struct pci_dev { unsigned int __aer_firmware_first:1; unsigned int broken_intx_masking:1; unsigned int io_window_1k:1; /* Intel P2P bridge 1K I/O windows */ +unsigned int irq_managed;/* IRQ number is assigned by OS */ pci_dev_flags_t dev_flags;atomic_t enable_cnt;/* pci_enable_device has been called */
Signature · 1 line
1.7.10.4
cover Fix bugs caused by "use irqdomain to dynamically allocate IRQ for IOAPIC"
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to Xen
2) Flag dev->dev.power.is_prepared has already been cleared when pcibios_enable_device() gets called, so it will cause IOAPIC pin reference count leak.
So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of dev->dev.power.is_prepared pcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.html
Regards!
Gerry
Jiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference count
arch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/2 x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation
Now IOAPIC driver dynamically allocates IRQ numbers for IOAPIC pins. We need to keep IRQ assignment for PCI devices during suspend/hibernation, otherwise it may cause failure of suspend/hibernation due to:
1) Device driver calls pci_enable_device() to allocate an IRQ number and register interrupt handler on the returned IRQ.
2) Device driver's suspend callback calls pci_disable_device() and release assigned IRQ in turn.
3) Device driver's resume callback calls pci_enable_device() to allocate IRQ number again. A different IRQ number may be assigned by IOAPIC driver this time.
4) Now the hardware delivers interrupt to the new IRQ but interrupt handler is still registered against the old IRQ, so it breaks suspend/hibernation.
To fix this issue, we keep IRQ assignment during suspend/hibernation. Flag pci_dev.dev.power.is_prepared is used to detect that pci_disable_device() is called during suspend/hibernation.
---
Hi Borislav,
Could you please help to review the patch again since I have
made changes against the previous version?
Regards!
Gerry
--- arch/x86/pci/intel_mid_pci.c | 2 +- arch/x86/pci/irq.c | 3 ++- drivers/acpi/pci_irq.c | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/pci/intel_mid_pci.c +1 -1
@@ -229,7 +229,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)static void intel_mid_pci_irq_disable (struct pci_dev *dev) { -if (dev->irq >0 ) +if (!dev->dev.power.is_prepared && dev->irq >0 )mp_unmap_irq (dev->irq); }
arch/x86/pci/irq.c +2 -1
@@ -1256,7 +1256,8 @@ static int pirq_enable_irq(struct pci_dev *dev)static void pirq_disable_irq (struct pci_dev *dev) { -if (io_apic_assign_pci_irqs && dev->irq) { +if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared && + dev->irq) {mp_unmap_irq (dev->irq); dev->irq =0 ; }
drivers/acpi/pci_irq.c +4 -0
@@ -481,6 +481,10 @@ void acpi_pci_irq_disable(struct pci_dev *dev)if (!pin)return ; +/* Keep IOAPIC pin configuration when suspending */ +if (dev->dev.power.is_prepared) +return ; + entry =acpi_pci_irq_lookup (dev, pin);if (!entry)return ;
Signature · 1 line
1.7.10.4
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to Xen
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to Xen
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to Xen
Quoted 3 lines
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Hi Konrad,
The patch at https://lkml.org/lkml/2014/7/30/725 skips invoking
xen_pcifront_enable_irq() on resume from suspend or restore from hibernation. I'm not sure whether that will affect suspend/hibernation with Xen. This patch series won't affect Xen anymore.
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend
Thanks for help!
Gerry
Quoted 27 lines
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to Xen
Quoted 3 lines
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Hi Konrad,
The patch at https://lkml.org/lkml/2014/7/30/725 skips invoking
xen_pcifront_enable_irq() on resume from suspend or restore from hibernation. I'm not sure whether that will affect suspend/hibernation with Xen. This patch series won't affect Xen anymore.
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend
Thanks for help!
Gerry
Quoted 27 lines
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Quoted 14 lines · Jiang Liu
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to Xen
Quoted 8 lines
Quoted 3 lines
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Hi Konrad,
The patch at https://lkml.org/lkml/2014/7/30/725 skips invoking
xen_pcifront_enable_irq()on resume from suspend or restore from hibernation. I'm not sure whether that will affect suspend/hibernation with Xen. This patch series won't affect Xen anymore.
Ah, it looks like:
415 pcibios_enable_irq = xen_pcifront_enable_irq;
416 pcibios_disable_irq = NULL;
Is the culprit right? If there was an pcibios_disable_irq set, then said patch would not been needed?
Quoted 2 lines
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend
Thank you. Will give it a spin tomorrow.
Quoted 31 lines
Thanks for help!
GerryQuoted 27 lines
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Quoted 14 lines · Jiang Liu
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to Xen
Quoted 8 lines
Quoted 3 lines
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Hi Konrad,
The patch at https://lkml.org/lkml/2014/7/30/725 skips invoking
xen_pcifront_enable_irq()on resume from suspend or restore from hibernation. I'm not sure whether that will affect suspend/hibernation with Xen. This patch series won't affect Xen anymore.
Ah, it looks like:
415 pcibios_enable_irq = xen_pcifront_enable_irq;
416 pcibios_disable_irq = NULL;
Is the culprit right? If there was an pcibios_disable_irq set, then said patch would not been needed?
Quoted 2 lines
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend
Thank you. Will give it a spin tomorrow.
Quoted 31 lines
Thanks for help!
GerryQuoted 27 lines
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Borislav Petkov
maintainerRe: [Bugfix 1/2] x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation
In reply to Jiang LiuQuoted 18 lines · Jiang Liu
Now IOAPIC driver dynamically allocates IRQ numbers for IOAPIC pins. We need to keep IRQ assignment for PCI devices during suspend/hibernation, otherwise it may cause failure of suspend/hibernation due to:
1) Device driver callspci_enable_device()to allocate an IRQ number and register interrupt handler on the returned IRQ.
2) Device driver's suspend callback callspci_disable_device()and release assigned IRQ in turn.
3) Device driver's resume callback callspci_enable_device()to allocate IRQ number again. A different IRQ number may be assigned by IOAPIC driver this time.
4) Now the hardware delivers interrupt to the new IRQ but interrupt handler is still registered against the old IRQ, so it breaks suspend/hibernation.To fix this issue, we keep IRQ assignment during suspend/hibernation. Flag pci_dev.dev.power.is_prepared is used to detect that
pci_disable_device()is called during suspend/hibernation.
Quoted 5 lines
Signed-off-by Jiang Liu <[email protected]>---
Hi Borislav,
Could you please help to review the patch again since I have
made changes against the previous version?
I think you're asking me to test that patch, correct?
If so, what is the exact tree I need to apply? tip/x86/apic + those two patches here? What else? What about the USB chunk which removes the proc splat, is that somewhere too? Maybe Linus did pull it already?
Please specify what exactly I should test.
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Re: [Bugfix 1/2] x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation
Quoted 25 lines · Borislav Petkov
Quoted 18 lines · Jiang Liu
Now IOAPIC driver dynamically allocates IRQ numbers for IOAPIC pins. We need to keep IRQ assignment for PCI devices during suspend/hibernation, otherwise it may cause failure of suspend/hibernation due to:
1) Device driver callspci_enable_device()to allocate an IRQ number and register interrupt handler on the returned IRQ.
2) Device driver's suspend callback callspci_disable_device()and release assigned IRQ in turn.
3) Device driver's resume callback callspci_enable_device()to allocate IRQ number again. A different IRQ number may be assigned by IOAPIC driver this time.
4) Now the hardware delivers interrupt to the new IRQ but interrupt handler is still registered against the old IRQ, so it breaks suspend/hibernation.To fix this issue, we keep IRQ assignment during suspend/hibernation. Flag pci_dev.dev.power.is_prepared is used to detect that
pci_disable_device()is called during suspend/hibernation.Quoted 5 lines
Signed-off-by Jiang Liu <[email protected]>---
Hi Borislav,
Could you please help to review the patch again since I have
made changes against the previous version?
Quoted 7 lines
I think you're asking me to test that patch, correct?
If so, what is the exact tree I need to apply? tip/x86/apic + those two patches here? What else? What about the USB chunk which removes the proc splat, is that somewhere too? Maybe Linus did pull it already?
Please specify what exactly I should test.
Hi Borislav,
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend2
It's based on tip/master and includes:
1) the patch to fix warning caused by USB controller
2) these two patches to fix failure of suspend/hibernation
Could you please help to check whether suspend/hibernation works as expect on your platforms?
Thanks!
Gerry
Quoted 3 lines
Thanks.
Quoted 29 lines · Konrad Rzeszutek Wilk
Quoted 14 lines · Jiang Liu
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to XenQuoted 8 lines
Quoted 3 lines
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Hi Konrad,
The patch at https://lkml.org/lkml/2014/7/30/725 skips invoking
xen_pcifront_enable_irq()on resume from suspend or restore from hibernation. I'm not sure whether that will affect suspend/hibernation with Xen. This patch series won't affect Xen anymore.Ah, it looks like:
415
pcibios_enable_irq=xen_pcifront_enable_irq;
416pcibios_disable_irq= NULL;
Quoted 8 lines
Is the culprit right? If there was an
pcibios_disable_irqset, then said patch would not been needed?Quoted 2 lines
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspendThank you. Will give it a spin tomorrow.
Hi Konrad,
Thanks for review.
I think no need to test it anymore. We are trying to fix an
issue caused by IOAPIC related work. The previous version of patch is too coarse grain and may affect Xen. And now we have reworked it, so it shouldn't affect Xen anymore.
Regards!
Gerry
Quoted 31 lines
Quoted 31 lines
Thanks for help!
GerryQuoted 27 lines
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Quoted 29 lines · Konrad Rzeszutek Wilk
Quoted 14 lines · Jiang Liu
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to XenQuoted 8 lines
Quoted 3 lines
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Hi Konrad,
The patch at https://lkml.org/lkml/2014/7/30/725 skips invoking
xen_pcifront_enable_irq()on resume from suspend or restore from hibernation. I'm not sure whether that will affect suspend/hibernation with Xen. This patch series won't affect Xen anymore.Ah, it looks like:
415
pcibios_enable_irq=xen_pcifront_enable_irq;
416pcibios_disable_irq= NULL;
Quoted 8 lines
Is the culprit right? If there was an
pcibios_disable_irqset, then said patch would not been needed?Quoted 2 lines
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspendThank you. Will give it a spin tomorrow.
Hi Konrad,
Thanks for review.
I think no need to test it anymore. We are trying to fix an
issue caused by IOAPIC related work. The previous version of patch is too coarse grain and may affect Xen. And now we have reworked it, so it shouldn't affect Xen anymore.
Regards!
Gerry
Quoted 31 lines
Quoted 31 lines
Thanks for help!
GerryQuoted 27 lines
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Quoted 39 lines · Jiang Liu
Quoted 36 lines · Konrad Rzeszutek Wilk
Quoted 14 lines · Jiang Liu
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to XenQuoted 8 lines
Quoted 3 lines
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Hi Konrad,
The patch at https://lkml.org/lkml/2014/7/30/725 skips invoking
xen_pcifront_enable_irq()on resume from suspend or restore from hibernation. I'm not sure whether that will affect suspend/hibernation with Xen. This patch series won't affect Xen anymore.Ah, it looks like:
415
pcibios_enable_irq=xen_pcifront_enable_irq;
416pcibios_disable_irq= NULL;Is the culprit right? If there was an
pcibios_disable_irqset, then said patch would not been needed?Quoted 2 lines
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend
Quoted 7 lines
Quoted 1 line
Thank you. Will give it a spin tomorrow.
Hi Konrad,
Thanks for review.
I think no need to test it anymore. We are trying to fix an
issue caused by IOAPIC related work. The previous version of patch is too coarse grain and may affect Xen. And now we have reworked it, so it shouldn't affect Xen anymore.
OK. Thanks for the heads up!
Quoted 34 lines
Regards!
GerryQuoted 31 lines
Quoted 31 lines
Thanks for help!
GerryQuoted 27 lines
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Quoted 39 lines · Jiang Liu
Quoted 36 lines · Konrad Rzeszutek Wilk
Quoted 14 lines · Jiang Liu
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Jiang Liu
Two issues have been reported against patch set "use irqdomain to dynamically allocate IRQ for IOAPIC" at https://lkml.org/lkml/2014/6/9/44.
This first one causes failure of suspend/hibernation, please refer to
https://lkml.org/lkml/2014/7/28/822 for more information. And we have worked out a patch to fix it (https://lkml.org/lkml/2014/7/30/725) and Borislav has tested it. But with more testing and analysis, I found the provided patch still has some issues:
1) It may cause regression to XenQuoted 8 lines
Quoted 3 lines
Could you elaborate please?
Is there a git tree with all of these patches to test it?
Hi Konrad,
The patch at https://lkml.org/lkml/2014/7/30/725 skips invoking
xen_pcifront_enable_irq()on resume from suspend or restore from hibernation. I'm not sure whether that will affect suspend/hibernation with Xen. This patch series won't affect Xen anymore.Ah, it looks like:
415
pcibios_enable_irq=xen_pcifront_enable_irq;
416pcibios_disable_irq= NULL;Is the culprit right? If there was an
pcibios_disable_irqset, then said patch would not been needed?Quoted 2 lines
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend
Quoted 7 lines
Quoted 1 line
Thank you. Will give it a spin tomorrow.
Hi Konrad,
Thanks for review.
I think no need to test it anymore. We are trying to fix an
issue caused by IOAPIC related work. The previous version of patch is too coarse grain and may affect Xen. And now we have reworked it, so it shouldn't affect Xen anymore.
OK. Thanks for the heads up!
Quoted 34 lines
Regards!
GerryQuoted 31 lines
Quoted 31 lines
Thanks for help!
GerryQuoted 27 lines
Quoted 27 lines
2) Flag
dev->dev.power.is_preparedhas already been cleared whenpcibios_enable_device()gets called, so it will cause IOAPIC pin reference count leak.So I reworked the patch to fix above issues. The first patch fixes issue 1 by moving check of
dev->dev.power.is_preparedpcibios_enable_irq, so it won't affect Xen. The second patch fixes the IOAPIC pin reference count leakage issue. It also solves the issue we have discussed at
http://www.spinics.net/lists/linux-pci/msg32902.htmlRegards!
GerryJiang Liu (2):
x86, irq, PCI: Keep IRQ assignment for PCI devices during
suspend/hibernation
x86, irq: Keep balance of IOAPIC pin reference countarch/x86/pci/intel_mid_pci.c | 9 ++++++++- arch/x86/pci/irq.c | 8 +++++++- drivers/acpi/pci_irq.c | 15 +++++++++++++-- include/linux/pci.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-)Signature · 1 line
1.7.10.4
Borislav Petkov
maintainerRe: [Bugfix 1/2] x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation
In reply to Jiang LiuQuoted 9 lines · Jiang Liu
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend2It's based on tip/master and includes:
1) the patch to fix warning caused by USB controller
2) these two patches to fix failure of suspend/hibernationCould you please help to check whether suspend/hibernation works as expect on your platforms?
Seems to work - just did 10-ish successful s/r cycles. The IO page faults are still there though.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--tip/x86/apic (was: Re: [Bugfix 1/2] x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation)
Quoted 8 lines · Borislav Petkov
Quoted 7 lines · Jiang Liu
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend2It's based on tip/master and includes:
1) the patch to fix warning caused by USB controller
2) these two patches to fix failure of suspend/hibernation
Quoted 5 lines
Quoted 2 lines
Could you please help to check whether suspend/hibernation works as expect on your platforms?
Seems to work - just did 10-ish successful s/r cycles. The IO page faults are still there though.
Ok, tip guys, so Jörg and I talked about the IOPFs a bit and we feel that while they still need to be taken care of, they're harmless and there's no need to hold off tip/x86/apic anymore unless there are other problems with it.
So, from my POV, it can go in so that it doesn't miss this merge window and we'd deal with the IOPFs later.
I'm guessing Jiang needs to give you some updated versions of patches from this thread for the branch to be complete. Jiang, please add my
for those.
Thanks to everyone involved.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--[GIT PULL] x86/apic changes for v3.17
Quoted 23 lines · Borislav Petkov
Quoted 8 lines · Borislav Petkov
Quoted 7 lines · Jiang Liu
I have prepared a tree for you at
https://github.com/jiangliu/linux.git suspend2It's based on tip/master and includes:
1) the patch to fix warning caused by USB controller
2) these two patches to fix failure of suspend/hibernationQuoted 5 lines
Quoted 2 lines
Could you please help to check whether suspend/hibernation works as expect on your platforms?
Seems to work - just did 10-ish successful s/r cycles. The IO page faults are still there though.
Ok, tip guys, so Jörg and I talked about the IOPFs a bit and we feel that while they still need to be taken care of, they're harmless and there's no need to hold off tip/x86/apic anymore unless there are other problems with it.
So, from my POV, it can go in so that it doesn't miss this merge window and we'd deal with the IOPFs later.
Quoted 8 lines
I'm guessing Jiang needs to give you some updated versions of patches from this thread for the branch to be complete. Jiang, please add my
Tested-by Borislav Petkov <[email protected]>for those.
Thanks to everyone involved.
Ok, thanks for the testing!
Linus, please pull the latest x86-apic-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-apic-for-linus
# HEAD: 5e3bf215f4f2efc0af89e6dbc5da789744aeb5d7 x86/apic/vsmp: Make is_vsmp_box() static
The main changes in this cycle are:
* Remove obsolete APIC driver abstractions. (David Rientjes)
* Use the irqdomain facilities to dynamically allocate IRQs for IOAPICs. This is a prerequisite to enable IOAPIC hotplug support, and it also frees up wasted vectors. (Jiang Liu)
* Misc fixlets.
out-of-topic modifications in x86-apic-for-linus:
---------------------------------------------------
drivers/acpi/pci_irq.c # 6a38fa0: x86, irq, ACPI: Release IOAPIC pi include/linux/irqdomain.h # 43a7759: genirq: Export irq_domain_disasso kernel/irq/irqdomain.c # 43a7759: genirq: Export irq_domain_disasso
Thanks,
Ingo
------------------>
David Rientjes (9):
x86, apic: Remove x86_32_numa_cpu_node callback x86, apic: Replace trampoline physical addresses with defaults x86, apic: Remove smp_callin_clear_local_apic callback x86, apic: Remove mps_oem_check callback
x86, apic: Remove check_apicid_present callback x86, apic: Replace noop_check_apicid_used
x86, apic: Remove multi_timer_check callback
x86, apic: Remove setup_portio_remap callback
x86, apic: Remove enable_apic_mode callback
H. Peter Anvin (1):
x86/apic/vsmp: Make is_vsmp_box() static
Jiang Liu (42):
genirq: Export irq_domain_disassociate() to architecture interrupt drivers x86, mpparse: Use pr_lvl() helper utilities to replace printk(KERN_LVL) x86, mpparse: Simplify arch/x86/include/asm/mpspec.h
x86, acpi: Reorganize code to avoid forward declaration in boot.c x86, PCI, ACPI: Use kmalloc_node() to optimize for performance
x86, acpi, irq: Kill static function irq_to_gsi()
x86, ACPI, trivial: Minor improvements to arch/x86/kernel/acpi/boot.c x86, ACPI, irq: Enhance error handling in function acpi_register_gsi() x86, ACPI, irq: Fix possible eror in GSI to IRQ mapping for legacy IRQ x86, irq, trivial: Minor improvements of IRQ related code
x86, ioapic: Kill unused global variable timer_through_8259
x86, ioapic: Kill static variable nr_irqs_gsi
x86, ioapic: Introduce helper utilities to walk ioapics and pins
x86, ioapic: Use irq_cfg() instead of irq_get_chip_data() for better readability x86, irq: Reorganize IO_APIC_get_PCI_irq_vector() to prepare for irqdomain x86, irq: Introduce some helper utilities to improve readability
x86: ce4100, irq: Make CE4100 depend on CONFIG_X86_IO_APIC
x86: ce4100, irq: Do not set legacy_pic to null_legacy_pic
x86, irq: Count legacy IRQs by legacy_pic->nr_legacy_irqs instead of NR_IRQS_LEGACY x86, irq: Simplify arch_early_irq_init()
x86, ACPI, irq: Consolidate algorithm of mapping (ioapic, pin) to IRQ number x86, irq, ACPI: Change __acpi_register_gsi to return IRQ number instead of GSI x86, irq: Introduce mechanisms to support dynamically allocate IRQ for IOAPIC x86, irq: Enhance mp_register_ioapic() to support irqdomain
x86, ACPI, irq: Provide basic irqdomain support
x86, mpparse, irq: Provide basic irqdomain support
x86, SFI, irq: Provide basic irqdomain support
x86, devicetree, irq: Use common mechanism to support irqdomain
x86, irq: Introduce two helper functions to support irqdomain map operation x86, irq, ACPI: Use common irqdomain map interface to program IOAPIC pins x86, irq, mpparse: Use common irqdomain map interface to program IOAPIC pins x86, irq, SFI: Use common irqdomain map interface to program IOAPIC pins x86, irq, devicetree: Use common irqdomain map interface to program IOAPIC pins x86, irq: Clean up unused IOAPIC interface
x86, irq: Simplify the way to handle ISA IRQ
x86, irq: Introduce helper functions to release IOAPIC pin
x86, irq, ACPI: Release IOAPIC pin when PCI device is disabled
x86, irq, mpparse: Release IOAPIC pin when PCI device is disabled x86, irq, SFI: Release IOAPIC pin when PCI device is disabled
x86, irq, devicetree: Release IOAPIC pin when PCI device is disabled x86, irq: Clean up irqdomain transition code
x86: intel-mid: Use the new io_apic interfaces
Oren Twaig (1):
x86, vsmp: Remove is_vsmp_box() from apic_is_clustered_box()
arch/x86/Kconfig | 2 + arch/x86/include/asm/apic.h | 46 +- arch/x86/include/asm/hardirq.h | 3 - arch/x86/include/asm/i8259.h | 5 + arch/x86/include/asm/io_apic.h | 56 +- arch/x86/include/asm/mpspec.h | 15 - arch/x86/include/asm/prom.h | 2 - arch/x86/include/asm/smpboot_hooks.h | 10 +- arch/x86/kernel/acpi/boot.c | 400 ++++++----- arch/x86/kernel/apic/apic.c | 75 +- arch/x86/kernel/apic/apic_flat_64.c | 16 - arch/x86/kernel/apic/apic_noop.c | 23 +- arch/x86/kernel/apic/apic_numachip.c | 8 - arch/x86/kernel/apic/bigsmp_32.c | 14 - arch/x86/kernel/apic/io_apic.c | 759 +++++++++++++-------- arch/x86/kernel/apic/probe_32.c | 33 +- arch/x86/kernel/apic/x2apic_cluster.c | 8 - arch/x86/kernel/apic/x2apic_phys.c | 8 - arch/x86/kernel/apic/x2apic_uv_x.c | 8 - arch/x86/kernel/devicetree.c | 207 ++---- arch/x86/kernel/irqinit.c | 12 +- arch/x86/kernel/mpparse.c | 111 +-- arch/x86/kernel/smpboot.c | 8 - arch/x86/kernel/vsmp_64.c | 4 +- arch/x86/pci/acpi.c | 6 +- arch/x86/pci/intel_mid_pci.c | 27 +- arch/x86/pci/irq.c | 15 +- arch/x86/pci/xen.c | 7 +- arch/x86/platform/ce4100/ce4100.c | 11 +- .../platform/intel-mid/device_libs/platform_wdt.c | 22 +- arch/x86/platform/intel-mid/sfi.c | 56 +- arch/x86/platform/sfi/sfi.c | 10 +- drivers/acpi/pci_irq.c | 3 +- include/linux/irqdomain.h | 2 + kernel/irq/irqdomain.c | 2 +- 35 files changed, 916 insertions(+), 1078 deletions(-)
arch/x86/Kconfig +2 -0
@@ -429,6 +429,7 @@ config X86_INTEL_CE bool "CE4100 TV platform" depends on PCI depends on PCI_GODIRECT + depends on X86_IO_APIC depends on X86_32 depends on X86_EXTENDED_PLATFORM select X86_REBOOTFIXUPS
@@ -835,6 +836,7 @@ config X86_IO_APIC def_bool y depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI select GENERIC_IRQ_LEGACY_ALLOC_HWIRQ + select IRQ_DOMAIN config X86_REROUTE_FOR_BROKEN_BOOT_IRQS bool "Reroute for broken boot IRQs"
arch/x86/include/asm/apic.h +5 -41
103 lines not on this page · raw message
arch/x86/include/asm/hardirq.h +0 -3
@@ -40,9 +40,6 @@ typedef struct {DECLARE_PER_CPU_SHARED_ALIGNED (irq_cpustat_t, irq_stat); -/* We can have at most NR_VECTORS irqs routed to a cpu at a time */ -#define MAX_HARDIRQS_PER_CPU NR_VECTORS -#define __ARCH_IRQ_STAT#define inc_irq_stat (member) this_cpu_inc(irq_stat.member)
arch/x86/include/asm/i8259.h +5 -0
@@ -67,4 +67,9 @@ struct legacy_pic {extern struct legacy_pic *legacy_pic;extern struct legacy_pic null_legacy_pic; +static inline int nr_legacy_irqs (void ) +{ +return legacy_pic->nr_legacy_irqs; +} +#endif /* _ASM_X86_I8259_H */
arch/x86/include/asm/io_apic.h +34 -22
111 lines not on this page · raw message
arch/x86/include/asm/mpspec.h +0 -15
@@ -40,8 +40,6 @@ extern int mp_bus_id_to_type[MAX_MP_BUSSES]; extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);extern unsigned int boot_cpu_physical_apicid; -extern unsigned int max_physical_apicid; -extern int mpc_default_type;extern unsigned long mp_lapic_addr;#ifdef CONFIG_X86_LOCAL_APIC
@@ -88,15 +86,6 @@ static inline void early_reserve_e820_mpc_new(void) { }#endif int generic_processor_info (int apicid,int version); -#ifdef CONFIG_ACPI -extern void mp_register_ioapic (int id,u32 address,u32 gsi_base); -extern void mp_override_legacy_irq (u8 bus_irq,u8 polarity,u8 trigger, -u32 gsi); -extern void mp_config_acpi_legacy_irqs (void ); -struct device ; -extern int mp_register_gsi (struct device *dev,u32 gsi,int edge_level, -int active_high_low); -#endif /* CONFIG_ACPI */ #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_LOCAL_APIC)
@@ -161,8 +150,4 @@ static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map)extern physid_mask_t phys_cpu_present_map; -extern int generic_mps_oem_check (struct mpc_table *,char *,char *); - -extern int default_acpi_madt_oem_check (char *,char *); -#endif /* _ASM_X86_MPSPEC_H */
arch/x86/include/asm/prom.h +0 -2
@@ -26,12 +26,10 @@extern int of_ioapic;extern u64 initial_dtb;extern void add_dtb (u64 data); -extern void x86_add_irq_domains (void );void x86_of_pci_init (void );void x86_dtb_init (void );#else static inline void add_dtb (u64 data) { } -static inline void x86_add_irq_domains (void ) { }static inline void x86_of_pci_init (void ) { }static inline void x86_dtb_init (void ) { }#define of_ioapic 0
arch/x86/include/asm/smpboot_hooks.h +5 -5
@@ -17,11 +17,11 @@ static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)spin_unlock_irqrestore (&rtc_lock, flags);local_flush_tlb ();pr_debug ("1.\n" ); - *((volatile unsigned short *)phys_to_virt (apic->trampoline_phys_high)) = - start_eip >>4 ; + *((volatile unsigned short *)phys_to_virt (TRAMPOLINE_PHYS_HIGH )) = + start_eip >>4 ;pr_debug ("2.\n" ); - *((volatile unsigned short *)phys_to_virt (apic->trampoline_phys_low)) = - start_eip &0xf ; + *((volatile unsigned short *)phys_to_virt (TRAMPOLINE_PHYS_LOW )) = + start_eip &0xf ;pr_debug ("3.\n" ); }
@@ -42,7 +42,7 @@ static inline void smpboot_restore_warm_reset_vector(void)CMOS_WRITE (0 ,0xf );spin_unlock_irqrestore (&rtc_lock, flags); - *((volatile u32 *)phys_to_virt (apic->trampoline_phys_low)) =0 ; + *((volatile u32 *)phys_to_virt (TRAMPOLINE_PHYS_LOW )) =0 ; }static inline void __init smpboot_setup_io_apic (void )
arch/x86/kernel/acpi/boot.c +190 -210
539 lines not on this page · raw message
arch/x86/kernel/apic/apic.c +2 -73
105 lines not on this page · raw message
arch/x86/kernel/apic/apic_flat_64.c +0 -16
@@ -168,21 +168,16 @@ static struct apic apic_flat = { .disable_esr = 0, .dest_logical = APIC_DEST_LOGICAL, .check_apicid_used = NULL, - .check_apicid_present = NULL, .vector_allocation_domain = flat_vector_allocation_domain, .init_apic_ldr = flat_init_apic_ldr, .ioapic_phys_id_map = NULL, .setup_apic_routing = NULL, - .multi_timer_check = NULL, .cpu_present_to_apicid = default_cpu_present_to_apicid, .apicid_to_cpu_present = NULL, - .setup_portio_remap = NULL, .check_phys_apicid_present = default_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = flat_phys_pkg_id, - .mps_oem_check = NULL, .get_apic_id = flat_get_apic_id, .set_apic_id = set_apic_id,
@@ -196,10 +191,7 @@ static struct apic apic_flat = { .send_IPI_all = flat_send_IPI_all, .send_IPI_self = apic_send_IPI_self, - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = false, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = default_inquire_remote_apic, .read = native_apic_mem_read,
@@ -283,7 +275,6 @@ static struct apic apic_physflat = { .disable_esr = 0, .dest_logical = 0, .check_apicid_used = NULL, - .check_apicid_present = NULL, .vector_allocation_domain = default_vector_allocation_domain,/* not needed, but shouldn't hurt: */
@@ -291,14 +282,10 @@ static struct apic apic_physflat = { .ioapic_phys_id_map = NULL, .setup_apic_routing = NULL, - .multi_timer_check = NULL, .cpu_present_to_apicid = default_cpu_present_to_apicid, .apicid_to_cpu_present = NULL, - .setup_portio_remap = NULL, .check_phys_apicid_present = default_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = flat_phys_pkg_id, - .mps_oem_check = NULL, .get_apic_id = flat_get_apic_id, .set_apic_id = set_apic_id,
@@ -312,10 +299,7 @@ static struct apic apic_physflat = { .send_IPI_all = physflat_send_IPI_all, .send_IPI_self = apic_send_IPI_self, - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = false, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = default_inquire_remote_apic, .read = native_apic_mem_read,
arch/x86/kernel/apic/apic_noop.c +1 -22
@@ -89,16 +89,6 @@ static const struct cpumask *noop_target_cpus(void)return cpumask_of (0 ); } -static unsigned long noop_check_apicid_used (physid_mask_t *map,int apicid) -{ -return physid_isset (apicid, *map); -} - -static unsigned long noop_check_apicid_present (int bit) -{ -return physid_isset (bit, phys_cpu_present_map); -} -static void noop_vector_allocation_domain (int cpu,struct cpumask *retmask,const struct cpumask *mask) {
@@ -133,27 +123,21 @@ struct apic apic_noop = { .target_cpus = noop_target_cpus, .disable_esr = 0, .dest_logical = APIC_DEST_LOGICAL, - .check_apicid_used = noop_check_apicid_used, - .check_apicid_present = noop_check_apicid_present, + .check_apicid_used = default_check_apicid_used, .vector_allocation_domain = noop_vector_allocation_domain, .init_apic_ldr = noop_init_apic_ldr, .ioapic_phys_id_map = default_ioapic_phys_id_map, .setup_apic_routing = NULL, - .multi_timer_check = NULL, .cpu_present_to_apicid = default_cpu_present_to_apicid, .apicid_to_cpu_present = physid_set_mask_of_physid, - .setup_portio_remap = NULL, .check_phys_apicid_present = default_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = noop_phys_pkg_id, - .mps_oem_check = NULL, - .get_apic_id = noop_get_apic_id, .set_apic_id = NULL, .apic_id_mask = 0x0F << 24,
@@ -168,12 +152,7 @@ struct apic apic_noop = { .wakeup_secondary_cpu = noop_wakeup_secondary_cpu, -/* should be safe */ - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, - .wait_for_init_deassert = false, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = NULL, .read = noop_apic_read,
arch/x86/kernel/apic/apic_numachip.c +0 -8
@@ -217,21 +217,16 @@ static const struct apic apic_numachip __refconst = { .disable_esr = 0, .dest_logical = 0, .check_apicid_used = NULL, - .check_apicid_present = NULL, .vector_allocation_domain = default_vector_allocation_domain, .init_apic_ldr = flat_init_apic_ldr, .ioapic_phys_id_map = NULL, .setup_apic_routing = NULL, - .multi_timer_check = NULL, .cpu_present_to_apicid = default_cpu_present_to_apicid, .apicid_to_cpu_present = NULL, - .setup_portio_remap = NULL, .check_phys_apicid_present = default_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = numachip_phys_pkg_id, - .mps_oem_check = NULL, .get_apic_id = get_apic_id, .set_apic_id = set_apic_id,
@@ -246,10 +241,7 @@ static const struct apic apic_numachip __refconst = { .send_IPI_self = numachip_send_IPI_self, .wakeup_secondary_cpu = numachip_wakeup_secondary, - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = false, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = NULL, /* REMRD not supported */ .read = native_apic_mem_read,
arch/x86/kernel/apic/bigsmp_32.c +0 -14
@@ -31,11 +31,6 @@ static unsigned long bigsmp_check_apicid_used(physid_mask_t *map, int apicid)return 0 ; } -static unsigned long bigsmp_check_apicid_present (int bit) -{ -return 1 ; -} -static int bigsmp_early_logical_apicid (int cpu) {/* on bigsmp, logical apicid is the same as physical */
@@ -168,21 +163,16 @@ static struct apic apic_bigsmp = { .disable_esr = 1, .dest_logical = 0, .check_apicid_used = bigsmp_check_apicid_used, - .check_apicid_present = bigsmp_check_apicid_present, .vector_allocation_domain = default_vector_allocation_domain, .init_apic_ldr = bigsmp_init_apic_ldr, .ioapic_phys_id_map = bigsmp_ioapic_phys_id_map, .setup_apic_routing = bigsmp_setup_apic_routing, - .multi_timer_check = NULL, .cpu_present_to_apicid = bigsmp_cpu_present_to_apicid, .apicid_to_cpu_present = physid_set_mask_of_physid, - .setup_portio_remap = NULL, .check_phys_apicid_present = bigsmp_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = bigsmp_phys_pkg_id, - .mps_oem_check = NULL, .get_apic_id = bigsmp_get_apic_id, .set_apic_id = NULL,
@@ -196,11 +186,7 @@ static struct apic apic_bigsmp = { .send_IPI_all = bigsmp_send_IPI_all, .send_IPI_self = default_send_IPI_self, - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, - .wait_for_init_deassert = true, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = default_inquire_remote_apic, .read = native_apic_mem_read,
arch/x86/kernel/apic/io_apic.c +463 -296
1,224 lines not on this page · raw message
arch/x86/kernel/apic/probe_32.c +1 -32
@@ -88,21 +88,16 @@ static struct apic apic_default = { .disable_esr = 0, .dest_logical = APIC_DEST_LOGICAL, .check_apicid_used = default_check_apicid_used, - .check_apicid_present = default_check_apicid_present, .vector_allocation_domain = flat_vector_allocation_domain, .init_apic_ldr = default_init_apic_ldr, .ioapic_phys_id_map = default_ioapic_phys_id_map, .setup_apic_routing = setup_apic_flat_routing, - .multi_timer_check = NULL, .cpu_present_to_apicid = default_cpu_present_to_apicid, .apicid_to_cpu_present = physid_set_mask_of_physid, - .setup_portio_remap = NULL, .check_phys_apicid_present = default_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = default_phys_pkg_id, - .mps_oem_check = NULL, .get_apic_id = default_get_apic_id, .set_apic_id = NULL,
@@ -116,11 +111,7 @@ static struct apic apic_default = { .send_IPI_all = default_send_IPI_all, .send_IPI_self = default_send_IPI_self, - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, - .wait_for_init_deassert = true, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = default_inquire_remote_apic, .read = native_apic_mem_read,
@@ -214,29 +205,7 @@ void __init generic_apic_probe(void)printk (KERN_INFO "Using APIC driver %s\n" , apic->name); } -/* These functions can switch the APIC even after the initial ->probe() */ - -int __init -generic_mps_oem_check (struct mpc_table *mpc,char *oem,char *productid) -{ -struct apic **drv; - -for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { -if (!((*drv)->mps_oem_check)) -continue ; -if (!(*drv)->mps_oem_check (mpc, oem, productid)) -continue ; - -if (!cmdline_apic) { - apic = *drv; -printk (KERN_INFO "Switched to APIC driver `%s'.\n" , - apic->name); - } -return 1 ; - } -return 0 ; -} - +/* This function can switch the APIC even after the initial ->probe() */ int __init default_acpi_madt_oem_check (char *oem_id,char *oem_table_id) {struct apic **drv;
arch/x86/kernel/apic/x2apic_cluster.c +0 -8
@@ -249,21 +249,16 @@ static struct apic apic_x2apic_cluster = { .disable_esr = 0, .dest_logical = APIC_DEST_LOGICAL, .check_apicid_used = NULL, - .check_apicid_present = NULL, .vector_allocation_domain = cluster_vector_allocation_domain, .init_apic_ldr = init_x2apic_ldr, .ioapic_phys_id_map = NULL, .setup_apic_routing = NULL, - .multi_timer_check = NULL, .cpu_present_to_apicid = default_cpu_present_to_apicid, .apicid_to_cpu_present = NULL, - .setup_portio_remap = NULL, .check_phys_apicid_present = default_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = x2apic_phys_pkg_id, - .mps_oem_check = NULL, .get_apic_id = x2apic_get_apic_id, .set_apic_id = x2apic_set_apic_id,
@@ -277,10 +272,7 @@ static struct apic apic_x2apic_cluster = { .send_IPI_all = x2apic_send_IPI_all, .send_IPI_self = x2apic_send_IPI_self, - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = false, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = NULL, .read = native_apic_msr_read,
arch/x86/kernel/apic/x2apic_phys.c +0 -8
@@ -103,21 +103,16 @@ static struct apic apic_x2apic_phys = { .disable_esr = 0, .dest_logical = 0, .check_apicid_used = NULL, - .check_apicid_present = NULL, .vector_allocation_domain = default_vector_allocation_domain, .init_apic_ldr = init_x2apic_ldr, .ioapic_phys_id_map = NULL, .setup_apic_routing = NULL, - .multi_timer_check = NULL, .cpu_present_to_apicid = default_cpu_present_to_apicid, .apicid_to_cpu_present = NULL, - .setup_portio_remap = NULL, .check_phys_apicid_present = default_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = x2apic_phys_pkg_id, - .mps_oem_check = NULL, .get_apic_id = x2apic_get_apic_id, .set_apic_id = x2apic_set_apic_id,
@@ -131,10 +126,7 @@ static struct apic apic_x2apic_phys = { .send_IPI_all = x2apic_send_IPI_all, .send_IPI_self = x2apic_send_IPI_self, - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = false, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = NULL, .read = native_apic_msr_read,
arch/x86/kernel/apic/x2apic_uv_x.c +0 -8
@@ -365,21 +365,16 @@ static struct apic __refdata apic_x2apic_uv_x = { .disable_esr = 0, .dest_logical = APIC_DEST_LOGICAL, .check_apicid_used = NULL, - .check_apicid_present = NULL, .vector_allocation_domain = default_vector_allocation_domain, .init_apic_ldr = uv_init_apic_ldr, .ioapic_phys_id_map = NULL, .setup_apic_routing = NULL, - .multi_timer_check = NULL, .cpu_present_to_apicid = default_cpu_present_to_apicid, .apicid_to_cpu_present = NULL, - .setup_portio_remap = NULL, .check_phys_apicid_present = default_check_phys_apicid_present, - .enable_apic_mode = NULL, .phys_pkg_id = uv_phys_pkg_id, - .mps_oem_check = NULL, .get_apic_id = x2apic_get_apic_id, .set_apic_id = set_apic_id,
@@ -394,10 +389,7 @@ static struct apic __refdata apic_x2apic_uv_x = { .send_IPI_self = uv_send_IPI_self, .wakeup_secondary_cpu = uv_wakeup_secondary, - .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, - .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = false, - .smp_callin_clear_local_apic = NULL, .inquire_remote_apic = NULL, .read = native_apic_msr_read,
arch/x86/kernel/devicetree.c +66 -141
258 lines not on this page · raw message
arch/x86/kernel/irqinit.c +3 -9
@@ -78,7 +78,7 @@ void __init init_ISA_irqs(void)#endif legacy_pic->init (0 ); -for (i =0 ; i < legacy_pic->nr_legacy_irqs; i++) +for (i =0 ; i <nr_legacy_irqs (); i++)irq_set_chip_and_handler_name (i, chip, handle_level_irq, name); }
@@ -87,12 +87,6 @@ void __init init_IRQ(void)int i;/* -* We probably need a better place for this, but it works for -* now ... -*/ -x86_add_irq_domains (); - -/* * On cpu 0, Assign IRQ0_VECTOR..IRQ15_VECTOR's to IRQ 0..15. * If these IRQ's are handled by legacy interrupt-controllers like PIC, * then this configuration will likely be static after the boot. If
@@ -100,7 +94,7 @@ void __init init_IRQ(void)* then this vector space can be freed and re-used dynamically as the * irq's migrate etc. */ -for (i =0 ; i < legacy_pic->nr_legacy_irqs; i++) +for (i =0 ; i <nr_legacy_irqs (); i++)per_cpu (vector_irq,0 )[IRQ0_VECTOR + i] = i; x86_init.irqs.intr_init ();
@@ -121,7 +115,7 @@ void setup_vector_irq(int cpu)* legacy PIC, for the new cpu that is coming online, setup the static * legacy vector to irq mapping: */ -for (irq =0 ; irq < legacy_pic->nr_legacy_irqs; irq++) +for (irq =0 ; irq <nr_legacy_irqs (); irq++)per_cpu (vector_irq, cpu)[IRQ0_VECTOR + irq] = irq;#endif
arch/x86/kernel/mpparse.c +56 -55
179 lines not on this page · raw message
arch/x86/platform/intel-mid/device_libs/platform_wdt.c +6 -16
Lines of this file are not shown. View the raw message.
arch/x86/platform/intel-mid/sfi.c +25 -31
56 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Borislav Petkov
maintainerRe: [GIT PULL] x86/apic changes for v3.17
Quoted 3 lines · Ingo Molnar
Linus, please pull the latest x86-apic-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gitx86-apic-for-linus
This tree still needs the suspend/resume fixes on this thread AFAICT. Like keeping IRQ numbers of PCI devices stable across a s/r cycle, for example.
I'm guessing you'll send Linus a follow-up pull request with those later, right?
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Re: [GIT PULL] x86/apic changes for v3.17
Quoted 7 lines · Borislav Petkov
This tree still needs the suspend/resume fixes on this thread AFAICT. Like keeping IRQ numbers of PCI devices stable across a s/r cycle, for example.
I'm guessing you'll send Linus a follow-up pull request with those later, right?
If there are known issues with suspend/resume, I'm not willing to pull this yet. The code for the merge window is supposed to be complete and ready.
Ingo?
Linus
[Bugfix] x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation
In reply to Ingo MolnarNow IOAPIC driver dynamically allocates IRQ numbers for IOAPIC pins. We need to keep IRQ assignment for PCI devices during suspend/hibernation, otherwise it may cause failure of suspend/hibernation due to:
1) Device driver calls pci_enable_device() to allocate an IRQ number and register interrupt handler on the returned IRQ.
2) Device driver's suspend callback calls pci_disable_device() and release assigned IRQ in turn.
3) Device driver's resume callback calls pci_enable_device() to allocate IRQ number again. A different IRQ number may be assigned by IOAPIC driver this time.
4) Now the hardware delivers interrupt to the new IRQ but interrupt handler is still registered against the old IRQ, so it breaks suspend/hibernation.
To fix this issue, we keep IRQ assignment during suspend/hibernation. Flag pci_dev.dev.power.is_prepared is used to detect that pci_disable_device() is called during suspend/hibernation.
---
Hi Ingo,
Could you please help to apply this patch ontogit://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-apic-for-linus?
It fixes the suspend/hibernation failure reported by Borislav.
Thanks!
Gerry
--- arch/x86/pci/intel_mid_pci.c | 2 +- arch/x86/pci/irq.c | 3 ++- drivers/acpi/pci_irq.c | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/pci/intel_mid_pci.c +1 -1
@@ -229,7 +229,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)static void intel_mid_pci_irq_disable (struct pci_dev *dev) { -if (dev->irq >0 ) +if (!dev->dev.power.is_prepared && dev->irq >0 )mp_unmap_irq (dev->irq); }
arch/x86/pci/irq.c +2 -1
@@ -1256,7 +1256,8 @@ static int pirq_enable_irq(struct pci_dev *dev)static void pirq_disable_irq (struct pci_dev *dev) { -if (io_apic_assign_pci_irqs && dev->irq) { +if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared && + dev->irq) {mp_unmap_irq (dev->irq); dev->irq =0 ; }
drivers/acpi/pci_irq.c +4 -0
@@ -481,6 +481,10 @@ void acpi_pci_irq_disable(struct pci_dev *dev)if (!pin)return ; +/* Keep IOAPIC pin configuration when suspending */ +if (dev->dev.power.is_prepared) +return ; + entry =acpi_pci_irq_lookup (dev, pin);if (!entry)return ;
Signature · 1 line
1.7.10.4
Re: [GIT PULL] x86/apic changes for v3.17
In reply to Linus TorvaldsQuoted 6 lines · Linus Torvalds
Quoted 5 lines · Borislav Petkov
This tree still needs the suspend/resume fixes on this thread AFAICT. Like keeping IRQ numbers of PCI devices stable across a s/r cycle, for example.
Quoted 8 lines
Quoted 2 lines
I'm guessing you'll send Linus a follow-up pull request with those later, right?
If there are known issues with suspend/resume, I'm not willing to pull this yet. The code for the merge window is supposed to be complete and ready.
Ingo?
Yeah, I think it might be better to delay this for v3.18 after all and let it cook - I should not have tried to hurry and force it, my bad, sorry about that!
Thanks,
Ingo
tip-bot for Jiang Liu
merge bot[tip:x86/apic] x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation
In reply to Jiang Liux86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation
Commit-ID: 3eec595235c17a74094daa1e02d1b0af2e9a7125 Gitweb: http://git.kernel.org/tip/3eec595235c17a74094daa1e02d1b0af2e9a7125 Author: Jiang Liu <[email protected]> AuthorDate: Fri, 8 Aug 2014 14:07:51 +0800 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 8 Aug 2014 11:14:45 +0200
x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation
Now IOAPIC driver dynamically allocates IRQ numbers for IOAPIC pins. We need to keep IRQ assignment for PCI devices during suspend/hibernation, otherwise it may cause failure of suspend/hibernation due to:
1) Device driver calls pci_enable_device() to allocate an IRQ number and register interrupt handler on the returned IRQ.
2) Device driver's suspend callback calls pci_disable_device() and release assigned IRQ in turn.
3) Device driver's resume callback calls pci_enable_device() to allocate IRQ number again. A different IRQ number may be assigned by IOAPIC driver this time.
4) Now the hardware delivers interrupt to the new IRQ but interrupt handler is still registered against the old IRQ, so it breaks suspend/hibernation.
To fix this issue, we keep IRQ assignment during suspend/hibernation. Flag pci_dev.dev.power.is_prepared is used to detect that pci_disable_device() is called during suspend/hibernation.
--- arch/x86/pci/intel_mid_pci.c | 2 +- arch/x86/pci/irq.c | 3 ++- drivers/acpi/pci_irq.c | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/pci/intel_mid_pci.c +1 -1
@@ -229,7 +229,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)static void intel_mid_pci_irq_disable (struct pci_dev *dev) { -if (dev->irq >0 ) +if (!dev->dev.power.is_prepared && dev->irq >0 )mp_unmap_irq (dev->irq); }
arch/x86/pci/irq.c +2 -1
@@ -1256,7 +1256,8 @@ static int pirq_enable_irq(struct pci_dev *dev)static void pirq_disable_irq (struct pci_dev *dev) { -if (io_apic_assign_pci_irqs && dev->irq) { +if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared && + dev->irq) {mp_unmap_irq (dev->irq); dev->irq =0 ; }
drivers/acpi/pci_irq.c +4 -0
@@ -481,6 +481,10 @@ void acpi_pci_irq_disable(struct pci_dev *dev)if (!pin)return ; +/* Keep IOAPIC pin configuration when suspending */ +if (dev->dev.power.is_prepared) +return ; + entry =acpi_pci_irq_lookup (dev, pin);if (!entry)return ;
Re: [GIT PULL] x86/apic changes for v3.17
In reply to Ingo MolnarQuoted 11 lines · Ingo Molnar
Linus, please pull the latest x86-apic-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-apic-for-linus # HEAD: 5e3bf215f4f2efc0af89e6dbc5da789744aeb5d7 x86/apic/vsmp: Make is_vsmp_box() staticThe main changes in this cycle are:
* Remove obsolete APIC driver abstractions. (David Rientjes)
These changes are unrelated from the other issues and can still be pulled from
git://git.kernel.org/pub/scm/linux/kernel/git/rientjes/linux.git x86/apic
if we want the cleanups for 3.17. The x86 pull request was originally at
http://marc.info/?l=linux-kernel&m=140678961924050.
It would be a shame to miss out on that because the changes share the same tip branch.
Borislav Petkov
maintainerRe: [GIT PULL] x86/apic changes for v3.17
Quoted 17 lines · David Rientjes
Quoted 11 lines · Ingo Molnar
Linus, please pull the latest x86-apic-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-apic-for-linus # HEAD: 5e3bf215f4f2efc0af89e6dbc5da789744aeb5d7 x86/apic/vsmp: Make is_vsmp_box() staticThe main changes in this cycle are:
* Remove obsolete APIC driver abstractions. (David Rientjes)
These changes are unrelated from the other issues and can still be pulled from
Quoted 7 lines
git://git.kernel.org/pub/scm/linux/kernel/git/rientjes/linux.gitx86/apicif we want the cleanups for 3.17. The x86 pull request was originally at
http://marc.info/?l=linux-kernel&m=140678961924050.It would be a shame to miss out on that because the changes share the same tip branch.
Actually, that whole branch could go in now, especially since Thomas picked up the stable IRQ numbers assignment during s/r fix:
https://lkml.kernel.org/r/[email protected]
@tglx: I don't know about IOAPIC reference count:
https://lkml.kernel.org/r/[email protected]
This looks like a bugfix too.
With those two applied, tip/x86/apic is good to go IMHO. The only thing that remains are the IOMMU IOPFs which we'll deal accordingly later - they need shutting up only anyway.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Re: [GIT PULL] x86/apic changes for v3.17
Quoted 29 lines · Borislav Petkov
Quoted 17 lines · David Rientjes
Quoted 11 lines · Ingo Molnar
Linus, please pull the latest x86-apic-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-apic-for-linus # HEAD: 5e3bf215f4f2efc0af89e6dbc5da789744aeb5d7 x86/apic/vsmp: Make is_vsmp_box() staticThe main changes in this cycle are:
* Remove obsolete APIC driver abstractions. (David Rientjes)
These changes are unrelated from the other issues and can still be pulled from
Quoted 7 lines
git://git.kernel.org/pub/scm/linux/kernel/git/rientjes/linux.gitx86/apicif we want the cleanups for 3.17. The x86 pull request was originally at
http://marc.info/?l=linux-kernel&m=140678961924050.It would be a shame to miss out on that because the changes share the same tip branch.
Actually, that whole branch could go in now, especially since Thomas picked up the stable IRQ numbers assignment during s/r fix:
Quoted 7 lines
https://lkml.kernel.org/r/[email protected]
@tglx: I don't know about IOAPIC reference count:
https://lkml.kernel.org/r/[email protected]
This looks like a bugfix too.
Hi Borislav,
The reference count fix only affects IOAPIC hotplug, so it
may be grouped into coming IOAPIC hotplug patch set. Thanks!
Gerry
Quoted 5 lines
With those two applied, tip/x86/apic is good to go IMHO. The only thing that remains are the IOMMU IOPFs which we'll deal accordingly later - they need shutting up only anyway.