From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932809AbcIMWyl (ORCPT ); Tue, 13 Sep 2016 18:54:41 -0400 Received: from mga04.intel.com ([192.55.52.120]:34549 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932243AbcIMWyk (ORCPT ); Tue, 13 Sep 2016 18:54:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,330,1470726000"; d="scan'208";a="8450869" Subject: Re: [PATCH v2 22/33] x86/intel_rdt.c: Extend RDT to per cache and per resources To: Fenghua Yu , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , Tony Luck , Peter Zijlstra , Tejun Heo , Borislav Petkov , Stephane Eranian , Marcelo Tosatti , David Carrillo-Cisneros , Shaohua Li , Ravi V Shankar , Vikas Shivappa , Sai Prakhya References: <1473328647-33116-1-git-send-email-fenghua.yu@intel.com> <1473328647-33116-23-git-send-email-fenghua.yu@intel.com> Cc: linux-kernel , x86 From: Dave Hansen Message-ID: <57D883AE.7070605@intel.com> Date: Tue, 13 Sep 2016 15:54:38 -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: <1473328647-33116-23-git-send-email-fenghua.yu@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/08/2016 02:57 AM, Fenghua Yu wrote: > +static int __init rdt_setup(char *str) > +{ > + char *tok; > + > + while ((tok = strsep(&str, ",")) != NULL) { > + if (!*tok) > + return -EINVAL; > + > + if (strcmp(tok, "simulate_cat_l3") == 0) { > + pr_info("Simulate CAT L3\n"); > + rdt_opts.simulate_cat_l3 = true; > + } else if (strcmp(tok, "disable_cat_l3") == 0) { > + pr_info("CAT L3 is disabled\n"); > + disable_cat_l3 = true; > + } else { > + pr_info("Invalid rdt option\n"); > + return -EINVAL; > + } > + } > + > + return 0; > +} > +__setup("resctrl=", rdt_setup); So, this allows you to specify both simulation and disabling at the same time, and in the same option? That seems a bit screwy, plus it requires some parsing which is quite prone to being broken. How about just having two setup options: __setup("resctrl=simulate_cat_l3", rdt_setup...); __setup("resctrl=disable_cat_l3", rdt_setup...); And allow folks to specify "resctrl" more than once instead of requiring the comma-separated arguments? Then you don't have to do any parsing at all and your __setup() handlers become one-liners. Is "resctrl" really the best name for this sucker? Wouldn't "intel-rdt=" or something be nicer? Also, a lot of __setup() functions actually clear cpuid bits. Should this be clearing X86_FEATURE_CAT_L3 instead of keeping a boolean around that effectively overrides it? > +static inline bool cat_l3_supported(struct cpuinfo_x86 *c) > +{ > + if (cpu_has(c, X86_FEATURE_CAT_L3)) > + return true; > + > + /* > + * Probe for Haswell server CPUs. > + */ > + if (c->x86 == 0x6 && c->x86_model == 0x3f) > + return cache_alloc_hsw_probe(); > + > + return false; > +} #include and s/0x3f/INTEL_FAM6_HASWELL_X/, please. Then your comment even go away.