From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759345AbcIMXAf (ORCPT ); Tue, 13 Sep 2016 19:00:35 -0400 Received: from mga01.intel.com ([192.55.52.88]:39263 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758176AbcIMXAe (ORCPT ); Tue, 13 Sep 2016 19:00:34 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,330,1470726000"; d="scan'208";a="1049870492" Subject: Re: [PATCH v2 07/33] x86/intel_rdt: Add support for Cache Allocation detection To: "Luck, Tony" References: <1473328647-33116-1-git-send-email-fenghua.yu@intel.com> <1473328647-33116-8-git-send-email-fenghua.yu@intel.com> <57D88052.60404@intel.com> <20160913225217.GA4325@intel.com> Cc: Fenghua Yu , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , Peter Zijlstra , Tejun Heo , Borislav Petkov , Stephane Eranian , Marcelo Tosatti , David Carrillo-Cisneros , Shaohua Li , Ravi V Shankar , Vikas Shivappa , Sai Prakhya , linux-kernel , x86 From: Dave Hansen Message-ID: <57D8850B.9000107@intel.com> Date: Tue, 13 Sep 2016 16:00:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160913225217.GA4325@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/13/2016 03:52 PM, Luck, Tony wrote: > On Tue, Sep 13, 2016 at 03:40:18PM -0700, Dave Hansen wrote: >> Are you sure you don't want to add RDT to disabled-features.h? You have >> a config option for it, so it seems like you should also be able to >> optimize some of these checks away when the config option is off. > > Makefile looks like this: > > obj-$(CONFIG_INTEL_RDT) += intel_rdt.o intel_rdt_rdtgroup.o intel_rdt_schemata.o > > which seems to skip compiling all our code when the CONFIG > option is off. > > Our hooks to generic code look like: > > +#ifdef CONFIG_INTEL_RDT > +extern void rdtgroup_fork(struct task_struct *child); > +extern void rdtgroup_exit(struct task_struct *tsk); > +#else > +static inline void rdtgroup_fork(struct task_struct *child) {} > +static inline void rdtgroup_exit(struct task_struct *tsk) {} > +#endif /* CONFIG_INTEL_RDT */ > > Does this disabled-features.h thing do something more? If you have cpuid checks in common code, disabled-features.h can compile them out if the config options are turned off. For instance: if (cpu_feature_enabled(X86_FEATURE_PKU)) foo(); is equivalent to: #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS if (boot_cpu_has(X86_FEATURE_PKU)) foo(); #endif But, if all the cpu_has(c, X86_FEATURE_CAT_L3) checks are confined to files only compiled under CONFIG_INTEL_RDT then it won't do you much good. But, it's pretty simple to add things, and would help you out if checks spread beyond intel_rdt*.c.