Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1231017imm; Fri, 14 Sep 2018 13:36:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYIgVmaWaI/usKEODMmzB1omOe/U/Z35U9y/oIQB4Lpdy1LRiKaLaFoUoGBHBfuaRRKBWgx X-Received: by 2002:a62:4bc6:: with SMTP id d67-v6mr14238149pfj.175.1536957399687; Fri, 14 Sep 2018 13:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536957399; cv=none; d=google.com; s=arc-20160816; b=VFfpZ6+G/QZzZ1O4YYPNnZrH/Z3ZNSeGus8UXclesXrWUNyl4tWUReS8CjBIRs2zX7 GgM2fd5F5Dz6jXUgF2HS5Vvn3Y6hd92IZUj59+QUKUCBYTaBvLwljiHtp1fivSuL6kQ5 u6h0pB8btANaLLvuYwBg7bjYSbb2Ch/gJ3Aqm50yu2BcENp0dwAXQVIVU1ud+18poEkd YLSbxiGyzc8i+DkYgjPEJZVIf9h7Lh7XO4QYxJomebV71roQJfbpCfQL2Fo2Yc1J+iEV h09nR1G65JZbcJxOOdFbZD1YdnyP2xGoh0Y5lrF6UzF9IkSqGnZX3GJcRpoAQTgVqTy1 XvUw== 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; bh=FiLzr7odBIMnCUWrt4mehi1NAbNC4T9txLyqU8Uh5s8=; b=CTkRjQVD5CI/uSdoxsmb65VwJnskytIVMgzSMLh0wEi/zG6wvr+MfqVGVyf1CTwaDz tdEMJ1VgqlOOdg0YIyUDNW56bVFHJU932sX4yaoxmGMd4M5BA1eYMA3k5cG+BCfFhb0a XuhnaUWK5spsZ5qJrZfS+6jT4lHaG5npySr4gNYC+JJ659RToj2uhlUKs2MYPLn+2ReA 0q3UOWvOdte2YKggPWDbvrT6Cm5ViOvIgW+FSLjuJY8VR6SsBgW7bDFNRhQpN8mOg+Gj khogQ3LkBdK7pAzn549QAyUPDpEYSSoVEvQ/Uo9Yah4Ut/p2KKk8FL2v12PJ7yVMcGQw FV/Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i35-v6si7628095plg.123.2018.09.14.13.36.24; Fri, 14 Sep 2018 13:36:39 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728378AbeIOBvx (ORCPT + 99 others); Fri, 14 Sep 2018 21:51:53 -0400 Received: from mga05.intel.com ([192.55.52.43]:60391 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728362AbeIOBvx (ORCPT ); Fri, 14 Sep 2018 21:51:53 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Sep 2018 13:35:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,374,1531810800"; d="scan'208";a="263593821" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga006.fm.intel.com with ESMTP; 14 Sep 2018 13:35:44 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "H Peter Anvin" , "Tony Luck" Cc: "Chatre, Reinette" , "Xiaochen Shen" , "Chen Yu" , "linux-kernel" , "x86" , "Fenghua Yu" Subject: [PATCH 8/9] x86/intel_rdt: Fix exclusive mode handling of MBA resource Date: Fri, 14 Sep 2018 13:32:08 -0700 Message-Id: <1536957129-70380-9-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1536957129-70380-1-git-send-email-fenghua.yu@intel.com> References: <1536957129-70380-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Reinette Chatre It is possible for a resource group to consist out of MBA as well as CAT/CDP resources. The "exclusive" resource mode only applies to the CAT/CDP resources since MBA allocations cannot be specified to overlap or not. When a user requests a resource group to become "exclusive" then it can only be successful if there are CAT/CDP resources in the group and none of their CBMs associated with the group's CLOSID overlaps with any other resource group. Fix the "exclusive" mode setting by failing if there isn't any CAT/CDP resource in the group and ensuring that the CBM checking is only done on CAT/CDP resources. Fixes: 49f7b4efa ("x86/intel_rdt: Enable setting of exclusive mode") Signed-off-by: Reinette Chatre Signed-off-by: Fenghua Yu --- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index afd93d45e21b..fac99f81d02f 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -1031,16 +1031,27 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) { int closid = rdtgrp->closid; struct rdt_resource *r; + bool has_cache = false; struct rdt_domain *d; for_each_alloc_enabled_rdt_resource(r) { + if (r->rid == RDT_RESOURCE_MBA) + continue; + has_cache = true; list_for_each_entry(d, &r->domains, list) { if (rdtgroup_cbm_overlaps(r, d, d->ctrl_val[closid], - rdtgrp->closid, false)) + rdtgrp->closid, false)) { + rdt_last_cmd_puts("schemata overlaps\n"); return false; + } } } + if (!has_cache) { + rdt_last_cmd_puts("cannot be exclusive without CAT/CDP\n"); + return false; + } + return true; } @@ -1092,7 +1103,6 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of, rdtgrp->mode = RDT_MODE_SHAREABLE; } else if (!strcmp(buf, "exclusive")) { if (!rdtgroup_mode_test_exclusive(rdtgrp)) { - rdt_last_cmd_printf("schemata overlaps\n"); ret = -EINVAL; goto out; } -- 2.19.0