From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: current not very current (vs curr_vcpu) Date: Fri, 19 Feb 2010 11:23:49 -0800 Message-ID: <20100219112349.2cd1854a@mantra.us.oracle.com> References: <20100218202158.6e3aeda1@mantra.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "Xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Fri, 19 Feb 2010 08:12:18 +0000 Keir Fraser wrote: > On 19/02/2010 04:21, "Mukesh Rathor" wrote: > > > I noticed while debugging something that current is not pointing to > > the current vcpu upon serial interrupt. The regs->SP clearly shows > > 64bit dom0 stack, guest_mode(regs) returns 1, but current is > > pointing to idle vcpu. I'm not able to figure how this is possible. > > I can come up with scenario where dom0.vcpu yields cpu to idle vcpu > > in which case curr_vcpu will point to dom0.vcpu and current to idle > > vcpu. But in that case guest_mode(regs) will be false, and regs.SP > > will show hyp stack. Correct? > > > > Am I correct that if guest_mode() then current should always point > > to guest vcpu? If yes, then I will debug this further. > > The behaviour you see is expected. Guest_mode() is meaningless when > running an idle vcpu. This is because the guest regs at the bottom of > the stack are junk for an idle vcpu (and also we do lazy state > synchronisation, so they may be the valid active regs for the last > scheduled non-idle vcpu). > > -- Keir > 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? thanks, Mukesh