Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp498580rdb; Mon, 29 Jan 2024 08:35:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEGlqdqAf8kJ8sMiV4kYLepdRHR4arQHN+kTTugwL5JltKElkbighnrhmM7zlH0llDICjR X-Received: by 2002:a9d:75c5:0:b0:6e0:be61:850d with SMTP id c5-20020a9d75c5000000b006e0be61850dmr5035482otl.1.1706546143866; Mon, 29 Jan 2024 08:35:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706546143; cv=pass; d=google.com; s=arc-20160816; b=l0Xt/mLc5xoF4CdneoQiO2AkhFMeDn8Qdp/bhbzp8rQbAKCxlaZopFYpnEpnjtxgHm Qgx3tXOKCgnRrJgwQWXkeZAg+sj0ugVVx+PWqEhg+SgZIf1PYd/klzEE2FsaPlweTGRn gLSfRF8kw0DPmLATUkCi8FxBa3p4m2vkxmoM384e8ABLWmeMJmDLgGwifNM1h1Dtmm2/ OflUG7WBajtwKq2kQbL3q78ZWGs81uEh1p6v4XWCoZxRVX1fEt6ACaB0EaPcy2fKnryn NPLr//L+Zbmig5OGTCWPHEPgpSAQVkSlOKdjyAzf0My7qxyp6PZUFG8VH+4EGiZHXvjB YLcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=6/L/3+aj4kshl/a2QQJi71HdU9Hie8YBQwAh5a5RCoI=; fh=BA0totQcvX+jp3vpE3Juz3qLJbLlISCRbxhefoFN2ck=; b=R6qO8BCqa/kFQsdPSqzyT8lIeTvT0bnGslCtfYhJX5/p8HPXt6YKvbTwnb155+foO3 Rv+qA2gNI9Dec4PSzvl++RGm3thhG9m8ED7HMg4rNkbu0+1MLGRbvxyZkRltWhxtJnuO ViS7XgtjYDj0kFp5TuiHr+Uw/ZEQY8dXikhAvE8ThyewF/ecCsM706nJgHLveCkdiRvM xlEq/4BU3MEAuhNCi3LxPRx2f3eTSD1lgPc1S2CkjhF82FolU0jeXtCICuo5VjTDgZPP rnRuSbWsBl+UQLLzrQKExO7Q6/o945a2bi4hZsEHh3KKSjmOLLsz7xMHJqhZtA/RSpm8 Xktg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=heGG28np; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-43106-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43106-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t191-20020a6381c8000000b005cee03c6e23si5997193pgd.731.2024.01.29.08.35.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 08:35:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43106-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=heGG28np; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-43106-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43106-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4D5C6282245 for ; Mon, 29 Jan 2024 16:35:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39B4215A4B1; Mon, 29 Jan 2024 16:32:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="heGG28np" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CDB115A4A6 for ; Mon, 29 Jan 2024 16:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545922; cv=none; b=EG17R4Gn9YButCwoyru9H5ev5+e3XNEOao7fPsZ1+xUBMQh9vQ3vq6XkJm1zKtKWYlDrgWWCsCa9q7LXfnr57fIf2RwrW04jNue9Efs0CqEuwY3EnvdssxpSNvllcWttpFYNRmApK6QAB7M3JZNN+92zHXfKF7/Id7dyiIzBqes= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545922; c=relaxed/simple; bh=k4/BNjbTTqjP49J8n1Pv3LvMOl+KNbRGTBoLdiaiFNM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JcF/wPgcn1+Dwe/OBzU2quWor+1tZcXHYpaaaDYYyt4chV9ytYtULho9fi44awzQo9PnRNLXs8p4ScsvYXmjI1DvYnlX6og5ATVJbN85TQHFzysExZ+lDlc5uC3thHkK6lgxgY5atkmXXeWUJB8sKSaBCDssSQNfgzFm+yZ/hh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=heGG28np; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706545919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6/L/3+aj4kshl/a2QQJi71HdU9Hie8YBQwAh5a5RCoI=; b=heGG28npeEaYyZP1suMeswaL0aka3ldxy21pLYIdYiElDkP+8O1u2oZ18VLc/tXU2ljb5B Ms1MrSaDepd947fPRT5tDBcCLkQfc2hHPdKfaT3P18JjZ3F5SuNL5wjJhe8jiQYWZH8jP2 wZKJRNGCU1cKrEK9XakCJeSSBoHykig= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-56-6L_ePKKkNNisQsGUd9fiLA-1; Mon, 29 Jan 2024 11:31:57 -0500 X-MC-Unique: 6L_ePKKkNNisQsGUd9fiLA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a2bc65005feso223543166b.0 for ; Mon, 29 Jan 2024 08:31:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706545916; x=1707150716; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6/L/3+aj4kshl/a2QQJi71HdU9Hie8YBQwAh5a5RCoI=; b=m8GAgYIimP/Q/yEyg2C7GtUWzwc9naVZnQzG4gAmJ5rvjWqu3+0s6NnazGo9bsXvl0 xsaAf/HnEGNOVUOIiAjaERCpp218ur2T9Fqo4QobPJ1jvzcwnXe7O0/I+FpeJrtrSWvg sXudeO1YYeyoBOiZV/oO2+CI6lMeZQm8K5ljVi1O+6qxg0AHwtLX6WzVS7JKuPAoy0AS oswL/8vGhtqbF2SfUfYUY4RQ8WWIjy8/JebSMf3ezEaJYmtJMwX0sDHK1ZcqkNVnaoq5 Kgu+Mn9R2SGRjRj8q95ExSKd1nQ/k2vdKZkdo/Lh8+Z+TjDG3EEFU+aeNOHc/SJ8Sihj UkCg== X-Gm-Message-State: AOJu0YxB/RyhPRLICdJbwrw6SHrNyjn/yP/OjG1I2pESwX60CMZ8Hfok SULNCzg0PPV0xv5WnLPqXFJ1yLPu3UNFcUsDIK66XkfPWHnTur5pPK4H+91S1ws5ETJnnxUOzF1 bJVkgTp2+ufu7qsxy0zrm5pgTT0TIOg9b3Dj9e5rx7mTNbHGMtTSre3NF1121sA== X-Received: by 2002:a17:906:a415:b0:a35:becf:4320 with SMTP id l21-20020a170906a41500b00a35becf4320mr1957161ejz.29.1706545916224; Mon, 29 Jan 2024 08:31:56 -0800 (PST) X-Received: by 2002:a17:906:a415:b0:a35:becf:4320 with SMTP id l21-20020a170906a41500b00a35becf4320mr1957140ejz.29.1706545915782; Mon, 29 Jan 2024 08:31:55 -0800 (PST) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id tl10-20020a170907c30a00b00a3554bb5d22sm2691654ejc.69.2024.01.29.08.31.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jan 2024 08:31:55 -0800 (PST) Message-ID: <6ba16249-a4d7-400d-a18a-96753367c722@redhat.com> Date: Mon, 29 Jan 2024 17:31:54 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Flood of logitech-hidpp-device messages in v6.7 Content-Language: en-US, nl To: Oleksandr Natalenko , linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, =?UTF-8?Q?Filipe_La=C3=ADns?= , Bastien Nocera , Jiri Kosina , Benjamin Tissoires References: <3277085.44csPzL39Z@natalenko.name> <12371430.O9o76ZdvQC@natalenko.name> <489d6c71-73eb-4605-8293-5cfea385cf08@redhat.com> <4894984.31r3eYUQgx@natalenko.name> From: Hans de Goede In-Reply-To: <4894984.31r3eYUQgx@natalenko.name> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Oleksandr, On 1/29/24 17:19, Oleksandr Natalenko wrote: > On pondělí 29. ledna 2024 17:08:56 CET Hans de Goede wrote: >> Hi, >> >> On 1/29/24 16:58, Oleksandr Natalenko wrote: >>> Hello. >>> >>> On úterý 9. ledna 2024 12:58:10 CET Hans de Goede wrote: >>>> Hi Oleksandr, >>>> >>>> On 1/9/24 12:45, Oleksandr Natalenko wrote: >>>>> Hello Hans et al. >>>>> >>>>> Starting from v6.7 release I get the following messages repeating in `dmesg` regularly: >>>>> >>>>> ``` >>>>> Jan 09 10:05:06 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: Disconnected >>>>> Jan 09 10:07:15 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: Disconnected >>>>> Jan 09 10:16:51 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: HID++ 4.5 device connected. >>>>> Jan 09 10:16:55 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. >>>>> Jan 09 10:16:55 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. >>>>> Jan 09 10:36:31 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: Disconnected >>>>> Jan 09 10:37:07 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: HID++ 4.5 device connected. >>>>> Jan 09 10:46:21 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: Disconnected >>>>> Jan 09 10:48:23 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: Disconnected >>>>> Jan 09 11:12:27 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: HID++ 4.5 device connected. >>>>> Jan 09 11:12:47 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. >>>>> Jan 09 11:12:47 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. >>>>> Jan 09 11:38:32 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: Disconnected >>>>> Jan 09 11:43:32 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: Disconnected >>>>> Jan 09 11:45:10 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: HID++ 4.5 device connected. >>>>> Jan 09 11:45:11 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. >>>>> Jan 09 11:45:11 spock kernel: logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. >>>>> Jan 09 12:31:48 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: Disconnected >>>>> Jan 09 12:33:21 spock kernel: logitech-hidpp-device 0003:046D:4051.0006: HID++ 4.5 device connected. >>>>> ``` >>>>> >>>>> I've got the following hardware: >>>>> >>>>> * Bus 006 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver >>>>> * Logitech MX Keys >>>>> * Logitech M510v2 >>>>> >>>>> With v6.6 I do not get those messages. >>>>> >>>>> I think this is related to 680ee411a98e ("HID: logitech-hidpp: Fix connect event race"). >>>>> >>>>> My speculation is that some of the devices enter powersaving state after being idle for some time (5 mins?), and then wake up and reconnect once I touch either keyboard or mouse. I should highlight that everything works just fine, it is the flood of messages that worries me. >>>>> >>>>> Is it expected? >>>> >>>> Yes this is expected, looking at your logs I see about 10 messages per >>>> hour which IMHO is not that bad. >>>> >>>> I guess we could change things to track we have logged the connect >>>> message once and if yes then log future connect messages (and all >>>> disconnect messages) at debug level. >>> >>> How granular such a tracking should be? Per-`struct hidpp_device`? >> >> Yes per struct hidpp_device we want to log the connect message once >> per device since it gives info which might be useful for troubleshooting. >> >>> Should there be something like `hid_info_once_then_dbg()` macro, or open-code it in each place instead? >> >> Since we want something like e.g. a "first_connect" (initialized >> to true if you use that name) flag per struct hidpp_device this needs >> to be open coded. > > OK, would something like this make sense (not tested)? Yes, thank you. I would call once_connected connected_once and you can drop the disconnected flag and just always log disconnect messages at the dbg level. Regards, Hans > > ``` > diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c > index 6ef0c88e3e60a..a9899709d6b74 100644 > --- a/drivers/hid/hid-logitech-hidpp.c > +++ b/drivers/hid/hid-logitech-hidpp.c > @@ -203,6 +203,9 @@ struct hidpp_device { > struct hidpp_scroll_counter vertical_wheel_counter; > > u8 wireless_feature_index; > + > + bool once_connected; > + bool once_disconnected; > }; > > /* HID++ 1.0 error codes */ > @@ -988,8 +991,13 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) > hidpp->protocol_minor = response.rap.params[1]; > > print_version: > - hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n", > - hidpp->protocol_major, hidpp->protocol_minor); > + if (!hidpp->once_connected) { > + hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n", > + hidpp->protocol_major, hidpp->protocol_minor); > + hidpp->once_connected = true; > + } else > + hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n", > + hidpp->protocol_major, hidpp->protocol_minor); > return 0; > } > > @@ -4184,7 +4192,11 @@ static void hidpp_connect_event(struct work_struct *work) > /* Get device version to check if it is connected */ > ret = hidpp_root_get_protocol_version(hidpp); > if (ret) { > - hid_info(hidpp->hid_dev, "Disconnected\n"); > + if (!hidpp->once_disconnected) { > + hid_info(hidpp->hid_dev, "Disconnected\n"); > + hidpp->once_disconnected = true; > + } else > + hid_dbg(hidpp->hid_dev, "Disconnected\n"); > if (hidpp->battery.ps) { > hidpp->battery.online = false; > hidpp->battery.status = POWER_SUPPLY_STATUS_UNKNOWN; > ``` > >> >> Regards, >> >> Hans >> >> >> >> >> > >