public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
* userspace regression with hwmon
@ 2017-06-26 14:33 Sudip Mukherjee
  2017-06-26 17:06 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2017-06-26 14:33 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare; +Cc: linux-kernel, Fenghua Yu, linux-hwmon

Hi Guenter, Jean,

The patch d72d19c26c41 ("hwmon: (coretemp) Convert to use
devm_hwmon_device_register_with_groups") has changed the location of the
sysfs nodes from /sys/devices/platform/coretemp.0/ to
/sys/devices/platform/coretemp.0/hwmon/hwmon0/ and that has broken
some of our usespace applications when we have updated the kernel from
v3.8 to v4.4. For now I am reverting that said patch in our production
kernel (based on v4.4) but that is not an elegant solution.
Do you have any other reports like this? I am sure changing the paths
upstream will now break some other userspace. So, what can be an elegant
solution to our problem? or do we always need to carry an out-of-tree
patch for our production kernel?

--
Regards
Sudip  

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: userspace regression with hwmon
  2017-06-26 14:33 userspace regression with hwmon Sudip Mukherjee
@ 2017-06-26 17:06 ` Guenter Roeck
  2017-06-27 12:23   ` Sudip Mukherjee
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2017-06-26 17:06 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Jean Delvare, linux-kernel, Fenghua Yu, linux-hwmon

On Mon, Jun 26, 2017 at 03:33:20PM +0100, Sudip Mukherjee wrote:
> Hi Guenter, Jean,
> 
> The patch d72d19c26c41 ("hwmon: (coretemp) Convert to use
> devm_hwmon_device_register_with_groups") has changed the location of the
> sysfs nodes from /sys/devices/platform/coretemp.0/ to
> /sys/devices/platform/coretemp.0/hwmon/hwmon0/ and that has broken
> some of our usespace applications when we have updated the kernel from
> v3.8 to v4.4. For now I am reverting that said patch in our production
> kernel (based on v4.4) but that is not an elegant solution.
> Do you have any other reports like this? I am sure changing the paths
> upstream will now break some other userspace. So, what can be an elegant
> solution to our problem? or do we always need to carry an out-of-tree
> patch for our production kernel?
> 

The problem only occurs if attributes are accessed using the raw path,
and if user space does not take into account that attributes may reside
in the hwmon directory (/sys/class/hwmon/hwmonX) _or_ in the device
directory (/sys/class/hwmon/hwmonX/device). There is no guarantee that
the raw path doesn't change from release to release; that is what the
symlinks are for. Actually, I have seen the raw platform device path
change over time, so I am surprised that this never affected you.

You might consider using libsensors to access the attributes.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: userspace regression with hwmon
  2017-06-26 17:06 ` Guenter Roeck
@ 2017-06-27 12:23   ` Sudip Mukherjee
  2017-06-27 12:52     ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2017-06-27 12:23 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Jean Delvare, linux-kernel, Fenghua Yu, linux-hwmon

On Mon, Jun 26, 2017 at 10:06:11AM -0700, Guenter Roeck wrote:
> On Mon, Jun 26, 2017 at 03:33:20PM +0100, Sudip Mukherjee wrote:
> > Hi Guenter, Jean,
> > 
> > The patch d72d19c26c41 ("hwmon: (coretemp) Convert to use
> > devm_hwmon_device_register_with_groups") has changed the location of the
> > sysfs nodes from /sys/devices/platform/coretemp.0/ to
> > /sys/devices/platform/coretemp.0/hwmon/hwmon0/ and that has broken
> > some of our usespace applications when we have updated the kernel from
> > v3.8 to v4.4. For now I am reverting that said patch in our production
> > kernel (based on v4.4) but that is not an elegant solution.
> > Do you have any other reports like this? I am sure changing the paths
> > upstream will now break some other userspace. So, what can be an elegant
> > solution to our problem? or do we always need to carry an out-of-tree
> > patch for our production kernel?
> > 
> 
> The problem only occurs if attributes are accessed using the raw path,
> and if user space does not take into account that attributes may reside
> in the hwmon directory (/sys/class/hwmon/hwmonX) _or_ in the device
> directory (/sys/class/hwmon/hwmonX/device). There is no guarantee that
> the raw path doesn't change from release to release; that is what the
> symlinks are for. Actually, I have seen the raw platform device path
> change over time, so I am surprised that this never affected you.

Well, using the raw platform device path was a bad design decision.
But I still see a difference. In v3.8 all the temp* nodes were in
/sys/class/hwmon/hwmon0/device/ but in v4.4 I can see that they are in
/sys/class/hwmon/hwmon0/. So if we do modify the code, then we still
need to have two versions of userspace code based on the kernel.

--
Regards
Sudip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: userspace regression with hwmon
  2017-06-27 12:23   ` Sudip Mukherjee
@ 2017-06-27 12:52     ` Guenter Roeck
  2017-06-27 13:34       ` Jean Delvare
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2017-06-27 12:52 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Jean Delvare, linux-kernel, Fenghua Yu, linux-hwmon

On 06/27/2017 05:23 AM, Sudip Mukherjee wrote:
> On Mon, Jun 26, 2017 at 10:06:11AM -0700, Guenter Roeck wrote:
>> On Mon, Jun 26, 2017 at 03:33:20PM +0100, Sudip Mukherjee wrote:
>>> Hi Guenter, Jean,
>>>
>>> The patch d72d19c26c41 ("hwmon: (coretemp) Convert to use
>>> devm_hwmon_device_register_with_groups") has changed the location of the
>>> sysfs nodes from /sys/devices/platform/coretemp.0/ to
>>> /sys/devices/platform/coretemp.0/hwmon/hwmon0/ and that has broken
>>> some of our usespace applications when we have updated the kernel from
>>> v3.8 to v4.4. For now I am reverting that said patch in our production
>>> kernel (based on v4.4) but that is not an elegant solution.
>>> Do you have any other reports like this? I am sure changing the paths
>>> upstream will now break some other userspace. So, what can be an elegant
>>> solution to our problem? or do we always need to carry an out-of-tree
>>> patch for our production kernel?
>>>
>>
>> The problem only occurs if attributes are accessed using the raw path,
>> and if user space does not take into account that attributes may reside
>> in the hwmon directory (/sys/class/hwmon/hwmonX) _or_ in the device
>> directory (/sys/class/hwmon/hwmonX/device). There is no guarantee that
>> the raw path doesn't change from release to release; that is what the
>> symlinks are for. Actually, I have seen the raw platform device path
>> change over time, so I am surprised that this never affected you.
> 
> Well, using the raw platform device path was a bad design decision.
> But I still see a difference. In v3.8 all the temp* nodes were in
> /sys/class/hwmon/hwmon0/device/ but in v4.4 I can see that they are in
> /sys/class/hwmon/hwmon0/. So if we do modify the code, then we still
> need to have two versions of userspace code based on the kernel.
> 

Your code should check for the 'name' attribute in both locations.

Guenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: userspace regression with hwmon
  2017-06-27 12:52     ` Guenter Roeck
@ 2017-06-27 13:34       ` Jean Delvare
  0 siblings, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2017-06-27 13:34 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Guenter Roeck, linux-kernel, Fenghua Yu, linux-hwmon

On Tue, 27 Jun 2017 05:52:39 -0700, Guenter Roeck wrote:
> On 06/27/2017 05:23 AM, Sudip Mukherjee wrote:
> > Well, using the raw platform device path was a bad design decision.
> > But I still see a difference. In v3.8 all the temp* nodes were in
> > /sys/class/hwmon/hwmon0/device/ but in v4.4 I can see that they are in
> > /sys/class/hwmon/hwmon0/. So if we do modify the code, then we still
> > need to have two versions of userspace code based on the kernel.
> 
> Your code should check for the 'name' attribute in both locations.

... as libsensors does. If you just do what libsensors does, you'll be
on the safe side.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-27 13:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-26 14:33 userspace regression with hwmon Sudip Mukherjee
2017-06-26 17:06 ` Guenter Roeck
2017-06-27 12:23   ` Sudip Mukherjee
2017-06-27 12:52     ` Guenter Roeck
2017-06-27 13:34       ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox