public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org, Uros Bizjak <ubizjak@gmail.com>
Cc: linux-tip-commits@vger.kernel.org,
	"H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	x86@kernel.org, Nathan Chancellor <nathan@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [tip: x86/percpu] x86/percpu: Convert this_percpu_xchg_op() from asm() to C code, to generate better code
Date: Wed, 20 Mar 2024 12:45:55 +0100	[thread overview]
Message-ID: <ZfrMcyZXCBQD/sE8@gmail.com> (raw)
In-Reply-To: <171093476000.10875.14076471223590027773.tip-bot2@tip-bot2>


* tip-bot2 for Uros Bizjak <tip-bot2@linutronix.de> wrote:

> The following commit has been merged into the x86/percpu branch of tip:
> 
> Commit-ID:     0539084639f3835c8d0b798e6659ec14a266b4f1
> Gitweb:        https://git.kernel.org/tip/0539084639f3835c8d0b798e6659ec14a266b4f1
> Author:        Uros Bizjak <ubizjak@gmail.com>
> AuthorDate:    Wed, 20 Mar 2024 09:30:40 +01:00
> Committer:     Ingo Molnar <mingo@kernel.org>
> CommitterDate: Wed, 20 Mar 2024 12:29:02 +01:00
> 
> x86/percpu: Convert this_percpu_xchg_op() from asm() to C code, to generate better code
> 
> Rewrite percpu_xchg_op() using generic percpu primitives instead
> of using asm. The new implementation is similar to local_xchg() and
> allows the compiler to perform various optimizations: e.g. the
> compiler is able to create fast path through the loop, according
> to likely/unlikely annotations in percpu_try_cmpxchg_op().

So, while at it, there's two other x86 percpu code generation details I was 
wondering about:

1)

Right now it's GCC-only:

  config CC_HAS_NAMED_AS
          def_bool CC_IS_GCC && GCC_VERSION >= 120100

Because we wanted to create a stable core of known-working functionality.

I suppose we have already established that with the current merge window, 
so it might be time to expand it.

Clang claims to be compatible:

  https://releases.llvm.org/9.0.0/tools/clang/docs/LanguageExtensions.html

  "You can also use the GCC compatibility macros __seg_fs and __seg_gs for the
   same purpose. The preprocessor symbols __SEG_FS and __SEG_GS indicate their
   support."

I haven't tried it yet though.

2)

Also, is the GCC_VERSION cutoff accurate - are previous GCC versions 
known-buggy, or was it primarily a risk-reduction cutoff?

Thanks,

	Ingo

  reply	other threads:[~2024-03-20 11:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20  8:30 [PATCH 1/2] x86/percpu: Define this_percpu_xchg_op() Uros Bizjak
2024-03-20  8:30 ` [PATCH 2/2] x86/percpu: Move raw_percpu_xchg_op() to a better place Uros Bizjak
2024-03-20 11:22   ` [tip: x86/percpu] " tip-bot2 for Uros Bizjak
2024-03-20 11:39   ` tip-bot2 for Uros Bizjak
2024-03-20 11:22 ` [tip: x86/percpu] x86/percpu: Convert this_percpu_xchg_op() from asm() to C code, to generate better code tip-bot2 for Uros Bizjak
2024-03-20 11:39 ` tip-bot2 for Uros Bizjak
2024-03-20 11:45   ` Ingo Molnar [this message]
2024-03-20 13:12     ` Uros Bizjak
2024-03-20 17:37       ` Nathan Chancellor

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=ZfrMcyZXCBQD/sE8@gmail.com \
    --to=mingo@kernel.org \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=ubizjak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox