From mboxrd@z Thu Jan 1 00:00:00 1970 From: Qing He Subject: Re: [PATCH 10/17] vmx: nest: VMExit handler in L2 Date: Fri, 21 May 2010 18:35:23 +0800 Message-ID: <20100521103523.GD21018@qhe2-db> References: <1271929289-18572-1-git-send-email-qing.he@intel.com> <1271929289-18572-11-git-send-email-qing.he@intel.com> <20100520114414.GQ4164@whitby.uk.xensource.com> <20100520160606.GD21538@qhe2-db> <20100521084215.GV4164@whitby.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20100521084215.GV4164@whitby.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Tim Deegan Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Fri, 2010-05-21 at 16:42 +0800, Tim Deegan wrote: > At 17:06 +0100 on 20 May (1274375166), Qing He wrote: > > On Thu, 2010-05-20 at 19:44 +0800, Tim Deegan wrote: > > > At 10:41 +0100 on 22 Apr (1271932882), Qing He wrote: > > > > + case EXIT_REASON_HLT: > > > > + case EXIT_REASON_RDTSC: > > > > + case EXIT_REASON_RDPMC: > > > > + case EXIT_REASON_MWAIT_INSTRUCTION: > > > > + case EXIT_REASON_PAUSE_INSTRUCTION: > > > > + case EXIT_REASON_MONITOR_INSTRUCTION: > > > > + case EXIT_REASON_DR_ACCESS: > > > > + case EXIT_REASON_INVLPG: > > > > + { > > > > + int i; > > > > + > > > > + /* exit according to guest exec_control */ > > > > + ctrl = __get_vvmcs(nest->vvmcs, CPU_BASED_VM_EXEC_CONTROL); > > > > + > > > > + for ( i = 0; i < ARRAY_SIZE(control_bit_for_reason); i++ ) > > > > + if ( control_bit_for_reason[i].reason == exit_reason ) > > > > + break; > > > > > > You've already got a switch statement - why not gate these individually > > > rather than bundling them together and scanning an array? > > > > > > > Well, they are the `regular' part of exit handling, a bit in the control > > bitmap corresponds to their behavior > > I understand that. It just seems inefficient to bundle them all > together into one clause of the switch statement and then scan an array > looking for which one you've hit. Wouldn't it be better to give each > one its own clause and then use goto (!) or similar to jump to the > common code? Ok, I'll change it to switch clauses, does it mean to be more friendly to the compiler? Thanks, Qing