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

Re: [Xen-devel] [PATCH 00/11] Alternate p2m: support multiple copies of host p2m



On 01/15/2015 09:45 AM, Tim Deegan wrote:
> At 09:28 -0800 on 15 Jan (1421310487), Ed White wrote:
>> On 01/15/2015 12:16 AM, Jan Beulich wrote:
>>>>>> On 14.01.15 at 18:35, <edmund.h.white@xxxxxxxxx> wrote:
>>>> On 01/14/2015 03:28 AM, Tamas K Lengyel wrote:
>>>>> At the mem_access trap point you can swap in an altp2m where the
>>>>> gfn->mfn mapping is the one where the breakpoints are hidden,
>>>>> singlestep, then swap the original p2m back. While this approach still
>>>>> has some overhead because of the use of singlestepping, it is going to
>>>>> be faster then what you currently have to do, which is removing all
>>>>> breakpoints, singlestep, then put breakpoints back. Now it would just
>>>>> be a matter of swapping a single pointer.
>>>>
>>>> Right. The key observation is that at any single point in time, a given
>>>> hardware thread can be fetching an instruction or reading data, but not
>>>> both.
>>>
>>> Fine, as long as an instruction reading itself isn't going to lead to
>>> a live lock.
>>>
>>
>> That's not how the hardware works. By the time you figure out that the
>> instruction you are executing reads memory, the instruction itself has
>> been fetched and decoded. That won't happen again during this execution.
> 
> Can you explain?  If the instruction faults and is returned to,
> execution starts again, right?  So for an instruction that reads itself:
> 
> - the fetch succeeds;
> - the read fails, and we fault;
> - the hypervisor switches from mapping MFN 1 (--x) to MFN 2 (r--);
> - the hypervisor returns to the guest.
> 
> Are you relying on the icache/trace cache/whatever to restart
> the instruction from a cached value rather than fault immediately?
> (Because the hypervisor didn't flush the TLB when it changed the mapping)?
> 

Nope. I just typed before drinking enough coffee. That whole answer was bogus.

Of course, if an instruction reads itself you can get a live lock using
these techniques, but it's a software-induced live lock and software can
avoid it. One way is compare the address being read with the instruction
pointer, and if they are on the same page emulate instead of switching p2m's.

Ed


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.