lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFv5VkIzTEVwo2PI@google.com>
Date:   Wed, 10 May 2023 13:06:46 -0700
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Jeffery Miller <jefferymiller@...gle.com>
Cc:     Andrew Duggan <andrew@...gan.us>,
        Jonathan Denose <jdenose@...omium.org>, jdenose@...gle.com,
        Lyude Paul <lyude@...hat.com>, loic.poulain@...aro.org,
        benjamin.tissoires@...hat.com,
        Andrew Duggan <aduggan@...aptics.com>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Maximilian Luz <luzmaximilian@...il.com>,
        Miguel Ojeda <ojeda@...nel.org>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>, linux-input@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Input: synaptics-rmi4 - retry reading SMBus version on
 resume

On Wed, May 10, 2023 at 07:27:22PM +0000, Jeffery Miller wrote:
> On resume there can be a period of time after the
> preceding serio_resume -> psmouse_deactivate call
> where calls to rmi_smb_get_version fail with
> -ENXIO.
> 
> The call path in rmi_smb_resume is rmi_smb_resume -> rmi_smb_reset ->
> rmi_smb_enable_smbus_mode -> rmi_smb_get_version where
> this failure would occur.
> 
> Adding a retry loop ensures that after rmi_smb_reset returns
> the following rmi_driver_resume calls in rmi_smbus_resume can
> succeed.
> 
> This behavior was seen on a Lenovo T440p machine that required
> a delay of approximately 7-12ms.
> The retry limit of 5 is chosen to be larger than
> this observed delay.
> 
> With this patch the trimmed resume logs look similar to:
> ```
> psmouse serio1: PM: calling serio_resume+0x0/0x8c @ 5399, parent: i8042
> [5399] libps2:__ps2_command:316: psmouse serio1: f5 [] - 0/00000000 []
> psmouse serio1: PM: serio_resume+0x0/0x8c returned 0 after 3259 usecs
> ...
> rmi4_smbus 0-002c: PM: calling rmi_smb_resume ... @ 5454, parent: i2c-0
> ...
> [5454] i2c_i801:i801_check_post:414: i801_smbus 0000:00:1f.3: No response
> smbus_result: i2c-0 a=02c f=0000 c=fd BYTE_DATA rd res=-6
> rmi4_smbus 0-002c: failed to get SMBus version number!
> rmi4_smbus 0-002c: sleeping to retry getting the SMBus version number
> ...
> rmi4_smbus 0-002c: PM: rmi_smb_resume ... returned 0 after 21351 usecs
> ```
> 
> Signed-off-by: Jeffery Miller <jefferymiller@...gle.com>
> ---
> 
> Early boot dmesg include:
> ```
> rmi4_smbus 0-002c: registering SMbus-connected sensor
> rmi4_f01 rmi4-00.fn01: found RMI device, manufacturer: Synaptics, product: TM2722-001, fw id: 0
> ```
> 
> The resume order looks correct. The `psmouse serio1` resume returns
> before the rmi_smb_resume is called showing the patch from
> https://lore.kernel.org/all/89456fcd-a113-4c82-4b10-a9bcaefac68f@google.com/
> is applied and working for that ordering.
> 
> I attempted to try to rule out some interaction between the concurrent
> input resume calls for other i8042 devices.
> Adding a 7ms delay after psmouse_deactivate which is called in the
> preceding psmouse serio1 serio_resume function also allows
> this version call to succeed.

I am not really fond of adding random repeats in the code base. Andrew,
do you know if the Synaptics device needs certain delay when switching
to SMbus mode?

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