Re: [PATCH -tip v2 3/3] x86/percpu: Avoid sparse warning with cast to named address space

From: Uros Bizjak
Date: Mon Dec 04 2023 - 09:03:29 EST


On Mon, Dec 4, 2023 at 12:20 AM Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> Currently sparse does not know about __seg_fs and __seg_fs named
> address space qualifiers. Avoid thousands of warnings about unexpected
> keyword at the end of cast operator by removing named address space
> qualifier from __my_cpu_type() when __CHECKER__ is defined.

We have discussed this issue a bit on the linux-sparse ML [1], and the
proposed solution is to define:

+#define __seg_gs __attribute__((address_space(__seg_gs)))
+#define __seg_fs __attribute__((address_space(__seg_fs)))

as done in the attached patch.

[1] https://lore.kernel.org/linux-sparse/CAFULd4YMcHhkSR4P5tq3ghLQyUCkiTOKS6PQd1Bec-2NicUiwQ@xxxxxxxxxxxxxx/T/#md048c918cd2145c822727e3aa401326e1660842f

Uros.