All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Razvan Cojocaru <rcojocaru@bitdefender.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: Is it safe to assume that v == current in hvm_do_resume()?
Date: Wed, 22 Oct 2014 10:04:59 +0100	[thread overview]
Message-ID: <5447733B.6010300@citrix.com> (raw)
In-Reply-To: <544766BD.4020009@bitdefender.com>

On 22/10/14 09:11, Razvan Cojocaru wrote:
> Hello,
>
> As far as I've understood the code, and based on several tests, it would
> appear that in xen/arch/x86/hvm/hvm.c, the struct vcpu *v parameter to
> hvm_do_resume() is always equal to current.
>
> Is that a reasonable assumption to make? I could have missed some use
> cases for the function.

The calls look like this:

{vmx,svm}_do_resume is the schedule_tail function pointer, which is a
no-return function and called on the way out of a context switch.

They call hvm_do_resume() followed by a reset_stack_and_jump() to
{vmx,svm}_asm_do_vmentry.

So yes - you can be guaranteed that the v in hvm_do_resume() is current.

If you do come to explicitly rely on this behaviour, and it is in any
way unclear, it might be worth introducing an ASSERT(v == current) near
to the expectation.

~Andrew

  reply	other threads:[~2014-10-22  9:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22  8:11 Is it safe to assume that v == current in hvm_do_resume()? Razvan Cojocaru
2014-10-22  9:04 ` Andrew Cooper [this message]
2014-10-22  9:10   ` Razvan Cojocaru

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=5447733B.6010300@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=xen-devel@lists.xen.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 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.