mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andy Lutomirski <luto@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>, X86 ML <x86@kernel.org>,
	Borislav Petkov <bp@alien8.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-abi@vger.kernel.org
Subject: Re: Can we break RDPID/RDTSCP ABI ASAP and see if it's okay?
Date: Mon, 13 Nov 2017 14:54:43 +0100	[thread overview]
Message-ID: <814b0b22-ab9a-cb2b-b968-03e584700794@redhat.com> (raw)
In-Reply-To: <CALCETrWZBzjw=sGT0SX29NtR+Ki+-eWEH_Yrphzrmi7dLFaBtg@mail.gmail.com>

On 28/10/2017 21:38, Andy Lutomirski wrote:
> We currently do this on boot:
> 
> write_rdtscp_aux((node << 12) | cpu);
> 
> This *sucks*.  It means that, to very quickly obtain the CPU number
> using RDPID, an ALU op is needed.  It also doesn't bloody work on
> systems with more than 4096 CPUs.
> 
> IMO it should be ((u64)node << 32) | cpu.

MSR_TSC_AUX is still documented as reserving bits 32-63 in the October
2017 SDM, and indeed on a Haswell you get a #GP if you write a nonzero
value to it.

Has Intel quietly "unreserved" them on machines that have RDPID?

Thanks,

Paolo

> Then getting the CPU number is just:
> 
> RDPID %rax
> MOVL %eax, %eax
> 
> I'm thinking about this because rseq users could avoid ever *loading*
> the rseq cacheline if they used RDPID to get the CPU number, and it
> would be nice to give them a sane way to do it.
> 
> This won't break any existing RDPID users if we do it quickly because
> there aren't any (the CPUs aren't available).  I would be a bit
> surprised if anyone uses RDTSCP for this because it's absurdly slow.
> 
> We can change this without affecting the LSL hack, and I think there
> are user programs that do the LSL hack.
> 
> --Andy
> 

  parent reply	other threads:[~2017-11-13 13:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-28 19:38 Andy Lutomirski
2017-10-28 23:23 ` Linus Torvalds
2017-10-29  9:08 ` Thomas Gleixner
2017-11-13 13:54 ` Paolo Bonzini [this message]
2017-11-13 18:06   ` Andy Lutomirski

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=814b0b22-ab9a-cb2b-b968-03e584700794@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bp@alien8.de \
    --cc=linux-abi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®