linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/3] genirq/msi: Silence set affinity failed warning
@ 2024-07-15 12:19 Marek Vasut
  2024-07-15 12:19 ` [PATCH v3 2/3] PCI/rcar-host: " Marek Vasut
  2024-07-15 12:19 ` [PATCH v3 3/3] PCI: tegra: " Marek Vasut
  0 siblings, 2 replies; 5+ messages in thread
From: Marek Vasut @ 2024-07-15 12:19 UTC (permalink / raw)
  To: linux-pci
  Cc: Marek Vasut, Krzysztof Wilczyński, Anna-Maria Behnsen,
	Anup Patel, Bjorn Helgaas, Jisheng Zhang, Jon Hunter,
	Koichiro Den, Lorenzo Pieralisi, Marc Zyngier, Nipun Gupta,
	Rob Herring, Shivamurthy Shastri, Thierry Reding, Thomas Gleixner,
	Yoshihiro Shimoda, linux-renesas-soc, linux-tegra

Various PCIe controllers that mux MSIs onto single IRQ line produce these
"IRQ%d: set affinity failed" warnings when entering suspend. This has been
discussed before [1] [2] and an example test case is included at the end
of this commit message.

Controller drivers which create MSI IRQ domain with MSI_FLAG_USE_DEF_CHIP_OPS
flag set and which do not override the .irq_set_affinity irqchip callback get
assigned default .irq_set_affinity = msi_domain_set_affinity() callback. That
is not desired on controllers where it is not possible to set affinity of each
MSI IRQ line to a specific CPU core due to hardware limitation.

Introduce dedicated flag MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity
unset in case the controller driver did not assign the callback. This way, the
migrate_one_irq() code in cpuhotplug.c can exit right away, without printing
the aforementioned warning. The .irq_set_affinity implementations which only
return -EINVAL can be removed from multiple controller drivers.

```
$ grep 25 /proc/interrupts
 25:   0 0 0 0 0 0 0 0   PCIe MSI   0   Edge   PCIe PME

$ echo core > /sys/power/pm_test ; echo mem > /sys/power/state
...
Disabling non-boot CPUs ...
IRQ25: set affinity failed(-22). <---------- This is being silenced here
psci: CPU7 killed (polled 4 ms)
...
```

[1] https://lore.kernel.org/all/d4a6eea3c5e33a3a4056885419df95a7@kernel.org/
[2] https://lore.kernel.org/all/5f4947b18bf381615a37aa81c2242477@kernel.org/

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: "Krzysztof Wilczyński" <kw@linux.com>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
Cc: Anup Patel <apatel@ventanamicro.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Cc: Jon Hunter <jonathanh@nvidia.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Koichiro Den <den@valinux.co.jp>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Nipun Gupta <nipun.gupta@amd.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Shivamurthy Shastri <shivamurthy.shastri@linutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
---
V2: - Introduce MSI_FLAG_NO_AFFINITY to inhibit assignment
      of msi_domain_set_affinity()
V3: - Replace MSI_FLAG_USE_DEF_CHIP_OPS_NOAFF with MSI_FLAG_NO_AFFINITY
      and make MSI_FLAG_NO_AFFINITY into separate flag
    - Update commit message
    - Rebase on current linux-next
    - Use genirq/msi: subject prefix which is likely better fit now
    - Split off R-Car part of the patch
---
 include/linux/msi.h | 2 ++
 kernel/irq/msi.c    | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/msi.h b/include/linux/msi.h
