Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1300942rwd; Thu, 25 May 2023 10:33:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Hl5j/dsb0uR3mDITXddRNPm7Uck2ASnbrZ/36M3ib8xSVelhgEcK4zTVGQRZ8XK5QNqrJ X-Received: by 2002:a17:90b:202:b0:253:5599:5fa4 with SMTP id fy2-20020a17090b020200b0025355995fa4mr2842120pjb.19.1685036001287; Thu, 25 May 2023 10:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685036001; cv=none; d=google.com; s=arc-20160816; b=ffC9Q338YawYeCqKCafQBB6PIo4ZNfe0JUtz1nigEYNV9UOSkNP870Z3UQdpXUS6H/ y4vC8f7Jw1ceraA+3RuuDGFmXBsa9KwLMyU/d95VawOwYS8e3srvS/DvdbLm3S+xKPSF M8wQCFG1EEyDRdznt/xtT6lk1ydQFwLKg79cyOSHzG9GCC6z5bzt9vX1YDKvI1WeWf8G EH/3rkztDoxzAPwmGi7iCfYHN3gSSjMZNZE39TKr62PjsE2rgY3V1zTVFltc9TibHyTv BcSsgjqNWAO5p/Y2vyTr6oieCpuf0zrMG0yiW0UPUu2gE7S0MvPQWGudvb62rjA1EvRT kQRQ== 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=mOnt8rRa7qWcU9q1pUn3J98m1wTepMIhJd1FsukYSF4=; b=RdQz/K9I3jdlGK5i5mnZiP+cEsOmc0DuFzdct6DtelAx9CO7y5+1FZ5rgwqY7DbMas 4N4nhfecDLodxqIq/KnvxVJkvdch1ZOuuUIVOpBm7UZtxtOvxUDlflzHcFZQ2g2zeDk3 S0IATe2l/YmtJKGnskIhSUnnv8tCE/L0R75NYs397TassI2uKbNrXbfPhg86LS80Ezhs nEy5VMzTUpV9p/Yrk3hb7Ui01GJGqaVPHvy+YCRyDTet5TkAFjVJ1kRQ9lbWQ9DQ03GP boX4hQt+BxmcQEPYS/7ryb83Ni9Bb+c3AmZOtw8Vf1K3pLNDJTaD1ZnH0s6+dBdlb+tm H6uw== 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 m137-20020a633f8f000000b0051b423d966csi1490726pga.280.2023.05.25.10.33.07; Thu, 25 May 2023 10:33:21 -0700 (PDT) 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 S240513AbjEYRcN (ORCPT + 99 others); Thu, 25 May 2023 13:32:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240328AbjEYRcF (ORCPT ); Thu, 25 May 2023 13:32:05 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78A5EB6 for ; Thu, 25 May 2023 10:32:04 -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 607381650; Thu, 25 May 2023 10:32:49 -0700 (PDT) Received: from [10.1.196.177] (eglon.cambridge.arm.com [10.1.196.177]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 035243F6C4; Thu, 25 May 2023 10:32:00 -0700 (PDT) Message-ID: <329e0e44-c7f0-a602-640c-585530e9c665@arm.com> Date: Thu, 25 May 2023 18:31:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v3 11/19] x86/resctrl: Allow arch to allocate memory needed in resctrl_arch_rmid_read() Content-Language: en-GB To: Reinette Chatre , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , 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, xingxin.hx@openanolis.org, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com References: <20230320172620.18254-1-james.morse@arm.com> <20230320172620.18254-12-james.morse@arm.com> <36af82d5-0d48-f899-9e95-1ec89be20581@intel.com> <24d3616a-7800-ba91-deed-8bcc639ce6ba@arm.com> <28845d8b-cf7a-b5b7-d5ae-1284e33d063c@intel.com> From: James Morse In-Reply-To: <28845d8b-cf7a-b5b7-d5ae-1284e33d063c@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Reinette, On 28/04/2023 00:40, Reinette Chatre wrote: > On 4/27/2023 7:19 AM, James Morse wrote: >> On 01/04/2023 00:27, Reinette Chatre wrote: >>> On 3/20/2023 10:26 AM, James Morse wrote: >>>> @@ -317,9 +318,14 @@ void __check_limbo(struct rdt_domain *d, bool force_free) >>>> u32 idx_limit = resctrl_arch_system_num_rmid_idx(); >>>> struct rmid_entry *entry; >>>> u32 idx, cur_idx = 1; >>>> + int arch_mon_ctx; >>>> bool rmid_dirty; >>>> u64 val = 0; >>>> >>>> + arch_mon_ctx = resctrl_arch_mon_ctx_alloc(r, QOS_L3_OCCUP_EVENT_ID); >>>> + if (arch_mon_ctx < 0) >>>> + return; >> >>> The vision for this is not clear to me. When I read that context needs to be allocated >>> I expect it to return a pointer to some new context, not an int. What would the >>> "context" consist of? >> >> It might just need a different name. >> >> For MPAM, this is allocating a monitor, which is the hardware that does the counting in >> the cache or the memory controller. The number of monitors is an implementation choice, >> and may not match the number of CLOSID/RMID that are in use. There aren't guaranteed to be >> enough to allocate one for every control or monitor group up front. >> >> The int being returned is the allocated monitor's index. It identifies which monitor needs >> programming to read the provided CLOSID/RMID, and the counter register to read with the value. > > I see. > >> >> I can allocate memory for an int if you think that is clearer. >> (I was hoping to leave that for whoever needs something bigger than a pointer) > I'd rather not complicate it in this way. It's a no-op for x86 as these calls get optimised out, but more annoying for MPAM (I've done it now). I think the result is more intuitive, but see what you think. Thanks, James