Messages in this thread | | | Date | Tue, 19 Jun 2018 08:11:32 -0700 | From | Fenghua Yu <> | Subject | Re: [RFC PATCH 5/8] x86/umwait.c: Add sysfs interface to show tsc_khz |
| |
On Tue, Jun 19, 2018 at 11:08:46AM +0200, Thomas Gleixner wrote: > On Fri, 15 Jun 2018, Fenghua Yu wrote: > > > +static ssize_t tsc_khz_show(struct device *dev, struct device_attribute *attr, > > + char *buf) > > +{ > > + return sprintf(buf, "%d\n", tsc_khz); > > +} > > + > > static DEVICE_ATTR_RW(umwait_disable_c0_2); > > +static DEVICE_ATTR_RO(tsc_khz); > > The right place to expose that information is the VDSO and a helper > function which allows to convert from nsec to TSC.
Sure. I will do that.
> > > static struct attribute *umwait_attrs[] = { > > &dev_attr_umwait_disable_c0_2.attr, > > @@ -92,6 +100,15 @@ static int __init umwait_init(void) > > if (ret) > > return ret; > > > > + /* Only add the tsc_khz interface when the value is known. */ > > Why so? The only reason why you don't want to expose TSC frequency is when > it's not constant frequency.
> > + if (boot_cpu_has(X86_FEATURE_TSC_KNOWN_FREQ)) { >
Thanks.
-Fenghua
| |