Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3053015pxj; Mon, 14 Jun 2021 13:15:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9oE30mFu+ijbspFahP5dSBq0z/bP4gq8CTaapg93IAYJ1642ndwNo0BaYuAmn//S5qf64 X-Received: by 2002:a05:6402:31a5:: with SMTP id dj5mr619485edb.229.1623701749583; Mon, 14 Jun 2021 13:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623701749; cv=none; d=google.com; s=arc-20160816; b=CXY0+/MQ0i6NSZWrqfbyPWt+x9tEie+tMs3Kvkz1bn7JHx8TWd54tokQlyjyeCiJO/ lXwpIrYqu+tCblLVres9VCnG736IcT6SrCV4ND8OHXu0fV2CN2uV89YqYpgbiCVjh36g JnUmGGOARCyQxRgXeDLjXTTEegL9kHyqiT6ZrLzGoEZvlMP4yTVCis+TUfkSJ1IiXY9q MAxaCTgHN2D62wwVKodsKc9Rdu28NFf4o2Eb1bWnEhCS/1JCjx1sBLF62j20IZRoEb/u PaPupepiH/IOdMVqCqXV/eW2B+pjqFXmrENimDc7k9tdFRhTYnMyFdJAAPkL/iSyEn98 vRtQ== 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=XsjYYGaA+0lpeaUVSYVIY15Iyx1TqCirnMUGkYnicgQ=; b=P9QpfmWmgSqUF/cyjeRq1X8E5YCLAuKhTCsyg7235MOWkapPVVN0WiKz5Nqdk3e22F vpRdYhbe5Gtl0DEBaVnhtkvRQFapOR/o87lLoi55FvOTWNwxRLBvNQ0hKRUkiWdyAk9F tR99RPNnM+uVh5yjQec9S97sWL33jbr1U7NnhhlSkstQHeWPJro86az9o48fGlBiOU+o 0LFcxeEnBq5dqH1LuUolUISJyWG/ZxBEVdAkAZDCVM+cB1AfdbVziiNahRATzWww6jrp zxFQIMHn7Dv/Xc8vXZpvcysVi4k0MM9cBlr+y+aLGit5yHS3cGCjqz/Q48Ya3JnwDKnH eqiA== 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 13si12078363ejh.524.2021.06.14.13.15.26; Mon, 14 Jun 2021 13:15:49 -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 S235603AbhFNUNP (ORCPT + 99 others); Mon, 14 Jun 2021 16:13:15 -0400 Received: from foss.arm.com ([217.140.110.172]:45980 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235630AbhFNUNB (ORCPT ); Mon, 14 Jun 2021 16:13:01 -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 6F0C713D5; Mon, 14 Jun 2021 13:10:58 -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 79EFA3F694; Mon, 14 Jun 2021 13:10:56 -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 v4 23/24] x86/resctrl: Expand resctrl_arch_update_domains()'s msr_param range Date: Mon, 14 Jun 2021 20:09:40 +0000 Message-Id: <20210614200941.12383-24-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210614200941.12383-1-james.morse@arm.com> References: <20210614200941.12383-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 e384398374da..0a1b878ca0db 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