Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp558056rwl; Wed, 29 Mar 2023 05:48:32 -0700 (PDT) X-Google-Smtp-Source: AKy350b68UMfv+ceP6N1mNljWjEAGLRL1W07KLTrS9kyws6bsr6s3a119XCLxe4XXbq0toQHvPwt X-Received: by 2002:a17:90a:318d:b0:237:d867:2260 with SMTP id j13-20020a17090a318d00b00237d8672260mr2165051pjb.4.1680094112672; Wed, 29 Mar 2023 05:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680094112; cv=none; d=google.com; s=arc-20160816; b=RqOikd1Bev5BbdFFcBZm2bQ8tvy1RZ+ZuCcqd5rEcXC9q96U9x15KET8GVCkDFgyLJ Z6Jw/G+zmzeSh9tOMxNWWshBI63G8rZf1yqaZtaADxUH3eGyb342w1eCWBK7UGToAZ1A 3383abJ3j1VWjng38Fb4YtyMAyA/Yvqc7c/YO1Z/KeY5L3rCEOLzoJNrA695f+BlELap JW6xw7KJ7O2L95AfKiyQAILQZSXhAr1Vy4O/63yUYPF7p5DtfKg88DaeRbVzr2X510bH 8M4bGuP0hrHEXT+1jBy6yhBI/zmSWDRB+P0onoQNugjT3JOZ+qdInQEPjXAQZzABMel4 8U9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=d4LKIkv2jjaqEZGV9hdNc6tEqjwN//q2Vxizmj38FUA=; b=Mtt33eHi8B1jSTHTnjxCFtfZaYdEjIFSp1CjpAg8ysPpIj97OzoyIXT6rRbUU42KOR yf2xcv8gWQjwkG0Q3hFMxNglxdfQ8gvloFLXawyKcEXNJFM6Op3KH7tczG21GHmTJoNp 66dGV9XCYtbQvtArZy0E/BzfIo3AA/wbgQJHEPMDlHGeyJkTmGw5c3rFcohWbpa3NcTN UFRTZN0iGsqPjMioD5LCJJ96rfksOejEplwjk0pYYthSAz2AVrHob54pqmkSo1RLJGpD JnXhogzoVLxIBfU4SziS6MQirHrBnyZtFhJcTJKBzj/S34FgQnSrhzkAybOiXf0lUeKJ 8oCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="C/FTOzsv"; 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 ck19-20020a17090afe1300b00240a96d8b44si1389242pjb.103.2023.03.29.05.48.20; Wed, 29 Mar 2023 05:48:32 -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=@gmail.com header.s=20210112 header.b="C/FTOzsv"; 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 S229915AbjC2MrL (ORCPT + 99 others); Wed, 29 Mar 2023 08:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbjC2MrH (ORCPT ); Wed, 29 Mar 2023 08:47:07 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C17644201; Wed, 29 Mar 2023 05:47:04 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id p15so19080930ybl.9; Wed, 29 Mar 2023 05:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680094024; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=d4LKIkv2jjaqEZGV9hdNc6tEqjwN//q2Vxizmj38FUA=; b=C/FTOzsvLpqVoXeHw2ea3zPblLBmegOph8K5ugkJuMIeVAh+UCRABDUafaz1f7aIY6 6uf6Eisxla9gTI1kVxoaNMRvLuZ+886001EChYlz+7QAHyUKtffhSZ+X9AgaV5Dhtt4i cUdoYx3/xC5++3RLFEW4Rn3nqjJISH/yMNBoXQmw5JVhqdMNSGq2uHeW/tSjnSOHMLQa YPEPwgq/aw07Xa5Eb8W/ULtEWEPMWzjvndelcYOIxi6SzYfEpuo/wUlWirjvVu84PMP1 vVbBQxeLG0dRy38s+Tx6/biOIJEOPkegxuH0BASHN12MurYJAEfE3M4DGsdnhYNOaZrl ka+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680094024; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d4LKIkv2jjaqEZGV9hdNc6tEqjwN//q2Vxizmj38FUA=; b=OHjyD6SoPlBWaxlf8DY5WWFgtOkShN1AhYYFPL7e4eFE5z5rjYjfgyrH+GWiuM8Ite Z12Dl5yvE3pnIBmiU+MwHVK9WYcS6tE4fNKkQ5Lu2pUWYpE67kzp/EysuNGv3HxUuzME kquZo18bLaOZWjZT2EkMnzq2TKo7DTaNE9VpFfk099sAAEP/10ZBAdLlaJvMwKxLcaUy LCb/CktQembxOvqGhc4NxpmEc5yMqrLcfIYPn1yadw/E1UMIuJxA0GaBleIqi+GsGXZI OWPUNmSJcsPrITSWBXj2ZqEgjNVNTWk7tpor2X27IBOaLJ3c1T1VDok027ENc2pQjxV5 J4jg== X-Gm-Message-State: AAQBX9c+f2Kx5gfXsyiJdmIfmt5GkjrDAR6asE/t87Wq4xJIoffCe4om SE0j8lCTd6M2br1tu8vGHfw= X-Received: by 2002:a25:1141:0:b0:b73:f2ab:8c8b with SMTP id 62-20020a251141000000b00b73f2ab8c8bmr2005620ybr.2.1680094023840; Wed, 29 Mar 2023 05:47:03 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id x94-20020a25a067000000b00b7767ca74a0sm3424611ybh.61.2023.03.29.05.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 05:47:03 -0700 (PDT) Sender: Guenter Roeck Date: Wed, 29 Mar 2023 05:47:00 -0700 From: Guenter Roeck To: "Zhang, Rui" Cc: "peter.ganzhorn@gmail.com" , "linux-hwmon@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 0/4] coretemp: Fix spamming of ring buffer Message-ID: References: <7e821f80b7700fcf1fb26f40bde8397f0e5e6d7e.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7e821f80b7700fcf1fb26f40bde8397f0e5e6d7e.camel@intel.com> X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 On Wed, Mar 29, 2023 at 03:43:58AM +0000, Zhang, Rui wrote: > Hi, Peter, > > CC the list. > > On Tue, 2023-03-28 at 22:37 +0200, Peter Ganzhorn wrote: > > Dear Mr. Rui, > > Dear Mr. Roeck, > > > > please consider accepting the attached patches or > > modifying the coretemp code to stop spamming my syslog. > > I would appreciate it very much if you can accept the patches. > > > > coretemp: Improve dynamic changes of TjMax > > After introduction of dynamic TjMax changes in commit > > c0c67f8761cec1fe36c21d85b1a5400ea7ac30cd > > my syslog gets spammed with "TjMax is ... degrees C" > > messages. > > If TjMax is subject to change at any time, it won't be > > set in tdata anymore and re-read every time from MSR. > > This causes quite a lot of dev_dbg() messages to be issued. > > > > The following patches change the code to read TjMax > > from the MSRs into tdata->tjmax (again) but allow for a > > dynamic update at any time as well. (Patches 1 and 2) > > This way a message will only be issued after actual changes. > > Also I replaced the dev_dbg() with dev_notice (Patch 3) and > > added a additional dev_notice for the case where TjMax is > > set based on assumptions. (Patch 4) > > > > > > If you do not want to accept my patches, removing the > > dev_dbg() in get_tjmax() would be the most simple > > solution I guess. > > > Please check if below patch solves your problem or not. > > From 9370ee5163a85f65230b5222f1f4dece59ce078a Mon Sep 17 00:00:00 2001 > From: Zhang Rui > Date: Wed, 29 Mar 2023 11:35:18 +0800 > Subject: [PATCH] hwmon: (coretemp) Avoid duplicate debug messages > > Avoid duplicate dev_dbg messages when tjmax value retrieved from MSR > does not change. > > Signed-off-by: Zhang Rui > --- > drivers/hwmon/coretemp.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c > index 30d77f451937..809456967b50 100644 > --- a/drivers/hwmon/coretemp.c > +++ b/drivers/hwmon/coretemp.c > @@ -267,6 +267,7 @@ static int get_tjmax(struct temp_data *tdata, struct device *dev) > int err; > u32 eax, edx; > u32 val; > + static u32 tjmax; That would apply to every instance of this driver, meaning to every CPU core. Is that really appropriate ? Guenter > > /* use static tjmax once it is set */ > if (tdata->tjmax) > @@ -287,7 +288,10 @@ static int get_tjmax(struct temp_data *tdata, struct device *dev) > * will be used > */ > if (val) { > - dev_dbg(dev, "TjMax is %d degrees C\n", val); > + if (tjmax != val) { > + dev_dbg(dev, "TjMax is %d degrees C\n", val); > + tjmax = val; > + } > return val * 1000; > } > } > -- > 2.25.1 >