From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Subject: Re: [RESEND PATCH 1/3] x86: Adding structs to reflect cpuid fields Date: Wed, 17 Sep 2014 17:22:21 +0200 Message-ID: <20140917152221.GF5358@nazgul.tnic> References: <20140917124501.GC5358@nazgul.tnic> <1410958454-7501-1-git-send-email-namit@cs.technion.ac.il> <1410958454-7501-2-git-send-email-namit@cs.technion.ac.il> <20140917132141.GD5358@nazgul.tnic> <20140917140601.GE5358@nazgul.tnic> <20140917150433.GC1273@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Nadav Amit , Ingo Molnar , Paolo Bonzini , "H. Peter Anvin" , Ingo Molnar , Thomas Gleixner , the arch/x86 maintainers , kvm , Linux Kernel Mailing List , Linus Torvalds , Andrew Morton , Peter Zijlstra To: Radim =?utf-8?B?S3LEjW3DocWZ?= Return-path: Content-Disposition: inline In-Reply-To: <20140917150433.GC1273@potion.brq.redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Wed, Sep 17, 2014 at 05:04:33PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: > which would result in a similar if-else hack >=20 > if (family > X) > ebx.split.max_monitor_line_size_after_family_X =3D 0 > else > ebx.split.max_monitor_line_size =3D 0 >=20 > other options are > ebx.split.after_family_X.max_monitor_line_size > or even > ebx.split.max_monitor_line_size.after_family_X And how is that better than simply doing cpuid =3D cpuid_ebx(5); if (family > X) max_monitor_line_size =3D cpuid & MASK_FAM_X; else max_monitor_line_size =3D cpuid & MASK_BEFORE_FAM_X; ? With proper variable naming all is perfectly clear, readable and simple. You don't need to open even the CPUID manual - the variable tells you you're getting the max monitor line size - "ebx.split.max_monitor_line_size_after_family_X" needs me to parse it with my eyes first. --=20 Regards/Gruss, Boris. --