Re: linux-next: add utrace tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Ananth N Mavinakayanahalli <ananth@xxxxxxxxxx> wrote:

> On Thu, Jan 28, 2010 at 09:55:02AM +0100, Ingo Molnar wrote:
> 
> ...
> 
> > Lets compare the two cases via a drawing. Your current uprobes submission 
> > does:
> > 
> >  [kernel]      do probe thing     single-step trap
> >                ^            |     ^              |
> >                |            v     |              v
> >  [user]     INT3            XOL-ins              next ins-stream
> > 
> >  ( add the need for serialization to make sure the whole single-step thing 
> >    does not get out of sync with reality. )
> > 
> > And emulator approach would do:
> > 
> >  [kernel]      emul-demux-fastpath, do probe thing
> >                ^                                 |
> >                |                                 v
> >  [user]     INT3                                 next ins-stream
> > 
> > far simpler conceptually, and faster as well, because it's one kernel entry.
> 
> Ingo,
> 
> Yes, conceptually, emulation is simpler. In fact, it may even be the
> right thing to do from a housekeeping POV if gdb were enabled to use
> breakpoint assistance in the kernel. However... emulation is not
> easy. Just quoting Peter Anvin:
> 
> > On the more general rule of interpretation: I'm really concerned about
> > having a bunch of partially-capable x86 interpreters all over the
> > kernel.  x86 is *hard* to emulate, and it will only get harder as the
> > architecture evolves.
> >
> >       -hpa

This is obviously true for a full emulator. Except for the fact that:

> Yes, I know you suggested we start with a small subset.

and for the fact that we already have emulators in the kernel.

Plus we _already_ need to decode instructions for safe kprobing and have the 
code for that upstream. So it's not like we can avoid decoding the 
instructions. (and emulating certain instruction patterns is really just a 
natural next step of a good decoder.)

> We already have an implementation of instruction emulation in kernel for x86 
> and powerpc, but its too KVM centric. If there is a generic emulation layer, 
> we would use it.

So this approach, beyond being simpler, more robust and faster than the 
current XOL code, would also trigger (much needed) cleanups in other parts of 
the kernel and would share code with other kernel subsystems.

Dont you see the obvious advantages of that?

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux