mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
percpu: use TYPEOF_UNQUAL() in variable declarations
Use TYPEOF_UNQUAL() to declare variables as a corresponding type without named address space qualifier to avoid "`__seg_gs' specified for auto variable `var'" errors. Link: https://lkml.kernel.org/r/20241208204708.3742696-4-ubizjak@gmail.com Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Acked-by: Nadav Amit <nadav.amit@gmail.com> Acked-by: Christoph Lameter <cl@linux.com> Acked-by: Dennis Zhou <dennis@kernel.org> Cc: Tejun Heo <tj@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Kent Overstreet <kent.overstreet@linux.dev> Cc: Arnd Bergmann <arnd@arndb.de> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will@kernel.org> Cc: Waiman Long <longman@redhat.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
bf3b91c387
commit
9c4ba50565
@ -180,7 +180,7 @@ do { \
|
|||||||
__pcpu_type_##size pto_val__ = __pcpu_cast_##size(_val); \
|
__pcpu_type_##size pto_val__ = __pcpu_cast_##size(_val); \
|
||||||
\
|
\
|
||||||
if (0) { \
|
if (0) { \
|
||||||
typeof(_var) pto_tmp__; \
|
TYPEOF_UNQUAL(_var) pto_tmp__; \
|
||||||
pto_tmp__ = (_val); \
|
pto_tmp__ = (_val); \
|
||||||
(void)pto_tmp__; \
|
(void)pto_tmp__; \
|
||||||
} \
|
} \
|
||||||
@ -219,7 +219,7 @@ do { \
|
|||||||
__pcpu_type_##size pto_val__ = __pcpu_cast_##size(_val); \
|
__pcpu_type_##size pto_val__ = __pcpu_cast_##size(_val); \
|
||||||
\
|
\
|
||||||
if (0) { \
|
if (0) { \
|
||||||
typeof(_var) pto_tmp__; \
|
TYPEOF_UNQUAL(_var) pto_tmp__; \
|
||||||
pto_tmp__ = (_val); \
|
pto_tmp__ = (_val); \
|
||||||
(void)pto_tmp__; \
|
(void)pto_tmp__; \
|
||||||
} \
|
} \
|
||||||
@ -240,7 +240,7 @@ do { \
|
|||||||
(val) == (typeof(val))-1)) ? (int)(val) : 0; \
|
(val) == (typeof(val))-1)) ? (int)(val) : 0; \
|
||||||
\
|
\
|
||||||
if (0) { \
|
if (0) { \
|
||||||
typeof(var) pao_tmp__; \
|
TYPEOF_UNQUAL(var) pao_tmp__; \
|
||||||
pao_tmp__ = (val); \
|
pao_tmp__ = (val); \
|
||||||
(void)pao_tmp__; \
|
(void)pao_tmp__; \
|
||||||
} \
|
} \
|
||||||
@ -273,7 +273,7 @@ do { \
|
|||||||
*/
|
*/
|
||||||
#define raw_percpu_xchg_op(_var, _nval) \
|
#define raw_percpu_xchg_op(_var, _nval) \
|
||||||
({ \
|
({ \
|
||||||
typeof(_var) pxo_old__ = raw_cpu_read(_var); \
|
TYPEOF_UNQUAL(_var) pxo_old__ = raw_cpu_read(_var); \
|
||||||
\
|
\
|
||||||
raw_cpu_write(_var, _nval); \
|
raw_cpu_write(_var, _nval); \
|
||||||
\
|
\
|
||||||
@ -287,7 +287,7 @@ do { \
|
|||||||
*/
|
*/
|
||||||
#define this_percpu_xchg_op(_var, _nval) \
|
#define this_percpu_xchg_op(_var, _nval) \
|
||||||
({ \
|
({ \
|
||||||
typeof(_var) pxo_old__ = this_cpu_read(_var); \
|
TYPEOF_UNQUAL(_var) pxo_old__ = this_cpu_read(_var); \
|
||||||
\
|
\
|
||||||
do { } while (!this_cpu_try_cmpxchg(_var, &pxo_old__, _nval)); \
|
do { } while (!this_cpu_try_cmpxchg(_var, &pxo_old__, _nval)); \
|
||||||
\
|
\
|
||||||
|
@ -586,7 +586,7 @@ do { \
|
|||||||
|
|
||||||
#define per_cpu_sum(_p) \
|
#define per_cpu_sum(_p) \
|
||||||
({ \
|
({ \
|
||||||
typeof(*_p) _ret = 0; \
|
TYPEOF_UNQUAL(*_p) _ret = 0; \
|
||||||
\
|
\
|
||||||
int cpu; \
|
int cpu; \
|
||||||
for_each_possible_cpu(cpu) \
|
for_each_possible_cpu(cpu) \
|
||||||
|
@ -74,7 +74,7 @@ do { \
|
|||||||
|
|
||||||
#define raw_cpu_generic_add_return(pcp, val) \
|
#define raw_cpu_generic_add_return(pcp, val) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) *__p = raw_cpu_ptr(&(pcp)); \
|
TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \
|
||||||
\
|
\
|
||||||
*__p += val; \
|
*__p += val; \
|
||||||
*__p; \
|
*__p; \
|
||||||
@ -82,8 +82,8 @@ do { \
|
|||||||
|
|
||||||
#define raw_cpu_generic_xchg(pcp, nval) \
|
#define raw_cpu_generic_xchg(pcp, nval) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) *__p = raw_cpu_ptr(&(pcp)); \
|
TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \
|
||||||
typeof(pcp) __ret; \
|
TYPEOF_UNQUAL(pcp) __ret; \
|
||||||
__ret = *__p; \
|
__ret = *__p; \
|
||||||
*__p = nval; \
|
*__p = nval; \
|
||||||
__ret; \
|
__ret; \
|
||||||
@ -91,7 +91,7 @@ do { \
|
|||||||
|
|
||||||
#define __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, _cmpxchg) \
|
#define __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, _cmpxchg) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) __val, __old = *(ovalp); \
|
TYPEOF_UNQUAL(pcp) __val, __old = *(ovalp); \
|
||||||
__val = _cmpxchg(pcp, __old, nval); \
|
__val = _cmpxchg(pcp, __old, nval); \
|
||||||
if (__val != __old) \
|
if (__val != __old) \
|
||||||
*(ovalp) = __val; \
|
*(ovalp) = __val; \
|
||||||
@ -100,8 +100,8 @@ do { \
|
|||||||
|
|
||||||
#define raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval) \
|
#define raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) *__p = raw_cpu_ptr(&(pcp)); \
|
TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \
|
||||||
typeof(pcp) __val = *__p, ___old = *(ovalp); \
|
TYPEOF_UNQUAL(pcp) __val = *__p, ___old = *(ovalp); \
|
||||||
bool __ret; \
|
bool __ret; \
|
||||||
if (__val == ___old) { \
|
if (__val == ___old) { \
|
||||||
*__p = nval; \
|
*__p = nval; \
|
||||||
@ -115,14 +115,14 @@ do { \
|
|||||||
|
|
||||||
#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
|
#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) __old = (oval); \
|
TYPEOF_UNQUAL(pcp) __old = (oval); \
|
||||||
raw_cpu_generic_try_cmpxchg(pcp, &__old, nval); \
|
raw_cpu_generic_try_cmpxchg(pcp, &__old, nval); \
|
||||||
__old; \
|
__old; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __this_cpu_generic_read_nopreempt(pcp) \
|
#define __this_cpu_generic_read_nopreempt(pcp) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) ___ret; \
|
TYPEOF_UNQUAL(pcp) ___ret; \
|
||||||
preempt_disable_notrace(); \
|
preempt_disable_notrace(); \
|
||||||
___ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \
|
___ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \
|
||||||
preempt_enable_notrace(); \
|
preempt_enable_notrace(); \
|
||||||
@ -131,7 +131,7 @@ do { \
|
|||||||
|
|
||||||
#define __this_cpu_generic_read_noirq(pcp) \
|
#define __this_cpu_generic_read_noirq(pcp) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) ___ret; \
|
TYPEOF_UNQUAL(pcp) ___ret; \
|
||||||
unsigned long ___flags; \
|
unsigned long ___flags; \
|
||||||
raw_local_irq_save(___flags); \
|
raw_local_irq_save(___flags); \
|
||||||
___ret = raw_cpu_generic_read(pcp); \
|
___ret = raw_cpu_generic_read(pcp); \
|
||||||
@ -141,7 +141,7 @@ do { \
|
|||||||
|
|
||||||
#define this_cpu_generic_read(pcp) \
|
#define this_cpu_generic_read(pcp) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) __ret; \
|
TYPEOF_UNQUAL(pcp) __ret; \
|
||||||
if (__native_word(pcp)) \
|
if (__native_word(pcp)) \
|
||||||
__ret = __this_cpu_generic_read_nopreempt(pcp); \
|
__ret = __this_cpu_generic_read_nopreempt(pcp); \
|
||||||
else \
|
else \
|
||||||
@ -160,7 +160,7 @@ do { \
|
|||||||
|
|
||||||
#define this_cpu_generic_add_return(pcp, val) \
|
#define this_cpu_generic_add_return(pcp, val) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) __ret; \
|
TYPEOF_UNQUAL(pcp) __ret; \
|
||||||
unsigned long __flags; \
|
unsigned long __flags; \
|
||||||
raw_local_irq_save(__flags); \
|
raw_local_irq_save(__flags); \
|
||||||
__ret = raw_cpu_generic_add_return(pcp, val); \
|
__ret = raw_cpu_generic_add_return(pcp, val); \
|
||||||
@ -170,7 +170,7 @@ do { \
|
|||||||
|
|
||||||
#define this_cpu_generic_xchg(pcp, nval) \
|
#define this_cpu_generic_xchg(pcp, nval) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) __ret; \
|
TYPEOF_UNQUAL(pcp) __ret; \
|
||||||
unsigned long __flags; \
|
unsigned long __flags; \
|
||||||
raw_local_irq_save(__flags); \
|
raw_local_irq_save(__flags); \
|
||||||
__ret = raw_cpu_generic_xchg(pcp, nval); \
|
__ret = raw_cpu_generic_xchg(pcp, nval); \
|
||||||
@ -190,7 +190,7 @@ do { \
|
|||||||
|
|
||||||
#define this_cpu_generic_cmpxchg(pcp, oval, nval) \
|
#define this_cpu_generic_cmpxchg(pcp, oval, nval) \
|
||||||
({ \
|
({ \
|
||||||
typeof(pcp) __ret; \
|
TYPEOF_UNQUAL(pcp) __ret; \
|
||||||
unsigned long __flags; \
|
unsigned long __flags; \
|
||||||
raw_local_irq_save(__flags); \
|
raw_local_irq_save(__flags); \
|
||||||
__ret = raw_cpu_generic_cmpxchg(pcp, oval, nval); \
|
__ret = raw_cpu_generic_cmpxchg(pcp, oval, nval); \
|
||||||
|
@ -33,7 +33,7 @@ struct disk_stats {
|
|||||||
|
|
||||||
#define part_stat_read(part, field) \
|
#define part_stat_read(part, field) \
|
||||||
({ \
|
({ \
|
||||||
typeof((part)->bd_stats->field) res = 0; \
|
TYPEOF_UNQUAL((part)->bd_stats->field) res = 0; \
|
||||||
unsigned int _cpu; \
|
unsigned int _cpu; \
|
||||||
for_each_possible_cpu(_cpu) \
|
for_each_possible_cpu(_cpu) \
|
||||||
res += per_cpu_ptr((part)->bd_stats, _cpu)->field; \
|
res += per_cpu_ptr((part)->bd_stats, _cpu)->field; \
|
||||||
|
@ -320,7 +320,7 @@ static __always_inline void __this_cpu_preempt_check(const char *op) { }
|
|||||||
|
|
||||||
#define __pcpu_size_call_return(stem, variable) \
|
#define __pcpu_size_call_return(stem, variable) \
|
||||||
({ \
|
({ \
|
||||||
typeof(variable) pscr_ret__; \
|
TYPEOF_UNQUAL(variable) pscr_ret__; \
|
||||||
__verify_pcpu_ptr(&(variable)); \
|
__verify_pcpu_ptr(&(variable)); \
|
||||||
switch(sizeof(variable)) { \
|
switch(sizeof(variable)) { \
|
||||||
case 1: pscr_ret__ = stem##1(variable); break; \
|
case 1: pscr_ret__ = stem##1(variable); break; \
|
||||||
@ -335,7 +335,7 @@ static __always_inline void __this_cpu_preempt_check(const char *op) { }
|
|||||||
|
|
||||||
#define __pcpu_size_call_return2(stem, variable, ...) \
|
#define __pcpu_size_call_return2(stem, variable, ...) \
|
||||||
({ \
|
({ \
|
||||||
typeof(variable) pscr2_ret__; \
|
TYPEOF_UNQUAL(variable) pscr2_ret__; \
|
||||||
__verify_pcpu_ptr(&(variable)); \
|
__verify_pcpu_ptr(&(variable)); \
|
||||||
switch(sizeof(variable)) { \
|
switch(sizeof(variable)) { \
|
||||||
case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
|
case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
|
||||||
|
@ -159,7 +159,7 @@ struct linux_tls_mib {
|
|||||||
|
|
||||||
#define __SNMP_ADD_STATS64(mib, field, addend) \
|
#define __SNMP_ADD_STATS64(mib, field, addend) \
|
||||||
do { \
|
do { \
|
||||||
__typeof__(*mib) *ptr = raw_cpu_ptr(mib); \
|
TYPEOF_UNQUAL(*mib) *ptr = raw_cpu_ptr(mib); \
|
||||||
u64_stats_update_begin(&ptr->syncp); \
|
u64_stats_update_begin(&ptr->syncp); \
|
||||||
ptr->mibs[field] += addend; \
|
ptr->mibs[field] += addend; \
|
||||||
u64_stats_update_end(&ptr->syncp); \
|
u64_stats_update_end(&ptr->syncp); \
|
||||||
@ -176,8 +176,7 @@ struct linux_tls_mib {
|
|||||||
#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
|
#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
|
||||||
#define __SNMP_UPD_PO_STATS64(mib, basefield, addend) \
|
#define __SNMP_UPD_PO_STATS64(mib, basefield, addend) \
|
||||||
do { \
|
do { \
|
||||||
__typeof__(*mib) *ptr; \
|
TYPEOF_UNQUAL(*mib) *ptr = raw_cpu_ptr(mib); \
|
||||||
ptr = raw_cpu_ptr((mib)); \
|
|
||||||
u64_stats_update_begin(&ptr->syncp); \
|
u64_stats_update_begin(&ptr->syncp); \
|
||||||
ptr->mibs[basefield##PKTS]++; \
|
ptr->mibs[basefield##PKTS]++; \
|
||||||
ptr->mibs[basefield##OCTETS] += addend; \
|
ptr->mibs[basefield##OCTETS] += addend; \
|
||||||
|
@ -184,7 +184,7 @@ EXPORT_SYMBOL_GPL(__percpu_down_read);
|
|||||||
|
|
||||||
#define per_cpu_sum(var) \
|
#define per_cpu_sum(var) \
|
||||||
({ \
|
({ \
|
||||||
typeof(var) __sum = 0; \
|
TYPEOF_UNQUAL(var) __sum = 0; \
|
||||||
int cpu; \
|
int cpu; \
|
||||||
compiletime_assert_atomic_type(__sum); \
|
compiletime_assert_atomic_type(__sum); \
|
||||||
for_each_possible_cpu(cpu) \
|
for_each_possible_cpu(cpu) \
|
||||||
|
@ -33,7 +33,7 @@ struct mpls_dev {
|
|||||||
|
|
||||||
#define MPLS_INC_STATS_LEN(mdev, len, pkts_field, bytes_field) \
|
#define MPLS_INC_STATS_LEN(mdev, len, pkts_field, bytes_field) \
|
||||||
do { \
|
do { \
|
||||||
__typeof__(*(mdev)->stats) *ptr = \
|
TYPEOF_UNQUAL(*(mdev)->stats) *ptr = \
|
||||||
raw_cpu_ptr((mdev)->stats); \
|
raw_cpu_ptr((mdev)->stats); \
|
||||||
local_bh_disable(); \
|
local_bh_disable(); \
|
||||||
u64_stats_update_begin(&ptr->syncp); \
|
u64_stats_update_begin(&ptr->syncp); \
|
||||||
@ -45,7 +45,7 @@ struct mpls_dev {
|
|||||||
|
|
||||||
#define MPLS_INC_STATS(mdev, field) \
|
#define MPLS_INC_STATS(mdev, field) \
|
||||||
do { \
|
do { \
|
||||||
__typeof__(*(mdev)->stats) *ptr = \
|
TYPEOF_UNQUAL(*(mdev)->stats) *ptr = \
|
||||||
raw_cpu_ptr((mdev)->stats); \
|
raw_cpu_ptr((mdev)->stats); \
|
||||||
local_bh_disable(); \
|
local_bh_disable(); \
|
||||||
u64_stats_update_begin(&ptr->syncp); \
|
u64_stats_update_begin(&ptr->syncp); \
|
||||||
|
Loading…
Reference in New Issue
Block a user