Re: [PATCH 03/17] vdso: Add generic time data storage

From: Thomas Weißschuh
Date: Wed Dec 18 2024 - 05:26:17 EST


Hi Christophe,

On Wed, Dec 18, 2024 at 08:32:14AM +0100, Christophe Leroy wrote:
> Le 16/12/2024 à 15:09, Thomas Weißschuh a écrit :
> > Historically each architecture defined their own way to store the vDSO
> > data page. Add a generic mechanism to provide storage for that page.
> >
> > Furthermore this generic storage will be extended to also provide
> > uniform storage for *non*-time-related data, like the random state or
> > architecture-specific data. These will have their own pages and data
> > structures, so rename 'vdso_data' into 'vdso_time_data' to make that
> > split clear from the name.
> >
> > Also introduce a new consistent naming scheme for the symbols related to
> > the vDSO, which makes it clear if the symbol is accessible from
> > userspace or kernel space and the type of data behind the symbol.
> >
> > The generic fault handler contains an optimization to prefault the vvar
> > page when the timens page is accessed. This was lifted from s390 and x86.
> >
> > Co-developed-by: Nam Cao <namcao@xxxxxxxxxxxxx>
> > Signed-off-by: Nam Cao <namcao@xxxxxxxxxxxxx>
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> > ---
> > MAINTAINERS | 1 +
> > include/linux/time_namespace.h | 1 +
> > include/linux/vdso_datastore.h | 10 +++++
> > include/vdso/datapage.h | 69 +++++++++++++++++++++++++----
> > lib/Kconfig | 1 +
> > lib/Makefile | 2 +
> > lib/vdso_kernel/Kconfig | 7 +++
> > lib/vdso_kernel/Makefile | 3 ++
> > lib/vdso_kernel/datastore.c | 99 ++++++++++++++++++++++++++++++++++++++++++
>
> There is only one single file, namely datastore.c. You don't need a new
> directory for that, I should go in lib/vdso/

lib/vdso/ currently only contains userspace code.
I don't have a strong opinion on that.
The lib/vdso_kernel location was suggested by tglx, maybe he has some
feedback. (Originally I put it into kernel/vdso_storage.c)

[..]

> > +enum vdso_pages {
> > + VDSO_TIME_PAGE_OFFSET,
> > + VDSO_TIMENS_PAGE_OFFSET,
> > + VDSO_NR_PAGES
> > +};
>
> Naming that VDSO_ is confusing. Most macros called VDSO_ are related to the
> VDSO Code. VDSO data related macros should be prefixed with VVAR_

Also a request from tglx.

[..]


Thanks!
Thomas