Skip to contentSkip to conversation

Question on shadow_invlpg return value handling.

DISCUSSION aditya shevalkar 2 participants 2 messages Mar 27, 2007

lore
Share & tools
lore
#0 lore raw

HI all,
I am trying to understand the invlpg vmexit case.
In this the sh_invlpg function is called from the shadow_invlpg function and the comment explains that the sh_invlpg function returns 1 in one case and zero in other case.But as I have seen return value from sh_invlpg is not used in shadow_invlpg function.
Can anyone explain me where does this return values from sh_invlpg are used.
The comment is given below:
/* Called when the guest requests an invlpg. Returns 1 if the invlpg
* instruction should be issued on the hardware, or 0 if it's safe not
* to do so. */
I have followed the following path of function call in my study of the function. vmx_vmexit_do_invlpg(va) à shadow_invlpg(v, va) à sh_invlpg(struct vcpu *v, unsigned long va). The files are given below:
shadow_invlpg àxen\include\asm-x86\shadow.h
sh_invlpg à xen\arch\x86\mm\shadow\multi.c
Specially what happens if it returns 1.

Thanks and Regards,
Aditya .

__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/

#1 lore raw
Quoted 7 lines · aditya shevalkar

Can anyone explain me where does this return values from sh_invlpg are used.
The comment is given below:
/* Called when the guest requests an invlpg. Returns 1 if the invlpg
* instruction should be issued on the hardware, or 0 if it's safe not
* to do so. */
I have followed the following path of function call in my study of the function. vmx_vmexit_do_invlpg(va) à shadow_invlpg(v, va) à sh_invlpg(struct vcpu *v, unsigned long va).

The VMX (and SVM) code ignores the return code of shadow_invlpg at the moment, because they both flush the entire TLB on every VM entry anyway (AMD's hardware support for tagged TLBs is apparently not quite useable yet).

arch/x86/mm.c, which handles PV guests, uses the return code correctly, e.g.:

  case MMUEXT_INVLPG_LOCAL:
       if ( !shadow_mode_enabled(d) 
            || shadow_invlpg(v, op.arg1.linear_addr) != 0 )
           local_flush_tlb_one(op.arg1.linear_addr);
       break;

Cheers,

Tim.

Signature · 2 lines
Tim Deegan <[email protected]>, XenSource UK Limited
Registered office c/o EC2Y 5EB, UK; company number 05334508