All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere
@ 2017-10-17  7:54 Thomas Gleixner
  2017-10-17  7:54   ` Thomas Gleixner
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17  7:54 UTC (permalink / raw)
  To: LKML
  Cc: Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed, Mihai Costache, Jork Loeser

Dexuan reported that the recent rework of the vector allocation mode in x86
broke HyperV PCI passtrough because the rework missed to add the
MSI_FLAG_MUST_REACTIVATE flag to the HyperV/PCI interrupt domain info.

The simple solution would be to set the flag in the HyperV/PCI driver but
it's better to make this generic and let the PCI/MSI core code set the flag
when reservation mode is enabled. That ensures that future users of this
wont trip over the same problem.

Thanks,

	tglx

---
 arch/x86/Kconfig           |    2 +-
 arch/x86/kernel/apic/msi.c |    5 ++---
 drivers/pci/msi.c          |    2 ++
 kernel/irq/Kconfig         |    3 +++
 4 files changed, 8 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 1/3] genirq: Add config option for reservation mode
  2017-10-17  7:54 [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere Thomas Gleixner
@ 2017-10-17  7:54   ` Thomas Gleixner
  2017-10-17  7:54   ` Thomas Gleixner
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17  7:54 UTC (permalink / raw)
  To: LKML
  Cc: Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed, Mihai Costache, Jork Loeser

[-- Attachment #1: genirq--Add-config-option-for-reservation-mode.patch --]
[-- Type: text/plain, Size: 583 bytes --]

The interrupt reservation mode requires reactivation of PCI/MSI
interrupts. Create a config option, so the PCI code can set the
corresponding flag when required.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/irq/Kconfig |    3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -100,6 +100,9 @@ config IRQ_TIMINGS
 config GENERIC_IRQ_MATRIX_ALLOCATOR
 	bool
 
+config GENERIC_IRQ_RESERVATION_MODE
+	bool
+
 config IRQ_DOMAIN_DEBUG
 	bool "Expose hardware/virtual IRQ mapping via debugfs"
 	depends on IRQ_DOMAIN && DEBUG_FS

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 1/3] genirq: Add config option for reservation mode
@ 2017-10-17  7:54   ` Thomas Gleixner
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17  7:54 UTC (permalink / raw)
  To: LKML
  Cc: Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed, Mihai Costache, Jork Loeser

The interrupt reservation mode requires reactivation of PCI/MSI
interrupts. Create a config option, so the PCI code can set the
corresponding flag when required.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/irq/Kconfig |    3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -100,6 +100,9 @@ config IRQ_TIMINGS
 config GENERIC_IRQ_MATRIX_ALLOCATOR
 	bool
 
+config GENERIC_IRQ_RESERVATION_MODE
+	bool
+
 config IRQ_DOMAIN_DEBUG
 	bool "Expose hardware/virtual IRQ mapping via debugfs"
 	depends on IRQ_DOMAIN && DEBUG_FS

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 2/3] PCI/MSI: Set MSI_FLAG_MUST_REACTIVATE in core code
  2017-10-17  7:54 [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere Thomas Gleixner
@ 2017-10-17  7:54   ` Thomas Gleixner
  2017-10-17  7:54   ` Thomas Gleixner
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17  7:54 UTC (permalink / raw)
  To: LKML
  Cc: Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed, Mihai Costache, Jork Loeser

[-- Attachment #1: PCI-MSI--Set-MSI_FLAG_MUST_REACTIVATE-in-core-code.patch --]
[-- Type: text/plain, Size: 727 bytes --]

If interrupt reservation mode is enabled then the PCI/MSI interrupts must
be reactivated after early activation.

Make sure that all callers of pci_msi_create_irq_domain() have the
MSI_FLAG_MUST_REACTIVATE set when reservation mode is enabled.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/pci/msi.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1441,6 +1441,8 @@ struct irq_domain *pci_msi_create_irq_do
 		pci_msi_domain_update_chip_ops(info);
 
 	info->flags |= MSI_FLAG_ACTIVATE_EARLY;
+	if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION))
+		info->flags |= MSI_FLAG_MUST_REACTIVATE;
 
 	domain = msi_create_irq_domain(fwnode, info, parent);
 	if (!domain)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 2/3] PCI/MSI: Set MSI_FLAG_MUST_REACTIVATE in core code
