xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>
Cc: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>
Subject: Re: current not very current (vs curr_vcpu)
Date: Fri, 19 Feb 2010 19:50:03 -0800	[thread overview]
Message-ID: <20100219195003.6d1fb125@mantra.us.oracle.com> (raw)
In-Reply-To: <C7A4B46F.AA72%keir.fraser@eu.citrix.com>

On Fri, 19 Feb 2010 21:34:39 +0000
Keir Fraser <keir.fraser@eu.citrix.com> wrote:

> On 19/02/2010 19:23, "Mukesh Rathor" <mukesh.rathor@oracle.com> wrote:
> 
> > Yes, but my point is it doesn't appear to be running idle vcpu as
> > indicated by regs->rsp and regs->rip. They both point to dom0
> > context. This from printk in ns16550_interrupt().
> > 
> > To rephrase the question, if regs->rip and regs->rsp show guest
> > context in do_IRQ(), then current must always point to guest vcpu,
> > correct?
> 
> Oh, so the serial interrupt interrupted a guest's execution? Then yes,
> current should point at that guest.
> 
>  -- Keir
> 

ah, I see what's going on. context_switch() is scheduling idle vcpu, and
calls continue_idle_domain() to reset_stack_and_jump(idle_loop).
well, reset_stack_and_jump() is setting rsp to guest_cpu_user_regs(),
and interrupt is coming right at that instant. so: 

diff = (char *)guest_cpu_user_regs() - (char *)(r)  is 0

and as a result, guest_mode(regs) == true.

It appears to me, that guest_mode() needs to check if current
rsp is already guest_cpu_user_regs() in which case a stack switch
has not happened, and guest_mode should be false. 
Or, perhaps, just not enable interrupts in context_switch and do 
it in idle_loop().

what do you think?

thanks,
Mukesh

  reply	other threads:[~2010-02-20  3:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19  4:21 current not very current (vs curr_vcpu) Mukesh Rathor
2010-02-19  8:12 ` Keir Fraser
2010-02-19 19:23   ` Mukesh Rathor
2010-02-19 21:34     ` Keir Fraser
2010-02-20  3:50       ` Mukesh Rathor [this message]
2010-02-20  7:45         ` Keir Fraser
2010-02-22 18:59           ` Mukesh Rathor
2010-02-23 19:46           ` Mukesh Rathor
2010-02-23 21:03             ` Keir Fraser
2010-02-24  3:55               ` Mukesh Rathor
2010-02-24 10:45                 ` Keir Fraser
2010-02-25  1:06                   ` Mukesh Rathor
2010-02-25  8:07                     ` Keir Fraser

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=20100219195003.6d1fb125@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=keir.fraser@eu.citrix.com \
    /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).