Received: by 10.192.165.148 with SMTP id m20csp772808imm; Fri, 20 Apr 2018 15:44:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx49GJPFZyb372m3Sz/3AVlGSBKU2C65lf0a4lIkKSHnsODjvWIv3pouFIpKXFCvQT5xnAJ/4 X-Received: by 10.99.61.202 with SMTP id k193mr9704127pga.435.1524264270074; Fri, 20 Apr 2018 15:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524264270; cv=none; d=google.com; s=arc-20160816; b=vEwhF2PoASUVkPioviSxbV7+Guz4GdMW2Gt2cGrhKw+L7JfrMlt5Q3u9HEfj032D1n Lhioxu/RUF0mRYOifuk55EyKfFeNKzPxT49hl7z4RIuQfx9jvolS7gmjT48cy66Ltnmm H27uYr/c8r/A2oD+Y7Z5PODjpshfqU8VN1OS+allmurqFW4WogW5lQoIIm3N1FLMFZ3F cfPTJMaQJ5Gy2bXQo1JBPoG8cqlaC6ia3eQEGtND0oCDT4np4lqsrqj7fq0D4YSvK7Ic 2ajE1lK91lTJa5jZDo0wCKAg77WLDEKRilFTeKE1/UL7g2OiY3gAsr3Y3Fi3zC4pCDZs 5NMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=17YtZUZRLjp9xQw8e15S2CAKAESNMk/tcTl70kjL1jY=; b=ttA8ZAWs/L1jC6LY0HTFDocqFv+3ZYnkNFH4U8aF10u5BUrujxbLA3C8fRbmTVNKad fPNvTLjUmg79ycNW9hbCyXD3jXP7vU5HU504tN2L19k1ndCtJak5niawxX9u/fo3l0yy Rhmyzljq+BYixc0lcO7uj9GlYe/a0rX4P426euVJAouenf0muM+oQziSmEx9/TpwlcPh GgpsWhEzwReSkkkAMsc2wnnbC9b8Rzl7OrNphIJBKF+hmFq2c+4fmvaUqIt+eQFjIR6Y 7/QibOe61jZMBBNTR1mPz2JdQHgjoAz3bwP6k9Yzfqfs7d/4wq9Ti7L3Bt8qAwCELv1q IpZg== 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 60-v6si6354225plc.453.2018.04.20.15.43.52; Fri, 20 Apr 2018 15:44:30 -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 S1753236AbeDTWjz (ORCPT + 99 others); Fri, 20 Apr 2018 18:39:55 -0400 Received: from mga01.intel.com ([192.55.52.88]:60382 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752900AbeDTWjK (ORCPT ); Fri, 20 Apr 2018 18:39:10 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 15:39:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,303,1520924400"; d="scan'208";a="34982641" Received: from vshiva-udesk.sc.intel.com ([10.3.52.52]) by orsmga007.jf.intel.com with ESMTP; 20 Apr 2018 15:39:08 -0700 From: Vikas Shivappa To: vikas.shivappa@intel.com, tony.luck@intel.com, ravi.v.shankar@intel.com, fenghua.yu@intel.com, x86@kernel.org, tglx@linutronix.de, hpa@zytor.com Cc: linux-kernel@vger.kernel.org, ak@linux.intel.com, vikas.shivappa@linux.intel.com Subject: [PATCH 4/6] x86/intel_rdt/mba_sc: Add schemata support Date: Fri, 20 Apr 2018 15:36:19 -0700 Message-Id: <1524263781-14267-5-git-send-email-vikas.shivappa@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524263781-14267-1-git-send-email-vikas.shivappa@linux.intel.com> References: <1524263781-14267-1-git-send-email-vikas.shivappa@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently when user updates the "schemata" with new MBA percentage values, kernel writes the corresponding bandwidth percentage values to the IA32_MBA_THRTL_MSR. When MBA is expressed in MBps, the schemata format is changed to have the per package memory bandwidth in MBps instead of being specified in percentage. We do not write the IA32_MBA_THRTL_MSRs when the schemata is updated as that is handled separately. Signed-off-by: Vikas Shivappa --- arch/x86/kernel/cpu/intel_rdt.c | 2 +- arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c index 07f6b3b..85805d7 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c @@ -179,7 +179,7 @@ struct rdt_resource rdt_resources_all[] = { .msr_update = mba_wrmsr, .cache_level = 3, .parse_ctrlval = parse_bw, - .format_str = "%d=%*d", + .format_str = "%d=%*u", .fflags = RFTYPE_RES_MB, }, }; diff --git a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c index 23e1d5c..116d57b 100644 --- a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c +++ b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c @@ -53,7 +53,8 @@ static bool bw_validate(char *buf, unsigned long *data, struct rdt_resource *r) return false; } - if (bw < r->membw.min_bw || bw > r->default_ctrl) { + if ((bw < r->membw.min_bw || bw > r->default_ctrl) && + !is_mba_sc(r)) { rdt_last_cmd_printf("MB value %ld out of range [%d,%d]\n", bw, r->membw.min_bw, r->default_ctrl); return false; @@ -179,6 +180,8 @@ static int update_domains(struct rdt_resource *r, int closid) struct msr_param msr_param; cpumask_var_t cpu_mask; struct rdt_domain *d; + bool mba_sc; + u32 *dc; int cpu; if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) @@ -188,13 +191,20 @@ static int update_domains(struct rdt_resource *r, int closid) msr_param.high = msr_param.low + 1; msr_param.res = r; + mba_sc = is_mba_sc(r); list_for_each_entry(d, &r->domains, list) { - if (d->have_new_ctrl && d->new_ctrl != d->ctrl_val[closid]) { + dc = !mba_sc ? d->ctrl_val : d->mbps_val; + if (d->have_new_ctrl && d->new_ctrl != dc[closid]) { cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask); - d->ctrl_val[closid] = d->new_ctrl; + dc[closid] = d->new_ctrl; } } - if (cpumask_empty(cpu_mask)) + + /* + * Avoid writing the control msr with control values when + * MBA software controller is enabled + */ + if (cpumask_empty(cpu_mask) || mba_sc) goto done; cpu = get_cpu(); /* Update CBM on this cpu if it's in cpu_mask. */ @@ -282,13 +292,17 @@ static void show_doms(struct seq_file *s, struct rdt_resource *r, int closid) { struct rdt_domain *dom; bool sep = false; + u32 ctrl_val; seq_printf(s, "%*s:", max_name_width, r->name); list_for_each_entry(dom, &r->domains, list) { if (sep) seq_puts(s, ";"); + + ctrl_val = (!is_mba_sc(r) ? dom->ctrl_val[closid] : + dom->mbps_val[closid]); seq_printf(s, r->format_str, dom->id, max_data_width, - dom->ctrl_val[closid]); + ctrl_val); sep = true; } seq_puts(s, "\n"); -- 1.9.1