@ 2017-10-17  7:54   ` Thomas Gleixner
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17  7:54 UTC (permalink / raw)
  To: LKML
  Cc: Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed, Mihai Costache, Jork Loeser

If interrupt reservation mode is enabled then the PCI/MSI interrupts must
be reactivated after early activation.

Make sure that all callers of pci_msi_create_irq_domain() have the
MSI_FLAG_MUST_REACTIVATE set when reservation mode is enabled.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/pci/msi.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1441,6 +1441,8 @@ struct irq_domain *pci_msi_create_irq_do
 		pci_msi_domain_update_chip_ops(info);
 
 	info->flags |= MSI_FLAG_ACTIVATE_EARLY;
+	if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION))
+		info->flags |= MSI_FLAG_MUST_REACTIVATE;
 
 	domain = msi_create_irq_domain(fwnode, info, parent);
 	if (!domain)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 3/3] x86/vector/msi: Select CONFIG_GENERIC_IRQ_RESERVATION_MODE
  2017-10-17  7:54 [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere Thomas Gleixner
@ 2017-10-17  7:54   ` Thomas Gleixner
  2017-10-17  7:54   ` Thomas Gleixner
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17  7:54 UTC (permalink / raw)
  To: LKML
  Cc: Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed, Mihai Costache, Jork Loeser

[-- Attachment #1: x86-apic--Select-CONFIG_GENERIC_IRQ_RESERVATION.patch --]
[-- Type: text/plain, Size: 1743 bytes --]

Select CONFIG_GENERIC_IRQ_RESERVATION_MODE so PCI/MSI domains get the
MSI_FLAG_MUST_REACTIVATE flag set in pci_msi_create_irq_domain().

Remove the explicit setters of this flag in the apic/msi code as they are
not longer required.

Fixes: 4900be83602b ("x86/vector/msi: Switch to global reservation mode")
Reported-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/Kconfig           |    2 +-
 arch/x86/kernel/apic/msi.c |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -95,7 +95,7 @@ config X86
 	select GENERIC_IRQ_MATRIX_ALLOCATOR	if X86_LOCAL_APIC
 	select GENERIC_IRQ_MIGRATION		if SMP
 	select GENERIC_IRQ_PROBE
-	select GENERIC_IRQ_SHOW
+	select GENERIC_IRQ_RESERVATION_MODE
 	select GENERIC_PENDING_IRQ		if SMP
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_STRNCPY_FROM_USER
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -129,7 +129,7 @@ static struct msi_domain_ops pci_msi_dom
 
 static struct msi_domain_info pci_msi_domain_info = {
 	.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-			  MSI_FLAG_PCI_MSIX | MSI_FLAG_MUST_REACTIVATE,
+			  MSI_FLAG_PCI_MSIX,
 	.ops		= &pci_msi_domain_ops,
 	.chip		= &pci_msi_controller,
 	.handler	= handle_edge_irq,
@@ -167,8 +167,7 @@ static struct irq_chip pci_msi_ir_contro
 
 static struct msi_domain_info pci_msi_ir_domain_info = {
 	.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-			  MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX |
-			  MSI_FLAG_MUST_REACTIVATE,
+			  MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX,
 	.ops		= &pci_msi_domain_ops,
 	.chip		= &pci_msi_ir_controller,
 	.handler	= handle_edge_irq,

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 3/3] x86/vector/msi: Select CONFIG_GENERIC_IRQ_RESERVATION_MODE
@ 2017-10-17  7:54   ` Thomas Gleixner
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17  7:54 UTC (permalink / raw)
  To: LKML
  Cc: Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed, Mihai Costache, Jork Loeser

Select CONFIG_GENERIC_IRQ_RESERVATION_MODE so PCI/MSI domains get the
MSI_FLAG_MUST_REACTIVATE flag set in pci_msi_create_irq_domain().

Remove the explicit setters of this flag in the apic/msi code as they are
not longer required.

