Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2939710lqp; Mon, 25 Mar 2024 13:50:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzpHvBnBNIN4RC5OCSKKhg+VvO7T1jV+n2wjXhyyf418l2rVzwyI/kus1qjDV57FhPsxDu0FFFfGq63mA7eD+qZKlcT5pDywOIK/+cbA== X-Google-Smtp-Source: AGHT+IFhV0ZQR0ow+CTxLaOYghDTpfyEdJXFido8tOtAPw5q4HYMhUVW61uNUkd+7yhDnHBw2JFV X-Received: by 2002:a05:6a00:3c92:b0:6ea:7e74:b256 with SMTP id lm18-20020a056a003c9200b006ea7e74b256mr8425862pfb.11.1711399815097; Mon, 25 Mar 2024 13:50:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711399815; cv=pass; d=google.com; s=arc-20160816; b=EvQBE4XV1cOUFS7VUDTrecLV+ocGdhVrQTwPG2JruJxR64hyyCGmHwnZ284a+WisUx obUbbabvLk6GWEsGK9/rzwMIC0Di5PJwSbzvQHm197PTxRRNp7f7FpdOMhgLwuUunkDv 3+uvkxcF8d/OTlTsdCk931e1mMGnEMn7KTznzfNOEqNhQrYIpAEcjYIN+zqq0JJ9ZtQ8 f+LYZ16cMwNemxb5Jmc73tGsSF11P2LAZnPJJOi+kfRIa/b7Gvg6D+LUsTCgjrwVPXl+ qUydj/8skuirljqKWSFrS54om5N2Svqgsn1HbmR7O0qBDRBAgcLU3ZAU0HatE4YZk/bw A8Sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=eQODAml6GRv67u4tGiAlhQmg2lKAKxqHYDSg7Yzvmrs=; fh=m7vtRYNnu5MAdb7E+oAHjF2bZEVCcqcHCzBuAgvv9iA=; b=BChTk16PCtPXUJIS01JcRY6JgXHOn+poSY+DLaRuT7cRjpXnRvfrkrEdadnyQkvqii k/E1p1LVL1btNcrR+xYluM27oLpMNgeAQeje5Afuz+h5gdK4zPDJ6RVAUIhTCpBQ/6W0 ruIermRQweiTgNE293WwKOh9f/c1HDUrYoO98nhU7ViA6ynBPPrD3fDFRr9Gmh06V6rw HQcm3I3zRX842Pjyx/8lt1DuTg+OopPwAYi6YTMrwamYKtkYsorabU4p0hMO3xK/5M2o eRCuunmLJfocJi72qeKW2xgoBTmUcXTsIPVkc4p38vWmu9SbWUQqyYMXjF1Ynoo7FRIn 3giA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vc4FsdRa; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117957-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r7-20020a635147000000b005dc42fd8c40si8235700pgl.404.2024.03.25.13.50.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 13:50:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vc4FsdRa; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117957-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 08CD132435B for ; Mon, 25 Mar 2024 20:42:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 520AE5A4D4; Mon, 25 Mar 2024 20:42:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vc4FsdRa" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5871D12E55; Mon, 25 Mar 2024 20:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399335; cv=none; b=ddqgT/b4xzdhPimW5wrRLeUs897x1H6PIDPxIOgoyKrYZZKfq7WWgIsEU0qy5evObbbHatlS0B24pJNdB6P0hZ51hXxPfARBlDZ0e/o23bbjf6Hd39FUILRNOieAzP7a0RfXeq/4Rkqf67re9Il1nCx7gvoWQegOj+DFqBnz0tA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399335; c=relaxed/simple; bh=AjuVlS8tHlrZ6H8T3W+PPsoKeY8DgVuue/TCrjp0oDA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B8dGDZkp/8OGyOdRmQI7PxGCXsIyQIkkHBEsxcV2dWBUq4OOiSTRyXubQUKJky0qwkxTnYHB5LSxoctIIwNT1eL4jsBwuseMzzSSeYwCs1vOKogi5+Qcdud1avtiUEFrikuYyJa1mPrVVB5VAJxZb7S6ZVO02fYVEy0kvJC3Tdo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vc4FsdRa; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 312B9C433F1; Mon, 25 Mar 2024 20:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711399334; bh=AjuVlS8tHlrZ6H8T3W+PPsoKeY8DgVuue/TCrjp0oDA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Vc4FsdRa6VxpKY8TH1xTCXyQ0Z6a5su1BES/BH9VU4okz6PHMM1CS4cdgTo8Gp0P0 D9igYEcpttdH0Wl08EFCCifIagBnizhJklyh/WII1Y/HL65zJWEqmF+X0QMAUWf5Uv Mqh2GW2VC0aow06KZcV7lUR8pEYHlUumJgskuORGc7rVY+8l/z1To37GBA+fh1gJHk uWDM9O4iFlUVPPriMElCb/ty9p9nS0hBiBNhsoVj8EXKKrs+jbscyeaKTXjb6zOD0P pG4vPzbBFM6k1b4DuyLe16B26drQecc54Y/DPI8FTf7KaghBTCDKjhm30M3/ixeWhr ccRlvLrMKT71A== Date: Mon, 25 Mar 2024 20:42:00 +0000 From: Jonathan Cameron To: George Stark Cc: Harald Geyer , , , , Subject: Re: [PATCH] iio: dht11: set debug log level for parsing error messages Message-ID: <20240325204200.466ff642@jic23-huawei> In-Reply-To: <01ed720d-a990-40dd-8a59-a95ea960ecec@salutedevices.com> References: <20240325165406.226916-1-gnstark@salutedevices.com> <01ed720d-a990-40dd-8a59-a95ea960ecec@salutedevices.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 25 Mar 2024 23:18:32 +0300 George Stark wrote: > Hello Harald >=20 > Thanks for the review. >=20 >=20 > On 3/25/24 21:48, Harald Geyer wrote: > > Hi George! > >=20 > > I'm torn on this: > >=20 > > Am Montag, dem 25.03.2024 um 19:54 +0300 schrieb George Stark: =20 > >> Protocol parsing errors could happen due to several reasons like > >> noise > >> environment, heavy load on system etc. If to poll the sensor > >> frequently > >> and/or for a long period kernel log will become polluted with error > >> messages if their log level is err (i.e. on by default). =20 > >=20 > > Yes, these error are often recoverable. (As are many other HW errors, > > that typically are logged. Eg USB bus resets due to EMI) > >=20 > > However they are still genuine errors of the HW. > > =20 > >> Also some types > >> of those messages already have dbg level so use unified log level for > >> all such cases. =20 > >=20 > > My take so far has been: Debug level messages are for debugging the > > code (ie adding/testing support of new device variants etc). Users > > aren't expected to know about or enable debug output. OTOH anything > > actually going wrong is an error and should be logged as such. > >=20 > > The idea is, that these messages help users understand issues with > > their HW (like too long cables, broken cables etc). But it is true, > > that they will slowly accumulate in many real world scenarios without > > anything being truly wrong. =20 >=20 > I agree with you that it's very convenient to just take a look to dmesg > and see device connection problems at once. But unlike e.g. usb user has > to actually start reading sensor to perform communication and read > errors will be propagated to the userspace and could be noticed \ > handled. >=20 > Anyway I believe we should use uniform approach for read errors - > currently in the driver there're already dbg messages: >=20 > "lost synchronisation at edge %d\n" > "invalid checksum\n" >=20 > I changed log level from err to dbg for the messages: >=20 > "Only %d signal edges detected\n" > "Don't know how to decode data: %d %d %d %d\n" >=20 > They all are from a single callback and say the same thing - > communication problem. >=20 > If we make all those messages as errors it'd be great to have mechanism > to disable them e.g. thru module parameter or somehow without rebuilding > kernel. Those errors can be bypassed by increasing read rate. Don't use a parameter for this. dev_dbg and dynamic debug is the way to go if this is the choice available. If Harald is comfortable with the change given this discussion, I'll pick up this patch. Jonathan >=20 > >=20 > > I don't consider the dmesg buffer being rotated after a month or two a > > bug. But I suppose this is a corner case. I'll happily accept whatever > > Jonathan thinks is reasonable. > >=20 > > Best regards, > > Harald > >=20 > > =20 > >> Signed-off-by: George Stark > >> --- > >> I use DHT22 sensor with Raspberry Pi Zero W as a simple home meteo > >> station. > >> Even if to poll the sensor once per tens of seconds after month or > >> two dmesg > >> may become full of useless parsing error messages. Anyway those > >> errors are caught > >> in the user software thru return values. > >> > >> =C2=A0drivers/iio/humidity/dht11.c | 4 ++-- > >> =C2=A01 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/iio/humidity/dht11.c > >> b/drivers/iio/humidity/dht11.c > >> index c97e25448772..e2cbc442177b 100644 > >> --- a/drivers/iio/humidity/dht11.c > >> +++ b/drivers/iio/humidity/dht11.c > >> @@ -156,7 +156,7 @@ static int dht11_decode(struct dht11 *dht11, int > >> offset) > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0dht11->temperature =3D temp_int * 1000; > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0dht11->humidity =3D hum_int * 1000; > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0dev_err(dht11->dev, > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0dev_dbg(dht11->dev, > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= "Don't know how to decode data: %d %d %d > >> %d\n", > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= hum_int, hum_dec, temp_int, temp_dec); > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0return -EIO; > >> @@ -239,7 +239,7 @@ static int dht11_read_raw(struct iio_dev > >> *iio_dev, > >> =C2=A0#endif > >> > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0if (ret =3D=3D 0 && dht11->num_edges < > >> DHT11_EDGES_PER_READ - 1) { > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dev_er= r(dht11->dev, "Only %d signal edges > >> detected\n", > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dev_db= g(dht11->dev, "Only %d signal edges > >> detected\n", > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dht11->num_edges); > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= ret =3D -ETIMEDOUT; > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0} > >> -- > >> 2.25.1 > >> =20 > > =20 >=20