All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Rajat Jain <rajatja@google.com>
Cc: Wolfram Sang <wsa@kernel.org>, Hugh Dickins <hughd@google.com>,
	Derek Basehore <dbasehore@chromium.org>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	"loic.poulain@linaro.org" <loic.poulain@linaro.org>,
	Andrew Duggan <aduggan@synaptics.com>,
	vincent.huang@tw.synaptics.com, cheiny@synaptics.com,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-input <linux-input@vger.kernel.org>
Subject: Re: 5.17-rc regression: rmi4 clients cannot deal with asynchronous suspend? (was: X1 Carbon touchpad not resumed)
Date: Mon, 7 Feb 2022 18:20:18 -0800	[thread overview]
Message-ID: <YgHTYrODoo2ou49J@google.com> (raw)
In-Reply-To: <CACK8Z6FUsceYgBoaAtN8o4m9HpZaBZMt0Nqtvw0a1Z3EuD_nWg@mail.gmail.com>

On Mon, Feb 07, 2022 at 01:41:36PM -0800, Rajat Jain wrote:
> +linux-input@vger.kernel.org
> 
> On Mon, Feb 7, 2022 at 1:09 PM Rajat Jain <rajatja@google.com> wrote:
> >
> > +Rafael (for any inputs on asynchronous suspend / resume)
> > +Dmitry Torokhov (since no other maintainer of rmi4 in MAINTAINERS file)
> > +loic.poulain@linaro.org (who fixed RMI device hierarchy recently)
> > + Some Synaptics folks (from recent commits - Vincent Huang, Andrew
> > Duggan, Cheiny)
> >
> > On Mon, Feb 7, 2022 at 12:23 PM Wolfram Sang <wsa@kernel.org> wrote:
> > >
> > > Hello Hugh,
> > >
> > > > Bisection led to 172d931910e1db800f4e71e8ed92281b6f8c6ee2
> > > > ("i2c: enable async suspend/resume on i2c client devices")
> > > > and reverting that fixes it for me.
> > >
> > > Thank you for the report plus bisection and sorry for the regression!
> >
> > +1, Thanks for the bisection, and apologies for the inconveniences.
> >
> > The problem here seems to be that for some reason, some devices (all
> > connected to rmi4 adapter) failed to resume, but only when
> > asynchronous suspend is enabled (by 172d931910e1):
> >
> > [   79.221064] rmi4_smbus 6-002c: failed to get SMBus version number!
> > [   79.265074] rmi4_physical rmi4-00: rmi_driver_reset_handler: Failed
> > to read current IRQ mask.
> > [   79.308330] rmi4_f01 rmi4-00.fn01: Failed to restore normal operation: -6.
> > [   79.308335] rmi4_f01 rmi4-00.fn01: Resume failed with code -6.
> > [   79.308339] rmi4_physical rmi4-00: Failed to suspend functions: -6
> > [   79.308342] rmi4_smbus 6-002c: Failed to resume device: -6
> > [   79.351967] rmi4_physical rmi4-00: Failed to read irqs, code=-6
> >
> > A resume failure that only shows up during asynchronous resume,
> > typically means that the device is dependent on some other device to
> > resume first, but this dependency is NOT established in a parent child
> > relationship (which is wrong and needs to be fixed, perhaps using
> > device_add_link()). Thus the kernel may be resuming these devices
> > without first resuming some other device that these devices need to
> > depend on.
> >
> > TBH, I'm not sure how to fix this. The only hint I see is that all of
> > these devices seem to be attached to rmi4 device so perhaps something
> > there? I see 6e4860410b828f recently fixed device hierarchy for rmi4,
> > and so seemingly should have fixed this very issue (as also seen in
> > commit message)?
> >
> > >
> > > I will wait a few days if people come up with a fix. If not, I will
> > > revert the offending commit.
> >
> > While I'll be sad because this means no i2c-client can now resume in
> > parallel and increases resume latency by a *LOT* (hundreds of ms on
> > all Linux systems), I understand that this needs to be done unless
> > someone comes up with a fix.

There is intricate dance happening switching touchpad from legacy PS/2
into RMI mode, with touchpad being dependent not only on SMbus
controller, but also on i8042 keyboard controller and its PS/2 port (or
rather their emulation by the system firmware).

I wonder if we could apply a little bit more targeted patch:

diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c
index 2407ea43de59..3901d06d38ca 100644
--- a/drivers/input/rmi4/rmi_smbus.c
+++ b/drivers/input/rmi4/rmi_smbus.c
@@ -335,6 +335,7 @@ static int rmi_smb_probe(struct i2c_client *client,
 		return error;
 	}
 
+	device_disable_async_suspend(&client->dev);
 	return 0;
 }
 

... and if that works then we cant try to establish proper dependencies
via device links later.

Hugh, could you please try this out and see if it helps?

Thanks!

-- 
Dmitry

  reply	other threads:[~2022-02-08  2:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 19:45 5.17-rc regression: X1 Carbon touchpad not resumed Hugh Dickins
2022-02-07 20:23 ` Wolfram Sang
2022-02-07 20:41   ` Hugh Dickins
2022-02-07 21:09   ` 5.17-rc regression: rmi4 clients cannot deal with asynchronous suspend? (was: X1 Carbon touchpad not resumed) Rajat Jain
2022-02-07 21:41     ` Rajat Jain
2022-02-08  2:20       ` Dmitry Torokhov [this message]
2022-02-08  2:50         ` Hugh Dickins
2022-02-08 10:02           ` Loic Poulain
2022-02-08 14:57           ` Jarkko Nikula
2022-02-14  2:31             ` Dmitry Torokhov
2022-02-14  7:36               ` Hugh Dickins
2022-02-14 12:11                 ` Jarkko Nikula
2022-02-14  8:57               ` Hans de Goede
2022-02-08  6:37 ` 5.17-rc regression: X1 Carbon touchpad not resumed Thorsten Leemhuis

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=YgHTYrODoo2ou49J@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=aduggan@synaptics.com \
    --cc=cheiny@synaptics.com \
    --cc=dbasehore@chromium.org \
    --cc=hughd@google.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=rafael@kernel.org \
    --cc=rajatja@google.com \
    --cc=regressions@leemhuis.info \
    --cc=vincent.huang@tw.synaptics.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.