Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2692438imm; Fri, 24 Aug 2018 03:49:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZJLGNzlzSYOG9jjgcpuvnDK9T0PBWHfbg6O8uk8m+U0LKi4h5PwyEXVmdMEPWbGsTA9Q07 X-Received: by 2002:a63:d345:: with SMTP id u5-v6mr1192814pgi.330.1535107767046; Fri, 24 Aug 2018 03:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535107767; cv=none; d=google.com; s=arc-20160816; b=W51UMktzy0qz93Nbzj3Y58Dxbja+e1H0NjasFK8nKjoXxeuiHRoTKu2BfSm4RgbuYT dNZI+5MyNSto9saJLdmAn1+MYulwJYZK7epVNqY7ltWh/tPZ8VUYDIt1PDHnqojNU9nA u/Ph6vrNz2eEXUGQ617M0ca1SmXUFkPR2Rr2N3NXnFhGxSl5KJq6rj725p/n8CWt/kbH dPySTZgfU2L7QGHurdGpS0d8VjWlwMcYjSVYekTWhOeHRIIkTfj7DwLwdKmMHqvIT4JM a/R4N9AnYB/42reOqMkrPPlHVvnjA8qBMiztwZb3QLBewnwlgnflhvZ+9pajmMFyOl2a sO4A== 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=qbSSnkkP8D8+2+NrlFx7emj7sbDb+aPHNKZmu5Pz0zY=; b=ndX3KlXhtNJdpM04YA3oxbKYmNd2um+l3XMpTy1CF5SZx/QeMGZpoX3/5MFqQI55Ck QHAe5LZBdbS1fftFFseJ9A2jd3s1FiRKWlQmirHtzEyLMw9R/CrUfqhTgPBOLu+rw7hm pqXfFTymdxsvxfa4ODUVgATNRbEbfvqR2I1TJDeNTv2uVPtsieJbjsqLlE8cYDx7JChP L8vDs35iTNmMbljRKhEN++mgE+NoYb34mjeKmiF733dAd5mcokosuew8leGgssTYSyG7 jS41IRgQd+YtWJW5bVcay71y0wGWLJ+UvV2OJcMINND+f/KRwE1pJDMOW5VLgOOI2rXv R3TA== 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 k80-v6si7564075pfg.42.2018.08.24.03.49.12; Fri, 24 Aug 2018 03:49:27 -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 S1727642AbeHXOUO (ORCPT + 99 others); Fri, 24 Aug 2018 10:20:14 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55488 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbeHXOUM (ORCPT ); Fri, 24 Aug 2018 10:20:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8C1241713; Fri, 24 Aug 2018 03:46:08 -0700 (PDT) Received: from melchizedek.Emea.Arm.com (melchizedek.emea.arm.com [10.4.12.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E48373F5A0; Fri, 24 Aug 2018 03:46:06 -0700 (PDT) From: James Morse To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Thomas Gleixner , Fenghua Yu , Tony Luck , Ingo Molnar , H Peter Anvin , Reinette Chatre , Vikas Shivappa Subject: [RFC PATCH 05/20] x86/intel_rdt: make update_domains() learn the affected closids Date: Fri, 24 Aug 2018 11:45:04 +0100 Message-Id: <20180824104519.11203-6-james.morse@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180824104519.11203-1-james.morse@arm.com> References: <20180824104519.11203-1-james.morse@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the closid is present in the staged configuration, update_domains() can learn which low/high values it should update. Remove the single passed in closid, and update msr_param as we apply each staged config. Once the L2/L2CODE/L2DATA resources are merged this will allow update_domains() to be called once for the single resource, even when CDP is in use. This results in both CODE and DATA configurations being applied and the two consecutive closids being updated with a single smp_call_function_many(). This will let us keep the CDP odd/even behaviour inside resctrl so that architectures that don't do this don't need to emulate it. Signed-off-by: James Morse --- arch/x86/kernel/cpu/intel_rdt.h | 4 ++-- arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h index 5e271e0fe1f5..8df549ef016d 100644 --- a/arch/x86/kernel/cpu/intel_rdt.h +++ b/arch/x86/kernel/cpu/intel_rdt.h @@ -241,8 +241,8 @@ static inline struct rdt_hw_domain *rc_dom_to_rdt(struct rdt_domain *r) */ struct msr_param { struct rdt_resource *res; - int low; - int high; + u32 low; + u32 high; }; static inline bool is_llc_occupancy_enabled(void) diff --git a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c index 0c849653a99d..01ffd455313a 100644 --- a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c +++ b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c @@ -193,22 +193,21 @@ static void apply_config(struct rdt_hw_domain *hw_dom, } } -static int update_domains(struct rdt_resource *r, int closid) +static int update_domains(struct rdt_resource *r) { struct resctrl_staged_config *cfg; struct rdt_hw_domain *hw_dom; + bool msr_param_init = false; struct msr_param msr_param; cpumask_var_t cpu_mask; struct rdt_domain *d; bool mba_sc; + u32 closid; int i, cpu; if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) return -ENOMEM; - /* TODO: learn these two by looping the config */ - msr_param.low = closid; - msr_param.high = msr_param.low + 1; msr_param.res = r; mba_sc = is_mba_sc(r); @@ -220,9 +219,21 @@ static int update_domains(struct rdt_resource *r, int closid) continue; apply_config(hw_dom, cfg, cpu_mask, mba_sc); + + closid = cfg->closid; + if (!msr_param_init) { + msr_param.low = closid; + msr_param.high = closid; + msr_param_init = true; + } else { + msr_param.low = min(msr_param.low, closid); + msr_param.high = max(msr_param.high, closid); + } } } + msr_param.high += 1; + /* * Avoid writing the control msr with control values when * MBA software controller is enabled @@ -301,7 +312,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, } for_each_alloc_enabled_rdt_resource(r) { - ret = update_domains(r, closid); + ret = update_domains(r); if (ret) goto out; } -- 2.18.0