linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: the arch/x86 maintainers <x86@kernel.org>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Dave Hansen <dave.hansen@intel.com>,
	Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@suse.de>,
	linux-mm <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC 0/3] x86: Patchable constants
Date: Wed, 7 Feb 2018 12:20:09 -0800	[thread overview]
Message-ID: <8fea57cc-8772-f8b4-3298-91b0de126358@zytor.com> (raw)
In-Reply-To: <CA+55aFxJO7kDNp6wRnU58Z6-sPbK1SqdzpgLBTAe54mdPjnd=g@mail.gmail.com>

On 02/07/18 09:01, Linus Torvalds wrote:
> 
> Look - much smaller code, and register %rcx isn't used at all. And no
> D$ miss on loading that constant (that is a constant depending on
> boot-time setup only).
> 
> It's rather more complex, but it actually gives a much bigger win. The
> code itself will be much better, and smaller.
> 
> The *infrastructure* for the code gets pretty hairy, though.
> 
> The good news is that the patch already existed to at least _some_
> degree. Peter Anvin did it about 18 months ago.
> 
> It was not really pursued all the way because it *is* a lot of extra
> complexity, and I think there was some other hold-up, but he did have
> skeleton code for the actual replacement.
> 
> There was a thread on the x86 arch list with the subject line
> 
>     Disgusting pseudo-self-modifying code idea: "variable constants"
> 
> but I'm unable to actually find the patch. I know there was at least a
> vert early prototype.
> 
> Adding hpa to the cc in the hope that he has some prototype code still
> laying around..
> 

The patchset I have is about 85% complete.  It mostly needs cleanup,
testing, and breaking into reasonable chunks (it got put on the
backburner for somewhat obvious reasons, but I don't think it'll take
very long at all to productize it.)

The main reason I haven't submitted it yet is that I got a bit overly
ambitious and wanted to implement a whole bunch of more complex
subcases, such as 64-bit shifts on a 32-bit kernel.  The win in that
case is actually quite huge, but it is requires data-dependent code
patching and not just immediate patching, which requires augmentation of
the alternatives framework.

	-hpa


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2018-02-07 20:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07 14:59 Kirill A. Shutemov
2018-02-07 14:59 ` [RFC 1/3] x86: Introduce patchable constants Kirill A. Shutemov
2018-02-07 14:59 ` [RFC 2/3] x86/mm/encrypt: Convert __PHYSICAL_MASK to patchable constant Kirill A. Shutemov
2018-02-07 14:59 ` [RFC 3/3] x86/mm/encrypt: Convert sme_me_mask " Kirill A. Shutemov
2018-02-07 16:25 ` [RFC 0/3] x86: Patchable constants Peter Zijlstra
2018-02-07 17:12   ` Kirill A. Shutemov
2018-02-07 17:01 ` Linus Torvalds
2018-02-07 17:13   ` hpa
2018-02-07 20:20   ` H. Peter Anvin [this message]
2018-02-07 20:43     ` H. Peter Anvin

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=8fea57cc-8772-f8b4-3298-91b0de126358@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@suse.de \
    --cc=dave.hansen@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=thomas.lendacky@amd.com \
    --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