lkml.org 
[lkml]   [2023]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()
Date

> On Oct 18, 2023, at 6:17 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
> I am more thinking of moving the ifdeffery to percpu.h, something like
> the attached part of the patch. This would handle all current and
> future stable percpu variables.

I think that for consistency this_cpu_read_stable() should always be an
rvalue, so instead of:

> #define this_cpu_read_stable(pcp) const_##pcp

You would use a statement expression:

#define this_cpu_read_stable(pcp) ({ const_##pcp; })

This would match the other (existing/fallback) definition of
this_cpu_read_stable.

Having said that, I am not sure what other usages you have in mind.
“current” is a pretty obvious straight forward case with considerable
impact on code generation. There may be additional variables, but it is
likely that there would be more functions/TU in which they would not be
constant and would require more refined techniques to avoid mistakes
such as the use of stale cached values.

\
 
 \ /
  Last update: 2023-10-18 18:03    [W:0.448 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site