Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1897571imm; Sat, 23 Jun 2018 05:10:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIals7Vc1KvGXHGVgFBndEckd6CHnPxpjMAMbq3v5ybtp7YEBX00ZA7rdYrDSxHnna5yERq X-Received: by 2002:a17:902:e10f:: with SMTP id cc15-v6mr5500534plb.100.1529755854802; Sat, 23 Jun 2018 05:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529755854; cv=none; d=google.com; s=arc-20160816; b=zr/gtvw0o8KJd8zJI0CwcsmYaE8Jt5jEG33RMbsbVtNsTYt3SMQsnA487z9WAyg3HO +pbLoH5s7E/z9HsT37ZxugxbD3at6xbSYDfyTrlU7uLd7Y3tWmVoBN2SnEUKDCEFjWcN HPtbniTOxX7wX3iutvocgAQJ4ygPhOtYvN8/e3DZ8tI2uA58XEEfGjDxS9sFeNc6hnDd vl2FBLuFYv5npqs5iN7j7iW/+D3QOYVKY+wl9DJU9TBnpU5QtC+jGRfvIKVB9HvCZjgY PgtkxeO5YPJ0sqBMVRhDJ3bpoz4FT3B59UPWHGoZ3oeZ3epqQcIT4Ibfdcu/22nt4HDQ RbHA== 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=/b7JgT3lzqu4Wdc8KWAwW+1PF9wqZysCGrbwgpGhiu0=; b=YDE4g/HVOAwwXQ2mTJQHvuHiC+HjEgAKlZXuSUI9DqoXAdt9rRMFCJf7cTkda0J45k 7QVBpprYDcyrkBpXVXvG3GPZb4nxq8eLbn+5eMEMpoK3oXS99i3WInTibsV4nqxlwkJE T9GTLl0CGJdSuIClEuwcOaV5lZUS3OWUeJZzfn+iSxxe74IIEUhcGEQ4sYzwTB0mTY35 ag5sfdj6ELzAxVRHuUciNzO2p2J935962X+VyXETFIzK3ApeKkjq8hIwpJp0XdTgdxV1 hB3FEkBhkxHMDmXFOx4bKXLqCG/ZWVARFWvnBxGg549RSmWZJkDslHsZUvJOsHr9Jmnq Vchg== 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 3-v6si9502341plc.415.2018.06.23.05.10.40; Sat, 23 Jun 2018 05:10:54 -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 S1751948AbeFWMIv (ORCPT + 99 others); Sat, 23 Jun 2018 08:08:51 -0400 Received: from terminus.zytor.com ([198.137.202.136]:53119 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751835AbeFWMIu (ORCPT ); Sat, 23 Jun 2018 08:08:50 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5NC8jXT463286 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Jun 2018 05:08:45 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5NC8jMp463279; Sat, 23 Jun 2018 05:08:45 -0700 Date: Sat, 23 Jun 2018 05:08:45 -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, reinette.chatre@intel.com, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org Reply-To: linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, reinette.chatre@intel.com, tglx@linutronix.de In-Reply-To: <797e4e1de4e4fcdf5b5e0039354d6a28079e2015.1529706536.git.reinette.chatre@intel.com> References: <797e4e1de4e4fcdf5b5e0039354d6a28079e2015.1529706536.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: 472ef09b40c5802a2e014ae2503ad8619486f9e6 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, 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: 472ef09b40c5802a2e014ae2503ad8619486f9e6 Gitweb: https://git.kernel.org/tip/472ef09b40c5802a2e014ae2503ad8619486f9e6 Author: Reinette Chatre AuthorDate: Fri, 22 Jun 2018 15:41:55 -0700 Committer: Thomas Gleixner CommitDate: Sat, 23 Jun 2018 13:03:41 +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/797e4e1de4e4fcdf5b5e0039354d6a28079e2015.1529706536.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 fef254e85da4..482dd6d3b8c5 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 fa668f967062..4a72061df7cd 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) { @@ -1491,6 +1512,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);