linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Dan Carpenter <error27@gmail.com>
Cc: oe-kbuild@lists.linux.dev, Fenghua Yu <fenghua.yu@intel.com>,
	lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	Frederic Weisbecker <frederic@kernel.org>
Subject: Re: [PATCH] hwmon: coretemp: avoid RDMSR interruptions to isolated CPUs
Date: Mon, 26 Dec 2022 09:43:57 -0300	[thread overview]
Message-ID: <Y6mXDUZkII5OnuE8@tpad> (raw)
In-Reply-To: <202212170101.tpSDqf7K-lkp@intel.com>

On Fri, Dec 23, 2022 at 01:48:14PM +0300, Dan Carpenter wrote:
> Hi Marcelo,
> 
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Marcelo-Tosatti/hwmon-coretemp-avoid-RDMSR-interruptions-to-isolated-CPUs/20221215-204904
> patch link:    https://lore.kernel.org/r/Y5sWMEG0xCl9bgEi%40tpad
> patch subject: [PATCH] hwmon: coretemp: avoid RDMSR interruptions to isolated CPUs
> config: i386-randconfig-m021
> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <error27@gmail.com>
> 
> smatch warnings:
> drivers/hwmon/coretemp.c:181 show_temp() warn: inconsistent returns '&tdata->update_lock'.
> 
> vim +181 drivers/hwmon/coretemp.c
> 
> 199e0de7f5df31 Durgadoss R     2011-05-20  154  static ssize_t show_temp(struct device *dev,
> 199e0de7f5df31 Durgadoss R     2011-05-20  155  			struct device_attribute *devattr, char *buf)
> 199e0de7f5df31 Durgadoss R     2011-05-20  156  {
> bebe467823c0d8 Rudolf Marek    2007-05-08  157  	u32 eax, edx;
> 199e0de7f5df31 Durgadoss R     2011-05-20  158  	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
> 199e0de7f5df31 Durgadoss R     2011-05-20  159  	struct platform_data *pdata = dev_get_drvdata(dev);
> 199e0de7f5df31 Durgadoss R     2011-05-20  160  	struct temp_data *tdata = pdata->core_data[attr->index];
> 199e0de7f5df31 Durgadoss R     2011-05-20  161  
> 199e0de7f5df31 Durgadoss R     2011-05-20  162  	mutex_lock(&tdata->update_lock);
> bebe467823c0d8 Rudolf Marek    2007-05-08  163  
> 199e0de7f5df31 Durgadoss R     2011-05-20  164  	/* Check whether the time interval has elapsed */
> 199e0de7f5df31 Durgadoss R     2011-05-20  165  	if (!tdata->valid || time_after(jiffies, tdata->last_updated + HZ)) {
> e78264610cd902 Marcelo Tosatti 2022-12-15  166  		if (!housekeeping_cpu(tdata->cpu, HK_TYPE_MISC))
> e78264610cd902 Marcelo Tosatti 2022-12-15  167  			return -EINVAL;
> 
> mutex_unlock(&tdata->update_lock);
> 
> 199e0de7f5df31 Durgadoss R     2011-05-20  168  		rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx);
> bf6ea084ebb54c Guenter Roeck   2013-11-20  169  		/*
> bf6ea084ebb54c Guenter Roeck   2013-11-20  170  		 * Ignore the valid bit. In all observed cases the register
> bf6ea084ebb54c Guenter Roeck   2013-11-20  171  		 * value is either low or zero if the valid bit is 0.
> bf6ea084ebb54c Guenter Roeck   2013-11-20  172  		 * Return it instead of reporting an error which doesn't
> bf6ea084ebb54c Guenter Roeck   2013-11-20  173  		 * really help at all.
> bf6ea084ebb54c Guenter Roeck   2013-11-20  174  		 */
> bf6ea084ebb54c Guenter Roeck   2013-11-20  175  		tdata->temp = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000;
> 952a11ca32a604 Paul Fertser    2021-09-24  176  		tdata->valid = true;
> 199e0de7f5df31 Durgadoss R     2011-05-20  177  		tdata->last_updated = jiffies;
> bebe467823c0d8 Rudolf Marek    2007-05-08  178  	}
> bebe467823c0d8 Rudolf Marek    2007-05-08  179  
> 199e0de7f5df31 Durgadoss R     2011-05-20  180  	mutex_unlock(&tdata->update_lock);
> bf6ea084ebb54c Guenter Roeck   2013-11-20 @181  	return sprintf(buf, "%d\n", tdata->temp);
> bebe467823c0d8 Rudolf Marek    2007-05-08  182  }
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://01.org/lkp

Thanks,

v3 of the patch should not suffer from this issue.


      reply	other threads:[~2022-12-26 13:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 12:42 [PATCH] hwmon: coretemp: avoid RDMSR interruptions to isolated CPUs Marcelo Tosatti
2022-12-15 14:22 ` Guenter Roeck
2022-12-16 14:07   ` [PATCH v2] " Marcelo Tosatti
2022-12-16 17:56     ` Guenter Roeck
2022-12-16 20:24       ` [PATCH v3] " Marcelo Tosatti
2022-12-28 15:59         ` Guenter Roeck
2022-12-23 10:48 ` [PATCH] " Dan Carpenter
2022-12-26 12:43   ` Marcelo Tosatti [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=Y6mXDUZkII5OnuE8@tpad \
    --to=mtosatti@redhat.com \
    --cc=error27@gmail.com \
    --cc=fenghua.yu@intel.com \
    --cc=frederic@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /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).