mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andy Lutomirski <luto@kernel.org>
Cc: 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: Sun, 29 Oct 2017 10:08:17 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1710290952440.1922@nanos> (raw)
In-Reply-To: <CALCETrWZBzjw=sGT0SX29NtR+Ki+-eWEH_Yrphzrmi7dLFaBtg@mail.gmail.com>

On Sat, 28 Oct 2017, 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.  Then getting the CPU number is just:

That breaks 32bit

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

What we can do on 64bit is:

     ((u64) cpu << 32) | (node << 12) | (cpu & 0xfff)

That does not solve the ALU op problem but works on both 32 and 64 bit and
on systems with more than 4096 CPUs.

Thanks,

	tglx

  parent reply	other threads:[~2017-10-29  9:08 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 [this message]
2017-11-13 13:54 ` Paolo Bonzini
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=alpine.DEB.2.20.1710290952440.1922@nanos \
    --to=tglx@linutronix.de \
    --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®