Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp117588imm; Tue, 19 Jun 2018 17:15:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJiAltSJl5vxs996W4ePeo3V+uxsw0g0lu53bSExsjiO710WhuHnlznpR69oPUWdi7YPg/v X-Received: by 2002:a63:79c5:: with SMTP id u188-v6mr16592550pgc.111.1529453741924; Tue, 19 Jun 2018 17:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529453741; cv=none; d=google.com; s=arc-20160816; b=B3WiN1cU3ZpxbVy4tCHLdak+EwBilPGCzI4b05LSXOzH6E2wMsbSjt9HBC3FjWXuu8 WIoT5zea8AFI8GKeAwfzxqkTPJziiGRFf/zIvGTUVOUW0sRJgjOWOaHsi9zfqQUkVJ3t Tgvez6aj6bS+USXS6n1iehqSoj2cwfWPNaEw37OI/O1ZxclH7+eK0Aoi4coq9N8+gtUM mZd3DUO3zOHXT2wOsXuBM5aeTpunEJ8NZWG9liPy6qNcVo4AbOZiNLl4tAxVC3dqWztP gBtFoUl70wQm2XaoFYxpzxZtWUx1pfVFG6ny9hh2P7x79GyBHeAZCuVa0JkvwtIRQEYz VP6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=oI5jMD6AZqZbpZI8qSFw62ApYre6c6Sk1ZdaH/J2kYI=; b=gjG1YkoTKwE0AkTXa7O5zoZIZNRyKqq/1IKYMd011JfL0N/JNvHQRINGPw8AhEpYT4 YpkPgEZDoHfB9g8Ujzaf8LtyUbwbxGctZTNFkX33I3OTNeuW3Ig3oFc2dbbr/R3jYRlB WdjfLQ/iTY/P9gZ4fu/Yka0s3xkNC3JAtstFVXW5/Cs/Cdl4v+7NWwZuDaoqQJicOUtW SOSxEptKor8kVqvix4+YRliWEOqLZYk7vMSbnLe5FpLLFFUw8hHjthnJiwVSU/sSSOiz hKtVX6mqMBHQoRUpk+9/FU7Wgp721gEdAtEYL3XJiUUU5U622EDB6Z3SDCIZSezg2IMK kQgg== 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 q71-v6si931645pfl.317.2018.06.19.17.15.27; Tue, 19 Jun 2018 17:15:41 -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 S1754059AbeFTAOR (ORCPT + 99 others); Tue, 19 Jun 2018 20:14:17 -0400 Received: from terminus.zytor.com ([198.137.202.136]:35023 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750929AbeFTAOO (ORCPT ); Tue, 19 Jun 2018 20:14:14 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5K0E6Ab3296272 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 19 Jun 2018 17:14:06 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5K0E66T3296269; Tue, 19 Jun 2018 17:14:06 -0700 Date: Tue, 19 Jun 2018 17:14:06 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Reinette Chatre Message-ID: Cc: tglx@linutronix.de, hpa@zytor.com, reinette.chatre@intel.com, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: hpa@zytor.com, reinette.chatre@intel.com, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de In-Reply-To: <2f1844c590a87f96b8b948d5d6da54b532d25888.1527593970.git.reinette.chatre@intel.com> References: <2f1844c590a87f96b8b948d5d6da54b532d25888.1527593970.git.reinette.chatre@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cache] x86/intel_rdt: Associate mode with each RDT resource group Git-Commit-ID: 5363fc10521acb00c4bdc19ab9e2482db12b5514 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 5363fc10521acb00c4bdc19ab9e2482db12b5514 Gitweb: https://git.kernel.org/tip/5363fc10521acb00c4bdc19ab9e2482db12b5514 Author: Reinette Chatre AuthorDate: Tue, 29 May 2018 05:57:28 -0700 Committer: Thomas Gleixner CommitDate: Wed, 20 Jun 2018 00:56:27 +0200 x86/intel_rdt: Associate mode with each RDT resource group Each RDT resource group is associated with a mode that will reflect the level of sharing of its allocations. The default, shareable, will be associated with each resource group on creation since it is zero and resource groups are created with kzalloc. The managing of the mode of a resource group will follow. The default resource group always remain though so ensure that it is reset to the default mode when the resctrl filesystem is unmounted. Also introduce a utility that can be used to determine the mode of a resource group when it is searched for based on its class of service. Signed-off-by: Reinette Chatre Signed-off-by: Thomas Gleixner Cc: fenghua.yu@intel.com Cc: tony.luck@intel.com Cc: vikas.shivappa@linux.intel.com Cc: gavin.hindman@intel.com Cc: jithu.joseph@intel.com Cc: dave.hansen@intel.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/2f1844c590a87f96b8b948d5d6da54b532d25888.1527593970.git.reinette.chatre@intel.com --- arch/x86/kernel/cpu/intel_rdt.h | 3 +++ arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h index c08eee73ecd3..7ff1f633bebe 100644 --- a/arch/x86/kernel/cpu/intel_rdt.h +++ b/arch/x86/kernel/cpu/intel_rdt.h @@ -122,6 +122,7 @@ struct mongroup { * @type: indicates type of this rdtgroup - either * monitor only or ctrl_mon group * @mon: mongroup related data + * @mode: mode of resource group */ struct rdtgroup { struct kernfs_node *kn; @@ -132,6 +133,7 @@ struct rdtgroup { atomic_t waitcount; enum rdt_group_type type; struct mongroup mon; + enum rdtgrp_mode mode; }; /* rdtgroup.flags */ @@ -461,6 +463,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off); int rdtgroup_schemata_show(struct kernfs_open_file *of, struct seq_file *s, void *v); +enum rdtgrp_mode rdtgroup_mode_by_closid(int closid); struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r); int alloc_rmid(void); void free_rmid(u32 rmid); diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index 749856a2e736..70d7846041fe 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -126,6 +126,27 @@ static void closid_free(int closid) closid_free_map |= 1 << closid; } +/** + * rdtgroup_mode_by_closid - Return mode of resource group with closid + * @closid: closid if the resource group + * + * Each resource group is associated with a @closid. Here the mode + * of a resource group can be queried by searching for it using its closid. + * + * Return: mode as &enum rdtgrp_mode of resource group with closid @closid + */ +enum rdtgrp_mode rdtgroup_mode_by_closid(int closid) +{ + struct rdtgroup *rdtgrp; + + list_for_each_entry(rdtgrp, &rdt_all_groups, rdtgroup_list) { + if (rdtgrp->closid == closid) + return rdtgrp->mode; + } + + return RDT_NUM_MODES; +} + /* set uid and gid of rdtgroup dirs and files to that of the creator */ static int rdtgroup_kn_set_ugid(struct kernfs_node *kn) { @@ -1483,6 +1504,7 @@ static void rdt_kill_sb(struct super_block *sb) reset_all_ctrls(r); cdp_disable_all(); rmdir_all_sub(); + rdtgroup_default.mode = RDT_MODE_SHAREABLE; static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); static_branch_disable_cpuslocked(&rdt_enable_key);