From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Jean Delvare <jdelvare@suse.de>
Cc: linux-i2c@vger.kernel.org, Wolfram Sang <wsa@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
ck+kernelbugzilla@bl4ckb0x.de, stephane.poignant@protonmail.com
Subject: Re: [PATCH v2] i2c: i801: Fix interrupt storm from SMB_ALERT signal
Date: Thu, 4 Nov 2021 16:42:21 +0200 [thread overview]
Message-ID: <f5a69031-485a-e645-9634-c978b76fb512@linux.intel.com> (raw)
In-Reply-To: <20211029162532.43e3f7b2@endymion>
On 10/29/21 5:25 PM, Jean Delvare wrote:
> In my first review, I suggested restoring SMBHSTCNT_INTREN to its
> original value at driver unload time. I stand on this position. If
> SMBHSTCNT_INTREN was originally 0, it will be 1 after the first
> transaction run by the driver. That's fine as long as
> SMBSLVCMD_SMBALERT_DISABLE is set, however i801_disable_host_notify()
> will clear that bit when you unload the driver. At that point, SMBus
> Alerts will keep generating interrupts. I'm not sure what happens if
> nobody is listening to that interrupt. But in case of a shared
> interrupt, the other driver is going to be flooded with interrupts
> forever if SMBus Alerts are being generated for whatever reason.
>
Ah, yeah and it's really happening. I wanted to debug it by installing a
shared dummy handler in another driver :-)
> So I suggest something like:
>
> --- linux-5.14.orig/drivers/i2c/busses/i2c-i801.c 2021-10-29 11:15:48.283807055 +0200
> +++ linux-5.14/drivers/i2c/busses/i2c-i801.c 2021-10-29 16:21:32.392978256 +0200
> @@ -259,6 +259,7 @@ struct i801_priv {
> struct i2c_adapter adapter;
> unsigned long smba;
> unsigned char original_hstcfg;
> + unsigned char original_hstcnt;
> unsigned char original_slvcmd;
> struct pci_dev *pci_dev;
> unsigned int features;
> @@ -1811,7 +1812,8 @@ static int i801_probe(struct pci_dev *de
> outb_p(inb_p(SMBAUXCTL(priv)) &
> ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B), SMBAUXCTL(priv));
>
> - /* Remember original Host Notify setting */
> + /* Remember original Interrupt and Host Notify settings */
> + priv->original_hstcnt = inb_p(SMBHSTCNT(priv)) & ~SMBHSTCNT_KILL;
> if (priv->features & FEATURE_HOST_NOTIFY)
> priv->original_slvcmd = inb_p(SMBSLVCMD(priv));
>
> @@ -1875,6 +1877,7 @@ static void i801_remove(struct pci_dev *
> {
> struct i801_priv *priv = pci_get_drvdata(dev);
>
> + outb_p(priv->original_hstcnt, SMBHSTCNT(priv));
> i801_disable_host_notify(priv);
> i801_del_mux(priv);
> i2c_del_adapter(&priv->adapter);
> @@ -1898,6 +1901,7 @@ static void i801_shutdown(struct pci_dev
> struct i801_priv *priv = pci_get_drvdata(dev);
>
> /* Restore config registers to avoid hard hang on some systems */
> + outb_p(priv->original_hstcnt, SMBHSTCNT(priv));
> i801_disable_host_notify(priv);
> pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg);
> }
>
> In addition to your changes. What do you think?
>
I think this is worth of a separate patch before mine since it does one
driver improvement and helps to stop interrupt flood coming from the
SMBus controller by unloading the driver.
You may add my Tested-by if you plan to send a patch or I can add commit
log from you and send both patches together.
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
prev parent reply other threads:[~2021-11-04 14:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 14:53 [PATCH v2] i2c: i801: Fix interrupt storm from SMB_ALERT signal Jarkko Nikula
2021-10-29 14:25 ` Jean Delvare
2021-11-04 14:42 ` Jarkko Nikula [this message]
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=f5a69031-485a-e645-9634-c978b76fb512@linux.intel.com \
--to=jarkko.nikula@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=ck+kernelbugzilla@bl4ckb0x.de \
--cc=jdelvare@suse.de \
--cc=linux-i2c@vger.kernel.org \
--cc=stephane.poignant@protonmail.com \
--cc=wsa@kernel.org \
/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 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.