linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Andi Kleen <andi@firstfloor.org>, tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	torvalds@linux-foundation.org, arjan@linux.intel.com,
	dave.hansen@intel.com,  Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] x86/retpoline: Optimize inline assembler for vmexit_fill_RSB
Date: Thu, 18 Jan 2018 13:41:09 +0100	[thread overview]
Message-ID: <1516279269.4937.125.camel@infradead.org> (raw)
In-Reply-To: <20180117225328.15414-1-andi@firstfloor.org>

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

On Wed, 2018-01-17 at 14:53 -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> I was looking at the generated assembler for the C fill RSB
> inline asm operations, and noticed several issues:
> 
> - The C code sets up the loop register, which
> is then immediately overwritten in __FILL_RETURN_BUFFER
> with the same value again.
> 
> - The C code also passes in the iteration count
> in another register, which is not used at all.
> 
> Remove these two unnecessary operations. Just rely on
> the single constant passed to the macro for the iterations.
> 
> This eliminates several instructions and avoids unnecessarily
> clobbering a register.
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>

We still clobber the register, but you're right it's now filled in the
__FILL_RETURN_BUFFER macro itself. It was a previous iteration which
had the loop count passed in.

Acked-by: David Woodhouse <dwmw@amazon.co.uk>

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]

  reply	other threads:[~2018-01-18 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 22:53 [PATCH] x86/retpoline: Optimize inline assembler for vmexit_fill_RSB Andi Kleen
2018-01-18 12:41 ` David Woodhouse [this message]
2018-01-19 15:49 ` [tip:x86/pti] " tip-bot for Andi Kleen

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=1516279269.4937.125.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=arjan@linux.intel.com \
    --cc=dave.hansen@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).