From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756331AbdJLWBi (ORCPT ); Thu, 12 Oct 2017 18:01:38 -0400 Received: from mga14.intel.com ([192.55.52.115]:54367 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753574AbdJLWBi (ORCPT ); Thu, 12 Oct 2017 18:01:38 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,368,1503385200"; d="scan'208";a="322649543" Date: Thu, 12 Oct 2017 15:01:36 -0700 From: Andi Kleen To: Thomas Gleixner Cc: Ingo Molnar , Andi Kleen , x86@kernel.org, linux-kernel@vger.kernel.org, Jonathan McDowell Subject: Re: [PATCH v9 2/5] x86/cpuid: Add generic table for cpuid dependencies Message-ID: <20171012220136.GL5109@tassilo.jf.intel.com> References: <20171007000328.12843-1-andi@firstfloor.org> <20171007000328.12843-3-andi@firstfloor.org> <20171012080733.4y5wlghjr524cgr3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 12, 2017 at 05:13:34PM +0200, Thomas Gleixner wrote: > On Thu, 12 Oct 2017, Ingo Molnar wrote: > > > > * Andi Kleen wrote: > > > > > --- /dev/null > > > +++ b/arch/x86/kernel/cpu/cpuid-deps.c > > > @@ -0,0 +1,109 @@ > > > +/* Declare dependencies between CPUIDs */ > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +struct cpuid_dep { > > > + unsigned short feature; > > > + unsigned short depends; > > > +}; > > > > Why are these 16-bit fields? 16-bit data types should be avoided as much as > > possible, as they generate suboptimal code. > > I was looking at that as well and decided that we preferrably have a > compressed data structure. The code which walks the table is hardly > performance critical and the difference in text size is marginal. Right it was an attempt to save a tiny bit of text space. On modern x86 CPUs there is no penalty for 16bit except for slightly larger code. The table is far bigger than the few additional 16bit prefixes in the code text data bss dec hex filename 436 0 0 436 1b4 arch/x86/kernel/cpu/cpuid-deps.o-short 572 0 0 572 23c arch/x86/kernel/cpu/cpuid-deps.o-int But can convert to 4 bytes in the next version. -Andi