Re: [PATCH 3/9] x86: vdso: Introduce asm/vdso/page.h

Vincenzo Frascino
2024-09-06T11:20:36Z

Hi Arnd,

On 04/09/2024 15:52, Arnd Bergmann wrote:
> On Tue, Sep 3, 2024, at 15:14, Vincenzo Frascino wrote:
>

...

>> +
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef __ASM_VDSO_PAGE_H
>> +#define __ASM_VDSO_PAGE_H
>> +
>> +#ifndef __ASSEMBLY__
>> +
>> +#include <asm/page_types.h>
>> +
>> +#define VDSO_PAGE_MASK PAGE_MASK
>> +#define VDSO_PAGE_SIZE PAGE_SIZE
>> +
>> +#endif /* !__ASSEMBLY__ */
>> +
>> +#endif /* __ASM_VDSO_PAGE_H */
>
> I don't get this one: the x86 asm/page_types.h still includes other
> headers outside of the vdso namespace, but you seem to only need these
> two definitions that are the same across everything.
> > Why not put PAGE_MASK and PAGE_SIZE into a global vdso/page.h
> header? I did spend a lot of time a few months ago ensuring that
> we can have a single definition for all architectures based on
> CONFIG_PAGE_SHIFT, so all the extra copies should just go away.
>
> Arnd
Looking at the definition of PAGE_SIZE and PAGE_MASK for each architecture they
all depend on CONFIG_PAGE_SHIFT but they are slightly different, e.g.:

x86:
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)

powerpc:
#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)

hence I left to the architecture the responsibility of redefining the constants
for the VSDO.

As a long term plan I would like to simplify the code and have a single
definition as you are saying in vdso/page.h for both the macros. But my
preference would be to post it as a separate series so that I can focus more on
validating it properly.

--
Regards,
Vincenzo