Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1791069rdb; Tue, 3 Oct 2023 00:31:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxA5VVZIVi1RNgrWKV7sQyQP3OJrVuJZResFZ2/7DQcrasvXh7kqnLKit0UMzIS6HYoGg/ X-Received: by 2002:a05:6a20:12cb:b0:157:d7cd:ebd with SMTP id v11-20020a056a2012cb00b00157d7cd0ebdmr16973501pzg.1.1696318281675; Tue, 03 Oct 2023 00:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696318281; cv=none; d=google.com; s=arc-20160816; b=Shy1RZ8+aBt38NmpQ6k5z+Y890GjluRcBc3TP+dpk9qTGo/ltOsAMg3wBbLrGnscRd 6vH/nDRuSNSNNUZtuquqq+LdP33Mj6zWhnm1Bo6I3EHUy/vRWcGEFIZ4avdwF1tow8o7 /9yq44wpoWix/c91pyUvoPbuFzaXB92dZ+2cRBPg4HuAK7Cu0tRA4fThYvpT+abwvs6J zUcFVrAufzGZONAoncZjDL7/Rb1KpQjfgE1b2MmPCBy0lOApVdhnPFBezwlBxz7x+rgA P0FD6Y5Vnqy55PqJf0jqh+7IAPSOdoqDibTbBdG1jtdVUkucMTBB4FgaggW8nrKw2KYM djkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=R7p4eenCCpwCtTidjSndEcHvfwD5ycJU1mQzomnxaB8=; fh=4y8TfsZCDs7y9nG/u/A6EX2dr7q2MjIEzNpXeOkmY4s=; b=EDdIxJ4s+SSBlth6Mr0qPYDUMqP9pCztJZ4EJienZ+esEuGhk9InEr0bcrg05M9S1W PReZscf6tUGvXsB92JzpWP8pu0ImlRdzoYNxpbC9PJxhS9kEGO98aUrrPwjcA3R6qGt9 fiw3q1GyaEhcIvWI3Kd/6EENVIwle3aWzwE9+YQXlsIpT+t/4KgxbX+oABx5CGRNK5x2 +evhtqS/Gb8K9vPV9d05W3ph0AAHyL+b/E+OQVbimQ2IAE4Yo8oHMqIfEuCWI5KTtI+V W/kjAWeWP/QjT3Z6w0lRx3YaWQf+s6BWwroyAYu4ZQBs3XguFPtSSs/f168QZ6IswoTk IJvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z3-20020aa78883000000b0068c0300a3f7si924587pfe.279.2023.10.03.00.31.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 00:31:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 191718082070; Tue, 3 Oct 2023 00:30:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231409AbjJCHa3 (ORCPT + 99 others); Tue, 3 Oct 2023 03:30:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbjJCHa2 (ORCPT ); Tue, 3 Oct 2023 03:30:28 -0400 Received: from wp530.webpack.hosteurope.de (wp530.webpack.hosteurope.de [80.237.130.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7143290; Tue, 3 Oct 2023 00:30:24 -0700 (PDT) Received: from [2a02:8108:8980:2478:8cde:aa2c:f324:937e]; authenticated by wp530.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1qnZrJ-0008Vn-Gd; Tue, 03 Oct 2023 09:30:21 +0200 Message-ID: <906cfb11-ee93-4251-a6ff-1c4d9656b577@leemhuis.info> Date: Tue, 3 Oct 2023 09:30:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Thorsten Leemhuis Subject: Re: [regression] Resume broken on T14s Gen1 (AMD) due to "Input: psmouse - add delay when deactivating for SMBus mode" To: Jeffery Miller Cc: Andrew Duggan , Dmitry Torokhov , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Linux kernel regressions list References: <1b3f8dd2-6364-4f00-a33e-8b15b8911dbf@leemhuis.info> Content-Language: en-US, de-DE Autocrypt: addr=linux@leemhuis.info; keydata= xsFNBFJ4AQ0BEADCz16x4kl/YGBegAsYXJMjFRi3QOr2YMmcNuu1fdsi3XnM+xMRaukWby47 JcsZYLDKRHTQ/Lalw9L1HI3NRwK+9ayjg31wFdekgsuPbu4x5RGDIfyNpd378Upa8SUmvHik apCnzsxPTEE4Z2KUxBIwTvg+snEjgZ03EIQEi5cKmnlaUynNqv3xaGstx5jMCEnR2X54rH8j QPvo2l5/79Po58f6DhxV2RrOrOjQIQcPZ6kUqwLi6EQOi92NS9Uy6jbZcrMqPIRqJZ/tTKIR OLWsEjNrc3PMcve+NmORiEgLFclN8kHbPl1tLo4M5jN9xmsa0OZv3M0katqW8kC1hzR7mhz+ Rv4MgnbkPDDO086HjQBlS6Zzo49fQB2JErs5nZ0mwkqlETu6emhxneAMcc67+ZtTeUj54K2y Iu8kk6ghaUAfgMqkdIzeSfhO8eURMhvwzSpsqhUs7pIj4u0TPN8OFAvxE/3adoUwMaB+/plk sNe9RsHHPV+7LGADZ6OzOWWftk34QLTVTcz02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R/1Aq+VZHdUeC6lijFiQblqV6EjenJu+pR9A 7EElGPPmYdO1WQbBrmuOrFuO6wQrbo0TbUiaxYWyoM9cA7v7eFyaxgwXBSWKbo/bcAAViqLW ysaCIZqWxrlhHWWmJMvowVMkB92uPVkxs5IMhSxHS4c2PfZ6D5kvrs3URvIc6zyOrgIaHNzR 8AF4PXWPAuZu1oaG/XKwzMqN/Y/AoxWrCFZNHE27E1RrMhDgmyzIzWQTffJsVPDMQqDfLBhV ic3b8Yec+Kn+ExIF5IuLfHkUgIUs83kDGGbV+wM8NtlGmCXmatyavUwNCXMsuI24HPl7gV2h n7RI In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;linux@leemhuis.info;1696318224;be12618c; X-HE-SMSGID: 1qnZrJ-0008Vn-Gd X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 00:30:32 -0700 (PDT) On 02.10.23 18:52, Jeffery Miller wrote: > On Sat, Sep 30, 2023 at 4:04 AM Thorsten Leemhuis wrote: >> """ >>> diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c >>> index 7b13de979908..fe12385bb856 100644 >>> --- a/drivers/input/mouse/psmouse-smbus.c >>> +++ b/drivers/input/mouse/psmouse-smbus.c >>> @@ -121,11 +121,11 @@ static psmouse_ret_t psmouse_smbus_process_byte(struct psmouse *psmouse) >>> >>> static void psmouse_activate_smbus_mode(struct psmouse_smbus_dev *smbdev) >>> { >>> - if (smbdev->need_deactivate) { >>> - psmouse_deactivate(smbdev->psmouse); >>> - /* Give the device time to switch into SMBus mode */ >>> - msleep(30); >>> - } >>> + if (smbdev->psmouse == NULL) { >>> + printk("XXX: smbdev->psmouse is null\n"); >>> + } else { >>> + printk("XXX: smbdev->psmouse is set\n"); >>> + } >>> } >>> >>> static int psmouse_smbus_reconnect(struct psmouse *psmouse) >> """ >> >> During boot this prints "XXX: smbdev->psmouse is set". But it helped, as >> the machine now resumes from s2idle again -- while printing "XXX: >> smbdev->psmouse is null". And that should not be the case I assume. Or >> did my brute force test go sideways due to my limited skills? > > This was a good test. You've identified where it is crashing. > > Maybe we could confirm that `psmouse->private` is not-NULL?: > ``` > diff --git a/drivers/input/mouse/psmouse-smbus.c > b/drivers/input/mouse/psmouse-smbus.c > index 7b13de979908..432615df9ae8 100644 > --- a/drivers/input/mouse/psmouse-smbus.c > +++ b/drivers/input/mouse/psmouse-smbus.c > @@ -130,7 +130,10 @@ static void psmouse_activate_smbus_mode(struct > psmouse_smbus_dev *smbdev) > > static int psmouse_smbus_reconnect(struct psmouse *psmouse) > { > - psmouse_activate_smbus_mode(psmouse->private); > + if (psmouse->private == NULL) { > + printk("XXX smbdev is null"); > + } > + //psmouse_activate_smbus_mode(psmouse->private); > return 0; > } > ``` This didn't print anything on resume, so `psmouse->private` apparently is set. Tried brute force again afterwards to find what might unset smbdev->psmouse by adding printk statements to psmouse_smbus_disconnect() and psmouse_smbus_cleanup() but those didn't fire, so it must be something else I didn't spot. Ciao, Thorsten > On Thu, Sep 28, 2023 at 4:08 AM Thorsten Leemhuis wrote: >> >> On 27.09.23 19:23, Thorsten Leemhuis wrote: >>> On 27.09.23 17:55, Jeffery Miller wrote: >>>> On Wed, Sep 27, 2023 at 10:43 AM Jeffery Miller >>>> wrote: >>>>> On Wed, Sep 27, 2023 at 3:54 AM Thorsten Leemhuis wrote: >>>>>> >>>>>> My dmesg from a kernel with the revert: >>>>>> https://www.leemhuis.info/files/misc/dmesg >>> >>> Thx for looking into this! >>> >>>>> In this dmesg output it shows that this is an elantech smbus device: >>>>> ``` >>>>> [ 4.260415] psmouse serio1: elantech: assuming hardware version 4 (with firmware version 0x7f3001) >>>>> [ 4.279297] psmouse serio1: elantech: Synaptics capabilities query result 0x90, 0x18, 0x0f. >>>>> [ 4.292788] psmouse serio1: elantech: Elan sample query result 00, 80, c9 >>>>> [ 4.319184] psmouse serio1: elantech: Elan ic body: 0x10, current fw version: 0x3 >>>>> ... >>>>> [ 4.346951] psmouse serio1: elantech: Trying to set up SMBus access >>>>> [ 4.346986] psmouse serio1: elantech: SMbus companion is not ready yet >>>>> [ 4.369993] input: ETPS/2 Elantech TrackPoint as /devices/platform/i8042/serio1/input/input7 >>>>> [ 4.376200] systemd[1]: bpf-lsm: LSM BPF program attached >>>>> [ 4.385192] input: ETPS/2 Elantech Touchpad as /devices/platform/i8042/serio1/input/input5 >>>>> ``` >>>>> The change in 92e24e0e57f72e shouldn't affect the elantouch device as elantech_setup_smbus >>>>> initializes `psmouse_smbus_init` with need_deactivate = false. >>> >>> Hmmm. Wondering if I should warm up the compiler again to recheck my >>> result one more time[1]. >> >> Just did that. Ran "make clean" and compiled mainline as of now >> (633b47cb009d) and the machine does never resume from s2idle; then I >> reverted 92e24e0e57f7 and compiled again (for completeness: without >> running "make clean" beforehand) and with that kernel s2idle resume >> works perfectly fine. >> >> Wondering if I or the compiler is doing something stupid here -- or if >> we missed some small but important detail somewhere. >> >> Ciao, Thorsten >> >>>>> Did you store dmesg logs from boot without the applied patch? >>>> I intended to ask if you have logs from a boot without 92e24e0e57f72e reverted. >>> >>> https://www.leemhuis.info/files/misc/dmesg-6.6-rc3-vanilla >>> >>>>> If the delay was being applied the timestamps should show the 30ms delay between >>>>> `psmouse serio1: elantech: Trying to set up SMBus access` >>>>> and >>>>> `psmouse serio1: elantech: SMbus companion is not ready yet` >>> >>> Unless I missed something there is not difference. :-/ >>> >>> Ciao, Thorsten >>> >>> [1] FWIW, this is my bisect log >>> >>> """ >>>> git bisect start >>>> # status: waiting for both good and bad commits >>>> # bad: [6465e260f48790807eef06b583b38ca9789b6072] Linux 6.6-rc3 >>>> git bisect bad 6465e260f48790807eef06b583b38ca9789b6072 >>>> # status: waiting for good commit(s), bad commit known >>>> # good: [2dde18cd1d8fac735875f2e4987f11817cc0bc2c] Linux 6.5 >>>> git bisect good 2dde18cd1d8fac735875f2e4987f11817cc0bc2c >>>> # good: [4fb0dacb78c6a041bbd38ddd998df806af5c2c69] Merge tag 'sound-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound >>>> git bisect good 4fb0dacb78c6a041bbd38ddd998df806af5c2c69 >>>> # good: [307d59039fb26212a84a9aa6a134a7d2bdea34ca] Merge tag 'media/v6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media >>>> git bisect good 307d59039fb26212a84a9aa6a134a7d2bdea34ca >>>> # bad: [4a0fc73da97efd23a383ca839e6fe86410268f6b] Merge tag 's390-6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux >>>> git bisect bad 4a0fc73da97efd23a383ca839e6fe86410268f6b >>>> # good: [e4f1b8202fb59c56a3de7642d50326923670513f] Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost >>>> git bisect good e4f1b8202fb59c56a3de7642d50326923670513f >>>> # good: [5eea5820c7340d39e56e169e1b87199391105f6b] Merge tag 'mm-stable-2023-09-04-14-00' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm >>>> git bisect good 5eea5820c7340d39e56e169e1b87199391105f6b >>>> # good: [65d6e954e37872fd9afb5ef3fc0481bb3c2f20f4] Merge tag 'gfs2-v6.5-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2 >>>> git bisect good 65d6e954e37872fd9afb5ef3fc0481bb3c2f20f4 >>>> # bad: [744a759492b5c57ff24a6e8aabe47b17ad8ee964] Merge tag 'input-for-v6.6-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input >>>> git bisect bad 744a759492b5c57ff24a6e8aabe47b17ad8ee964 >>>> # good: [dbce1a7d5dce7318d8465b1e0d052ef1d2202237] Input: Explicitly include correct DT includes >>>> git bisect good dbce1a7d5dce7318d8465b1e0d052ef1d2202237 >>>> # good: [29057cc5bddc785ea0a11534d7ad2546fa0872d3] Merge tag 'linux-watchdog-6.6-rc1' of git://www.linux-watchdog.org/linux-watchdog >>>> git bisect good 29057cc5bddc785ea0a11534d7ad2546fa0872d3 >>>> # bad: [3e4bb047b23375a34dbf5885709ac3729d9cfb22] Input: qt2160 - convert to use devm_* api >>>> git bisect bad 3e4bb047b23375a34dbf5885709ac3729d9cfb22 >>>> # good: [e175eae16c1bf92062f1f431a95f476a61a77c48] Input: mcs-touchkey - convert to use devm_* api >>>> git bisect good e175eae16c1bf92062f1f431a95f476a61a77c48 >>>> # bad: [92e24e0e57f72e06c2df87116557331fd2d4dda2] Input: psmouse - add delay when deactivating for SMBus mode >>>> git bisect bad 92e24e0e57f72e06c2df87116557331fd2d4dda2 >>>> # good: [8362bf82fb5441613aac7c6c9dbb6b83def6ad3b] Input: mcs-touchkey - fix uninitialized use of error in mcs_touchkey_probe() >>>> git bisect good 8362bf82fb5441613aac7c6c9dbb6b83def6ad3b >>>> # first bad commit: [92e24e0e57f72e06c2df87116557331fd2d4dda2] Input: psmouse - add delay when deactivating for SMBus mode >>> """ >>> >>> > >