public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: wenxiong@linux.ibm.com, linux-kernel@vger.kernel.org,
	gjoyce@linux.ibm.com
Cc: Wen Xiong <wenxiong@linux.ibm.com>
Subject: Re: [PATCH 1/1] genirq/msi: Dynamic remove/add stroage adapter hits EEH
Date: Wed, 19 Mar 2025 17:15:34 +0100	[thread overview]
Message-ID: <87a59h3sk9.ffs@tglx> (raw)
In-Reply-To: <1742386474-13717-1-git-send-email-wenxiong@linux.ibm.com>

On Wed, Mar 19 2025 at 07:14, wenxiong@linux.ibm.com wrote:
> There is very small window: irqbalance daemon kicks in before ipr driver
> calls pci_restore_state(pdev), irqbalance daemon read back all 0 for that
> msix vector in __pci_read_msi_msg().

You fail to explain how irqbalanced is able to invoke __pci_read_msi_msg().

I assume that this happens in the set_affinity() path, which ends up in
pseries_msi_compose_msg(). pseries_msi_compose_msg() reads back the
message from the device.

> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index 396a067a8a56..fcde35efb64c 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -671,7 +671,8 @@ int msi_domain_set_affinity(struct irq_data *irq_data,
>  	if (ret >= 0 && ret != IRQ_SET_MASK_OK_DONE) {
>  		BUG_ON(irq_chip_compose_msi_msg(irq_data, msg));
>  		msi_check_level(irq_data->domain, msg);
> -		irq_chip_write_msi_msg(irq_data, msg);
> +		if ((msg->address_lo != 0) && (msg->address_hi != 0))
> +			irq_chip_write_msi_msg(irq_data, msg);

That's just papering over the underlying problem and thereby breaks all
architetures except your machine. address_hi _IS_ zero on most systems
and there is no requirement for address_lo to be non-zero when
address_hi is non-zero. Not going to happen.

The real problem has nothing to do with a remove/add operation. The
problem is solely in the probe function.

It does:

   pci_alloc_irq_vectors();     // Exposes interrupts in /proc/irq/
                                // which makes them visible to
                                // irqbalanced

   pci_save_state();

#A reset_device();              // Clears the config space

#B pci_restore_state();         // Restores the config space

So the driver creates inconsistent state between #A and #B, which is
wrong to begin with when it first sets up resources which are visible
to other entities.

Why are the interrupts set up _before_ the reset? That does not make any
sense.

And no, we are not going to do a random undocumented hack in generic
code to work around such a driver insanity.

Fix the problem where it was created, i.e. at the driver level.

Thanks,

        tglx






  reply	other threads:[~2025-03-19 16:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 12:14 [PATCH 1/1] genirq/msi: Dynamic remove/add stroage adapter hits EEH wenxiong
2025-03-19 16:15 ` Thomas Gleixner [this message]
2025-03-20  2:58   ` Wen Xiong
2025-03-20  8:23     ` Thomas Gleixner
2025-03-20  8:48       ` Thomas Gleixner
2025-03-27 21:36         ` Wen Xiong
2025-03-28 11:27           ` Thomas Gleixner
2025-04-01 20:14             ` Wen Xiong
2025-04-02  8:33               ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a59h3sk9.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=gjoyce@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wenxiong@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox