lkml.org 
[lkml]   [2018]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 5/8] x86/umwait.c: Add sysfs interface to show tsc_khz
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.

> 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,

tglx

\
 
 \ /
  Last update: 2018-06-19 11:09    [W:0.239 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site