Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2742240rda; Wed, 25 Oct 2023 10:57:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHq9KF2q2C9Rpqx4WWLhtUfV/+F+55WN8yb7uJn8jXTLrWCicBPJSZD+1TTj7G3cg8X9Kam X-Received: by 2002:a25:d801:0:b0:d81:917c:69b with SMTP id p1-20020a25d801000000b00d81917c069bmr15769460ybg.10.1698256624342; Wed, 25 Oct 2023 10:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698256624; cv=none; d=google.com; s=arc-20160816; b=CTXCK/vFNPM79RbzdGVQg5o9EWGHfIwxsv7hq4CaKU2VfY+gv2T06JDldAI5MI/YY2 Ef04DfSMHgJOtpGQmdgC6JITelPf2/gPMvkXF+tXNRx6A7N9nAyDBYtYyVkfz1S5A85o vgI24V+xJP7071fbiPRMDkzw1k1oHKVgYTaxSPFlBf66828bbwYGSyRz4TNaZIzggPMC GOGG8uYCfFpOBa63gsIlPmNnM2NjMwIXI0QJbQcP61mswBNcQzNO2MJAX7fN9QaCfxxh vKhh/ftY5eKIvralSVE1C0Q7U5L0oxKNPHOGAX/gFL6EUwtF2y5GbyzYz0GfUnmrzBPD Vmrg== 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=e2D4KyWsC+ztrnvzJ0ZKDLTQnbAn5pqeuJU67O36Y5Y=; fh=9O97hdzEezSdAQ/hEUF6K6/7TfN/3Uf0QBPpPtoaJ2Y=; b=vfTBBRCL/9gcl7RPn9d9r1CR5pYf0V5mxs08AooxmnYMAWD1NJSpDrtf/DZ1sB6iNE K30Gz1LQut0SNEm2/5gVosseGtuHbmOPhjgWs6rA0CTMDlO50+PvZIoqs1JdBzxyQsFa hMIvUQaWEmXWLxdA2GvHrqGocC8tvFDZqnlHfBLApzh6KT+NzCJCzeVF/cjFGRHUSCNo KYmxQBqZUARNGarzUt/PG70JUoQpvFgmxOui9isBUWXG0QNJRhELAClbiaMo25JWPeWK qyp93U+3uKX3+zCynjfNqoLwfR1d91soVnRGuNR7ZUf4J+16tAyQj72MBT5qQevi4179 FSPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id 78-20020a250251000000b00d9a39b624d2si11578745ybc.584.2023.10.25.10.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 10:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 333608023A12; Wed, 25 Oct 2023 10:57:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234545AbjJYR4j (ORCPT + 99 others); Wed, 25 Oct 2023 13:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234479AbjJYR4f (ORCPT ); Wed, 25 Oct 2023 13:56:35 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 021DF181 for ; Wed, 25 Oct 2023 10:56:33 -0700 (PDT) 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 5F8E71474; Wed, 25 Oct 2023 10:57:14 -0700 (PDT) Received: from [10.1.197.60] (eglon.cambridge.arm.com [10.1.197.60]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 400DD3F738; Wed, 25 Oct 2023 10:56:30 -0700 (PDT) Message-ID: Date: Wed, 25 Oct 2023 18:56:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v6 10/24] x86/resctrl: Allocate the cleanest CLOSID by searching closid_num_dirty_rmid Content-Language: en-GB To: babu.moger@amd.com, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, xingxin.hx@openanolis.org, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com References: <20230914172138.11977-1-james.morse@arm.com> <20230914172138.11977-11-james.morse@arm.com> <1dc0fb2f-7b68-d1b3-e6fe-bf341afb545d@amd.com> From: James Morse In-Reply-To: <1dc0fb2f-7b68-d1b3-e6fe-bf341afb545d@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 10:57:01 -0700 (PDT) Hi Babu, On 05/10/2023 21:26, Moger, Babu wrote: > On 9/14/2023 12:21 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. >> >> Instead of allocating the first free CLOSID, on architectures where >> CONFIG_RESCTRL_RMID_DEPENDS_ON_COSID is enabled, search >> closid_num_dirty_rmid[] to find the cleanest CLOSID. >> >> The CLOSID found is returned to closid_alloc() for the free list >> to be updated. >> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> index fa449ee0d1a7..1f8f1c417a4b 100644 >> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> @@ -132,11 +132,20 @@ static void closid_init(void) >>     static int closid_alloc(void) >>   { >> -    u32 closid = ffs(closid_free_map); >> +    u32 closid; >> +    int err; > Naming "err" seems odd here.  How about cleanest_closid ? That's just habit because the value might be an error code until its been checked, and once it has, its called 'closid'. But sure, if you think that is clearer. Thanks, James