Received: by 10.223.164.202 with SMTP id h10csp205093wrb; Mon, 13 Nov 2017 16:49:13 -0800 (PST) X-Google-Smtp-Source: AGs4zMYFWNzzv0anBNfY+FTuZcwcoMWEt8dHilDMFArWaZP+6k+2VwEeMhB7iKtUQopY3u9mNASM X-Received: by 10.101.99.144 with SMTP id h16mr10347010pgv.13.1510620553607; Mon, 13 Nov 2017 16:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510620553; cv=none; d=google.com; s=arc-20160816; b=ljUTkFsjzSNkJipKVaYPMwTUecxxaEsx5gbYpY3jJsf/SfJf7zpf1iTRGjeP+uHIOy o12x50PU5OA9GQlVn/Sc5Q5H5wdUIOCN/j2JZEzzRhGlJ93Cf6U1tceKhGDu3KnZEGv8 gzei4iFcwZBWcANEVDwwu3/vWc10Zrt08vrDw+vtbAZ/uRRTyFD0FiTbS0nrSyzJtWNS UllM9XQdrPED1pcDtygvtFhxZygh45wlda5cnE5DzHt2J2AHZaomwoSsKVLGOfO4zvrO ywRt/YGoUEMfXMvK1vkqEcEgdTEj5bJAAbjOJEGqZ+slK8Tq8eV4KEBJYOKdj2Mw/mzC 8ADw== 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:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+knFJxdd6OWeedTniZaiUyOzPvxGCuMUYDiLi2iDrJ4=; b=gSfk9YPG8hSt5jHXjJP9yaGf/dGuzgQFztW3Wlie6AwHXiMK7OLQ2CXExZ2Khpn8Jp dZnwDTLviELHWlT2RgQvGvPIYkq0qdpkTJN+NU7YK8Vjr9hgNXAPI9Qt/YrtBqjlhpoM GLyrzjmvJcsRNlzQayoUuDHlFyeyxVSzc8dZzR2eWHH9CzuDVaknSsetnDlbWZ7TOpUq rcDLqk8IT/3DRW01FSuLLxT70riAk0B4zClSFRbWGZ3g+vF5ztuiiSN5t3qjlg5rNBxp rU5QoB+K+MHRUhbau/j3dRndL2/kDFAINMuI+YiJao+bMEmftyWCWp+N7oSM2zCjoFfw Fp1w== 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 11si15401303plf.247.2017.11.13.16.49.00; Mon, 13 Nov 2017 16:49:13 -0800 (PST) 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 S1753494AbdKNAqX (ORCPT + 90 others); Mon, 13 Nov 2017 19:46:23 -0500 Received: from mga01.intel.com ([192.55.52.88]:37796 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752456AbdKNAmT (ORCPT ); Mon, 13 Nov 2017 19:42:19 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2017 16:42:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,392,1505804400"; d="scan'208";a="2288276" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by fmsmga001.fm.intel.com with ESMTP; 13 Nov 2017 16:42:19 -0800 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com Cc: vikas.shivappa@linux.intel.com, dave.hansen@intel.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre Subject: [RFC PATCH 08/20] x86/intel_rdt: Introduce pseudo-locking resctrl files Date: Mon, 13 Nov 2017 08:39:31 -0800 Message-Id: X-Mailer: git-send-email 2.13.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each sub-directory within the pseudo-lock directory represents a pseudo-locked region. Each of these sub-directories now receive the files that will be used by the user to specify requirements for the particular region and for the kernel to communicate some details about the region. Only support reading operations on these files in this commit. Since writing to these files will trigger the locking of a region we also just support reading of unlocked region data. Two files are created: schemata: Print the details of the portion of cache locked. If this has not yet been locked all resources will be listed as uninitialized. size: Print the size in bytes of the memory region pseudo-locked to the cache. Value is not yet initialized. Signed-off-by: Reinette Chatre --- arch/x86/kernel/cpu/intel_rdt.h | 5 +++ arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 49 +++++++++++++++++++++++++++++ arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 14 +++++++++ 3 files changed, 68 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h index 260f09f872b0..3216488f72df 100644 --- a/arch/x86/kernel/cpu/intel_rdt.h +++ b/arch/x86/kernel/cpu/intel_rdt.h @@ -131,6 +131,7 @@ struct rdtgroup { #define RFTYPE_CTRL BIT(RF_CTRLSHIFT) #define RFTYPE_MON BIT(RF_MONSHIFT) #define RFTYPE_TOP BIT(RF_TOPSHIFT) +#define RF_PSEUDO_LOCK BIT(7) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) #define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) @@ -455,5 +456,9 @@ int rdt_pseudo_lock_fs_init(struct kernfs_node *root); void rdt_pseudo_lock_fs_remove(void); int rdt_pseudo_lock_mkdir(const char *name, umode_t mode); int rdt_pseudo_lock_rmdir(struct kernfs_node *kn); +int pseudo_lock_schemata_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v); +int pseudo_lock_size_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v); #endif /* _ASM_X86_INTEL_RDT_H */ diff --git a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c index 7a22e367b82f..94bd1b4fbfee 100644 --- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c @@ -40,6 +40,7 @@ static DEFINE_MUTEX(rdt_pseudo_lock_mutex); * @kn: kernfs node representing this region in the resctrl * filesystem * @cbm: bitmask of the pseudo-locked region + * @size: size of pseudo-locked region in bytes * @cpu: core associated with the cache on which the setup code * will be run * @minor: minor number of character device associated with this @@ -52,6 +53,7 @@ static DEFINE_MUTEX(rdt_pseudo_lock_mutex); struct pseudo_lock_region { struct kernfs_node *kn; u32 cbm; + unsigned int size; int cpu; unsigned int minor; bool locked; @@ -227,6 +229,49 @@ static struct kernfs_ops pseudo_lock_avail_ops = { .seq_show = pseudo_lock_avail_show, }; +int pseudo_lock_schemata_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct pseudo_lock_region *plr; + struct rdt_resource *r; + int ret = 0; + + plr = pseudo_lock_region_kn_lock(of->kn); + if (!plr) { + ret = -ENOENT; + goto out; + } + + if (!plr->locked) { + for_each_alloc_enabled_rdt_resource(r) { + seq_printf(seq, "%s:uninitialized\n", r->name); + } + } + +out: + pseudo_lock_region_kn_unlock(of->kn); + return ret; +} + +int pseudo_lock_size_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct pseudo_lock_region *plr; + int ret = 0; + + plr = pseudo_lock_region_kn_lock(of->kn); + if (!plr) { + ret = -ENOENT; + goto out; + } + + seq_printf(seq, "%u\n", plr->size); + +out: + pseudo_lock_region_kn_unlock(of->kn); + return ret; +} + int rdt_pseudo_lock_mkdir(const char *name, umode_t mode) { struct pseudo_lock_region *plr; @@ -258,6 +303,10 @@ int rdt_pseudo_lock_mkdir(const char *name, umode_t mode) if (ret) goto out_remove; + ret = rdtgroup_add_files(kn, RF_PSEUDO_LOCK); + if (ret) + goto out_remove; + kref_init(&plr->refcount); kernfs_activate(kn); new_plr = plr; diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index afa3795a124e..947e9d706864 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -859,6 +859,20 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_schemata_show, .fflags = RF_CTRL_BASE, }, + { + .name = "schemata", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = pseudo_lock_schemata_show, + .fflags = RF_PSEUDO_LOCK, + }, + { + .name = "size", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = pseudo_lock_size_show, + .fflags = RF_PSEUDO_LOCK, + }, }; int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) -- 2.13.5 From 1592312992998372632@xxx Tue Feb 13 18:53:25 +0000 2018 X-GM-THRID: 1584010581342537607 X-Gmail-Labels: Inbox,Category Forums,Downloaded_2018-02