index 9449797638255..b10093c4d00ea 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -554,6 +554,8 @@ enum {
 	MSI_FLAG_MSIX_CONTIGUOUS	= (1 << 19),
 	/* PCI/MSI-X vectors can be dynamically allocated/freed post MSI-X enable */
 	MSI_FLAG_PCI_MSIX_ALLOC_DYN	= (1 << 20),
+	/* PCI MSIs cannot be steered separately to CPU cores */
+	MSI_FLAG_NO_AFFINITY		= (1 << 21),
 };
 
 /**
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 5fa0547ece0c4..ca6e2ae6d6fc0 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -832,7 +832,7 @@ static void msi_domain_update_chip_ops(struct msi_domain_info *info)
 	struct irq_chip *chip = info->chip;
 
 	BUG_ON(!chip || !chip->irq_mask || !chip->irq_unmask);
-	if (!chip->irq_set_affinity)
+	if (!chip->irq_set_affinity && !(info->flags & MSI_FLAG_NO_AFFINITY))
 		chip->irq_set_affinity = msi_domain_set_affinity;
 }
 
-- 
2.43.0


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

* [PATCH v3 2/3] PCI/rcar-host: Silence set affinity failed warning
  2024-07-15 12:19 [PATCH v3 1/3] genirq/msi: Silence set affinity failed warning Marek Vasut
@ 2024-07-15 12:19 ` Marek Vasut
  2024-07-22 22:38   ` Bjorn Helgaas
  2024-07-15 12:19 ` [PATCH v3 3/3] PCI: tegra: " Marek Vasut
  1 sibling, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2024-07-15 12:19 UTC (permalink / raw)
  To: linux-pci
  Cc: Marek Vasut, Krzysztof Wilczyński, Anna-Maria Behnsen,
	Anup Patel, Bjorn Helgaas, Jisheng Zhang, Jon Hunter,
	Koichiro Den, Lorenzo Pieralisi, Marc Zyngier, Nipun Gupta,
	Rob Herring, Shivamurthy Shastri, Thierry Reding, Thomas Gleixner,
	Yoshihiro Shimoda, linux-renesas-soc, linux-tegra

Use newly introduced MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity unset
and allows migrate_one_irq() code in cpuhotplug.c to exit right away, without
printing "IRQ...: set affinity failed(-22)" warning.

Remove .irq_set_affinity implementation which only return -EINVAL from this
controller driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: "Krzysztof Wilczyński" <kw@linux.com>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
Cc: Anup Patel <apatel@ventanamicro.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Cc: Jon Hunter <jonathanh@nvidia.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Koichiro Den <den@valinux.co.jp>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Nipun Gupta <nipun.gupta@amd.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Shivamurthy Shastri <shivamurthy.shastri@linutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
---
V3: - New patch
---
 drivers/pci/controller/pcie-rcar-host.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index c01efc6ea64f6..3dd653f3d7841 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -658,11 +658,6 @@ static void rcar_msi_irq_unmask(struct irq_data *d)
 	spin_unlock_irqrestore(&msi->mask_lock, flags);
 }
 
-static int rcar_msi_set_affinity(struct irq_data *d, const struct cpumask *mask, bool force)
-{
-	return -EINVAL;
-}
-
 static void rcar_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 {
 	struct rcar_msi *msi = irq_data_get_irq_chip_data(data);
@@ -678,7 +673,6 @@ static struct irq_chip rcar_msi_bottom_chip = {
 	.irq_ack		= rcar_msi_irq_ack,
 	.irq_mask		= rcar_msi_irq_mask,
 	.irq_unmask		= rcar_msi_irq_unmask,
-	.irq_set_affinity 	= rcar_msi_set_affinity,
 	.irq_compose_msi_msg	= rcar_compose_msi_msg,
 };
 
@@ -725,8 +719,8 @@ static const struct irq_domain_ops rcar_msi_domain_ops = {
 };
 
 static struct msi_domain_info rcar_msi_info = {
-	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-		   MSI_FLAG_MULTI_PCI_MSI),
+	.flags	= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
+		  MSI_FLAG_NO_AFFINITY | MSI_FLAG_MULTI_PCI_MSI,
 	.chip	= &rcar_msi_top_chip,
 };
 
-- 
2.43.0


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

* [PATCH v3 3/3] PCI: tegra: Silence set affinity failed warning
  2024-07-15 12:19 [PATCH v3 1/3] genirq/msi: Silence set affinity failed warning Marek Vasut
  2024-07-15 12:19 ` [PATCH v3 2/3] PCI/rcar-host: " Marek Vasut
@ 2024-07-15 12:19 ` Marek Vasut
  1 sibling, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2024-07-15 12:19 UTC (permalink / raw)
  To: linux-pci
  Cc: Marek Vasut, Krzysztof Wilczyński, Anna-Maria Behnsen,
	Anup Patel, Bjorn Helgaas, Jisheng Zhang, Jon Hunter,
	Koichiro Den, Lorenzo Pieralisi, Marc Zyngier, Nipun Gupta,
	Rob Herring, Shivamurthy Shastri, Thierry Reding, Thomas Gleixner,
	Yoshihiro Shimoda, linux-renesas-soc, linux-tegra

Use newly introduced MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity unset
and allows migrate_one_irq() code in cpuhotplug.c to exit right away, without
printing "IRQ...: set affinity failed(-22)" warning.

Remove .irq_set_affinity implementation which only return -EINVAL from this
controller driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: "Krzysztof Wilczyński" <kw@linux.com>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
Cc: Anup Patel <apatel@ventanamicro.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Cc: Jon Hunter <jonathanh@nvidia.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Koichiro Den <den@valinux.co.jp>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Nipun Gupta <nipun.gupta@amd.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Shivamurthy Shastri <shivamurthy.shastri@linutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
---
V3: - New patch
---
 drivers/pci/controller/pci-tegra.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index 038d974a318ea..d7517c3976e7f 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -1629,11 +1629,6 @@ static void tegra_msi_irq_unmask(struct irq_data *d)
 	spin_unlock_irqrestore(&msi->mask_lock, flags);
 }
 
-static int tegra_msi_set_affinity(struct irq_data *d, const struct cpumask *mask, bool force)
-{
-	return -EINVAL;
-}
-
 static void tegra_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 {
 	struct tegra_msi *msi = irq_data_get_irq_chip_data(data);
@@ -1648,7 +1643,6 @@ static struct irq_chip tegra_msi_bottom_chip = {
 	.irq_ack		= tegra_msi_irq_ack,
 	.irq_mask		= tegra_msi_irq_mask,
 	.irq_unmask		= tegra_msi_irq_unmask,
-	.irq_set_affinity 	= tegra_msi_set_affinity,
 	.irq_compose_msi_msg	= tegra_compose_msi_msg,
 };
 
@@ -1697,8 +1691,8 @@ static const struct irq_domain_ops tegra_msi_domain_ops = {
 };
 
 static struct msi_domain_info tegra_msi_info = {
-	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-		   MSI_FLAG_PCI_MSIX),
+	.flags	= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
+		  MSI_FLAG_NO_AFFINITY | MSI_FLAG_PCI_MSIX,
 	.chip	= &tegra_msi_top_chip,
 };
 
-- 
2.43.0


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

* Re: [PATCH v3 2/3] PCI/rcar-host: Silence set affinity failed warning
  2024-07-15 12:19 ` [PATCH v3 2/3] PCI/rcar-host: " Marek Vasut
@ 2024-07-22 22:38   ` Bjorn Helgaas
  2024-07-23 22:17     ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2024-07-22 22:38 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Krzysztof Wilczyński, Anna-Maria Behnsen,
	Anup Patel, Bjorn Helgaas, Jisheng Zhang, Jon Hunter,
	Koichiro Den, Lorenzo Pieralisi, Marc Zyngier, Nipun Gupta,
	Rob Herring, Shivamurthy Shastri, Thierry Reding, Thomas Gleixner,
	Yoshihiro Shimoda, linux-renesas-soc, linux-tegra

In subject, to match history:

s|PCI/rcar-host|PCI: rcar-host|

On Mon, Jul 15, 2024 at 02:19:27PM +0200, Marek Vasut wrote:
> Use newly introduced MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity unset
> and allows migrate_one_irq() code in cpuhotplug.c to exit right away, without
> printing "IRQ...: set affinity failed(-22)" warning.
> 
> Remove .irq_set_affinity implementation which only return -EINVAL from this
> controller driver.

This would be a nice improvement; thanks for working on it.

As you allude to at [1], there are many more PCI controller drivers
that could benefit from similar changes.  I'd like to do them all at
once if possible.

[1] https://lore.kernel.org/r/d5efcb28-dd5a-4b96-aabd-c73c95dff8e7@mailbox.org

> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: "Krzysztof Wilczyński" <kw@linux.com>
> Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
> Cc: Anup Patel <apatel@ventanamicro.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> Cc: Jon Hunter <jonathanh@nvidia.com>
> Cc: Jonathan Hunter <jonathanh@nvidia.com>
> Cc: Koichiro Den <den@valinux.co.jp>
> Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Nipun Gupta <nipun.gupta@amd.com>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Shivamurthy Shastri <shivamurthy.shastri@linutronix.de>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Cc: linux-pci@vger.kernel.org
> Cc: linux-renesas-soc@vger.kernel.org
> Cc: linux-tegra@vger.kernel.org
> ---
> V3: - New patch
> ---
>  drivers/pci/controller/pcie-rcar-host.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
> index c01efc6ea64f6..3dd653f3d7841 100644
> --- a/drivers/pci/controller/pcie-rcar-host.c
> +++ b/drivers/pci/controller/pcie-rcar-host.c
> @@ -658,11 +658,6 @@ static void rcar_msi_irq_unmask(struct irq_data *d)
>  	spin_unlock_irqrestore(&msi->mask_lock, flags);
>  }
>  
> -static int rcar_msi_set_affinity(struct irq_data *d, const struct cpumask *mask, bool force)
> -{
> -	return -EINVAL;
> -}
> -
>  static void rcar_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
>  {
>  	struct rcar_msi *msi = irq_data_get_irq_chip_data(data);
> @@ -678,7 +673,6 @@ static struct irq_chip rcar_msi_bottom_chip = {
>  	.irq_ack		= rcar_msi_irq_ack,
>  	.irq_mask		= rcar_msi_irq_mask,
>  	.irq_unmask		= rcar_msi_irq_unmask,
> -	.irq_set_affinity 	= rcar_msi_set_affinity,
>  	.irq_compose_msi_msg	= rcar_compose_msi_msg,
>  };
>  
> @@ -725,8 +719,8 @@ static const struct irq_domain_ops rcar_msi_domain_ops = {
>  };
>  
>  static struct msi_domain_info rcar_msi_info = {
> -	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
> -		   MSI_FLAG_MULTI_PCI_MSI),
> +	.flags	= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
> +		  MSI_FLAG_NO_AFFINITY | MSI_FLAG_MULTI_PCI_MSI,
>  	.chip	= &rcar_msi_top_chip,
>  };
>  
> -- 
> 2.43.0
> 

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

* Re: [PATCH v3 2/3] PCI/rcar-host: Silence set affinity failed warning
  2024-07-22 22:38   ` Bjorn Helgaas
@ 2024-07-23 22:17     ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2024-07-23 22:17 UTC (permalink / raw)
  To: Bjorn Helgaas, Marek Vasut
  Cc: linux-pci, Krzysztof Wilczyński, Anna-Maria Behnsen,
	Anup Patel, Bjorn Helgaas, Jisheng Zhang, Jon Hunter,
	Koichiro Den, Lorenzo Pieralisi, Marc Zyngier, Nipun Gupta,
	Rob Herring, Shivamurthy Shastri, Thierry Reding, Thomas Gleixner,
	Yoshihiro Shimoda, linux-renesas-soc, linux-tegra

On 7/23/24 12:38 AM, Bjorn Helgaas wrote:
> In subject, to match history:
> 
> s|PCI/rcar-host|PCI: rcar-host|
> 
> On Mon, Jul 15, 2024 at 02:19:27PM +0200, Marek Vasut wrote:
>> Use newly introduced MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity unset
>> and allows migrate_one_irq() code in cpuhotplug.c to exit right away, without
>> printing "IRQ...: set affinity failed(-22)" warning.
>>
>> Remove .irq_set_affinity implementation which only return -EINVAL from this
>> controller driver.
> 
> This would be a nice improvement; thanks for working on it.
> 
> As you allude to at [1], there are many more PCI controller drivers
> that could benefit from similar changes.  I'd like to do them all at
> once if possible.

Should be addressed in V4 .

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

end of thread, other threads:[~2024-07-23 22:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-15 12:19 [PATCH v3 1/3] genirq/msi: Silence set affinity failed warning Marek Vasut
2024-07-15 12:19 ` [PATCH v3 2/3] PCI/rcar-host: " Marek Vasut
2024-07-22 22:38   ` Bjorn Helgaas
2024-07-23 22:17     ` Marek Vasut
2024-07-15 12:19 ` [PATCH v3 3/3] PCI: tegra: " Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).