Skip to contentSkip to conversation

HWMON periodically collection

DISCUSSION Guenter Roeck 2 participants 3 messages Oct 11, 2023 – Oct 12, 2023 1 message not in the archive Hardware monitoring

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Guenter Roeck

author maintainer
#1 lore raw
Quoted 9 lines · Almog

Hi all,

We'd like to collect hwmon sensors and get their min/max/avg for our platforms.

Those sensors doesn't support min/max by HW and only support reading current values (they also don't support avg but that is likely the case for all other devices).

For that goal of getting min/max/avg we have two options:

1. Write userspace service that will constantly read the values and do the calculations (and later report to our database)

Yes, this is what you'll have to do.

Quoted 2 lines

2. Extend HWMON subsystem/library so each registering hwmon device will ask the subsystem to do it for you.
Then kernel will create workqueue and constantly read the values and make the calculations (which shall later be readable via hwmon sysfs)

No. This would add runtime overhead to each hwmon device even if the information is not used (which would be the case for almost every user).

Guenter

#2 lore raw
Quoted 4 lines · Guenter Roeck
Quoted 2 lines · Almog

Hi all,

Quoted 8 lines
Quoted 7 lines

We'd like to collect hwmon sensors and get their min/max/avg for our platforms.

Those sensors doesn't support min/max by HW and only support reading current values (they also don't support avg but that is likely the case for all other devices).

For that goal of getting min/max/avg we have two options:

1. Write userspace service that will constantly read the values and do the calculations (and later report to our database)

Yes, this is what you'll have to do.

We appreciate the prompt response!

Quoted 5 lines
Quoted 3 lines

2. Extend HWMON subsystem/library so each registering hwmon device will ask the subsystem to do it for you.
Then kernel will create workqueue and constantly read the values and make the calculations (which shall later be readable via hwmon sysfs)

No. This would add runtime overhead to each hwmon device even if the information is not used (which would be the case for almost every user).

That is a fair point.

What about enabling this during runtime in case user will want to utilize this?

e.g. ioctl/sysfs/debugfs

Of course users can configure the interval during runtime (or even devfreq based?).

The only concern we had for doing it from usrespace is the short interval (and multiple sensors) required will create overhead. Of course doing that in kernel space doesn't make this overhead go away and even worsen it as we don't go via scheduler. (but does ease userspace/kernelspace context switch).

And of course the added value of contributing such a feature which does make sense as probably many want to know across their HW what is the power consumption. are you aware of some package that supply this kind of info? or everyone interested is doing some sort of home made solution?

Quoted 2 lines

Guenter

author maintainer
#3 lore raw
Quoted 21 lines · Talel
Quoted 4 lines · Guenter Roeck
Quoted 2 lines · Almog

Hi all,

Quoted 8 lines
Quoted 7 lines

We'd like to collect hwmon sensors and get their min/max/avg for our platforms.

Those sensors doesn't support min/max by HW and only support reading current values (they also don't support avg but that is likely the case for all other devices).

For that goal of getting min/max/avg we have two options:

1. Write userspace service that will constantly read the values and do the calculations (and later report to our database)

Yes, this is what you'll have to do.

We appreciate the prompt response!

Quoted 5 lines
Quoted 3 lines

2. Extend HWMON subsystem/library so each registering hwmon device will ask the subsystem to do it for you.
Then kernel will create workqueue and constantly read the values and make the calculations (which shall later be readable via hwmon sysfs)

No. This would add runtime overhead to each hwmon device even if the information is not used (which would be the case for almost every user).

Quoted 7 lines

That is a fair point.

What about enabling this during runtime in case user will want to utilize this?

e.g. ioctl/sysfs/debugfs

No.

Quoted 9 lines

Of course users can configure the interval during runtime (or even devfreq based?).

The only concern we had for doing it from usrespace is the short interval (and multiple sensors) required will create overhead. Of course doing that in kernel space doesn't make this overhead go away and even worsen it as we don't go via scheduler. (but does ease userspace/kernelspace context switch).

Following your logic, we should implement pretty much everything in the kernel to avoid userspace/kernelspace context switches. Sorry, we'll have to agree to disagree here.

Quoted 6 lines

And of course the added value of contributing such a feature which does make sense as probably many want to know across their HW what is the power consumption. are you aware of some package that supply this kind of info? or everyone interested is doing some sort of home made solution?

Presumably various userspace packages implement this, but I don't know of any specific ones.

Guenter