Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3299259rwd; Mon, 22 May 2023 11:29:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CoV/RQh11RhKzOcpgET0zO1Y/c/xUN/Nt4rAynCn0cRqaT/0G3dbAGAGAD7+RvaIpYBYc X-Received: by 2002:a05:6a20:9c8b:b0:102:472b:424c with SMTP id mj11-20020a056a209c8b00b00102472b424cmr10373196pzb.22.1684780187626; Mon, 22 May 2023 11:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684780187; cv=none; d=google.com; s=arc-20160816; b=cjqPhvl5+5Xp8NhZmbEj93+97z+BMVg69Oh93IEvehitE32Is+sUgdRAZPEkJ4OZIK /maM7aEt/xdUi9lky7fP6HExLuaNSHe8bMnHLikJIs6lV3mHSbONIAnuNFnlNRBVoJYd dw+K6QulRyw7ni98C5fDh01UZtIDooMwZa1kTkweNSVJVesGG8qf9dMjCkJiAcqZgTqF lMirCjgdaVVx3fdN143GWiaVAhSrkzPWyZ8emKFPW295PETH69Wo/3OAPgW8X+Ix+/wR zHC4t6vcViMPEBaBpnuxHLca0Hgpv5Aq5/mfbX58A7I5EuUUKaOri193be0rsR/EYBgJ /eBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OYRWgCDntd6M6zPwTuoO6FVTAIFdNPknpscZnk3SHyI=; b=V4FgWZ2fxbXIXwHSZIN+gMwamXcRePHC/tKQfB54U9u6LVKZdQxgF0Gw8PpXj8SrC3 cQVdAYiZ7obg9eYChzzsu2ynNOGcNJhq4mrLj5oi6+/fYZpT006WO/HLaFdoPW55BUS+ GMKNTm6YkQj8pZ4FTJhc3LNGBgRof7fus1SQvkyrrEb0UnI5Z5kS3a/0FLO8ct4B3d68 rkHauStQR4lnHd2Dhnp5P2DllfEJdOR1lgN7L5dj3gKnXHzaela0DrISbiVajWHjVqRt YphyTfmaxRTkUFLLIvAiyA0icny6UNLxchbKxwG1hiOy0F1DVF60Q9qRfsgstJPFCu4+ 5eeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Uv8lWKhI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020aa7998b000000b0064d47205f47si4710805pfh.21.2023.05.22.11.29.35; Mon, 22 May 2023 11:29:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Uv8lWKhI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233092AbjEVSYU (ORCPT + 99 others); Mon, 22 May 2023 14:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231577AbjEVSYP (ORCPT ); Mon, 22 May 2023 14:24:15 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 564D711F for ; Mon, 22 May 2023 11:24:13 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-510dabb39aeso9143123a12.2 for ; Mon, 22 May 2023 11:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1684779851; x=1687371851; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=OYRWgCDntd6M6zPwTuoO6FVTAIFdNPknpscZnk3SHyI=; b=Uv8lWKhIsUfAw8AnlM03yoZvfoUecbhmcjScdnZqdh2uKUIXTShMOWDQI+yJmMjVyT b8HVgMAO67LM7eJaUzLgDJ1E9ePaXGcgbCbVDOK9vN8N5REvhyWFE+0VjPlZqy9Ln50x lgZvvXIXmwU/Pctg+a2a5O+AHI+e7g+3Jjvho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684779851; x=1687371851; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OYRWgCDntd6M6zPwTuoO6FVTAIFdNPknpscZnk3SHyI=; b=Zj6c2ay937BGy0QLuP+6Py6KfgtgtYKF0I3QyTkf4c5DtqhaIiKDBscvPLLHjcxnot BBJWYaIs79F7yr6eVbm53EvojGUFBpy39DySqbRS57XC4cSDJ62jSGC5Cpg4Ngze5+Pn vdD0E9omPWWbK0CKoAtIn+vCCR1lKz5nUoSV0RAxVKQdeuZpN5VbJceALTecFT6Dvnte u/hfznLRKqjjOsAApRNFfEXt32hTY2DkaSI03/Cq+PNilopT6JJ21XM3x4+GwQZlCPBo rdsBHI1Umii8lMy4KkJe1TBkQ03AX/+YU72qEoHpDoBT8L30VG4+vAhJ1HdrKRoYFKa1 fKSg== X-Gm-Message-State: AC+VfDxAOMSpM1R2Ex7XvW4kpIfa4lFa5QUFzmtErjy5lA+9Qq+Fyzl2 oYTkhfLmvRMvGURk4yaUcY8zEaermwJpjxq5CcXQX7iS X-Received: by 2002:a05:6402:2d8:b0:4fe:ddf:8d8c with SMTP id b24-20020a05640202d800b004fe0ddf8d8cmr9533915edx.13.1684779851375; Mon, 22 May 2023 11:24:11 -0700 (PDT) Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com. [209.85.218.51]) by smtp.gmail.com with ESMTPSA id u16-20020a50a410000000b0050696c2d2f6sm3384201edb.88.2023.05.22.11.24.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 May 2023 11:24:10 -0700 (PDT) Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-96ff9c0a103so173436266b.0 for ; Mon, 22 May 2023 11:24:10 -0700 (PDT) X-Received: by 2002:a17:907:86a2:b0:96f:a39c:86d6 with SMTP id qa34-20020a17090786a200b0096fa39c86d6mr8145445ejc.8.1684779850024; Mon, 22 May 2023 11:24:10 -0700 (PDT) MIME-Version: 1.0 References: <9b987585-0834-bb8c-3414-283c29f3f2ab@leemhuis.info> <55dda0bb-fe42-6dee-28ea-00121554d092@leemhuis.info> In-Reply-To: <55dda0bb-fe42-6dee-28ea-00121554d092@leemhuis.info> From: Linus Torvalds Date: Mon, 22 May 2023 11:23:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [regression] Since kernel 6.3.1 logitech unify receiver not working properly To: Linux regressions mailing list Cc: Benjamin Tissoires , Bagas Sanjaya , =?UTF-8?Q?Filipe_La=C3=ADns?= , Bastien Nocera , Jiri Kosina , "open list:HID CORE LAYER" , LKML , guy.b@bluewin.ch Content-Type: multipart/mixed; boundary="0000000000007cd31e05fc4c60e2" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 --0000000000007cd31e05fc4c60e2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, May 22, 2023 at 5:38=E2=80=AFAM Linux regression tracking (Thorsten Leemhuis) wrote: > > FWIW, in case anybody is interested in a status update: one reporter > bisected the problem down to 586e8fede79 ("HID: logitech-hidpp: Retry > commands when device is busy"); reverting that commit on-top of 6.3 > fixes the problem for that reporter. For that reporter things also work > on 6.4-rc; but for someone else that is affected that's not the case. Hmm. It's likely timing-dependent. But that code is clearly buggy. If the wait_event_timeout() returns early, the device hasn't replied, but the code does if (!wait_event_timeout(hidpp->wait, hidpp->answer_availabl= e, 5*HZ)) { dbg_hid("%s:timeout waiting for response\n", __func= __); memset(response, 0, sizeof(struct hidpp_report)); ret =3D -ETIMEDOUT; } and then continues to look at the response _anyway_. Now, depending on out hardening options, that response may have been initialized by the compiler, or may just be random stack contents. That bug is pre-existing (ie the problem was not introduced by that commit), but who knows if the retry makes things worse (ie if it then triggers on a retry, the response data will be the *previous* response). The whole "goto exit" games should be removed too, because we're in a for-loop, and instead of "goto exit" it should just do "break". IOW, something like this might be worth testing. That said, while I think the code is buggy, I doubt this is the actual cause of the problem people are reporting. But it would be lovely to hear if the attached patch makes any difference, and I think this is fixing a real - but unlikely - problem anyway. And obviously it might be helpful to actually enable those dbg_hid() messages, but I didn't look at what the magic config option to do so was. NOTE! Patch below *ENTIRELY* untested. I just looked at the code when that commit was mentioned, and went "that's not right"... Linus --0000000000007cd31e05fc4c60e2 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lhz6dxva0 IGRyaXZlcnMvaGlkL2hpZC1sb2dpdGVjaC1oaWRwcC5jIHwgOCArKysrLS0tLQogMSBmaWxlIGNo YW5nZWQsIDQgaW5zZXJ0aW9ucygrKSwgNCBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9kcml2 ZXJzL2hpZC9oaWQtbG9naXRlY2gtaGlkcHAuYyBiL2RyaXZlcnMvaGlkL2hpZC1sb2dpdGVjaC1o aWRwcC5jC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