All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Ingo Molnar <mingo@kernel.org>
Cc: Wedson Almeida Filho <wedsonaf@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH] x86: Use asm-goto to implement mutex fast path on x86-64
Date: Fri, 28 Jun 2013 16:09:38 +0200	[thread overview]
Message-ID: <20130628140938.GA24819@pd.tnic> (raw)
In-Reply-To: <20130628111948.GA31065@gmail.com>

On Fri, Jun 28, 2013 at 01:19:48PM +0200, Ingo Molnar wrote:
> 
> * Wedson Almeida Filho <wedsonaf@gmail.com> wrote:
> 
> > The new implementation allows the compiler to better optimize the code; the
> > original implementation is still used when the kernel is compiled with older
> > versions of gcc that don't support asm-goto.
> > 
> > Compiling with gcc 4.7.3, the original mutex_lock() is 60 bytes with the fast
> > path taking 16 instructions; the new mutex_lock() is 42 bytes, with the fast
> > path taking 12 instructions.
> > 
> > The original mutex_unlock() is 24 bytes with the fast path taking 7
> > instructions; the new mutex_unlock() is 25 bytes (because the compiler used
> > a 2-byte ret) with the fast path taking 4 instructions.
> > 
> > The two versions of the functions are included below for reference.

Btw, do we have any perf data showing any improvements from this patch?

[ … ]

> One detail:
> 
> > +#if defined(CC_HAVE_ASM_GOTO)
> > +#if defined(CC_HAVE_ASM_GOTO)
> 
> Please change these to #ifdef.

Cool - so we have a scripts/gcc-goto.sh which checks for support
for asm goto.

Our testing for asm goto otherwise is a bit more, hmm, hands-on in
arch/x86/include/asm/cpufeature.h:

#if __GNUC__ > 4 || __GNUC_MINOR__ >= 5

Maybe I should change that to the more explicit CC_HAVE_ASM_GOTO then.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

  reply	other threads:[~2013-06-28 14:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 10:54 [PATCH] x86: Use asm-goto to implement mutex fast path on x86-64 Wedson Almeida Filho
2013-06-28 11:19 ` Ingo Molnar
2013-06-28 14:09   ` Borislav Petkov [this message]
2013-06-28 14:12     ` H. Peter Anvin
2013-06-28 15:15       ` Peter Zijlstra
2013-06-28 16:41       ` [PATCH] x86, cpufeature: Use new CC_HAVE_ASM_GOTO Borislav Petkov
2013-07-05 14:24         ` [tip:x86/cpu] " tip-bot for Borislav Petkov
2013-06-29 23:56     ` [PATCH] x86: Use asm-goto to implement mutex fast path on x86-64 Wedson Almeida Filho
2013-06-30 22:00       ` Borislav Petkov
2013-07-01  7:50         ` Ingo Molnar
2013-07-01 10:23           ` Borislav Petkov
2013-07-01 11:11             ` Ingo Molnar
2013-07-01 12:29               ` Borislav Petkov
2013-07-01 12:50                 ` Ingo Molnar
2013-07-01 14:48                   ` Borislav Petkov
2013-07-01 22:28                     ` Borislav Petkov
2013-07-01 22:35                       ` Wedson Almeida Filho
2013-07-01 22:44                         ` Borislav Petkov
2013-07-02  6:39                           ` Ingo Molnar
2013-07-02 10:29                             ` Borislav Petkov
2013-07-01 14:30             ` H. Peter Anvin
2013-07-01 14:36               ` Borislav Petkov
2013-07-01 14:45                 ` H. Peter Anvin
2013-07-01 14:50                   ` Borislav Petkov

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=20130628140938.GA24819@pd.tnic \
    --to=bp@alien8.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=wedsonaf@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.