From: Mukesh Rathor Subject: Re: [PATCH 10/18 V2]: PVH xen: introduce vmx_pvh.c and pvh.c Date: Wed, 3 Apr 2013 16:38:21 -0700 Message-ID: <20130403163821.59ed051a@mantra.us.oracle.com> References: <20130315174145.4bc0e78f@mantra.us.oracle.com> <20130321164912.GO12338@ocelot.phlegethon.org> <20130402183734.16b1ba68@mantra.us.oracle.com> <515BFF1A02000078000CA3D4@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <515BFF1A02000078000CA3D4@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@lists.xensource.com" , Tim Deegan List-Id: xen-devel@lists.xenproject.org On Wed, 03 Apr 2013 09:06:18 +0100 "Jan Beulich" wrote: > >>> On 03.04.13 at 03:37, Mukesh Rathor > >>> wrote: > > On Thu, 21 Mar 2013 16:49:12 +0000 Tim Deegan wrote: > >> > + uint acc_typ = > >> > VMX_CONTROL_REG_ACCESS_TYPE(exit_qualification); > >> > + int cr, rc = 1; > >> > + > >> > + switch ( acc_typ ) > >> > + { > >> > + case VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR: > >> > + case VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR: > >> > + { > >> > + uint gpr = > >> > VMX_CONTROL_REG_ACCESS_GPR(exit_qualification); > >> > + uint64_t *regp = decode_register(gpr, regs, 0); > >> > + cr = VMX_CONTROL_REG_ACCESS_NUM(exit_qualification); > >> > + > >> > + if (regp == NULL) > >> > + break; > >> > + > >> > + /* pl don't embed switch statements */ <======== > >> > + if (cr == 0) > >> > + rc = access_cr0(regs, acc_typ, regp); > >> > + else if (cr == 3) { > >> > + printk("PVH: d%d: unexpected cr3 access vmexit. > >> > rip:%lx\n", > >> > + current->domain->domain_id, regs->rip); > >> > + domain_crash_synchronous(); > >> > >> Again, ITYM BUG(). And again. probably a switch statement. > > > > No, lets not embed switch statements please, that is obfuscating. > > I don't see a reason not to. Long rows of if/else-if are at least as > obfuscating. Not sure I agree. Long switch statements, as few places in xen code, make it hard to figure which break goes with which switch, and that makes code reading take longer. But whatever. I'll change to switch. Mukesh