[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 10/17] vmx: nest: VMExit handler in L2



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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.