Skip to contentSkip to conversation

arch_set_info_guest() and cr1

DISCUSSION Mukesh Rathor 6 participants 8 messages Aug 12, 2011 – Sep 23, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

Just wondering under what circumstances will cr1 be set in this function?

int arch_set_info_guest(
struct vcpu *v, vcpu_guest_context_u c)
{
.....

#ifdef __x86_64__
        if ( c.nat->ctrlreg[1] )           <------
        {

.....

thanks,
Mukesh

#1 lore raw

We stash the user-space CR3 value there (PV x86_64 guests have two CR3s). Of course you should need only the guest kernel CR3.

K.

Quoted 24 lines · Mukesh Rathor

Hi,

Just wondering under what circumstances will cr1 be set in this function?

int arch_set_info_guest(
struct vcpu *v, vcpu_guest_context_u c)
{
.....

#ifdef __x86_64__
        if ( c.nat->ctrlreg[1] )           <------
        {

.....

thanks,
Mukesh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

Ah I see it, during save/restore, it is used.
Well, I'm trying to keep the option of using PV paging with hybrid, so I may need to honor that. But that's phase 2.

thanks,
Mukesh

Quoted 32 lines · On Fri, 12 Aug 2011 07:16:39 +0100 Keir Fraser <[email protected]> wrote:

We stash the user-space CR3 value there (PV x86_64 guests have two CR3s). Of course you should need only the guest kernel CR3.

K.

Quoted 24 lines · Mukesh Rathor

Hi,

Just wondering under what circumstances will cr1 be set in this function?

int arch_set_info_guest(
struct vcpu *v, vcpu_guest_context_u c)
{
.....

#ifdef __x86_64__
        if ( c.nat->ctrlreg[1] )           <------
        {

.....

thanks,
Mukesh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 3 lines · Mukesh Rathor

Ah I see it, during save/restore, it is used.
Well, I'm trying to keep the option of using PV paging with hybrid, so I may need to honor that. But that's phase 2.

Though it would be nice to re-enable the use of PV writable pagetables to get access to HAP, and we could do without that.

Does Xen require that the user pagetable be a proper subset of the kernel pagetable? If we can assume that and get proper ring protections in the HVM container, then we can simply ignore the user pagetable (and would have to if we want to get good syscall performance).

J

#4 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Jeremy Fitzhardinge
Quoted 3 lines · Mukesh Rathor

Ah I see it, during save/restore, it is used.
Well, I'm trying to keep the option of using PV paging with hybrid, so I may need to honor that. But that's phase 2.

Quoted 7 lines

Though it would be nice to re-enable the use of PV writable pagetables to get access to HAP, and we could do without that.

Does Xen require that the user pagetable be a proper subset of the kernel pagetable? If we can assume that and get proper ring protections in the HVM container, then we can simply ignore the user pagetable (and would have to if we want to get good syscall performance).

No, Xen doesn't enforce anything on the user page table that it wouldn't on a kernel one. In fact, it can't even correlate the respective (kernel,user) pairs.

Jan

#5 lore raw
In reply to Jeremy Fitzhardinge

(old mail, I know)

Quoted 5 lines · Jeremy Fitzhardinge
Quoted 3 lines · Mukesh Rathor

Ah I see it, during save/restore, it is used.
Well, I'm trying to keep the option of using PV paging with hybrid, so I may need to honor that. But that's phase 2.

Quoted 7 lines

Though it would be nice to re-enable the use of PV writable pagetables to get access to HAP, and we could do without that.

Does Xen require that the user pagetable be a proper subset of the kernel pagetable? If we can assume that and get proper ring protections in the HVM container, then we can simply ignore the user pagetable (and would have to if we want to get good syscall performance).

IIRC back when I did the (now completely defunct) supervisor mode kernel stuff that was exactly the assumption which was made and it certainly worked in practice (although "require" might be a strong term).

Ian.

#6 lore raw
Quoted 10 lines · Ian Campbell

(old mail, I know)

Quoted 7 lines · Jeremy Fitzhardinge
Quoted 3 lines · Mukesh Rathor

Ah I see it, during save/restore, it is used.
Well, I'm trying to keep the option of using PV paging with hybrid, so I may need to honor that. But that's phase 2.

Though it would be nice to re-enable the use of PV writable pagetables to get access to HAP, and we could do without that.

Quoted 7 lines
Quoted 4 lines

Does Xen require that the user pagetable be a proper subset of the kernel pagetable? If we can assume that and get proper ring protections in the HVM container, then we can simply ignore the user pagetable (and would have to if we want to get good syscall performance).

IIRC back when I did the (now completely defunct) supervisor mode kernel stuff that was exactly the assumption which was made and it certainly worked in practice (although "require" might be a strong term).

Well, I guess we could add ELF notes to allow a guest to say "I really need separate non-intersecting user/kernel pagetables" if they really need it. Or repurpose auto_translated_physmap to also mean "no separate user/kernel pagetables required". Has that ever been supported for 64-bit PV guests? My memory of the chronology is that it died as a feature at about the time that 64-bit support went in.

J

#7 lore raw
Quoted 15 lines · Jeremy Fitzhardinge
Quoted 14 lines · Ian Campbell

(old mail, I know)

Quoted 11 lines · Jeremy Fitzhardinge
Quoted 3 lines · Mukesh Rathor

Ah I see it, during save/restore, it is used.
Well, I'm trying to keep the option of using PV paging with hybrid, so I may need to honor that. But that's phase 2.

Though it would be nice to re-enable the use of PV writable pagetables to get access to HAP, and we could do without that.

Does Xen require that the user pagetable be a proper subset of the kernel pagetable? If we can assume that and get proper ring protections in the HVM container, then we can simply ignore the user pagetable (and would have to if we want to get good syscall performance).

Quoted 8 lines
Quoted 3 lines

IIRC back when I did the (now completely defunct) supervisor mode kernel stuff that was exactly the assumption which was made and it certainly worked in practice (although "require" might be a strong term).

Well, I guess we could add ELF notes to allow a guest to say "I really need separate non-intersecting user/kernel pagetables" if they really need it. Or repurpose auto_translated_physmap to also mean "no separate user/kernel pagetables required".

IIRC that's effectively one of the things which auto_translated_physmap implies.

Quoted 1 line

Has that ever been supported for 64-bit PV guests?

In the classic patches, yes, but not in the pvops ones AFAIK.

Quoted 4 lines

My memory of the chronology is that it died as a
feature at about the time that 64-bit support went in.

J