Received: by 10.223.185.116 with SMTP id b49csp28311wrg; Tue, 13 Feb 2018 15:55:43 -0800 (PST) X-Google-Smtp-Source: AH8x224eXlIr/OHi3ybRjHBk8BCHf6ZE3pb7TaLCQcVj7kSuGpKRM3lIGiEhL3UobQULLdxSUYNZ X-Received: by 10.98.237.21 with SMTP id u21mr2873969pfh.190.1518566143066; Tue, 13 Feb 2018 15:55:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518566143; cv=none; d=google.com; s=arc-20160816; b=JuxcFtqGPX9ptDBFCC7M0yA9kCvSI4/tvibX2SFNXvW/zPA32UEC7pdC94g2av52C9 fjrXXIwzxX51uYwWzbrS/hsmkE+/v/UqAIAfuOcbzUt/SyKlNPWlRDT9GqUsSEpg7GwC SewHIKwVqi017ZKeSYIX2inuJsTaKz6FETp3IRdHECFFPMy1EaN7X9s/vziD0n46j0gD eDBQi0BMzDj046Yg6DJWhQgUJ6yaDao+tVk0RnPrQRmpBO7SHQzKnGTpmpZC/32Fqm8O AqEJ+4BBtDNyzEbCE6ezW6IiS4rShzhqd6YlDU74qoP+dwVjpqsGT7LzXszCVVvCmWuh PB/w== 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=R4dBZGp6KBNwaEHMI8eOFm6Km4lsjAQr7UkjWYQMCpg=; b=A7CEmxZnmpzTex/0QXS7irquyy/W5lTnK8f1kePCqer0c4JLpKHLYNyAtL7sAovCsV fThDOpYkMKNCQZRYEvHcmg4mWt78QjR9wkbo9HTZHF8B4yNfpD1jk4SpyPis7GUUHtcD vg5x0Qc/naxAghMM/v0dXq9gX3IF9/9LPo9jpuMRLlKi3/MbvWzY28K9koZffLMQLr22 DB/928mccJ0ATtzcPameFz6SXlBiazfIyDxumA+kEnAQNpe6slra2i2QCcnBJYudgnYT 8cqSZ9TmzWhPaj1YjjrsbgC9Rm09TC+uy1EOszb1csBRE4wAowGxYNTw1EdQm8BlAoBr AZ8A== 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 s4si396562pgq.658.2018.02.13.15.55.28; Tue, 13 Feb 2018 15:55:43 -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 S966284AbeBMXyF (ORCPT + 99 others); Tue, 13 Feb 2018 18:54:05 -0500 Received: from mga17.intel.com ([192.55.52.151]:53393 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966133AbeBMXtd (ORCPT ); Tue, 13 Feb 2018 18:49:33 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2018 15:49:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,509,1511856000"; d="scan'208";a="29822308" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by fmsmga004.fm.intel.com with ESMTP; 13 Feb 2018 15:49:32 -0800 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com Cc: gavin.hindman@intel.com, 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 V2 04/22] x86/intel_rdt: Introduce test to determine if closid is in use Date: Tue, 13 Feb 2018 07:46:48 -0800 Message-Id: <5858b9df20e81bc140bae9283c3e63cc219fb7c8.1518443616.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.13.6 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 During CAT feature discovery the capacity bitmasks (CBMs) associated with all the classes of service are initialized to all ones, even if the class of service is not in use. Introduce a test that can be used to determine if a class of service is in use. This test enables code interested in parsing the CBMs to know if its values are meaningful or can be ignored. Signed-off-by: Reinette Chatre --- arch/x86/kernel/cpu/intel_rdt.h | 1 + arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h index 146a8090bb58..8f5ded384e19 100644 --- a/arch/x86/kernel/cpu/intel_rdt.h +++ b/arch/x86/kernel/cpu/intel_rdt.h @@ -435,6 +435,7 @@ int rdtgroup_kn_set_ugid(struct kernfs_node *kn); struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r); int closid_alloc(void); void closid_free(int closid); +bool closid_allocated(unsigned int closid); int update_domains(struct rdt_resource *r, int closid); 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 2a14867a14f7..5698d66b6892 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -126,6 +126,12 @@ void closid_free(int closid) closid_free_map |= 1 << closid; } +/* closid_allocated - test if provided closid is in use */ +bool closid_allocated(unsigned int closid) +{ + return (closid_free_map & (1 << closid)) == 0; +} + /* set uid and gid of rdtgroup dirs and files to that of the creator */ int rdtgroup_kn_set_ugid(struct kernfs_node *kn) { -- 2.13.6