Re: [patch] paravirt: VDSO page is essential

Ingo Molnar
2007-03-06T08:35:29Z

* Roland McGrath <roland@redhat.com> wrote:

> > Jan Beulich just posted a patch to do just this - relocate the
> > vdso's ELF header. If that's all that's really required to keep
> > COMPAT_VDSO viable under PARAVIRT, then it seems like the way to go.
>
> I found
> http://marc.theaimsgroup.com/?l=xen-devel&m=117309332600075&w=2 and
> that must be the one you meant. The ELF-grokking form of that is
> exactly what I had in mind. The "find relocs with cmp" scheme is
> pretty silly, but also works fine. It trades tweaky ELF knowledge
> with tweaky fragile build methods, but it's all about the same to me.

this looks good to me too in principle, the #else branch. But the actual
implementation will have to be redone quite a bit i fear. Some details:
relocate_vdso() needs some major coding style cleanups. This bit:

-# define VDSO_PRELINK VDSO_HIGH_BASE
+# ifndef CONFIG_XEN
+# define VDSO_PRELINK VDSO_HIGH_BASE
+# else
+# define VDSO_PRELINK (0UL - FIX_VDSO * PAGE_SIZE)
+# endif

should be Kconfig driven, not #ifdef driven, due to cleanliness and also
because lguest wants to have the same thing. Plus:

+#if defined(CONFIG_XEN) && defined(CONFIG_COMPAT_VDSO)

i'd just make this depend on CONFIG_COMPAT_VDSO, always. Same here:

+#if defined(CONFIG_XEN) && defined(CONFIG_COMPAT_VDSO)
+static void __init relocate_vdso

just make this driven in the normal CONFIG_COMPAT_VDSO case too - even
though we 'prelink' the VDSO to the usual address - we better run
through the same code all the time and reduce the number of variants as
much as possible.

furthermore, there should be a paravirt_ops method to chose the
relocation address, unless i'm missing something. On the native kernel
that address will default to 0xffffe000. (if CONFIG_COMPAT_VDSO is
selected)

this way there will only be two main variants to worry about: compat and
modern (which is the current status quo anyway), instead of 4-5
variants.

Ingo