Messages in this thread | | | From | Uros Bizjak <> | Date | Mon, 1 Apr 2024 21:16:22 +0200 | Subject | Re: warning: cast removes address space '__percpu' of expression |
| |
On Sat, Mar 30, 2024 at 12:57 AM Charlemagne Lasse <charlemagnelasse@gmail.com> wrote: > > After switching to linux 6.9-rc1, I get a lot of these errors (when > compiling with cgcc/sparse): > > ./include/linux/netdevice.h:4033:17: warning: cast removes address > space '__percpu' of expression > > This is around code which wasn't changed and which correctly uses the > per cpu helper. Sparse flags were -Wsparse-all for sparse 0.6.4 > (latest release). Sparse was enabled via C=1 parameter and sparse was > configured using CHECK="sparse -Wsparse-all" > > Problem was introduced between commit 8ae292c66dcb ("x86/lib: Address > kernel-doc warnings") and 3a1d3829e193 ("x86/percpu: Avoid sparse > warning with cast to named address space"). > > I would even go as far as saying that 1ca3683cc6d2 ("x86/percpu: > Enable named address spaces with known compiler version") together > with 3a1d3829e193 ("x86/percpu: Avoid sparse warning with cast to > named address space") triggered this problem
Are you sure this is the offending commit?
The complexity of x86 low-level code forced the whole x86 percpu rewrite to be designed and written in such a way that it can be disabled in a single place. So, using the attached patch will switch x86 percpu functionality back to the previous implementation - and I get the same warnings from the old implementation as when new named address spaces are enabled:
security/selinux/netif.c: note: in included file: /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression /include/linux/netdevice.h:4041:17: warning: cast removes address space '__percpu' of expression
4037 static inline void __dev_put(struct net_device *dev) 4038 { 4039 if (dev) { 4040 #ifdef CONFIG_PCPU_DEV_REFCNT 4041 this_cpu_dec(*dev->pcpu_refcnt); 4042 #else 4043 refcount_dec(&dev->dev_refcnt); 4044 #endif 4045 } 4046 }
Uros.
| |