Fixes: 4900be83602b ("x86/vector/msi: Switch to global reservation mode")
Reported-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/Kconfig           |    2 +-
 arch/x86/kernel/apic/msi.c |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -95,7 +95,7 @@ config X86
 	select GENERIC_IRQ_MATRIX_ALLOCATOR	if X86_LOCAL_APIC
 	select GENERIC_IRQ_MIGRATION		if SMP
 	select GENERIC_IRQ_PROBE
-	select GENERIC_IRQ_SHOW
+	select GENERIC_IRQ_RESERVATION_MODE
 	select GENERIC_PENDING_IRQ		if SMP
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_STRNCPY_FROM_USER
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -129,7 +129,7 @@ static struct msi_domain_ops pci_msi_dom
 
 static struct msi_domain_info pci_msi_domain_info = {
 	.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-			  MSI_FLAG_PCI_MSIX | MSI_FLAG_MUST_REACTIVATE,
+			  MSI_FLAG_PCI_MSIX,
 	.ops		= &pci_msi_domain_ops,
 	.chip		= &pci_msi_controller,
 	.handler	= handle_edge_irq,
@@ -167,8 +167,7 @@ static struct irq_chip pci_msi_ir_contro
 
 static struct msi_domain_info pci_msi_ir_domain_info = {
 	.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-			  MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX |
-			  MSI_FLAG_MUST_REACTIVATE,
+			  MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX,
 	.ops		= &pci_msi_domain_ops,
 	.chip		= &pci_msi_ir_controller,
 	.handler	= handle_edge_irq,

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [patch 2/3] PCI/MSI: Set MSI_FLAG_MUST_REACTIVATE in core code
  2017-10-17  7:54   ` Thomas Gleixner
  (?)
@ 2017-10-17 12:28   ` Thomas Gleixner
  -1 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17 12:28 UTC (permalink / raw)
  To: LKML
  Cc: Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed, Mihai Costache, Jork Loeser

On Tue, 17 Oct 2017, Thomas Gleixner wrote:

> If interrupt reservation mode is enabled then the PCI/MSI interrupts must
> be reactivated after early activation.
> 
> Make sure that all callers of pci_msi_create_irq_domain() have the
> MSI_FLAG_MUST_REACTIVATE set when reservation mode is enabled.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  drivers/pci/msi.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -1441,6 +1441,8 @@ struct irq_domain *pci_msi_create_irq_do
>  		pci_msi_domain_update_chip_ops(info);
>  
>  	info->flags |= MSI_FLAG_ACTIVATE_EARLY;
> +	if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION))

Bah. quilt refresh seems overrated. Correct patch below.

Thanks,

	tglx

8<----------------

--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1441,6 +1441,8 @@ struct irq_domain *pci_msi_create_irq_do
 		pci_msi_domain_update_chip_ops(info);
 
 	info->flags |= MSI_FLAG_ACTIVATE_EARLY;
+	if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION_MODE))
+		info->flags |= MSI_FLAG_MUST_REACTIVATE;
 
 	domain = msi_create_irq_domain(fwnode, info, parent);
 	if (!domain)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [patch 3/3] x86/vector/msi: Select CONFIG_GENERIC_IRQ_RESERVATION_MODE
  2017-10-17  7:54   ` Thomas Gleixner
@ 2017-10-17 18:59     ` Dexuan Cui
  -1 siblings, 0 replies; 16+ messages in thread
From: Dexuan Cui @ 2017-10-17 18:59 UTC (permalink / raw)
  To: Thomas Gleixner, LKML
  Cc: x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed,
	Mihai Costache (Cloudbase Solutions SRL),
	Jork Loeser

> From: Thomas Gleixner [mailto:tglx@linutronix.de]
> Sent: Tuesday, October 17, 2017 12:55 AM
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -95,7 +95,7 @@ config X86
>  	select GENERIC_IRQ_MATRIX_ALLOCATOR	if X86_LOCAL_APIC
>  	select GENERIC_IRQ_MIGRATION		if SMP
>  	select GENERIC_IRQ_PROBE
> -	select GENERIC_IRQ_SHOW
> +	select GENERIC_IRQ_RESERVATION_MODE
>  	select GENERIC_PENDING_IRQ		if SMP
>  	select GENERIC_SMP_IDLE_THREAD
>  	select GENERIC_STRNCPY_FROM_USER

Hi Thomas,
It looks you removed GENERIC_IRQ_SHOW by accident?

I got this build error:
...
  LD      vmlinux.o
  MODPOST vmlinux.o
fs/proc/interrupts.o:(.rodata+0x118): undefined reference to `show_interrupts'
Makefile:1000: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Adding GENERIC_IRQ_SHOW back can fix the build failure, and with the
pachset Hyper-V PCI pass-through can work fine.

Thanks,
-- Dexuan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [patch 3/3] x86/vector/msi: Select CONFIG_GENERIC_IRQ_RESERVATION_MODE
@ 2017-10-17 18:59     ` Dexuan Cui
  0 siblings, 0 replies; 16+ messages in thread
From: Dexuan Cui @ 2017-10-17 18:59 UTC (permalink / raw)
  To: Thomas Gleixner, LKML
  Cc: x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed,
	Mihai Costache (Cloudbase Solutions SRL),
	Jork Loeser

> From: Thomas Gleixner [mailto:tglx@linutronix.de]
> Sent: Tuesday, October 17, 2017 12:55 AM
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -95,7 +95,7 @@ config X86
>  	select GENERIC_IRQ_MATRIX_ALLOCATOR	if X86_LOCAL_APIC
>  	select GENERIC_IRQ_MIGRATION		if SMP
>  	select GENERIC_IRQ_PROBE
> -	select GENERIC_IRQ_SHOW
> +	select GENERIC_IRQ_RESERVATION_MODE
>  	select GENERIC_PENDING_IRQ		if SMP
>  	select GENERIC_SMP_IDLE_THREAD
>  	select GENERIC_STRNCPY_FROM_USER

Hi Thomas,
It looks you removed GENERIC_IRQ_SHOW by accident?

I got this build error:
...
  LD      vmlinux.o
  MODPOST vmlinux.o
fs/proc/interrupts.o:(.rodata+0x118): undefined reference to `show_interrup=
ts'
Makefile:1000: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Adding GENERIC_IRQ_SHOW back can fix the build failure, and with the
pachset Hyper-V PCI pass-through can work fine.

Thanks,
-- Dexuan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [patch 3/3] x86/vector/msi: Select CONFIG_GENERIC_IRQ_RESERVATION_MODE
  2017-10-17 18:59     ` Dexuan Cui
  (?)
@ 2017-10-17 21:49     ` Thomas Gleixner
  -1 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-17 21:49 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: LKML, x86, Bjorn Helgaas, Marc Zyngier, KY Srinivasan,
	Stephen Hemminger, linux-pci, devel, Josh Poulson, Haiyang Zhang,
	Simon Xiao, Saeed Mahameed,
	Mihai Costache (Cloudbase Solutions SRL),
	Jork Loeser

On Tue, 17 Oct 2017, Dexuan Cui wrote:

> > From: Thomas Gleixner [mailto:tglx@linutronix.de]
> > Sent: Tuesday, October 17, 2017 12:55 AM
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -95,7 +95,7 @@ config X86
> >  	select GENERIC_IRQ_MATRIX_ALLOCATOR	if X86_LOCAL_APIC
> >  	select GENERIC_IRQ_MIGRATION		if SMP
> >  	select GENERIC_IRQ_PROBE
> > -	select GENERIC_IRQ_SHOW
> > +	select GENERIC_IRQ_RESERVATION_MODE
> >  	select GENERIC_PENDING_IRQ		if SMP
> >  	select GENERIC_SMP_IDLE_THREAD
> >  	select GENERIC_STRNCPY_FROM_USER
> 
> Hi Thomas,
> It looks you removed GENERIC_IRQ_SHOW by accident?

Indeed. My patch foo today is more than bad....

> I got this build error:
> ...
>   LD      vmlinux.o
>   MODPOST vmlinux.o
> fs/proc/interrupts.o:(.rodata+0x118): undefined reference to `show_interrupts'
> Makefile:1000: recipe for target 'vmlinux' failed
> make: *** [vmlinux] Error 1
> 
> Adding GENERIC_IRQ_SHOW back can fix the build failure, and with the
> pachset Hyper-V PCI pass-through can work fine.

