Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp240912imm; Wed, 3 Oct 2018 15:19:15 -0700 (PDT) X-Google-Smtp-Source: ACcGV61T77SSqLnoDKe9kfbQNUVGt8p4oz3GpXuy/BtduVnMZARLPnSuOf3ifROcHJN2u4bM1cJ5 X-Received: by 2002:a63:7f0e:: with SMTP id a14-v6mr3122023pgd.296.1538605155391; Wed, 03 Oct 2018 15:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538605155; cv=none; d=google.com; s=arc-20160816; b=QjrMuLpwRN8BcRmGNSoI5TuIP26d/nUJ9rmc0FeNQXGtxzaoWC5Wz2zIjCawtxsPxx TRbNDYlUgoDCd1Z/Ibme9W4X+pTJ7ggbSHwN4Ye+z3o6aITM9LELQ+p7Oz7w97R4o14K nzo2WPiFISZZap8naFaB5VPG5c4BuzmQJ505jeRN/4tqVFm3q7jMLLrv9sYQJBedy3Or psyEF831f9BEBDUxfwppvmq8o0V1Sw2f732/X14jBYudzs5Hhes4DGp0bc/AN2emQEQm hkL7NoBAPLG7HIcvdIDoycIgkgpyxIJtVKJuMMGcj176Onlmz6O+5uc3d9BaKrqsw6AD wjDg== 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=TBQHwj7qlJDGf9OZA8ANgH505cAErzvLJ/JmclDNasg=; b=YF+1pyt7ZFSSKlUScOFnmyfpHW/LJxSF/lDQvsw7B7RY1F6asWOVsJjRC9ov8rLneD LiBSfbtttz0F0m3PIn/78GKW/CPK/ZhGH+gN7VKJlnbPifYDD+mT7fw+dz9C08UbPGns spf6vnEOwJyYrrbXDKFa53pdDbO2p5IY06HmG/Mq4RdGrpCmtxBKc0eZEx5abFcO7BC5 4bg0X//GmvJ7rGUY7WtqNWh9HHh1B75lJe+ufllgCqEiXMHKCD/WvsFOU1puDDXa3VqK DhaVVw/oPM7puwe8OmwyCfrBKyyzIZk+kESjj3t518rX0s4yoYJ9dWVzkGHnexrIb325 Bj9w== 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 p5-v6si2671225pgi.411.2018.10.03.15.19.00; Wed, 03 Oct 2018 15:19:15 -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 S1727279AbeJDFI7 (ORCPT + 99 others); Thu, 4 Oct 2018 01:08:59 -0400 Received: from mga02.intel.com ([134.134.136.20]:62866 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbeJDFI6 (ORCPT ); Thu, 4 Oct 2018 01:08:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2018 15:18:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,337,1534834800"; d="scan'208";a="91965089" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by fmsmga002.fm.intel.com with ESMTP; 03 Oct 2018 15:17:42 -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 V2 3/3] x86/intel_rdt: Fix initial allocation to consider CDP Date: Wed, 3 Oct 2018 15:17:03 -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 1a0bf6d1f06a..ce924e5e6406 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -2457,11 +2457,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; @@ -2473,6 +2476,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; @@ -2482,9 +2486,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