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

Re: [Xen-devel] where can I find the 'address translation' code in Xen?



On Tue, May 1, 2018 at 1:54 PM, Minjun Hong <nickeysgo@xxxxxxxxx> wrote:
> On Mon, Apr 30, 2018 at 10:13 PM, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> wrote:
>>
>> On 29/04/18 11:11, Minjun Hong wrote:
>> > Hi.
>> > I'm looking for a point where address translation (guest virtual
>> > address to machine address) occurs in Xen.
>> > Of course, I mean when TLB miss has occured.
>>
>> This question makes me wonder whether you are more familiar with PowerPC
>> than x86.  In x86, the TLB is automatically maintained by hardware, and
>> new entries will be populated as necessary.  All pagetable related
>> errors result in a pagefault exception, which Xen handles.
>>
>> > I'm using a PV guest and I've found 'guest_walk_tables()' function in
>> > "xen/arch/x86/mm/guest_walk.c".
>> > However, in the comment of the function, it says "Walk the guest
>> > pagetables, after the manner of a hardware walker".
>> > I'm confused because I'm not sure if the function is called after the
>> > 'hardware page table walker'.
>>
>> "after the manner" is an uncommon phrase in English, which AFAICT
>> derives from Latin originally.  It means "in the style of", "in the same
>> way as", etc.
>>
>> guest_walk_tables() is a function which tries to match the behaviour of
>> the hardware pagewalker.  However, it is only used for cases where we
>> can't use regular hardware support, such as emulation of instructions.
>>
>> ~Andrew
>
>
> Thank you, Andrew.
> Your answer is very helpful for me.
>
> It appears that there is no code to be executed when address translations of
> the guest occurs in Xen.
> Frankly, I was expecting there may be an address translation when accessing
> guest memory, and I wanted to find the code used in Xen at that time.
> Is there any code I can use for this purpose in Xen? No matter how I look, I
> could not find it in Xen with my background knowledge right now. So that I
> need your help.

Maybe if you described what it was you were trying to accomplish, we
could help point you in the right direction.

If you actually need to intercept every virtual -> physical
translation, I'm afraid full emulation (such as QEMU) is going to be
your only option.

If you only need to intercept them the first time they're used, then
you might be able to use some combination of VMI and/or shadow mode to
intercept only the virtual -> physical translations you need.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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