Re: [PATCH v3 1/2] x86, msr: allow rdmsr_safe_on_cpu() to schedule

From: Borislav Petkov
Date: Sun Mar 25 2018 - 10:13:44 EST


On Sat, Mar 24, 2018 at 07:29:48AM -0700, Eric Dumazet wrote:
> It is named gsysd, "Google System Tool", a daemon+cli that is run
> on all machines in production to provide a generic interface
> for interacting with the system hardware.

So I'm wondering if poking at the hardware like that is a really optimal
design. Maybe it would be cleaner if the OS would provide properly
abstracted sysfs interfaces instead of raw MSRs. For a couple of
reasons:

* different vendors have different MSR ranges giving the same info so
instead of differentiating that in your daemon, we can do that nicely in
the kernel.

* exposing raw MSRs instead of having clearly defined sysfs files is
always a pain when a new CPU decides to change those MSRs. Hiding that
change in the OS is always easier.

* periodically polling MSRs which don't change that often is, of course,
wasting power and so reading a cached result is leaner.

* <another reason which I'll think of after hitting send... :\ >

In general, we should've never have had exposed that raw MSR access but
it is too late now - that ship has sailed. We can still try to design
new interfaces more cleanly, though.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.