All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Zhang Rui <rui.zhang@intel.com>
Cc: jdelvare@suse.com, fenghua.yu@intel.com,
	linux-hwmon@vger.kernel.org, srinivas.pandruvada@linux.intel.com
Subject: Re: [PATCH 3/3] hwmon (coretemp): Add support for dynamic ttarget
Date: Sat, 12 Nov 2022 07:10:18 -0800	[thread overview]
Message-ID: <20221112151018.GA512473@roeck-us.net> (raw)
In-Reply-To: <59a59d1d69c2647ff2cd62d72d6613660db29d7d.camel@intel.com>

On Sat, Nov 12, 2022 at 04:37:50PM +0800, Zhang Rui wrote:
> Hi, Guenter,
> 
> Thanks for reviewing the patches.
> I will address the comments in next version. And also some comments
> below.
> 
> On Fri, 2022-11-11 at 13:34 -0800, Guenter Roeck wrote:
> > >  
> > >  /* Keep track of how many zone pointers we allocated in init() */
> > >  static int max_zones __read_mostly;
> > > @@ -150,8 +150,17 @@ static ssize_t show_ttarget(struct device
> > > *dev,
> > >  {
> > >  	struct sensor_device_attribute *attr =
> > > to_sensor_dev_attr(devattr);
> > >  	struct platform_data *pdata = dev_get_drvdata(dev);
> > > +	struct temp_data *tdata = pdata->core_data[attr->index];
> > > +	int ttarget;
> > > +
> > > +	mutex_lock(&tdata->update_lock);
> > 
> > Is that mutex really necessary ? I don't immediately see the need
> > for it.
> 
> I just followed the same pattern as show_crit_alarm().
> I checked the history and it was introduced by commit 723f573433b2
> ("hwmon: (coretemp) Fixup target cpu for package when cpu is
> offlined"), to make sure the msr is not running on an offlined cpu.
> 
Good point. I am not sure if it matters at that point if the code
uses the old or the new CPU, but I guess it is safer.

Thanks for the clarification,

Guenter

> > > +
> > > +	/*
> > > +	 * ttarget is valid only if tjmax can be retrieved from
> > > +	 * MSR_IA32_TEMPERATURE_TARGET
> > > +	 */
> > > +	if (tdata->tjmax)
> > > +		return -ENODEV;
> > > +
> > > +	if (c->x86_model <= 0xe || c->x86_model == 0x1c)
> > > +		return -ENODEV;
> > > +
> > 
> > Does it really make sense to re-check this each time the target
> > temperature
> > is read ?
> 
> You're right. We can keep this as it was, when deciding whether to
> create this sysfs attr or not. Then the check in get_ttarget() can be
> removed.
> 
> thanks,
> rui
> 

      reply	other threads:[~2022-11-12 15:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  7:50 [PATCH 0/3] hwmon (coretemp): Add support for dynamic tjmax/ttarget Zhang Rui
2022-11-08  7:50 ` [PATCH 1/3] hwmon (coretemp): Remove obsolete temp_data->valid Zhang Rui
2022-11-11 21:14   ` Guenter Roeck
2022-11-08  7:50 ` [PATCH 2/3] hwmon (coretemp): Add support for dynamic tjmax Zhang Rui
2022-11-11 21:26   ` Guenter Roeck
2022-11-08  7:50 ` [PATCH 3/3] hwmon (coretemp): Add support for dynamic ttarget Zhang Rui
2022-11-11 21:34   ` Guenter Roeck
2022-11-12  8:37     ` Zhang Rui
2022-11-12 15:10       ` Guenter Roeck [this message]

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=20221112151018.GA512473@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=fenghua.yu@intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.