Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp60666lqj; Thu, 11 Apr 2024 09:48:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXEDif9Xgb/8UA9pNoVbWe6I406kjbnXjMIq9N/hMCCi+grTOMuMviofHXER+gAE3SiavEBacTeORBNk7H3GyOLb/Lb8r0bKGD3QHegMg== X-Google-Smtp-Source: AGHT+IEqzK3O4dObxfCOeIEmh+S0A4TleydDEHf+gznEMj3eYFguTEPKOAwtG9YWy5MPZChdzIaA X-Received: by 2002:a17:902:ccce:b0:1e4:62e2:fc86 with SMTP id z14-20020a170902ccce00b001e462e2fc86mr34195ple.7.1712854137591; Thu, 11 Apr 2024 09:48:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712854137; cv=pass; d=google.com; s=arc-20160816; b=GV7PET+4YeuTr+OIQJ7UK4Hsw45BF5IbNSt8vXgQEKVEDSbXjqbTQoQhakrpmri3Sd FOjhJV6xg7aAP8i6Y8lXJpIYGDIECo1eM7/1taZ7LnK5EN2XUJDctD7EBbNMwNLa1ger gS52DHnxfCWVXqkavbAFFc9Km8KsD7aQvzU5bb8wHis1bi2ZCRIMXdN5E6wwb1QEeZ2Y mHXSPLcK6GDacjYwESX9pjiohjNMLwBoI25XTKTa5OgiK7JhcvZkQa2lKoDaolmi0LgI mouSDSrR1zSwwlq9IYm6/ltub/Tl6HScK2D2gfG7OeaJi1l0wLt0M8P2RkqkGiAZFx1j CJfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=Ih2UzzooOKO+KkRI/fodu/dwY7qbNNYeQ0/qJ7528U4=; fh=DCeU5mfJJjWHG7pO4a5qq0Ay6ilOlWvFXBS73KPRiWY=; b=ZFYro3yRM58egOHmVQ2uoZ+KfBt26F4ov+6nYRetK3ZB7zfirjfntvM+qZCRCMm/4L TD2YQbUJ32+zbd50y7JWWHaJdMUXap2B1feA4wgLDYdAYN+ogKD580M6xjyQs9+7OFhw BZ+JB5NbYxXNG65ZWOM47Wy230mY9cQfMs0HH4jhFLW+g5sEoT1b9qdvQECVIK5cGrth P2Qy+AzUQ7Qc5GFrNQ7M78zlg22C6d7ndWMPGmRszXpHVFBkiILS4VhUK9ypTS8Ni2hi b3hn2s8nQszlf5KG7M5AezoYX+77rPDKuhUNxkXOO77csRD8tIIh/QC1X6zGuB6e1Scz Iv/w==; dara=google.com 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-140923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w1-20020a170902904100b001e0f2770d1esi1498925plz.531.2024.04.11.09.48.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:48:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-140923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140923-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BAFB9B2564E for ; Thu, 11 Apr 2024 16:14:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FD591A0AE2; Thu, 11 Apr 2024 15:36:06 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 360EA19DF5E for ; Thu, 11 Apr 2024 15:36:03 +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=1712849765; cv=none; b=uJKdmNT9fjBQkNiQD8agyFUkvfaQJ7gqMb/DogUyE8CbqagximeZR83Kx536umxN5fw7kdCaGVATfK2vHrZGK7Dv+RZe9cG6fim9dQlzkEFwwPqCLlL4Nzsg/P87pBht9eiw0kjX/MxmvQHmJ9T7oPsCzkNAliA7RvG5ICGMrn8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849765; c=relaxed/simple; bh=0VVDSxDozDuY9366NJCNFekjulkSHGITutb5i0OFTy0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=K9CYrEn/8Pax0BYKYP4vBtTq2Bu00IVqsUu5w8SoV+5G3mpL2a2RNephDLzGzuaP3YUVZGzGh0DIiJKE2ikH9vdwfLrVWO6htIqRdBsMl00XeD9BOUXFwM8CBg/L5fno0onX7VWDDrHx0c84h0k/CwHxKvo4VTCaVIqSgKGVABo= 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 0626D113E; Thu, 11 Apr 2024 08:36:33 -0700 (PDT) Received: from e133380.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 960F23F6C4; Thu, 11 Apr 2024 08:36:00 -0700 (PDT) Date: Thu, 11 Apr 2024 16:35:58 +0100 From: Dave Martin To: Shawn Wang Cc: James Morse , 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 , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Rex Nie Subject: Re: [PATCH v1 10/31] x86/resctrl: Move monitor init work to a resctrl init call Message-ID: References: <20240321165106.31602-1-james.morse@arm.com> <20240321165106.31602-11-james.morse@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Apr 10, 2024 at 10:57:30AM +0800, Shawn Wang wrote: > Hi James, > > On 3/22/24 12:50 AM, James Morse wrote: > > rdt_get_mon_l3_config() is called from the architecture's > > resctrl_arch_late_init(), and initialises both architecture specific > > fields, such as hw_res->mon_scale and resctrl filesystem fields > > by calling dom_data_init(). > > > > To separate the filesystem and architecture parts of resctrl, this > > function needs splitting up. > > > > Add resctrl_mon_resource_init() to do the filesystem specific work, > > and call it from resctrl_init(). This runs later, but is still before > > the filesystem is mounted and the rmid_ptrs[] array can be used. > > > > Signed-off-by: James Morse > > --- > > arch/x86/kernel/cpu/resctrl/internal.h | 1 + > > arch/x86/kernel/cpu/resctrl/monitor.c | 24 +++++++++++++++++------- > > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 4 ++++ > > 3 files changed, 22 insertions(+), 7 deletions(-) > > > > diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h > > index 031948322eab..7a0c74779c53 100644 > > --- a/arch/x86/kernel/cpu/resctrl/internal.h > > +++ b/arch/x86/kernel/cpu/resctrl/internal.h > > @@ -540,6 +540,7 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg); > > void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, > > struct rdt_domain *d, struct rdtgroup *rdtgrp, > > int evtid, int first); > > +int resctrl_mon_resource_init(void); > > void mbm_setup_overflow_handler(struct rdt_domain *dom, > > unsigned long delay_ms, > > int exclude_cpu); > > diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c > > index 06565153ceb2..929ec1430b45 100644 > > --- a/arch/x86/kernel/cpu/resctrl/monitor.c > > +++ b/arch/x86/kernel/cpu/resctrl/monitor.c > > @@ -1003,12 +1003,28 @@ static void l3_mon_evt_init(struct rdt_resource *r) > > list_add_tail(&mbm_local_event.list, &r->evt_list); > > } > > +int resctrl_mon_resource_init(void) > > +{ > > + struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); > > + int ret; > > + > > + if (!r->mon_capable) > > + return 0; > > + > > + ret = dom_data_init(r); > > + if (ret) > > + return ret; > > + > > + l3_mon_evt_init(r); > > + > > + return 0; > > +} > > + > > Now x86 platform defaults to all monitoring features on the L3 cache, but some monitoring features may also be on the L2 cache or memory controller according to the MPAM spec. For example, the memory bandwidth monitors could be on the memory controller. > > Will resctrl_mon_resource_init() consider this scenario? > > Best Regards, > Shawn My understanding is limited here, so this will probably have to wait until James gets back for a full answer. The resctrl userspace filesystem interface looks like it can describe monitors at multiple levels of the memory system, so my assumption would be that it should be possible to wire it up. This series focuses on refactoring and does not try to add new functionality, though. Cheers ---Dave