Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp20651rdb; Mon, 22 Jan 2024 10:32:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFn7+I3bJIpwIEZBjrxfjKGnA9TkDTKQ2v0oBz3S1soAkiJWpAXKwrfJYGDG2hhVxv3Slw X-Received: by 2002:a05:6122:3a0f:b0:4b7:adc1:fde6 with SMTP id fp15-20020a0561223a0f00b004b7adc1fde6mr1324598vkb.31.1705948333659; Mon, 22 Jan 2024 10:32:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705948333; cv=pass; d=google.com; s=arc-20160816; b=T3J/NPErt1xqbNAvAvaECrxGWx5LEf7z/xO6VRcAaXCrzCG05eJUBed/HSGJ+XqmdW Nl91bwa0k7zooT4a/gMZJIsUPoGk7dTyABrS1SVJI0hxftAmkwOAZEElnhg2jzxH3YH7 GWGF86j8jlqE2VpVx0LDgGz4Jxi7DffPoLyPN+/vfpkaYRE6ef25NzMop9Y7bLuh+9x5 ifSsVAcE4P9nO5Lb4Mol/yeJzBqGjHvKESJhm7T3iqEhy3oMacji7iCwHWiG9iyd14Lf eyFIBrBad4nyDP5wstnd17N11CnHlZ+f3ocM1iA1DhDvRXstcvbf4dFEmBZ2OWguTAKA D4kg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=qG8nRtgzRyrXh09CU6DL/us7cCGAV2f/8I/aGCGFu7c=; fh=CVxm+98lkXITl0au7ZG91t3Hs4aa5lXhej4qzNkAGIY=; b=X7QMSC8UPAGXKg12MalwUOPELD8guqXt6okldo6xGusdnbIgEDvQGBBNW3GT4DNV7S FUMesDp4C5T2d1oLZs86L1uQXV2Z6foj4MRksah+oCojMyxpQd+8dEK4TM3CyOMaeKK1 D1SAwTQOAqtbXnzGM8GSmXVWW8G/GTWnljO7qI4vyiN0vJYQ/YUala5vYxsB/nVoOBEE AnAC1KxN7p7cLQfyGwNndDinVgR7khBcQMsXHEdJIY1RAr3HNovstEpT5Vi8KXgO8X1m p7h9ZYYBBXSJzl/TeEeI2mRA/t/XG+dAv2k83uz4b49o8Lp75CxKXbpB7Qe9hXFgdBhk iEfg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-33895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bb9-20020a056122220900b004b2ee145b63si3017810vkb.70.2024.01.22.10.32.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:32:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-33895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 629081C25841 for ; Mon, 22 Jan 2024 18:32:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 490B85D75D; Mon, 22 Jan 2024 18:05:47 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FE125D74F for ; Mon, 22 Jan 2024 18:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705946746; cv=none; b=T2fvaMUpuoXQX3P45Jv/HMuAEdwYqhmPQlVy/Pjmwu9jV2j9Nf2IW+jgDCYUOP3iQuV6RGXYy891kuagXNLBCu9Hw/aH6Gcp9EKBsDbWK248j1XTFBsgni2VjEXxwV2+2/JgdaeaPR0AuGNvjwH/kQjAgnhoddRlRi6KkS4CjVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705946746; c=relaxed/simple; bh=ywSMKNUpfoIudE9QTwBf2gl5hq63/kmu+8bfghyi3NU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aK/EPzVyai9bbzef+vyhFkV6xr2rOqmnCgSjhQSp1PnVXMBQ15Sv445sy+8ILoi8N8fGZu4zvLuChunPVpbSPI9MZi2ORFmhjx3Qvf+JepdlsbxdWANdCCuafUZ6KxB0OJIkovSvcY2EeQKJuXmqhJ8bnFD/57UL69FzjWOH9S4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 9F818113E; Mon, 22 Jan 2024 10:06:30 -0800 (PST) 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 EAEB43F5A1; Mon, 22 Jan 2024 10:05:41 -0800 (PST) Message-ID: <6eecc051-8e8c-fae9-0889-af6998e10be4@arm.com> Date: Mon, 22 Jan 2024 18:05:40 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v8 08/24] x86/resctrl: Track the number of dirty RMID a CLOSID has Content-Language: en-GB To: Peter Newman Cc: x86@kernel.org, linux-kernel@vger.kernel.org, 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, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , dfustini@baylibre.com, amitsinght@marvell.com References: <20231215174343.13872-1-james.morse@arm.com> <20231215174343.13872-9-james.morse@arm.com> From: James Morse In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Peter, On 04/01/2024 19:13, Peter Newman wrote: > On Fri, Dec 15, 2023 at 9:44 AM James Morse wrote: >> void free_rmid(u32 closid, u32 rmid) >> @@ -792,13 +813,33 @@ void mbm_setup_overflow_handler(struct rdt_domain *dom, unsigned long delay_ms) >> static int dom_data_init(struct rdt_resource *r) >> { >> u32 idx_limit = resctrl_arch_system_num_rmid_idx(); >> + u32 num_closid = resctrl_arch_get_num_closid(r); > Which resource is this again? Surely the one with the smallest number > of CLOSIDs? Today it's implicitly L3 because that is the only one resctrl supports monitoring on > It's not much harm if the array is bigger than it needs to be, but Heh, this use of this variable is behind those IS_ENABLED(), which means it gets removed unless you are on an MPAM system. MPAM always has to sanitise these fields as not all the hardware is exposed to resctrl. (e.g. L3 and MB might support 16 CLOSID, but if there is an invisible system-cache in between them that only supports 8 CLOSID, the system-wide value has to be 8, regardless of what the hardware supports.) The MPAM driver finds the system wide value here: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/tree/drivers/platform/mpam/mpam_devices.c?h=mpam/snapshot/v6.7-rc2#n757 And regardless of which resource you select, returns that value here: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/tree/drivers/platform/mpam/mpam_resctrl.c?h=mpam/snapshot/v6.7-rc2#n128 On x86 the helper returns the hardware num CLOSID so that the resctrl sanitisation does the right thing. I'll add a comment that this may over-allocate if the architecture isn't pre-sanitising this field: | /* | * If the architecture hasn't provided a sanitised value here, | * this may result in larger arrays than necessary. Resctrl will | * use a smaller system wide value based on the resources in | * use. | */ > I've become curious about how The Monitoring Resource is used in the > code when there are later changes[1] which would cause this function > to be called on RDT_RESOURCE_L3, RDT_RESOURCE_MBA, or both. I need to digest Tony's series. Today the event names all have L3 in them - the MPAM driver is ignoring both this and the resources, and relying on heuristics to pick something to back these counters with. Something is better than nothing,. I agree it can be improved as resctrl allows more things to be exposed. > Given that we have hardware with event counters residing at different > levels of the topology and possibly being associated with different > rdt_resources, more attention needs to be paid to how these parameters > are used in code related to monitoring. Certainly there are likely to be weirdness in what the MPAM driver picks here. Those patches are marked untested for a reason! I have nothing I can test the bandwidth counters on. My intention here is that 'things that look like a Xeon' should behave equivalently as far as resctrl can see. That gets any existing software working. Beyond that we can talk about extending what we have to better cover the hardware people have built. I'm coming to the conclusion that results vary depending on {ingress,egress} of {L3, SLC, Memory-Side-Cache, Memory-Controller} - even when only one is implemented, and that hiding this in resctrl isn't helpful. Using perf's platform-specific json files to identify counters may be a better approach. Thanks, James