virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Chris Wright <chrisw@sous-sol.org>,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: changing definition of paravirt_ops.iret
Date: Mon, 21 May 2007 11:37:03 -0700	[thread overview]
Message-ID: <4651E6CF.9010001@vmware.com> (raw)
In-Reply-To: <4651C865.9090605@goop.org>

Jeremy Fitzhardinge wrote:
> I'm implementing a more efficient version of the Xen iret paravirt_op,
> so that it can use the real iret instruction where possible.  I really
> need to get access to per-cpu variables, so I can set the event mask
> state in the vcpu_info structure, but unfortunately at the point where
> INTERRUPT_RETURN is used in entry.S, the usermode %fs has already been
> restored.
>
> How would you feel if we changed paravirt_ops.iret to make it also
> responsible for restoring %fs? 
>
> In other words, change RESTORE_REGS to skip %fs, and then native_iret
> would look like:
>
> 1:	popl %fs
> 	iret
>
> with the normal exception stuff.  Fortunately, %fs is already the first
> thing to be saved and last to be restored, so there's no major
> rearrangements.
>
> Ideally I'd also like a register to play with, but that would require
> rearranging pt_regs, which is a bit tricky.
>   

Strongly nacked.  If you need %fs and a free register, just push / pop 
them yourself.  We use push / pop to get %eax free for IRET in the VMI ROM.

A change in IRET call convention is performance critical, and has severe 
negative effects on VMI, since we then need to wrap the IRET entry point 
in the ROM with more code in Linux - so iret is a jump to fs restore, 
call to ROM gobbledygook that misaligns the call/return stack and rots 
performance in some hitherto unkown case - perhaps on native.

There is absolutely no argument that re-arranging entry.S like this is 
nightmarish and makes the code near unmaintainable without carefully 
considering the effects on paravirt-ops hypervisors.

If you really absolutely must avoid reloading %fs for your own 
performance, I can suggest several alternative schemes that, while more 
complex, might also make native exception handling faster, thus 
justifying the hack-to-bitty-pieces of entry.S

Zach

  parent reply	other threads:[~2007-05-21 18:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-21 16:27 changing definition of paravirt_ops.iret Jeremy Fitzhardinge
2007-05-21 16:46 ` Chris Wright
2007-05-21 16:53   ` Jeremy Fitzhardinge
2007-05-21 18:37 ` Zachary Amsden [this message]
2007-05-22  0:08   ` Jeremy Fitzhardinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4651E6CF.9010001@vmware.com \
    --to=zach@vmware.com \
    --cc=chrisw@sous-sol.org \
    --cc=ebiederm@xmission.com \
    --cc=jeremy@goop.org \
    --cc=virtualization@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).