Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap paravirt ops callsites to make them patchable

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeremy Fitzhardinge
Date: Friday, March 16, 2007 - 5:40 pm

Zachary Amsden wrote:

Thanks.


Yeah, it doesn't try as hard as your example, so its all based around
the function call ABI.  If you want to inline something, you need to do
that elsewhere, which I guess is OK because that's not the
common case (only very simple cases can be replaced by inlines, and only
a few of those are worth doing).


I'm pretty sure that's not what he means.  The big objection to the
PVOP_* stuff is the fact that there are these massive macros full of
inline asm to wrap the calls, which have to be invoked in a fragile
type-unsafe way.  Adding custom relocs would suffer the same problem,
since you'd need inline asm to deal with them, and I'm deathly
frightened of whatever binutils would do if you mean real relocs.

I think the suggestion is much simpler.  If you convince gcc/binutils to
leave the .reloc section in vmlinux, and make that available to the
kernel itself, then you can scan all the kernel's relocs to find ones
which refer to paravirt_ops, and use those to determine which are
callsites that can be patched.

The main upside is that all the callsites are just normal C calls;
there's no special syntax or strange macros, and we get the full benefit
of typechecking, etc.

But I can see a few downsides compared the current scheme:

   1. Identifying the callsites is a somewhat hackish process of looking
      at a reloc and doing a bit of dissassembly to see what is using
      the reloc, to identify calls and jumps
   2. There's nothing explicit to tell us how much space there is to
      patch into; we just have to assume sizeof(indirect call/jmp)
   3. There's no information about the register environment at the
      callsite, so we just have to adopt normal C ABI rules.  For the
      patch sites in hand-written asm, this could be tricky.
   4. gcc could do strange things which prevent detection of patch
      sites.  For example, it might CSE the value of, say,
      paravirt_ops.irq_enable, which would be a reasonable optimisation,
      but prevent any of the resulting indirect calls from being
      patched.  In general it relies on gcc to generate identifiable
      callsites, which is a bit unpredictable.
   5. There's still a moderate amount of binutils hackery to get the
      relocs into the right form, and there's plenty of scope for it to
      screw up.



    J
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 13/26] Xen-paravirt_ops: Consistently wrap paravirt ..., Jeremy Fitzhardinge, (Thu Mar 1, 4:24 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Fri Mar 16, 10:36 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Fri Mar 16, 12:16 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Fri Mar 16, 1:38 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Fri Mar 16, 5:40 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Sun Mar 18, 12:59 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Sun Mar 18, 8:58 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Sun Mar 18, 10:29 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Sun Mar 18, 4:46 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Mon Mar 19, 10:58 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Eric W. Biederman, (Mon Mar 19, 11:25 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Mon Mar 19, 12:10 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Mon Mar 19, 12:33 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Mon Mar 19, 1:06 pm)
[PATCH] x86_64 : Suppress __jiffies, Eric Dumazet, (Mon Mar 19, 2:55 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Mon Mar 19, 6:45 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Eric W. Biederman, (Mon Mar 19, 9:19 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Mon Mar 19, 10:54 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Eric W. Biederman, (Tue Mar 20, 8:58 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Eric W. Biederman, (Tue Mar 20, 9:25 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Tue Mar 20, 9:26 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Tue Mar 20, 9:31 am)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Tue Mar 20, 4:33 pm)
Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap para ..., Jeremy Fitzhardinge, (Tue Mar 20, 5:20 pm)