From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Venkatesh Pallipadi <venki@google.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org, mingo@redhat.com
Subject: RE: [RFC] Exposing TSC "reliability" to userland
Date: Tue, 4 May 2010 16:51:01 -0700 (PDT) [thread overview]
Message-ID: <691ab2ec-380b-4294-bab3-53fbf3fa33fc@default> (raw)
In-Reply-To: <m2z3055132f1005041616r2d6a9747i32b8187912049182@mail.gmail.com>
> > Running a warp test in userland is not nearly as accurate
> > as the warp test run by the kernel. So it makes sense to expose
> > the results of the kernel warp test to userland, maybe
> > through /sys/devices/system/clocksource/tsc_reliable
> >
> > Comments?
>
> [ Sorry if this is a duplicate. I had messed up my mail client format
> setting ]
>
> One option is to remove tsc from
> /sys/devices/system/clocksource/clocksource*/available_clocksource
> when it is detected as unstable.
>
> That should already be happening with NOHZ or HIGHRES selected. But,
> should be simple to add some code to do this always.
>
> Would that work?
Hi Venki --
In some offlist discussion, a similar solution was suggested:
If /sys/devices/system/clocksource/clocksource*/current_clocksource
is "tsc" AND the "Invariant TSC" CPUID bit is set, then "reliable TSC"
can be assumed.
BUT, exposing the information explicitly from the kernel would be
more comforting rather than requiring some reverse-engineering some
combination of kernel tests that might change over time. If the
kernel determines TSC is reliable, that seems like it should be
good enough for userland.
AND it was also pointed out that userland usage of TSC is almost
useless unless some reliable reasonably-precise frequency is also
known. A possible solution to this is to expose:
/sys/devices/system/clocksource/clocksource*/clocksource_mult and
/sys/devices/system/clocksource/clocksource*/clocksource_shift
(or some other more TSC-specific name) and provide the same
mult/shift values the kernel uses for clocksource_cyc2ns().
By the way, excuse my ignorance, but is there ever a clocksourceN
where N is not zero?
Hope things are going well in google-land!
Thanks,
Dan
prev parent reply other threads:[~2010-05-04 23:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-03 20:21 [RFC] Exposing TSC "reliability" to userland Dan Magenheimer
2010-05-04 23:16 ` Venkatesh Pallipadi
2010-05-04 23:51 ` Dan Magenheimer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=691ab2ec-380b-4294-bab3-53fbf3fa33fc@default \
--to=dan.magenheimer@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=venki@google.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox