Re: [PATCH RFT] i2c: designware: ratelimit 'transfer when suspended' errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 30-04-19 22:15, skidnik wrote:
On 4/30/19 5:09 PM, Hans de Goede wrote:
Hi,

On 4/25/19 9:21 PM, skidnik wrote:
On 4/24/19 7:16 PM, Wolfram Sang wrote:
There are two problems with dev_err() here. One: It is not ratelimited.
Two: We don't see which driver tried to transfer something with a
suspended adapter. Switch to dev_WARN_ONCE to fix both issues. Drawback
is that we don't see if multiple drivers are trying to transfer while
suspended. They need to be discovered one after the other now. This is
better than a high CPU load because a really broken driver might try to
resend endlessly.

Link: https://bugs.archlinux.org/task/62391
Fixes: 275154155538 ("i2c: designware: Do not allow i2c_dw_xfer() calls while suspended")
Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
---

skdnik: Would you be so kind and test this patch? I can only build-test here.

I have a prototype to fix the similar issue in the core, but this needs more
testing first, so I am sending this one out already.

  drivers/i2c/busses/i2c-designware-master.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index bb8e3f149979..d464799e40a3 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -426,8 +426,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
      pm_runtime_get_sync(dev->dev);
-    if (dev->suspended) {
-        dev_err(dev->dev, "Error %s call while suspended\n", __func__);
+    if (dev_WARN_ONCE(dev->dev, dev->suspended, "Transfer while suspended\n")) {
          ret = -ESHUTDOWN;
          goto done_nolock;
      }

This solves system journal flooding, but I still have one core under full load after resume from hibernation. The touchpad attached to that bus works perfectly fine after resume.

Ah, this is on a resume from hibernate, in that case I think this patch will fix this:

https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=c8afd03486c26accdda4846e5561aa3f8e862a9d

Can you build a kernel with that patch added?

Regards,

Hans

Built linux-5.1.0-rc7 (linux-mainline PKGBUILD from aur) with both patches applied.

This has fixed the issue. After resume from hibernation idle CPU usage goes back to normal (around 1%). The i2c_designware related error doesn't appear in kernel log.

I'm going to report back to Archlinux bug tracker that the issue has been fixed. Please can you tell which kernel release will have these fixes so that I can provide relevant information.

The patch is scheduled for inclusion into 5.2 and it has a Cc: stable,
so it will get backported to older kernels like the 5.1.x and 5.0.x releases
once it is merged into Linus' tree.

Regards,

Hans



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux