lkml.org 
[lkml]   [2010]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] [PATCH 1/7] User Space Breakpoint Assistance Layer (UBP)
On 01/18/2010 03:15 PM, Peter Zijlstra wrote:
> On Mon, 2010-01-18 at 14:37 +0200, Avi Kivity wrote:
>
>> On 01/18/2010 02:14 PM, Peter Zijlstra wrote:
>>
>>>
>>>> Well, the alternatives are very unappealing. Emulation and
>>>> single-stepping are going to be very slow compared to a couple of jumps.
>>>>
>>>>
>>> With CPL2 or RPL on user segments the protection issue seems to be
>>> manageable for running the instructions from kernel space.
>>>
>>>
>> CPL2 gives unrestricted access to the kernel address space; and RPL does
>> not affect page level protection. Segment limits don't work on x86-64.
>> But perhaps I missed something - these things are tricky.
>>
> So setting RPL to 3 on the user segments allows access to kernel pages
> just fine? How useful.. :/
>

The further we stay away from segmentation, the better. Thankfully AMD
removed hardware task switching from x86-64 so we can't even think about
that.

>> It should be possible to translate the instruction into an address space
>> check, followed by the action, but that's still slower due to privilege
>> level switches.
>>
> Well, if you manage to do the address validation you don't need the priv
> level switch anymore, right?
>

Right.

> Are the ins encodings sane enough to recognize mem parameters without
> needing to know the actual ins?
>

No. You need to know whether the instruction accesses memory or not.

Look at the tables at the beginning of arch/x86/kvm/emulate.c. Opcodes
marked with ModRM, BitOp, MemAbs, String, Stack are all different styles
of memory instructions. You need to know the operand size for the edge
cases. And there are probably a few special cases in the code.

> How about using a hw-breakpoint to close the gap for the inline single
> step? You could even re-insert the int3 lazily when you need the
> hw-breakpoint again. It would consume one hw-breakpoint register for
> each task/cpu that has probes though..
>

If you have more than four threads, it breaks, no? And you need an IPI
each time you hit the breakpoint.

Ultimately I'd like to see the breakpoint avoided as well, use a jump to
the XOL area and trace in ~20 cycles instead of ~1000.

--
error compiling committee.c: too many arguments to function



\
 
 \ /
  Last update: 2010-01-18 14:37    [W:0.767 / U:1.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site