From: Mukesh Rathor Subject: Re: [PATCH 1/18 V2]: PVH xen: turn gdb_frames/gdt_ents into union Date: Mon, 18 Mar 2013 17:04:09 -0700 Message-ID: <20130318170409.1f8414e7@mantra.us.oracle.com> References: <20130315171450.4318930a@mantra.us.oracle.com> <514706CB02000078000C64B8@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <514706CB02000078000C64B8@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 Mon, 18 Mar 2013 11:21:31 +0000 "Jan Beulich" wrote: > >>> On 16.03.13 at 01:14, Mukesh Rathor > >>> wrote: > > --- a/xen/include/public/arch-x86/xen.h > > +++ b/xen/include/public/arch-x86/xen.h > > @@ -170,7 +170,20 @@ struct vcpu_guest_context { > > struct cpu_user_regs user_regs; /* User-level CPU > > registers */ struct trap_info trap_ctxt[256]; /* Virtual > > IDT */ unsigned long ldt_base, ldt_ents; /* > > LDT (linear address, # ents) */ +#if __XEN_INTERFACE_VERSION__ < > > 0x00040300 unsigned long gdt_frames[16], gdt_ents; /* GDT (machine > > frames, # ents) */ +#else > > + union { > > + struct { > > + /* GDT (machine frames, # ents) */ > > + unsigned long gdt_frames[16], gdt_ents; > > + } pv; > > + struct { > > + /* PVH: GDTR addr and size */ > > + unsigned long gdtaddr, gdtsz; > > + } pvh; > > + } u; > > Leaving aside the line wrapping issue already pointed out by > others, I can only repeat that I don't see why you would name > the union as badly as "u" when the obvious name would be "gdt". > > With that, I can further more only repeat that dropping the > "gdt_" and "gdt" prefixes on the names would be much preferred. Ok, I thought we had resolved that in V1 when I said it was recommended during linux review to have it that way (linux patches were posted on xen-devel). But I guess it has to be your way now. So I'll change it as much as I dislike making code harder to read by naming variables that can't be easily grep'd/cscope'd. Since gdt_frames/gdt_ents is pre-existing code, I'll just change gdtaddr to addr, and gdtsz to sz or call it limit. > And finally I question the usefulness of having what is currently > named "gdtsz" be an "unsigned long" when this can't exceed a > 16-bit quantity (the more if you used a limit value here rather > than a size, just like hardware does). Ok, I will change it to unsigned short. thanks Mukesh