Skip to contentSkip to conversation

xc_vcpu_setcontext problem with translated shadow page table domains

DISCUSSION Tim Wood 2 participants 5 messages Nov 21, 2006 – Nov 22, 2006

lore
Share & tools
lore

Tim Wood

author
#0 lore raw

Hi,
I'm working on save/restore for (non hvm) domains with the auto_translated_physmap feature enabled. I've based my code roughly off of a patch to provide save/restore support for HVM domains, but I'm running into problems when I try to restore a domain.

My call to xc_vcpu_setcontext() is failing during restoration -- is there anything unusual about context structs for these types of domains?

In my save function I write to disk the value returned from xc_vcpu_getcontext(), which I then read back in during my restore function and pass to xc_vcpu_setcontext(). Can someone think of a reason why this would fail?

thanks for any ideas,
-Tim

#1 lore raw

RE: xc_vcpu_setcontext problem with translated shadow pagetable domains

Quoted 6 lines

I'm working on save/restore for (non hvm) domains with the auto_translated_physmap feature enabled. I've based my code roughly off of a patch to provide save/restore support for HVM domains, but I'm running into problems when I try to restore a domain.

Quoted 8 lines

My call to xc_vcpu_setcontext() is failing during restoration -- is there anything unusual about context structs for these types of domains?

In my save function I write to disk the value returned from xc_vcpu_getcontext(), which I then read back in during my restore function and pass to xc_vcpu_setcontext(). Can someone think of a reason why this would fail?

Are you getting the restore domain into the right shadow pagetable mode?

Otherwise things like the pagetable base will be invalid (you don't need to canonical-ize it on save as its already in gpfn form).

Ian

author
#2 lore raw

Re: xc_vcpu_setcontext problem with translated shadow pagetable domains

Quoted 6 lines · Ian Pratt
Quoted 6 lines

I'm working on save/restore for (non hvm) domains with the auto_translated_physmap feature enabled. I've based my code roughly off of a patch to provide save/restore support for HVM domains, but I'm running into problems when I try to restore a domain.

Quoted 6 lines
Quoted 3 lines

My call to xc_vcpu_setcontext() is failing during restoration -- is there anything unusual about context structs for these types of domains?

Are you getting the restore domain into the right shadow pagetable mode?

I can see that when I restore the domain it is aware that the "auto_translated_physmap" feature is being used, so I am assuming that will result in the selection of the correct shadow page table mode. I'll try to look and see whether that is actually happening.

Quoted 8 lines

Otherwise things like the pagetable base will be invalid (you don't need to canonical-ize it on save as its already in gpfn form).

Ian

Right -- I'm just copying the page table/memory contents directly without canonicalizing (a nice benefit of using shadows!).

Thanks
- Tim

author
#3 lore raw

Re: xc_vcpu_setcontext problem with translated shadow pagetable domains

Quoted 11 lines · Tim Wood
Quoted 10 lines · Ian Pratt
Quoted 9 lines

I'm working on save/restore for (non hvm) domains with the auto_translated_physmap feature enabled. I've based my code roughly off of a patch to provide save/restore support for HVM domains, but I'm running into problems when I try to restore a domain.

My call to xc_vcpu_setcontext() is failing during restoration -- is there anything unusual about context structs for these types of domains?

Quoted 7 lines
Quoted 2 lines

Are you getting the restore domain into the right shadow pagetable mode?

I can see that when I restore the domain it is aware that the "auto_translated_physmap" feature is being used, so I am assuming that will result in the selection of the correct shadow page table mode. I'll try to look and see whether that is actually happening.

You are right (as usual) -- the restored domains return false for shadow_mode_translate() so they are not using shadow mode like they should. As a result the set_gdt function is dying since gmfn_to_mfn() returns bad values. Any pointers to where this mode is typically enabled on domain startup?

The output from the restore function in libxc shows that when it reads in the configuration file from the saved location it knows that the auto_translated_physmap feature is enabled for the domain, but I guess it is not acting on that to correctly enable shadow mode.

thanks
-Tim

#4 lore raw

RE: xc_vcpu_setcontext problem with translated shadow pagetable domains

Quoted 3 lines
Quoted 3 lines

I can see that when I restore the domain it is aware that the "auto_translated_physmap" feature is being used, so I am assuming

that

Quoted 8 lines
Quoted 2 lines

will result in the selection of the correct shadow page table mode. I'll try to look and see whether that is actually happening.

You are right (as usual) -- the restored domains return false for shadow_mode_translate() so they are not using shadow mode like they should. As a result the set_gdt function is dying since gmfn_to_mfn() returns bad values. Any pointers to where this mode is typically enabled on domain startup?

See the following code in xc_linux_build.c :

963 if ( xc_shadow_control(xc_handle, dom,
964
XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE,
965 NULL, 0, NULL, 0, NULL) < 0 )
966 {
967 PERROR("Could not enable translation mode");
968 goto error_out;
969 }

Ian

Quoted 7 lines

The output from the restore function in libxc shows that when it reads in the configuration file from the saved location it knows that the auto_translated_physmap feature is enabled for the domain, but I guess it is not acting on that to correctly enable shadow mode.

thanks
-Tim