Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1452086pxf; Fri, 12 Mar 2021 09:47:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJykJgmSHglVWEnS6EKPA2wQAYJ83HXsQO4Btp6Qgn+BKfnaj8qnWLV6tzypBXKWEaux2yy6 X-Received: by 2002:a17:906:1fd2:: with SMTP id e18mr10138589ejt.49.1615571239942; Fri, 12 Mar 2021 09:47:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615571239; cv=none; d=google.com; s=arc-20160816; b=uguz9kfWglpOYRVJu5sn4Q0euBTQsRxnckmtaPnMQTIiiH1nAw5jEyvr7jr4Lrr34+ nRxwGgpwkvTnIA6zZTeMbbEybCBgup8oHGPIhTr47IWl/snF3viTu04mO1xfY1EVkmSt 8M2OYnm16ZucrZosfRs0PW0RS9usayQZEq3DwBr23PCUsAY9JaRueN2FiTA5CnGBoNvO Wz2MT1nb3i0Q2ysAWWbD2VIldpZUScridurSMs8O6aeN0q+GdAnsFaT5cbt+PRtb7idW fryUqaRiY+dIC9veXgTIV/mL6rGvAYzf/PwrhYTebr2R1oi2c0cuBik7dk/uEG6myN0I DFqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from; bh=0OfBSjITH3Rr1bHuwbTPRKdISjOWWzfXFqGA6kkA4j0=; b=WfBq2ZCfRZa7kdiIapix2fxRNrb84ZT959RBL+FM6EHGgx/HWjmJDV0Gyjn6j4AyUW 9BOsp66V73sp7dyXmzbJCzo4cNDbxbAKumUc4slPtEwPxUOgh3DJRrT3S23Dng2KKV09 qE++mMXxdzOiKQzy5SACnCEgxoq202en/1qO3BeR6YJp0bIlmQVeq5G5slfUetZkDb7S RE9GINfQkV+nHmDV8z1xUpHSUwgoXtXymHqPG9gFxyVRczEab5176VpmW3jhe352xG+W etKgk3DAfol5ZpEh7eQy2VDtBJv2MjQWOhxXxzE45Hy5d2Ua4vfCmJIzfh5+1aTJ9+dG R4/A== 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 g19si4543702ejf.52.2021.03.12.09.46.57; Fri, 12 Mar 2021 09:47:19 -0800 (PST) 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 S232362AbhCLRnw (ORCPT + 99 others); Fri, 12 Mar 2021 12:43:52 -0500 Received: from foss.arm.com ([217.140.110.172]:58136 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbhCLRnX (ORCPT ); Fri, 12 Mar 2021 12:43:23 -0500 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 C507A1FB; Fri, 12 Mar 2021 09:43:22 -0800 (PST) Received: from [192.168.0.14] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 42F903F7D7; Fri, 12 Mar 2021 09:43:21 -0800 (PST) From: James Morse Subject: Re: [PATCH 12/24] x86/resctrl: Add closid to the staged config To: Reinette Chatre , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , shameerali.kolothum.thodi@huawei.com, Jamie Iles , D Scott Phillips OS References: <20201030161120.227225-1-james.morse@arm.com> <20201030161120.227225-13-james.morse@arm.com> <136b0a82-7d77-dc08-80ca-5265d4af30fd@intel.com> Message-ID: Date: Fri, 12 Mar 2021 17:43:20 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <136b0a82-7d77-dc08-80ca-5265d4af30fd@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Reinette, On 17/11/2020 23:46, Reinette Chatre wrote: > On 10/30/2020 9:11 AM, James Morse wrote: >> Once the L2/L2CODE/L2DATA resources are merged, there may be two >> configurations staged for one resource when CDP is enabled. The >> closid should always be passed with the type of configuration to the >> arch code. >> >> Because update_domains() will eventually apply a set of configurations, >> it should take the closid from the same place, so they pair up. >> >> Move the closid to be a staged parameter. > > Move implies that it is taken from one location and added to another. This seems like a > copy instead? I'll rephrase it. >> diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c >> b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c >> index 0c95ed83eb05..b107c0202cfb 100644 >> --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c >> +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c >> @@ -72,6 +72,7 @@ int parse_bw(struct rdt_parse_data *data, struct resctrl_schema *s, >>       if (!bw_validate(data->buf, &bw_val, r)) >>           return -EINVAL; >>       cfg->new_ctrl = bw_val; >> +    cfg->closid = data->rdtgrp->closid; >>       cfg->have_new_ctrl = true; >>         return 0; >> @@ -178,6 +179,7 @@ int parse_cbm(struct rdt_parse_data *data, struct resctrl_schema *s, >>       } >>         cfg->new_ctrl = cbm_val; >> +    cfg->closid = data->rdtgrp->closid; >>       cfg->have_new_ctrl = true; > rdtgrp is already available so it could just be: > cfg->closid = rdtgrp->closid? Yes, this is just trying to be identical to the earlier version. I'll change it. >>       return 0; >> @@ -245,15 +247,15 @@ static int parse_line(char *line, struct resctrl_schema *s, >>   } >>     static void apply_config(struct rdt_hw_domain *hw_dom, >> -             struct resctrl_staged_config *cfg, int closid, >> +             struct resctrl_staged_config *cfg, >>                cpumask_var_t cpu_mask, bool mba_sc) >>   { >>       struct rdt_domain *dom = &hw_dom->resctrl; >>       u32 *dc = mba_sc ? hw_dom->mbps_val : hw_dom->ctrl_val; >>   -    if (cfg->new_ctrl != dc[closid]) { >> +    if (cfg->new_ctrl != dc[cfg->closid]) { >>           cpumask_set_cpu(cpumask_any(&dom->cpu_mask), cpu_mask); >> -        dc[closid] = cfg->new_ctrl; >> +        dc[cfg->closid] = cfg->new_ctrl; >>       } >>         cfg->have_new_ctrl = false; >> @@ -284,7 +286,7 @@ int update_domains(struct rdt_resource *r, int closid) >>               if (!cfg->have_new_ctrl) >>                   continue; >>   -            apply_config(hw_dom, cfg, closid, cpu_mask, mba_sc); >> +            apply_config(hw_dom, cfg, cpu_mask, mba_sc); >>           } >>       } > It is not clear to me that storing the closid in the staged config is necessary. A closid > is associated with a resource group so when the user writes to the schemata file all > configurations would be (from the resource group perspective) for the same closid. This is > the value provided here to update domains. Looking ahead in this series this closid is > later used to compute the index (get_config_index()) that would use as input cfg->closid, > but that cfg->closid would be identical for all resources/staged configs and then the new > index would be computed based on the resource type. Having the closid in the staged config > thus does not seem to be necessary, it could remain as this function parameter and be used > for all staged configs? Yes, when emulating CDP with MPAM, these can be two unrelated numbers, but it looks like I lost track of the 'its always going to be the same value' for each invocation through the filesystem. An earlier version tried to push separate code/data closid values further into the resctrl code, but I thought it was getting too confusing. The x86 CDP behaviour is either 'configuration is twice the size' or 'an odd even pair of closid' depending on how you look at it. For MPAM the equivalent feature is an (arbitary!) pair of closid/partid. Yes its not necessary for resctrl, I'll see how much of this I can unpick! Thanks, James