Re: [tip: x86/percpu] x86/percpu: Convert this_percpu_xchg_op() from asm() to C code, to generate better code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* tip-bot2 for Uros Bizjak <tip-bot2@xxxxxxxxxxxxx> 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@xxxxxxxxx>
> AuthorDate:    Wed, 20 Mar 2024 09:30:40 +01:00
> Committer:     Ingo Molnar <mingo@xxxxxxxxxx>
> 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




[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux