Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2691085imm; Fri, 24 Aug 2018 03:47:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaJsQnyC6jIwgBDlXRMUBYXw89ckcTKt58FNGeClSvpJpV4nKYBMTruM8FkHh5tHXInN+9N X-Received: by 2002:a17:902:8b86:: with SMTP id ay6-v6mr1191514plb.25.1535107668878; Fri, 24 Aug 2018 03:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535107668; cv=none; d=google.com; s=arc-20160816; b=bTUIAOAHkxiWYUttJkndidBsiBUhdz84QBIIfry07m27pa1LY32Np6HlnbP3iAphv9 dDXQh7oziVa4OP1zjCBOHiyFnAdqri3X4X3naQycK8BO0mG9NhtGeSa9MIXwv34HBxSD Tzwfx0Wo0wNwCRdPwuWFeioI3n8RiTfZr9w6AudnE4XOsadVuz8FH4A7/f6GuVNrxZje sjZXUxbZFmBnkAkQUmFI/lDLVSlN99684kRsZ9sgS3vZ3NpZE+G6t0pfvrmtapMLpOI+ LtHxYrzSyLwui/PvygGRSGC0pKCL4+YX2PE37bMxpIVkrfBPJtx1W22qaro6VGVxaD6b 82+Q== 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=CyB6GiPjo+rFOYk2dB0gvt7kgv0hysiQbpVos4FjSsQ=; b=iVxSqA+krQC2vQqPwbPP5JpzocDTvr//DB0HbpEWiNw95sSZ64j8n5MMqwyiF27Ye7 5MgurCVVch67ZO+8x1KwTvIMiveIP65J6vbhW4YmKyya8WII8ge4zlzpSN3rxJ3q8xgF Wg2iJrOqAnMTn7KIoWxjJ4i0vddOqMAbInk1rl3hHqmn/uZ6wNq0S0eiqwGFBpoo8O4i 6/58fF8eKOJ8nHLHeI/fU8/G0p/eNq+BVx09fMhYfiVOZQmVta55VbQknCZl/tskbj9a NyRTl9LqEIzPxhyxISdiuQB2pHt/LFySqTUQYbuLD5oZhlYkPmQUJmElUgzDeRlomjd4 W/7g== 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 o3-v6si6453728plk.321.2018.08.24.03.47.33; Fri, 24 Aug 2018 03:47:48 -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 S1727736AbeHXOUR (ORCPT + 99 others); Fri, 24 Aug 2018 10:20:17 -0400 Received: from foss.arm.com ([217.140.101.70]:55500 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbeHXOUP (ORCPT ); Fri, 24 Aug 2018 10:20:15 -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 C71121650; Fri, 24 Aug 2018 03:46:10 -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 2AF3A3F5A0; Fri, 24 Aug 2018 03:46:09 -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 06/20] x86/intel_rdt: Add a helper to read a closid's configuration for show_doms() Date: Fri, 24 Aug 2018 11:45:05 +0100 Message-Id: <20180824104519.11203-7-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 The configuration values used by the arch code may not be the same as the bitmaps generated by resctrl, resctrl shouldn't read or write them directly. update_domains() and the staged config are suitable for letting the arch code perform any conversion. Add a helper to read the current configuration. This will allow another architecture to scale the bitmaps if necessary, and possibly use controls that don't take a bitmap at all. Signed-off-by: James Morse --- arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c | 17 +++++++++++++---- arch/x86/kernel/cpu/intel_rdt_monitor.c | 2 +- include/linux/resctrl.h | 3 +++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c index 01ffd455313a..ec3c15ee3473 100644 --- a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c +++ b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c @@ -322,21 +322,30 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, return ret ?: nbytes; } +void resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, + u32 closid, u32 *value) +{ + struct rdt_hw_domain *hw_dom = rc_dom_to_rdt(d); + + if (!is_mba_sc(r)) + *value = hw_dom->ctrl_val[closid]; + else + *value = hw_dom->mbps_val[closid]; +} + static void show_doms(struct seq_file *s, struct rdt_resource *r, int closid) { - struct rdt_hw_domain *hw_dom; + 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) { - hw_dom = rc_dom_to_rdt(dom); if (sep) seq_puts(s, ";"); - ctrl_val = (!is_mba_sc(r) ? hw_dom->ctrl_val[closid] : - hw_dom->mbps_val[closid]); + resctrl_arch_get_config(r, dom, closid, &ctrl_val); seq_printf(s, r->format_str, dom->id, max_data_width, ctrl_val); sep = true; diff --git a/arch/x86/kernel/cpu/intel_rdt_monitor.c b/arch/x86/kernel/cpu/intel_rdt_monitor.c index c05f1cecf6cd..42ddcefc7065 100644 --- a/arch/x86/kernel/cpu/intel_rdt_monitor.c +++ b/arch/x86/kernel/cpu/intel_rdt_monitor.c @@ -390,7 +390,7 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_domain *dom_mbm) hw_dom_mba = rc_dom_to_rdt(dom_mba); cur_bw = pmbm_data->prev_bw; - user_bw = hw_dom_mba->mbps_val[closid]; + resctrl_arch_get_config(r_mba, dom_mba, closid, &user_bw); delta_bw = pmbm_data->delta_bw; cur_msr_val = hw_dom_mba->ctrl_val[closid]; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 370db085ee77..03d9fbc230af 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -125,4 +125,7 @@ struct rdt_resource { }; +void resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, + u32 closid, u32 *value); + #endif /* __LINUX_RESCTRL_H */ -- 2.18.0