Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1120357imm; Wed, 26 Sep 2018 12:01:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV62y1M1ka5cHzhP7GdI4TRbmMM8lZjpiARlEq45px73TimLNh8d+H1q18pImsciuhY4Yoh5u X-Received: by 2002:a62:8913:: with SMTP id v19-v6mr7625918pfd.127.1537988497410; Wed, 26 Sep 2018 12:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537988497; cv=none; d=google.com; s=arc-20160816; b=gfYk8PnAIZGiVA+qlENGlwTqTSH8zlFMMLHkd9FCqinFXmGE8w1x6agD09kX8RnbCK 1Ma7iypCtu/4Zb0k7PewtHdmcgiJzupgsRKcIKf5AzBmYnRjlcfs5Zbq6l0rOUePK9kK QrNFsrgDyjRmR8pq7VRsemc6SP0tf4nT9rzacy0/1CniphwL9zR7bY9hcrwIW6oMP2Pq mifHC/oo2b6TIO/Op4sF2WSAyfoxDtPtHolLnUmSYqt7BRQ0Ci3zPGd7B/nqO+gHtPNB KMQW0fwpFUMa+OD2IaybmHjaeKb0+LHAE8+tuyRChWlqC1Zn8/w+2EERwReIU3AuJCRn JLOw== 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; bh=nPnqBP0VDvTSVkr71MBp5X0VN4JA+PwD8S0IdXcawIo=; b=iUnirD4F7T3cirAVzZRiJRFyL75TT+tVLpuwG2913k4TFnbXzMv3OJXguPYArZQAFs +fJ1oQk+/wgO58L3+G1LI2mnB6lcp/zabpnbGNqCsrGYNpaskvbq71imclXCoAT1ZHz/ gZ2ZVZxJqzoaxFhy3f5bu/EB3Ww+dCjdu9KfgBaiYdCNBXdDI+djXHDxcy2vK5EYdpBc IBD/4KRfeMW/P/3J1qmpXXYzqZm6/JQ2JMIKgnT6ZLMBHV2sFhfSL1xZjnJj3eHgyQFA xdotxuJ1VGSNADj/tlw9Zl14Rv+SNTQHDYLY9zhxZJmr4oiqS1cfPfefGsb4eJ9yTaHr 3JUQ== 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 m64-v6si6302362pfc.17.2018.09.26.12.01.22; Wed, 26 Sep 2018 12:01:37 -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 S1728622AbeI0BPG (ORCPT + 99 others); Wed, 26 Sep 2018 21:15:06 -0400 Received: from mga04.intel.com ([192.55.52.120]:64733 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbeI0BPF (ORCPT ); Wed, 26 Sep 2018 21:15:05 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 12:00:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,307,1534834800"; d="scan'208";a="76436982" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by orsmga008.jf.intel.com with ESMTP; 26 Sep 2018 12:00:39 -0700 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com Cc: jithu.joseph@intel.com, gavin.hindman@intel.com, dave.hansen@intel.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre Subject: [PATCH 3/3] x86/intel_rdt: Fix initial allocation to consider CDP Date: Wed, 26 Sep 2018 11:59:45 -0700 Message-Id: X-Mailer: git-send-email 2.17.0 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 When a new resource group is created it is initialized with a default allocation that considers which portions of cache are currently available for sharing across all resource groups or which portions of cache are currently unused. If a CDP allocation forms part of a resource group that is in exclusive mode then it should be ensured that no new allocation overlaps with any resource that shares the underlying hardware. The current initial allocation does not take this sharing of hardware into account and a new allocation in a resource that shares the same hardware would affect the exclusive resource group. Fix this by considering the allocation of a peer RDT domain - a RDT domain sharing the same hardware - as part of the test to determine which portion of cache is in use and available for use. Fixes: 95f0b77efa57 ("x86/intel_rdt: Initialize new resource group with sane defaults") Signed-off-by: Reinette Chatre Acked-by: Fenghua Yu --- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index 3f56b4e624ea..5b7932af522a 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -2459,11 +2459,14 @@ static void cbm_ensure_valid(u32 *_val, struct rdt_resource *r) */ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) { + struct rdt_resource *r_cdp = NULL; + struct rdt_domain *d_cdp = NULL; u32 used_b = 0, unused_b = 0; u32 closid = rdtgrp->closid; struct rdt_resource *r; enum rdtgrp_mode mode; struct rdt_domain *d; + u32 peer_ctl; int i, ret; u32 *ctrl; @@ -2475,6 +2478,7 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) if (r->rid == RDT_RESOURCE_MBA) continue; list_for_each_entry(d, &r->domains, list) { + rdt_cdp_peer_get(r, d, &r_cdp, &d_cdp); d->have_new_ctrl = false; d->new_ctrl = r->cache.shareable_bits; used_b = r->cache.shareable_bits; @@ -2484,9 +2488,19 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) mode = rdtgroup_mode_by_closid(i); if (mode == RDT_MODE_PSEUDO_LOCKSETUP) break; - used_b |= *ctrl; + /* + * If CDP is active include peer + * domain's usage to ensure there + * is no overlap with an exclusive + * group. + */ + if (d_cdp) + peer_ctl = d_cdp->ctrl_val[i]; + else + peer_ctl = 0; + used_b |= *ctrl | peer_ctl; if (mode == RDT_MODE_SHAREABLE) - d->new_ctrl |= *ctrl; + d->new_ctrl |= *ctrl | peer_ctl; } } if (d->plr && d->plr->cbm > 0) -- 2.17.0