Skip to contentSkip to conversation

Task Switching and Xen-SVM

DISCUSSION Vivek Mohan 4 participants 8 messages Oct 27, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I was just going through the (svm.c) svm_vmexit_handler() in the SVM part of Xen, and saw that:

case VMEXIT_TASK_SWITCH:

        __hvm_bug(regs);
        break;

task switches are not intercepted and handled. I was wondering if it is not so, then how do you manage consistency of the VM if the Guest does a task switch (which could alter the value of CR3)? Am I missing something here?

Thanks,
Vivek

#1 lore raw
Quoted 11 lines · Vivek Mohan

I was just going through the (svm.c) svm_vmexit_handler() in the SVM part of Xen, and saw that:

case VMEXIT_TASK_SWITCH:

         __hvm_bug(regs);
         break;

task switches are not intercepted and handled. I was wondering if it is not so, then how do you manage consistency of the VM if the Guest does a task switch (which could alter the value of CR3)? Am I missing something here?

Task switches aren't currently supported. The guest is marked as 'crashed' if it attempts to do one.

-- Keir

#2 lore raw
In reply to Vivek Mohan
Quoted 13 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Vivek Mohan
Sent: 27 October 2006 07:29
To: [email protected]
Subject: [Xen-devel] Task Switching and Xen-SVM

Hi,

I was just going through the (svm.c) svm_vmexit_handler() in the SVM part of Xen, and saw that:

Quoted 8 lines

case VMEXIT_TASK_SWITCH:

         __hvm_bug(regs);
         break;

task switches are not intercepted and handled. I was wondering if it is not so, then how do you manage consistency of the VM if the Guest does a task switch (which could alter the value of CR3)? Am I missing something here?

AMD and Intel are doing the same thing here.

Do you actually know of any (32-bit) OS that uses task switching? In my experience, it's horribly slow (because it generally saves/restores more of the context than is necessary). Of course, in 64-bit mode it's not even allowed, all task-management features have been removed... I'm saying 32-bit OS, since there's probably some 16-bit OS's out there that do use task-switching, but those OS's are not able to run on current Xen anyways, since Xen in it's current form is very poor at supporting segments with base != 0 in protected mode. So far I've only seen a few rare reports of anyone actually wishing to run a 16-bit OS...

--
Mats

Quoted 11 lines

Thanks,
Vivek

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

#3 lore raw
Quoted 11 lines · Mats

AMD and Intel are doing the same thing here.

Do you actually know of any (32-bit) OS that uses task switching? In my experience, it's horribly slow (because it generally saves/restores more of the context than is necessary). Of course, in 64-bit mode it's not even allowed, all task-management features have been removed... I'm saying 32-bit OS, since there's probably some 16-bit OS's out there that do use task-switching, but those OS's are not able to run on current Xen anyways, since Xen in it's current form is very poor at supporting segments with base != 0 in protected mode. So far I've only seen a few rare reports of anyone actually wishing to run a 16-bit OS...

It's primarily used to obtain a fresh context when things have gobe very bad (so, for example, double-fault and NMI exceptions often specify a task gate in the IDT).

-- Keir

#4 lore raw
In reply to Petersson, Mats
Quoted 1 line

Do you actually know of any (32-bit) OS that uses task switching?

It's often used in double fault, NMI and MCA handlers, all of which are typically fatal.

It would still be good to have them implemented to get a decent oops message out though.

Ian

Quoted 2 lines

In my
experience, it's horribly slow (because it generally saves/restores

more

Quoted 3 lines

of the context than is necessary). Of course, in 64-bit mode it's not even allowed, all task-management features have been removed... I'm saying 32-bit OS, since there's probably some 16-bit OS's out there

that

Quoted 1 line

do use task-switching, but those OS's are not able to run on current

Xen

Quoted 24 lines

anyways, since Xen in it's current form is very poor at supporting segments with base != 0 in protected mode. So far I've only seen a few rare reports of anyone actually wishing to run a 16-bit OS...

--
Mats

Quoted 11 lines

Thanks,
Vivek

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

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

#5 lore raw
Quoted 9 lines

-----Original Message-----
From: Ian Pratt [mailto:[email protected]]
Sent: 27 October 2006 10:07
To: Petersson, Mats; Vivek Mohan; [email protected]
Cc: [email protected]
Subject: RE: [Xen-devel] Task Switching and Xen-SVM

Quoted 8 lines
Quoted 1 line

Do you actually know of any (32-bit) OS that uses task switching?

It's often used in double fault, NMI and MCA handlers, all of which are
typically fatal.

It would still be good to have them implemented to get a decent oops message out though.

