Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp743753pxj; Thu, 17 Jun 2021 12:49:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx39K/A/CyIAfn87wkJn9J2VZViVtGxaipKYXIsZc86RUv6zzKXPTzr5wNRrX3gtpwXoEOG X-Received: by 2002:a92:d852:: with SMTP id h18mr719019ilq.299.1623959340334; Thu, 17 Jun 2021 12:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623959340; cv=none; d=google.com; s=arc-20160816; b=tP4doA2tgZsJqOA0lq745Jxb9k81yC/HDSt7t8pVUWs+wROl9V0n42wrnRZD6NC7NH slOfq7gWeCTNOYTEwyga1pVclukVT0/GwlwehAAQolVXH4OcJ+szn9ptBZlTx+5FDI2A AoFdlRpnKACh4nRq+J+YBhipSW6a3pHwFmdHiaYkZmXfTrHJoeBWfNXT1IAb2+oO7/Ol jCuqLp7dYAZ3LijoN9/og/LQZqQpk1gHFc6EDBpIfXepbWC6wh7W/zMLbJez/iS6csAt jS+rnPBy6SdEeC+ROwMYeK56gNWoAO4bK/rQgAD0pogdeMO8NfQK8SWqy1klynirflBM o1Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=sTLXV3JIGwmDig69QiNChTFjCHcOE3N0gqw55TTQuTQ=; b=mMKNjm7fhCtuK3lU7im/PuHRtac8RSxC5EGjiUwOqktUmLXtQyX8zoUmNaLJruv6zz Oyog9JsuAhgYjASNl9iWJhcVZDG3M2P/Lk9lX8SMq1jo41RSMfKKSV5W+1zfws79mUxy okFlpE62K78oZ1h63hNvz1nWudDmAJZkHv0jHW8+EubhIhg7+sVsA3AQW5mEKho5NPqc aMsUVo9PoOg00uy021dmE6Oeve3OHxF5u3QtLce6CmUpsKIKBLEG5DOvrdjXeztJ8h3E n4Pd6aZwqnCRYRU2bbaGiUSCBCKJE8iu412aQmheLdN8Y+D7OKXd+v2SXRCuOtVFkVKa jD3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y28si6393586iox.1.2021.06.17.12.48.47; Thu, 17 Jun 2021 12:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233580AbhFQSCd (ORCPT + 99 others); Thu, 17 Jun 2021 14:02:33 -0400 Received: from foss.arm.com ([217.140.110.172]:57786 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233289AbhFQSCF (ORCPT ); Thu, 17 Jun 2021 14:02:05 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 381631478; Thu, 17 Jun 2021 10:59:57 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5C4D13F694; Thu, 17 Jun 2021 10:59:55 -0700 (PDT) From: James Morse To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , James Morse , shameerali.kolothum.thodi@huawei.com, Jamie Iles , D Scott Phillips OS , lcherian@marvell.com Subject: [PATCH v5 23/24] x86/resctrl: Expand resctrl_arch_update_domains()'s msr_param range Date: Thu, 17 Jun 2021 17:58:19 +0000 Message-Id: <20210617175820.24037-24-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210617175820.24037-1-james.morse@arm.com> References: <20210617175820.24037-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org resctrl_arch_update_domains() specifies the one closid that has been modified and needs copying to the hardware. resctrl_arch_update_domains() takes a struct rdt_resource and a closid as arguments, but copies all the staged configurations for that closid into the ctrl_val[] array. resctrl_arch_update_domains() is called once per schema, but once the resources and domains are merged, the second call of a L2CODE/L2DATA pair will find no staged configurations, as they were previously applied. The msr_param of the first call only has one index, so would only have update the hardware for the last staged configuration. To avoid a second round of IPIs when changing L2CODE and L2DATA in one go, expand the range of the msr_param if multiple staged configurations are found. Signed-off-by: James Morse --- No changes since v3. Changes since v2: * This patch is new. --- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c index 04d54d942527..9e1c6730520b 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -292,6 +292,7 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) return -ENOMEM; mba_sc = is_mba_sc(r); + msr_param.res = NULL; list_for_each_entry(d, &r->domains, list) { hw_dom = resctrl_to_arch_dom(d); for (t = 0; t < CDP_NUM_TYPES; t++) { @@ -303,9 +304,14 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) if (!apply_config(hw_dom, cfg, idx, cpu_mask, mba_sc)) continue; - msr_param.low = idx; - msr_param.high = msr_param.low + 1; - msr_param.res = r; + if (!msr_param.res) { + msr_param.low = idx; + msr_param.high = msr_param.low + 1; + msr_param.res = r; + } else { + msr_param.low = min(msr_param.low, idx); + msr_param.high = max(msr_param.high, idx + 1); + } } } -- 2.30.2