Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp907680rwb; Wed, 9 Nov 2022 10:04:31 -0800 (PST) X-Google-Smtp-Source: AMsMyM6OIwXzVLWJqJGUyW6cnXnTvSHEBWhAkjqcCrWZUVWboAr+0rtu+Z+huk7Is4IOhmZB/bEs X-Received: by 2002:a62:1a13:0:b0:56d:d72b:408c with SMTP id a19-20020a621a13000000b0056dd72b408cmr44002471pfa.52.1668017071261; Wed, 09 Nov 2022 10:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668017071; cv=none; d=google.com; s=arc-20160816; b=CfSEFXF85/1mfxrpuCKEmaMak/mNpGKtjgBOef1jv4ONMHpoE9srXqn/w9aQTDzvbD I0uF1mPh1fTQnQzWrU4NeqeNwQm1sKU2Y001/tWX3niBFgM40adWyW7uHpXfIUKMqrWF ZYcpoWgckq3rVJHUvV1vPUxLWWhrE/sqGKKbdzyK5rNiLT+11iO1ephapHdFo4pzrvtx gqVoHqkUW/FElj//ZDANltxgR6V9E7LaB+NdLjSMJcnUIjp5r2DOav0uJjdwleEP1gXZ tL1wAtAVS4eWW55pm4zBoMnvBODn/mOQsYt1sKcV6JQ93VncfOxg2K2KbkuZBzMOqV/b +d9A== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=7Voh//AzrrY6Mj9W40h87y0Yy+zjlJ9nCfhpXv1BgiI=; b=hD8dUPlUjc46CHMOsIm9npippUiWUAUkknXnBKn9Ks6FHG1MvhtdipHiBrbo/UNgxK D5bGMqElXd13kmjcDaVXhhiaWhGHUJVMAa5IDqT7ui3trhn1eNlstWtPTHt+ocGbf5lz 1GHaKwDeDuL1T2NJ9KK7b3aKPbNkLG4JFji+XopAv38fY7vwcMS/MyLEGI92t+21FS5P U/o+tZnJracSiRWLn0RGBjim6gbEWJpPXDFwTtUaSZKiZUR8b4sbpyXkJP0xrT/MMI0e prXLuRn0/V1GwFkoyCXj3NVASPJKetBEaCq4+Qk7mzvirQZ9Ak/FcrPt10LkV80/C3mf Po1g== 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=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a1709027c8d00b001822121c45fsi16895526pll.338.2022.11.09.10.04.17; Wed, 09 Nov 2022 10:04:31 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbiKIREE (ORCPT + 92 others); Wed, 9 Nov 2022 12:04:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231738AbiKIRDg (ORCPT ); Wed, 9 Nov 2022 12:03:36 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8D5E929C8A for ; Wed, 9 Nov 2022 09:02:51 -0800 (PST) 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 56F871FB; Wed, 9 Nov 2022 09:02:56 -0800 (PST) Received: from [10.1.197.38] (eglon.cambridge.arm.com [10.1.197.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 97F603F534; Wed, 9 Nov 2022 09:02:46 -0800 (PST) Message-ID: Date: Wed, 9 Nov 2022 17:02:40 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH 06/18] x86/resctrl: Allow the allocator to check if a CLOSID can allocate clean RMID Content-Language: en-GB To: Shawn Wang , 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> From: James Morse In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 Shawn, On 08/11/2022 15:57, Shawn Wang wrote: > 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. >> +/** >> + * 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)) Yup. Bother. Thanks for spotting that! It was intended to avoid this work on x86 as its pointless, and the number of RMID could be large. Thanks! James