Re: [RFC PATCH v3 08/12] lib: vdso: allow arches to provide vdso data pointer

From: Thomas Gleixner
Date: Thu Jan 16 2020 - 05:35:37 EST


Christophe Leroy <christophe.leroy@xxxxxx> writes:
> Le 15/01/2020 Ã 07:15, Christophe Leroy a ÃcritÂ:
> From your point of view, what should I do:
> A/ __arch_get_vdso_data() handled entirely at arch level and arches
> handing over the vdso data pointer to generic C VDSO functions all the
> time (as in my v2 series) ?

No. That's again moving the same code to all architectures.

> B/ Data pointer being handed over all the way up for arches wanting to
> do so, no changes at all for others (as in my v3 series) ?

Too much ifdeffery

> C/ __arch_get_vdso_data() being called at the outermost generic level
> for arches not interested in handling data pointer from the caller (as
> suggested by Thomas) ?
>
> Andy, with A/ you were concerned about arches being able to do PC
> related accesses. Would it be an issue for C/ as well ? If not, I guess
> C/ would be cleaner than B/ allthought not as clean as A which doesn't
> add any #ifdefery at all.

You can avoid ifdeffery with C if you do:

static __maybe_unused int
__cvdso_data_clock_gettime(clockid_t clock, struct __kernel_timespec *ts,
const struct vdso_data *vd)
{
.....
}

static __maybe_unused int
__cvdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
{
const struct vdso_data *vd = __arch_get_vdso_data();

return __cvdso_data_clock_gettime(clock, ts, vd);
}

and then use __cvdso_data_clock_gettime on PPC and let the other archs
unmodified.

Thanks,

tglx