Received: by 10.213.65.68 with SMTP id h4csp545149imn; Fri, 30 Mar 2018 10:24:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx48lNBXgpZcH9uwQRf8Ba8w165FIYufbCMLk7rlj0aMA4NK0W99uZRD9pDfpOj+SAPc/HZjU X-Received: by 10.98.63.75 with SMTP id m72mr10368767pfa.167.1522430687749; Fri, 30 Mar 2018 10:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522430687; cv=none; d=google.com; s=arc-20160816; b=dFXRIiX6nlVDjvQQElymrRZjPH1EKABQ7TcMiwahjoVEBH2tCVNS+ItjRSes1gbahD e1dRLNjHydFY2LMk7tjwj8BCPHsyAanhgkslhi5tBoSTRnipUOsDXmg6JANKSoedpkN8 uLyOq5zC+XNnQp+IqcOVqsuaiWcnZeMYUYQowpY4bGE/0/P0sLTH/M+jnoJ+AjXSsZmS AJu746ma8dvfD47Oj0Vchs4gk4OyZWQ2SS692o62np3G645L56jR+apvc3FDs4nJ51gf 9jgcSduAz0MDkcs7LEzw67FybHVwEVEHxK7nUE996k/w3nwPuHakoTXjMNmRpochzEeX m/Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=LYSXJ3bBsF6XReMBKaccphZddR9luvHB5enx1uagNHI=; b=edVU87RJwfwskosRskCdpnV+q6st+dV/+psKBjBubebw3Eot2ibIxLlbrrG3uIIwbI WnR+395PSw18KLKAO9g+Coe+av8W10yrT5TpQsQXn3XL6C5p2gxc6n3GtvcLDnixR+9L M6FLwA4x/R8LS9UTe6K/lW1JZgxrW+VswE7Asv1ziomxwb+4D1N8c7RHHAhvqqe9hI+x KNKVln+Quj98tvUV9kIoFF8BkK2MbyXwXHOg29iRcjo8doObKp6g9BB3fWSqHxIixkRb IVJWzHk17Fclpf8apdg+7AbpMVpZFZcUrI0lz5BPih01rZKYEYw3b+tqmQWE5C5gt3AA XKGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si9087961plk.655.2018.03.30.10.24.33; Fri, 30 Mar 2018 10:24:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752163AbeC3RWV (ORCPT + 99 others); Fri, 30 Mar 2018 13:22:21 -0400 Received: from mga18.intel.com ([134.134.136.126]:45303 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbeC3RWU (ORCPT ); Fri, 30 Mar 2018 13:22:20 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Mar 2018 10:22:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,382,1517904000"; d="scan'208";a="32830706" Received: from vshiva-udesk.sc.intel.com (HELO vshiva-Udesk) ([10.3.52.52]) by fmsmga002.fm.intel.com with ESMTP; 30 Mar 2018 10:22:19 -0700 Date: Fri, 30 Mar 2018 10:19:17 -0700 (PDT) From: Shivappa Vikas X-X-Sender: vikas@vshiva-Udesk To: Thomas Gleixner cc: Vikas Shivappa , vikas.shivappa@intel.com, tony.luck@intel.com, ravi.v.shankar@intel.com, fenghua.yu@intel.com, sai.praneeth.prakhya@intel.com, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, ak@linux.intel.com Subject: Re: [PATCH 2/6] x86/intel_rdt/mba_sc: Add support to enable/disable via mount option In-Reply-To: Message-ID: References: <1522362376-3505-1-git-send-email-vikas.shivappa@linux.intel.com> <1522362376-3505-3-git-send-email-vikas.shivappa@linux.intel.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Thomas, On Fri, 30 Mar 2018, Thomas Gleixner wrote: > On Thu, 29 Mar 2018, Vikas Shivappa wrote: > > Subject: x86/intel_rdt/mba_sc: Add support to enable/disable via mount option > > Huch? From Documentation: > > The ``summary phrase`` in the email's Subject should concisely > describe the patch which that email contains. > > You're introducing somthing new: mba_sc > > It's completely unclear what that is and what it means. > > x86/intel_rdt: Add mount option for bandwidth allocation in MB/s > > or something like that. would 'Mount option to enable MBA softwarecontroller' be better? Given that I have a documentation patch which says what is mba software controller. > >> Specify a new mount option "mba_MB" to enable the user to specify MBA >> bandwidth in Megabytes(Software Controller/SC) instead of b/w > > You cannot specify bandwidth in Megabytes. Bandwidth is a bit-rate and the > units are multiples of bits per second and not Megabytes. > >> --- a/arch/x86/kernel/cpu/intel_rdt.h >> +++ b/arch/x86/kernel/cpu/intel_rdt.h >> @@ -259,6 +259,7 @@ struct rdt_cache { >> * @min_bw: Minimum memory bandwidth percentage user can request >> * @bw_gran: Granularity at which the memory bandwidth is allocated >> * @delay_linear: True if memory B/W delay is in linear scale >> + * @bw_byte: True if memory B/W is specified in bytes > > So the mount parameter says Megabytes, but here you say bytes? What? > > And bw_byte is a misnomer. bw_bytes if you really mean bytes. bw_mb if it's megabytes. Will fix the namings. Thanks for pointing it should be MBps everywhere. > >> +#define is_mba_linear() rdt_resources_all[RDT_RESOURCE_MBA].membw.delay_linear >> +#define is_mba_MBctrl() rdt_resources_all[RDT_RESOURCE_MBA].membw.bw_byte > > Please use inlines and no camel case. That's horrible. Will fix.. > >> + >> /** >> * struct rdt_resource - attributes of an RDT resource >> * @rid: The index of the resource >> diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c >> index fca759d..0707191 100644 >> --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c >> +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c >> @@ -1041,6 +1041,24 @@ static int set_cache_qos_cfg(int level, bool enable) >> return 0; >> } >> >> +static void __set_mba_byte_ctrl(bool byte_ctrl) >> +{ >> + struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA]; >> + >> + r->membw.bw_byte = byte_ctrl; > > I don't see the point of this extra function. It has exactly one user. > >> +} >> + >> +/* >> + * MBA allocation in bytes is only supported if >> + * MBM is supported and MBA is in linear scale. >> +*/ > > Hint: checkpatch.pl is not optional > >> +static void set_mba_byte_ctrl(bool byte_ctrl) >> +{ >> + if ((is_mbm_enabled() && is_mba_linear()) && >> + byte_ctrl != is_mba_MBctrl()) >> + __set_mba_byte_ctrl(byte_ctrl); > > And that user is a small enough function. To avoid indentation you can > simply return when the condition is false. > > Also if the user wants to mount with the MB option and it's not supported, > why are you not returning an error code and refuse the mount? That's just > wrong. Will fix. can merge into one function and return error when not available. > >> + >> static int cdp_enable(int level, int data_type, int code_type) >> { >> struct rdt_resource *r_ldata = &rdt_resources_all[data_type]; >> @@ -1104,7 +1122,7 @@ static void cdp_disable_all(void) >> cdpl2_disable(); >> } >> >> -static int parse_rdtgroupfs_options(char *data) >> +static int parse_rdtgroupfs_options(char *data, bool *mba_MBctrl) > > What? > >> { >> char *token, *o = data; >> int ret = 0; >> @@ -1123,6 +1141,8 @@ static int parse_rdtgroupfs_options(char *data) >> ret = cdpl2_enable(); >> if (ret) >> goto out; >> + } else if (!strcmp(token, "mba_MB")) { >> + *mba_MBctrl = true; > > That's mindless hackery. Really. What's wrong with setting the flag in the > resource and then add the actual register fiddling right in the > > if (is_mbm_enabled()) { > > section in rdt_mount()? That would be too obvious and fit into the existing > code, right? Will fix. > >> + /*Set the control values before the rest of reset*/ > > Space after '/*' and before '*/ > > Aside of that the comment is pretty useless. 'the control values' ??? Which > control values? > Will fix the comment or remove. Wanted to point here that we reset the control values (the delay values that go into the IA32_MBA_THRTL_MSRs) but thats done any ways in the reset_all_ctrls call after this, so comment can be removed. Will fix the checkpatch issues as pointed. In general wanted to know if this is a sane idea to have a software feedback and let the user specify b/w in MBps rather than the confusing percentage values. The typical confusing scenarios are documented in documentation patch with examples. The use can can occur in any rdtgroups which are trying to group jobs where different number of threads are active. Say if you want to create an rdtgroup with low priority jobs and give them 10% of b/w the actual raw b/w in MBps used can vary and increase if more threads are spawned (because the new threads spawned belong to the same rdtgroup and each thread can use up 10% of the 'per core' memory b/w). Thanks, Vikas >> + set_mba_byte_ctrl(false); > > Thanks, > > tglx >