Thanks for testing.

       tglx

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [tip:x86/apic] genirq: Add config option for reservation mode
  2017-10-17  7:54   ` Thomas Gleixner
  (?)
@ 2017-10-18 13:42   ` tip-bot for Thomas Gleixner
  -1 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Thomas Gleixner @ 2017-10-18 13:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: saeedm, hpa, mingo, decui, v-micos, tglx, linux-kernel, kys,
	jopoulso, sixiao, bhelgaas, sthemmin, marc.zyngier, Jork.Loeser,
	haiyangz

Commit-ID:  2b5175c4fa974b6aa05bbd2ee8d443a8036a1714
Gitweb:     https://git.kernel.org/tip/2b5175c4fa974b6aa05bbd2ee8d443a8036a1714
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 17 Oct 2017 09:54:57 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 18 Oct 2017 15:38:30 +0200

genirq: Add config option for reservation mode

The interrupt reservation mode requires reactivation of PCI/MSI
interrupts. Create a config option, so the PCI code can set the
corresponding flag when required.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poulson <jopoulso@microsoft.com>
Cc: Mihai Costache <v-micos@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-pci@vger.kernel.org
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Simon Xiao <sixiao@microsoft.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Jork Loeser <Jork.Loeser@microsoft.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: devel@linuxdriverproject.org
Cc: KY Srinivasan <kys@microsoft.com>
Link: https://lkml.kernel.org/r/20171017075600.369375409@linutronix.de

---
 kernel/irq/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
index ac1a3e2..89e3558 100644
--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -100,6 +100,9 @@ config IRQ_TIMINGS
 config GENERIC_IRQ_MATRIX_ALLOCATOR
 	bool
 
+config GENERIC_IRQ_RESERVATION_MODE
+	bool
+
 config IRQ_DOMAIN_DEBUG
 	bool "Expose hardware/virtual IRQ mapping via debugfs"
 	depends on IRQ_DOMAIN && DEBUG_FS

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:x86/apic] PCI/MSI: Set MSI_FLAG_MUST_REACTIVATE in core code
  2017-10-17  7:54   ` Thomas Gleixner
  (?)
  (?)
@ 2017-10-18 13:43   ` tip-bot for Thomas Gleixner
  -1 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Thomas Gleixner @ 2017-10-18 13:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: haiyangz, jopoulso, sixiao, sthemmin, marc.zyngier, decui, kys,
	linux-kernel, Jork.Loeser, tglx, saeedm, mingo, bhelgaas, hpa,
	v-micos

Commit-ID:  25e960efc63852b84d1c3739aef586285b177395
Gitweb:     https://git.kernel.org/tip/25e960efc63852b84d1c3739aef586285b177395
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 17 Oct 2017 09:54:58 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 18 Oct 2017 15:38:31 +0200

PCI/MSI: Set MSI_FLAG_MUST_REACTIVATE in core code

If interrupt reservation mode is enabled then the PCI/MSI interrupts must
be reactivated after early activation.

Make sure that all callers of pci_msi_create_irq_domain() have the
MSI_FLAG_MUST_REACTIVATE set when reservation mode is enabled.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poulson <jopoulso@microsoft.com>
Cc: Mihai Costache <v-micos@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-pci@vger.kernel.org
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Simon Xiao <sixiao@microsoft.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Jork Loeser <Jork.Loeser@microsoft.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: devel@linuxdriverproject.org
Cc: KY Srinivasan <kys@microsoft.com>
Link: https://lkml.kernel.org/r/20171017075600.448649905@linutronix.de

---
 drivers/pci/msi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 496ed91..e066071 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1441,6 +1441,8 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
 		pci_msi_domain_update_chip_ops(info);
 
 	info->flags |= MSI_FLAG_ACTIVATE_EARLY;
+	if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION_MODE))
+		info->flags |= MSI_FLAG_MUST_REACTIVATE;
 
 	domain = msi_create_irq_domain(fwnode, info, parent);
 	if (!domain)

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:x86/apic] x86/vector/msi: Select CONFIG_GENERIC_IRQ_RESERVATION_MODE
  2017-10-17  7:54   ` Thomas Gleixner
  (?)
  (?)
@ 2017-10-18 13:43   ` tip-bot for Thomas Gleixner
  -1 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Thomas Gleixner @ 2017-10-18 13:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: sixiao, Jork.Loeser, marc.zyngier, tglx, mingo, hpa, sthemmin,
	saeedm, haiyangz, bhelgaas, v-micos, jopoulso, kys, linux-kernel,
	decui

Commit-ID:  c201c91799d687c0a6d8c3272950f51aad5ffebe
Gitweb:     https://git.kernel.org/tip/c201c91799d687c0a6d8c3272950f51aad5ffebe
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 17 Oct 2017 09:54:59 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 18 Oct 2017 15:38:31 +0200

x86/vector/msi: Select CONFIG_GENERIC_IRQ_RESERVATION_MODE

Select CONFIG_GENERIC_IRQ_RESERVATION_MODE so PCI/MSI domains get the
MSI_FLAG_MUST_REACTIVATE flag set in pci_msi_create_irq_domain().

Remove the explicit setters of this flag in the apic/msi code as they are
not longer required.

Fixes: 4900be83602b ("x86/vector/msi: Switch to global reservation mode")
Reported-and-tested-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poulson <jopoulso@microsoft.com>
Cc: Mihai Costache <v-micos@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-pci@vger.kernel.org
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Simon Xiao <sixiao@microsoft.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Jork Loeser <Jork.Loeser@microsoft.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: devel@linuxdriverproject.org
Cc: KY Srinivasan <kys@microsoft.com>
Link: https://lkml.kernel.org/r/20171017075600.527569354@linutronix.de

---
 arch/x86/Kconfig           | 1 +
 arch/x86/kernel/apic/msi.c | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 64e99d3..ea4beda 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -95,6 +95,7 @@ config X86
 	select GENERIC_IRQ_MATRIX_ALLOCATOR	if X86_LOCAL_APIC
 	select GENERIC_IRQ_MIGRATION		if SMP
 	select GENERIC_IRQ_PROBE
+	select GENERIC_IRQ_RESERVATION_MODE
 	select GENERIC_IRQ_SHOW
 	select GENERIC_PENDING_IRQ		if SMP
 	select GENERIC_SMP_IDLE_THREAD
diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c
index 5b6dd1a..9b18be7 100644
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -129,7 +129,7 @@ static struct msi_domain_ops pci_msi_domain_ops = {
 
 static struct msi_domain_info pci_msi_domain_info = {
 	.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-			  MSI_FLAG_PCI_MSIX | MSI_FLAG_MUST_REACTIVATE,
+			  MSI_FLAG_PCI_MSIX,
 	.ops		= &pci_msi_domain_ops,
 	.chip		= &pci_msi_controller,
 	.handler	= handle_edge_irq,
@@ -167,8 +167,7 @@ static struct irq_chip pci_msi_ir_controller = {
 
 static struct msi_domain_info pci_msi_ir_domain_info = {
 	.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-			  MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX |
-			  MSI_FLAG_MUST_REACTIVATE,
+			  MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX,
 	.ops		= &pci_msi_domain_ops,
 	.chip		= &pci_msi_ir_controller,
 	.handler	= handle_edge_irq,

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere
  2017-10-17  7:54 [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere Thomas Gleixner
                   ` (2 preceding siblings ...)
  2017-10-17  7:54   ` Thomas Gleixner
@ 2017-10-20 23:01 ` Bjorn Helgaas
  2017-10-21  7:19   ` Thomas Gleixner
  3 siblings, 1 reply; 16+ messages in thread
From: Bjorn Helgaas @ 2017-10-20 23:01 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier,
	KY Srinivasan, Stephen Hemminger, linux-pci, devel, Josh Poulson,
	Haiyang Zhang, Simon Xiao, Saeed Mahameed, Mihai Costache,
	Jork Loeser

On Tue, Oct 17, 2017 at 09:54:56AM +0200, Thomas Gleixner wrote:
> Dexuan reported that the recent rework of the vector allocation mode in x86
> broke HyperV PCI passtrough because the rework missed to add the
> MSI_FLAG_MUST_REACTIVATE flag to the HyperV/PCI interrupt domain info.
> 
> The simple solution would be to set the flag in the HyperV/PCI driver but
> it's better to make this generic and let the PCI/MSI core code set the flag
> when reservation mode is enabled. That ensures that future users of this
> wont trip over the same problem.
> 
> Thanks,
> 
> 	tglx
> 
> ---
>  arch/x86/Kconfig           |    2 +-
>  arch/x86/kernel/apic/msi.c |    5 ++---
>  drivers/pci/msi.c          |    2 ++
>  kernel/irq/Kconfig         |    3 +++
>  4 files changed, 8 insertions(+), 4 deletions(-)

This mentions 4900be83602b ("x86/vector/msi: Switch to global reservation
mode"), which I don't have, so I assume it's an x86 thing.  So I guess
you'll probably merge this via the same tree?

Here's my ack for the PCI part:

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere
  2017-10-20 23:01 ` [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere Bjorn Helgaas
@ 2017-10-21  7:19   ` Thomas Gleixner
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2017-10-21  7:19 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: LKML, Dexuan Cui, x86, Bjorn Helgaas, Marc Zyngier,
	KY Srinivasan, Stephen Hemminger, linux-pci, devel, Josh Poulson,
	Haiyang Zhang, Simon Xiao, Saeed Mahameed, Mihai Costache,
	Jork Loeser

On Fri, 20 Oct 2017, Bjorn Helgaas wrote:
> On Tue, Oct 17, 2017 at 09:54:56AM +0200, Thomas Gleixner wrote:
> > Dexuan reported that the recent rework of the vector allocation mode in x86
> > broke HyperV PCI passtrough because the rework missed to add the
> > MSI_FLAG_MUST_REACTIVATE flag to the HyperV/PCI interrupt domain info.
> > 
> > The simple solution would be to set the flag in the HyperV/PCI driver but
> > it's better to make this generic and let the PCI/MSI core code set the flag
> > when reservation mode is enabled. That ensures that future users of this
> > wont trip over the same problem.
> > 
> > Thanks,
> > 
> > 	tglx
> > 
> > ---
> >  arch/x86/Kconfig           |    2 +-
> >  arch/x86/kernel/apic/msi.c |    5 ++---
> >  drivers/pci/msi.c          |    2 ++
> >  kernel/irq/Kconfig         |    3 +++
> >  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> This mentions 4900be83602b ("x86/vector/msi: Switch to global reservation
> mode"), which I don't have, so I assume it's an x86 thing.  So I guess
> you'll probably merge this via the same tree?

Yes, it's in tip/x86/apic branch and the fixups are applied there now as well.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-10-21  7:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-17  7:54 [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere Thomas Gleixner
2017-10-17  7:54 ` [patch 1/3] genirq: Add config option for reservation mode Thomas Gleixner
2017-10-17  7:54   ` Thomas Gleixner
2017-10-18 13:42   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2017-10-17  7:54 ` [patch 2/3] PCI/MSI: Set MSI_FLAG_MUST_REACTIVATE in core code Thomas Gleixner
2017-10-17  7:54   ` Thomas Gleixner
2017-10-17 12:28   ` Thomas Gleixner
2017-10-18 13:43   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2017-10-17  7:54 ` [patch 3/3] x86/vector/msi: Select CONFIG_GENERIC_IRQ_RESERVATION_MODE Thomas Gleixner
2017-10-17  7:54   ` Thomas Gleixner
2017-10-17 18:59   ` Dexuan Cui
2017-10-17 18:59     ` Dexuan Cui
2017-10-17 21:49     ` Thomas Gleixner
2017-10-18 13:43   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2017-10-20 23:01 ` [patch 0/3] x86/PCI/MSI: Make sure that irq reservation mode works everywhere Bjorn Helgaas
2017-10-21  7:19   ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.