linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Rui" <rui.zhang@intel.com>
To: "peter.ganzhorn@gmail.com" <peter.ganzhorn@gmail.com>,
	"linux@roeck-us.net" <linux@roeck-us.net>
Cc: "linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/4] coretemp: Fix spamming of ring buffer
Date: Wed, 29 Mar 2023 03:43:58 +0000	[thread overview]
Message-ID: <7e821f80b7700fcf1fb26f40bde8397f0e5e6d7e.camel@intel.com> (raw)
In-Reply-To: <CA+3fRbFzq38sQomFM7xJt-UoeLv_ZZbQ2uaHZ+8J_5ntweJ7TA@mail.gmail.com>

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 <rui.zhang@intel.com>
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 <rui.zhang@intel.com>
---
 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;
 
 	/* 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


       reply	other threads:[~2023-03-29  3:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+3fRbFzq38sQomFM7xJt-UoeLv_ZZbQ2uaHZ+8J_5ntweJ7TA@mail.gmail.com>
2023-03-29  3:43 ` Zhang, Rui [this message]
2023-03-29 12:47   ` [PATCH 0/4] coretemp: Fix spamming of ring buffer Guenter Roeck
2023-03-29 14:11     ` Zhang, Rui
2023-03-29 18:53       ` Peter Ganzhorn
2023-03-29 21:49       ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e821f80b7700fcf1fb26f40bde8397f0e5e6d7e.camel@intel.com \
    --to=rui.zhang@intel.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=peter.ganzhorn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).