Good point. On the other hand, double-fault is caught by SVM (vmx.c doesn't seem to do the same here) and debug info printed to the console before we ship the DF back into the guest, so it should be detectable what went wrong there.

NMI and MCA shouldn't happen in the guest - at least not in the current architecture where NMI and MCA are all handled in Xen. Is there a reasonable cause for this to change anytime soon? [How do we know what guest cause MCE - as memory related MCE's happen on the processor owning the memory, and may also be caused by the "memory scrubber". And it doesn't really make much sense to give MCE's to the guest, as it's generally a hardware related problem.]

NMI's to guest may make more sense if we take for example performance counters... Not sure if this is important or not... Performance counting in the guest is another "interesting" topic where it's hard for the guest to make sense of the numbers without knowing about the hypervisor, I think...

--
Mats

Quoted 41 lines

Ian

Quoted 2 lines

In my
experience, it's horribly slow (because it generally saves/restores

more

Quoted 1 line

of the context than is necessary). Of course, in 64-bit

mode it's not

Quoted 2 lines

even allowed, all task-management features have been removed... I'm saying 32-bit OS, since there's probably some 16-bit OS's out there

that

Quoted 1 line

do use task-switching, but those OS's are not able to run on current

Xen

Quoted 2 lines

anyways, since Xen in it's current form is very poor at supporting segments with base != 0 in protected mode. So far I've only

seen a few

Quoted 22 lines

rare reports of anyone actually wishing to run a 16-bit OS...

--
Mats

Quoted 11 lines

Thanks,
Vivek

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

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

#6 lore raw
Quoted 10 lines
Quoted 8 lines
Quoted 1 line

Do you actually know of any (32-bit) OS that uses task switching?

It's often used in double fault, NMI and MCA handlers, all of which are
typically fatal.

It would still be good to have them implemented to get a decent oops message out though.

NMI and MCA shouldn't happen in the guest - at least not in the

current

Quoted 3 lines

architecture where NMI and MCA are all handled in Xen. Is there a reasonable cause for this to change anytime soon? [How do we know what guest cause MCE - as memory related MCE's happen on the processor

owning

Quoted 6 lines

the memory, and may also be caused by the "memory scrubber". And it doesn't really make much sense to give MCE's to the guest, as it's generally a hardware related problem.]

NMI's to guest may make more sense if we take for example performance counters... Not sure if this is important or not... Performance

counting

Quoted 2 lines

in the guest is another "interesting" topic where it's hard for the guest to make sense of the numbers without knowing about the

hypervisor,

Quoted 1 line

I think...

Well, having the s/w equivalent of the NMI 'dump' button would be useful.

Ian

Quoted 7 lines

--
Mats

Quoted 5 lines

Ian

Quoted 2 lines

In my
experience, it's horribly slow (because it generally

saves/restores

Quoted 4 lines
Quoted 4 lines

more

Quoted 1 line

of the context than is necessary). Of course, in 64-bit

mode it's not

Quoted 1 line

even allowed, all task-management features have been removed...

I'm

Quoted 1 line
Quoted 1 line
Quoted 1 line

saying 32-bit OS, since there's probably some 16-bit OS's out

there

Quoted 2 lines
Quoted 2 lines

that

Quoted 1 line

do use task-switching, but those OS's are not able to run on

current

Quoted 30 lines
Quoted 29 lines

Xen

Quoted 2 lines

anyways, since Xen in it's current form is very poor at supporting segments with base != 0 in protected mode. So far I've only

seen a few

Quoted 22 lines

rare reports of anyone actually wishing to run a 16-bit OS...

--
Mats

Quoted 11 lines

Thanks,
Vivek

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

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

#7 lore raw
In reply to Petersson, Mats

True, not really many OSes, atleast the ones that matter, use task switching, but I was just wondering how well Xen w/ HVM would scale as a full architectural simulator - apparently not.

Any idea why SVM (or VMX) have no support for non-intrusive stepwise execution of guest VMs?

-Vivek

Quoted 50 lines · Mats
Quoted 13 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Vivek Mohan
Sent: 27 October 2006 07:29
To: [email protected]
Subject: [Xen-devel] Task Switching and Xen-SVM

Hi,

I was just going through the (svm.c) svm_vmexit_handler() in the SVM part of Xen, and saw that:

Quoted 8 lines

case VMEXIT_TASK_SWITCH:

         __hvm_bug(regs);
         break;

task switches are not intercepted and handled. I was wondering if it is not so, then how do you manage consistency of the VM if the Guest does a task switch (which could alter the value of CR3)? Am I missing something here?

AMD and Intel are doing the same thing here.

Do you actually know of any (32-bit) OS that uses task switching? In my experience, it's horribly slow (because it generally saves/restores more of the context than is necessary). Of course, in 64-bit mode it's not even allowed, all task-management features have been removed... I'm saying 32-bit OS, since there's probably some 16-bit OS's out there that do use task-switching, but those OS's are not able to run on current Xen anyways, since Xen in it's current form is very poor at supporting segments with base != 0 in protected mode. So far I've only seen a few rare reports of anyone actually wishing to run a 16-bit OS...

--
Mats

Quoted 11 lines

Thanks,
Vivek

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

Signature · 2 lines
http://sig9.com/vivek/
Sig9.com  - Sugar for your brain