All of lore.kernel.org
 help / color / mirror / Atom feed
* svm vmexit action sequence
@ 2007-05-10 16:01 Jan Beulich
  2007-05-10 16:12 ` Petersson, Mats
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2007-05-10 16:01 UTC (permalink / raw)
  To: xen-devel

Is there any particular reason why on 32-bits the order is VMLOAD then
HVM_SAVE_ALL_NOSEGREGS, while on 64-bits its is the other way around?
Trying to put in the saving of EAX, I could save a GET_CURRENT() on 32-bits
if I could order things the same way as on 64-bits.

Also, both versions seem to have a redundant GET_CURRENT() right after
the clgi/sti sequence - again, is there a particular reason for this?

Thanks, Jan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: svm vmexit action sequence
  2007-05-10 16:01 svm vmexit action sequence Jan Beulich
@ 2007-05-10 16:12 ` Petersson, Mats
  2007-05-11  7:28   ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Petersson, Mats @ 2007-05-10 16:12 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

 

> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com 
> [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of 
> Jan Beulich
> Sent: 10 May 2007 17:02
> To: xen-devel@lists.xensource.com
> Subject: [Xen-devel] svm vmexit action sequence
> 
> Is there any particular reason why on 32-bits the order is VMLOAD then
> HVM_SAVE_ALL_NOSEGREGS, while on 64-bits its is the other way around?
> Trying to put in the saving of EAX, I could save a 
> GET_CURRENT() on 32-bits
> if I could order things the same way as on 64-bits.

I don't see any reason why these shouldn't be the same (or at least as
similar as possible).
> 
> Also, both versions seem to have a redundant GET_CURRENT() right after
> the clgi/sti sequence - again, is there a particular reason for this?

No reason as far as I can tell. Assuming rbx (in 64-bit case) isn't
clobbered by called functions, that is. I can't remember for 64-bit if
rbx is "safe" or not. [It certainly is safe in 32-bit]. 

Thanks for spotting these things.

--
Mats
> 
> Thanks, Jan
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: svm vmexit action sequence
  2007-05-10 16:12 ` Petersson, Mats
@ 2007-05-11  7:28   ` Jan Beulich
  2007-05-11  7:37     ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2007-05-11  7:28 UTC (permalink / raw)
  To: Mats Petersson; +Cc: xen-devel

One more question: both variants have HVM_SAVE_ALL_NOSEGREGS do a
forced reset of eflags/rflags - what is this needed for? #VMEXIT supposedly
restores them. Jan 

>>> "Petersson, Mats" <Mats.Petersson@amd.com> 10.05.07 18:12 >>>


> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com 
> [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of 
> Jan Beulich
> Sent: 10 May 2007 17:02
> To: xen-devel@lists.xensource.com 
> Subject: [Xen-devel] svm vmexit action sequence
> 
> Is there any particular reason why on 32-bits the order is VMLOAD then
> HVM_SAVE_ALL_NOSEGREGS, while on 64-bits its is the other way around?
> Trying to put in the saving of EAX, I could save a 
> GET_CURRENT() on 32-bits
> if I could order things the same way as on 64-bits.

I don't see any reason why these shouldn't be the same (or at least as
similar as possible).
> 
> Also, both versions seem to have a redundant GET_CURRENT() right after
> the clgi/sti sequence - again, is there a particular reason for this?

No reason as far as I can tell. Assuming rbx (in 64-bit case) isn't
clobbered by called functions, that is. I can't remember for 64-bit if
rbx is "safe" or not. [It certainly is safe in 32-bit]. 

Thanks for spotting these things.

--
Mats
> 
> Thanks, Jan
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com 
> http://lists.xensource.com/xen-devel 
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: svm vmexit action sequence
  2007-05-11  7:28   ` Jan Beulich
@ 2007-05-11  7:37     ` Keir Fraser
  0 siblings, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2007-05-11  7:37 UTC (permalink / raw)
  To: Jan Beulich, Mats Petersson; +Cc: xen-devel

See the unstable staging tree for some changes already in this area. As you
can see there is still quite some scope for improvement - I bet we can just
get rid of this push/popf pair for example. And the horrendous
VMLOAD/VMSAVE/VMLOAD/VMSAVE sequence can probably be shoved off at least to
only context switches.

 -- Keir

On 11/5/07 08:28, "Jan Beulich" <jbeulich@novell.com> wrote:

> One more question: both variants have HVM_SAVE_ALL_NOSEGREGS do a
> forced reset of eflags/rflags - what is this needed for? #VMEXIT supposedly
> restores them. Jan
> 
>>>> "Petersson, Mats" <Mats.Petersson@amd.com> 10.05.07 18:12 >>>
> 
> 
>> -----Original Message-----
>> From: xen-devel-bounces@lists.xensource.com
>> [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of
>> Jan Beulich
>> Sent: 10 May 2007 17:02
>> To: xen-devel@lists.xensource.com
>> Subject: [Xen-devel] svm vmexit action sequence
>> 
>> Is there any particular reason why on 32-bits the order is VMLOAD then
>> HVM_SAVE_ALL_NOSEGREGS, while on 64-bits its is the other way around?
>> Trying to put in the saving of EAX, I could save a
>> GET_CURRENT() on 32-bits
>> if I could order things the same way as on 64-bits.
> 
> I don't see any reason why these shouldn't be the same (or at least as
> similar as possible).
>> 
>> Also, both versions seem to have a redundant GET_CURRENT() right after
>> the clgi/sti sequence - again, is there a particular reason for this?
> 
> No reason as far as I can tell. Assuming rbx (in 64-bit case) isn't
> clobbered by called functions, that is. I can't remember for 64-bit if
> rbx is "safe" or not. [It certainly is safe in 32-bit].
> 
> Thanks for spotting these things.
> 
> --
> Mats
>> 
>> Thanks, Jan
>> 
>> 
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>> 
>> 
>> 
> 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: svm vmexit action sequence
@ 2007-05-11  7:42 Jan Beulich
  2007-05-11  7:51 ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2007-05-11  7:42 UTC (permalink / raw)
  To: Mats Petersson; +Cc: xen-devel

Sorry, yet another question: both variants adjust rSP around the 
vmload/vmrun/vmsave block - since these adjustments are already inverting
one another on 64-bits (and I'm making them so also on 32-bits), I would
think they could equally well both be left off - I think nothing inspects the
host VMCB while the guest is running, and hence nothing can get confused
by these pointing to a different stack slot.

Finally, is there a win of using an adjustment to rSP through add/sub
compared to using a push? I'd like to make the 64-bit save/restore
sequences symmetrical in either both skipping the RAX slot or both
pushing/popping a value (the pop would obviously go to a different
register, as the value must be discarded). I would even consider
replacing the whole push/pop sequences by using moves - this ought
to be faster, despite creating bigger code (assuming that the
throughput of moves is higher than that of back-to-back pushes/pops).

Jan

>>> "Petersson, Mats" <Mats.Petersson@amd.com> 10.05.07 18:12 >>>


> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com 
> [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of 
> Jan Beulich
> Sent: 10 May 2007 17:02
> To: xen-devel@lists.xensource.com 
> Subject: [Xen-devel] svm vmexit action sequence
> 
> Is there any particular reason why on 32-bits the order is VMLOAD then
> HVM_SAVE_ALL_NOSEGREGS, while on 64-bits its is the other way around?
> Trying to put in the saving of EAX, I could save a 
> GET_CURRENT() on 32-bits
> if I could order things the same way as on 64-bits.

I don't see any reason why these shouldn't be the same (or at least as
similar as possible).
> 
> Also, both versions seem to have a redundant GET_CURRENT() right after
> the clgi/sti sequence - again, is there a particular reason for this?

No reason as far as I can tell. Assuming rbx (in 64-bit case) isn't
clobbered by called functions, that is. I can't remember for 64-bit if
rbx is "safe" or not. [It certainly is safe in 32-bit]. 

Thanks for spotting these things.

--
Mats
> 
> Thanks, Jan
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com 
> http://lists.xensource.com/xen-devel 
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: svm vmexit action sequence
  2007-05-11  7:42 Jan Beulich
@ 2007-05-11  7:51 ` Keir Fraser
  0 siblings, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2007-05-11  7:51 UTC (permalink / raw)
  To: Jan Beulich, Mats Petersson; +Cc: xen-devel

On 11/5/07 08:42, "Jan Beulich" <jbeulich@novell.com> wrote:

> I would even consider
> replacing the whole push/pop sequences by using moves - this ought
> to be faster, despite creating bigger code (assuming that the
> throughput of moves is higher than that of back-to-back pushes/pops).

If moves can be measured as faster than pushes/pops on a reasonable range of
processors, it would make sense to change all our entry/exit sequences
rather than just this one and stick to one idiom (push/pop) or the other
(mov).

 -- Keir

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-05-11  7:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-10 16:01 svm vmexit action sequence Jan Beulich
2007-05-10 16:12 ` Petersson, Mats
2007-05-11  7:28   ` Jan Beulich
2007-05-11  7:37     ` Keir Fraser
  -- strict thread matches above, loose matches on Subject: below --
2007-05-11  7:42 Jan Beulich
2007-05-11  7:51 ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.