Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3852743rwb; Tue, 8 Nov 2022 09:05:02 -0800 (PST) X-Google-Smtp-Source: AMsMyM7jjVum7kH2l2e2irl++u+OX20+TAg7Xdp/KmVlkm2Dq10WGe7jQ47vnNVlLtzeHf9/XVDZ X-Received: by 2002:a17:907:a068:b0:7ad:956f:f13d with SMTP id ia8-20020a170907a06800b007ad956ff13dmr54124376ejc.643.1667927102672; Tue, 08 Nov 2022 09:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667927102; cv=none; d=google.com; s=arc-20160816; b=UWzSJzB6hv4tFCRDb9wLOVPwFKP8jR7Of6c8ZfwdFG3SPDu2g9Bjak8sBsDAv7fKbg zci50AakwxTp4hiCC8Eqf9Iuy+X6UOTzHLRPC1iev3vMS/1MgmM9mwqKThNZsArXuup+ bLS6jx57ZB9fD43ocP+ghG6oysXN/g4/fM6xBYuK0r+RgTFc1fQFmYbkw4+M820euz7M ellhcf6EqMHa8qsnyeSlL1VZ58GwV4x6marfmDSjic2J/9IFDWKalQxrS0ISi8irN9Ez QNPAEgklLjFKV48/K1dmLVV0Emt/zY1N9Tg4GRF4c8nuWBIh0BZbgbQt9TRa8QacyYfQ bTFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:subject:from:user-agent:mime-version:date:message-id; bh=3eCtL4HAx9A/B76gB/52jA8VgwmpkURlzpauuiGP2U8=; b=Mw8m394Rj4lcgU63vOiBwUvp9FbHJH77Xptlm24RP4YQFEnz8V7ACrsc9oYdPqigZ9 Oh8Sv50GB7KJSrSU1Wzx89QmHE5ormldC2MCbSO+mZo1rOM06AOHkG7jqJi7+oL7CWf2 FGu68bzge0Z2sgTE+3EZR5Gl+cnhAP081lQuDYE6yYhR8U+YiGzlepE2x/keLl+u3aJ+ o4lz867ihQoT9mz0M2RfAs+1tkF6F4ez3UrChHpvwJcvWKkbYUTdwmW/ZrNlSA2wwccE rkhhH7M68uCPMHmiEJb8dNhslb8uJNwH0fvIZyXDULtKollKhmPL97MSk0BSqdjbWC+8 mBUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dk1-20020a170906f0c100b007ae3958c7besi10628083ejb.97.2022.11.08.09.04.39; Tue, 08 Nov 2022 09:05:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234468AbiKHP6R (ORCPT + 91 others); Tue, 8 Nov 2022 10:58:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234310AbiKHP6Q (ORCPT ); Tue, 8 Nov 2022 10:58:16 -0500 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE8B815701 for ; Tue, 8 Nov 2022 07:58:14 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R261e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=shawnwang@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0VUK61dP_1667923078; Received: from 30.39.65.162(mailfrom:shawnwang@linux.alibaba.com fp:SMTPD_---0VUK61dP_1667923078) by smtp.aliyun-inc.com; Tue, 08 Nov 2022 23:58:09 +0800 Message-ID: Date: Tue, 8 Nov 2022 23:57:57 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 From: Shawn Wang Subject: Re: [PATCH 06/18] x86/resctrl: Allow the allocator to check if a CLOSID can allocate clean RMID To: James Morse , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, Jamie Iles , Xin Hao , xingxin.hx@openanolis.org, baolin.wang@linux.alibaba.com, peternewman@google.com References: <20221021131204.5581-1-james.morse@arm.com> <20221021131204.5581-7-james.morse@arm.com> In-Reply-To: <20221021131204.5581-7-james.morse@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi James, On 10/21/2022 9:11 PM, James Morse wrote: > MPAM's PMG bits extend its PARTID space, meaning the same PMG value can be > used for different control groups. > > This means once a CLOSID is allocated, all its monitoring ids may still be > dirty, and held in limbo. > > Add a helper to allow the CLOSID allocator to check if a CLOSID has dirty > RMID values. This behaviour is enabled by a kconfig option selected by > the architecture, which avoids a pointless search for x86. > > Signed-off-by: James Morse > --- > arch/x86/kernel/cpu/resctrl/internal.h | 1 + > arch/x86/kernel/cpu/resctrl/monitor.c | 31 ++++++++++++++++++++++++++ > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 +++++++++------ > 3 files changed, 43 insertions(+), 7 deletions(-) > +/** > + * resctrl_closid_is_dirty - Determine if clean RMID can be allocate for this > + * CLOSID. > + * @closid: The CLOSID that is being queried. > + * > + * MPAM's equivalent of RMID are per-CLOSID, meaning a freshly allocate CLOSID > + * may not be able to allocate clean RMID. To avoid this the allocator will > + * only return clean CLOSID. > + */ > +bool resctrl_closid_is_dirty(u32 closid) > +{ > + struct rmid_entry *entry; > + int i; > + > + lockdep_assert_held(&rdtgroup_mutex); > + > + if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) > + return false; Since dirty closid occurs when the kconfig option for MPAM is enabled, it seems that the condition of the if statement here should take the opposite value: if (!IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) > + > + for (i = 0; i < resctrl_arch_system_num_rmid_idx(); i++) { > + entry = &rmid_ptrs[i]; > + if (entry->closid != closid) > + continue; > + > + if (entry->busy) > + return true; > + } > + > + return false; > +} > + Shawn