Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2691257imm; Fri, 24 Aug 2018 03:47:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZjCByYetmN312zJOqReg4vNWslHuzNmB5qRJ0R5PgT2VoQXBae/Q9tC1uxa1Dvyq2IK/mH X-Received: by 2002:a63:586:: with SMTP id 128-v6mr1182002pgf.169.1535107678581; Fri, 24 Aug 2018 03:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535107678; cv=none; d=google.com; s=arc-20160816; b=Dp/osWt8bnZXNZL8MkVTKD4CZIf38iRv3HsBlJj30EMDWzwpUCFHBiRjL1Kn14bGhh pNLMq4wacMfROIeeju77VSKByZNsedcpRm7a8yLZWYHv7U1OU7VpL0n9ccvh2d5HRQSg AxH/LpF4cCgOpQqp3+Pwn3tWs0Rs7MPyTrLqwiXRqiwz2s+mNZgq2dgC5HQwt3Ur2+BO KMGSYzrfq9ieypHeawbsjZtfu1zkDouJa4h8yeo4n834Qjcxzlj0vXHPK9BURKppAFYC b9dEtIMfAl0BbjPEsSkooQRAE7AsEaRYDjZB94LfqCx1m3+CS0Uz2fX57wuVCTjHD1ol KyqQ== 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:arc-authentication-results; bh=LEAAvhxWY5B4FTDFKC3yVCddcQc+y0nQyt3/S43hVPs=; b=zJt9PpwgQOKTS8I0zNN36s9OIcY+ehO8UMA9kpl3QBGz0rVTwGPdPF96ac1771W6ci STBEX5yUkLsBZy8qbj3h16t1MYMz4NFmuyynKtO0LVSfwEtHQHZ0yD7N0Pcsnq8I4cEx Z3JQFaqtNptk8JB8keeSMaghD3tAGMdQUA5FiuHtVon0sggnFwlXd7dKBwfYGN/aUPhc HyzBKxmfQ7QD14mjzUdo1+aT8IxHx2G6mFj1w92MWcWzrPrFkBjh2guDz9cWeCAu4Kb0 MsdREjLeWZdPbVHadScsBROUjEQWVkvYrg8n5QT27sF/PY/eUWRBIMJeTRXd1C63Zlzr Sdkw== 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 g185-v6si6208814pgc.151.2018.08.24.03.47.43; Fri, 24 Aug 2018 03:47:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727839AbeHXOUZ (ORCPT + 99 others); Fri, 24 Aug 2018 10:20:25 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55558 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbeHXOUY (ORCPT ); Fri, 24 Aug 2018 10:20:24 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 230581A25; Fri, 24 Aug 2018 03:46:20 -0700 (PDT) Received: from melchizedek.Emea.Arm.com (melchizedek.emea.arm.com [10.4.12.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7AD683F5A0; Fri, 24 Aug 2018 03:46:18 -0700 (PDT) From: James Morse To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Thomas Gleixner , Fenghua Yu , Tony Luck , Ingo Molnar , H Peter Anvin , Reinette Chatre , Vikas Shivappa Subject: [RFC PATCH 10/20] x86/intel_rdt: Let resctrl change the resources's num_closid Date: Fri, 24 Aug 2018 11:45:09 +0100 Message-Id: <20180824104519.11203-11-james.morse@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180824104519.11203-1-james.morse@arm.com> References: <20180824104519.11203-1-james.morse@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Today we switch between different alloc_enabled resources which have differing preset num_closid to account for CDP. We want to merge these illusionary caches together, at which point something needs to change the resctrl's view of num_closid. The arch code now has its own idea of how many closids there are, and as the two configurations for one rdtgroup is part of resctrl's ABI we should get resctrl to change it. We change the num_closid on the l2/l3 resources, which aren't yet in use when cdp is enabled, then change them back afterwards. Once we merge illusionary caches, resctrl will see the value it changed here. Signed-off-by: James Morse --- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index 58dceaad6863..e2a9202674f3 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -1149,16 +1149,36 @@ int resctrl_arch_set_cdp_enabled(bool enable) static int try_to_enable_cdp(int level) { + int ret; struct rdt_resource *r = &rdt_resources_all[level].resctrl; + struct rdt_resource *l3 = &rdt_resources_all[RDT_RESOURCE_L3].resctrl; + struct rdt_resource *l2 = &rdt_resources_all[RDT_RESOURCE_L2].resctrl; if (!r->cdp_capable) return -EINVAL; + if (r->cdp_enabled) + return 0; - return resctrl_arch_set_cdp_enabled(true); + ret = resctrl_arch_set_cdp_enabled(true); + if (!ret) { + if (l2->cdp_enabled) + l2->num_closid /= 2; + if (l3->cdp_enabled) + l3->num_closid /= 2; + } + + return ret; } static void cdp_disable_all(void) { + struct rdt_resource *l2 = &rdt_resources_all[RDT_RESOURCE_L2].resctrl; + struct rdt_resource *l3 = &rdt_resources_all[RDT_RESOURCE_L3].resctrl; + + if (l2->cdp_enabled) + l2->num_closid *= 2; + if (l3->cdp_enabled) + l3->num_closid *= 2; resctrl_arch_set_cdp_enabled(false); } -- 2.18.0