mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim Wiederhake <twiederh@redhat.com>
To: "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@kernel.org>,
	 Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
		x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] x86/msr: Document I/O-like MSR semantics in /dev/cpu/*/msr driver
Date: Mon, 29 Jun 2026 17:14:12 +0200	[thread overview]
Message-ID: <759ad7207f201e9b81e1d4d9c5ba3d6375db44ec.camel@redhat.com> (raw)
In-Reply-To: <0239cda7-b638-44df-9739-746a7173a577@zytor.com>

On Fri, 2026-06-26 at 14:42 -0700, H. Peter Anvin wrote:
> On 2026-06-26 13:33, Tim Wiederhake wrote:
> > 
> > This version splits the change in two:
> > 
> >   1/2 adds a comment explaining why the driver loops over the same
> >       register, so future readers don't have to rediscover the
> > rationale.
> >   2/2 removes only the read loop, where repeated access to the same
> >       register is less obviously useful.
> > 
> The same applies to the read loop, although the use case(s) are
> obviously
> different.
> 
> Either way, you risk breaking working tools for no reason.
> 
> 	-hpa
While looking into this I also noticed that /dev/cpu/*/msr is the only
register-addressed character device that doesn't advance ppos on read.
/dev/cpu/*/cpuid, /dev/port, and /dev/nvram do. That causes ftell() and
lseek(SEEK_CUR, 0) to disagree after an fread(). I don't know how
important that is though, and whether that is more of a glibc issue.

Can you please point me to a tool that uses the multiple-read behavior?
I want to mention that in the file comment, but turbostat, rdmsr,
cpupower, coreboot's inteltool, all read exactly 8 bytes.

Thanks for the review,
Tim


  reply	other threads:[~2026-06-29 15:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 17:40 [PATCH] x86/msr: Restrict /dev/cpu/*/msr read and write to a single MSR per call Tim Wiederhake
2026-06-26 17:49 ` H. Peter Anvin
2026-06-26 20:17   ` Borislav Petkov
2026-06-26 20:23 ` [PATCH v2 1/2] x86/msr: Document I/O-like MSR semantics in /dev/cpu/*/msr driver Tim Wiederhake
2026-06-26 20:33   ` Tim Wiederhake
2026-06-26 21:42     ` H. Peter Anvin
2026-06-29 15:14       ` Tim Wiederhake [this message]
2026-06-29 15:23         ` H. Peter Anvin
2026-06-29 17:14           ` Tim Wiederhake
2026-06-26 20:23 ` [PATCH v2 2/2] x86/msr: Restrict /dev/cpu/*/msr read to a single MSR per call Tim Wiederhake

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=759ad7207f201e9b81e1d4d9c5ba3d6375db44ec.camel@redhat.com \
    --to=twiederh@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --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

Powered by JetHome