From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [PATCH 09/18] PVH xen: Support privileged op emulation for PVH Date: Wed, 26 Jun 2013 15:41:30 -0700 Message-ID: <20130626154130.6c50b347@mantra.us.oracle.com> References: <1372118507-16864-1-git-send-email-mukesh.rathor@oracle.com> <1372118507-16864-10-git-send-email-mukesh.rathor@oracle.com> <51C980C902000078000E0445@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51C980C902000078000E0445@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel List-Id: xen-devel@lists.xenproject.org On Tue, 25 Jun 2013 10:36:41 +0100 "Jan Beulich" wrote: > >>> On 25.06.13 at 02:01, Mukesh Rathor > >>> wrote: > > @@ -1524,6 +1528,49 @@ static int read_descriptor(unsigned int sel, > > --- a/xen/include/asm-x86/system.h > > +++ b/xen/include/asm-x86/system.h > > @@ -4,10 +4,20 @@ > > #include > > #include > > > > -#define read_segment_register(vcpu, regs, name) \ > > -({ u16 __sel; \ > > - asm volatile ( "movw %%" STR(name) ",%0" : "=r" (__sel) ); \ > > - __sel; \ > > +/* > > + * We need vcpu because during context switch, going from PVH to > > PV, > > + * in save_segments(), current has been updated to next, and no > > longer pointing > > + * to the PVH. > > + */ > > This is bogus - you shouldn't need any of the {save,load}_segment() > machinery for PVH, and hence this is not a valid reason for adding a > vcpu parameter here. Ok, lets revisit this again since it's been few months already: read_segment_register() is called from few places for PVH, and for PVH it needs to read the value from regs. So it needs to be modified to check for PVH. Originally, I had started with checking for is_pvh_vcpu(current), but that failed quickly because of the context switch call chain: __context_switch -> ctxt_switch_from --> save_segments -> read_segment_register In this path, going from PV to PVH, the intention is to save segments for PV, and since current has already been updated to point to PVH, the check for current is not correct. Hence, the need for vcpu parameter. I will enhance my comments in the macro prolog in the next patch version. Hope that resolves it. thanks, Mukesh