On Thu, Oct 12, 2023 at 01:18:37PM +0300, Shenhar, Talel wrote: > > On 10/11/2023 6:09 PM, Guenter Roeck wrote: > > > > On Wed, Oct 11, 2023 at 10:45:03AM +0000, Ben Shaul, Almog wrote: > > > 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. > We appreciate the prompt response! > > > > > 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 > No. > 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. > > 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