Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp433720lqg; Thu, 11 Apr 2024 07:22:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUM0BkB0eVsLwWOvg2H5Zk8Kbb/RCmKvqd381pJxtInRDjJWOEWvhRrtpdVS0GVZsS3VdfvpWicGZG907GGQ7CnAwO/TCj2tdqKy6KcNA== X-Google-Smtp-Source: AGHT+IEcPTGMnEOy4T+m9aU2Pkd3pkuz6k1ymQlDJKBFiBGbI9i1e8OSLz29sQMo2bqNzKtS3jn6 X-Received: by 2002:a17:90a:be0c:b0:2a4:739a:23c4 with SMTP id a12-20020a17090abe0c00b002a4739a23c4mr6304037pjs.35.1712845365472; Thu, 11 Apr 2024 07:22:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712845365; cv=pass; d=google.com; s=arc-20160816; b=FP3jXDNSx+UDF26dPI6oKOKXwYQVqOPasngVadF98fuzhx4SFYaG0DgQLg0PkbqDwV I/n1s2KCi3ybYj0IuU/2ADMQROvd1IhJXSz+bBMpSaIDPBKf448z8CdHO/nD5oXWpyIo C1Q06leVOTX5VZOc1dXEp1xXJoB1fZjgqNVH85T0/d6qbdkuvx7ElKQCWWbNTiw0aeWV W4yHPNiwvIEpmgR/JP79npRULm2TqF76flAUXJYFz9lV6P7Z9bn2leXYaoSpwi8BNqbi 3JzzftqEYo1I13zG1JGV7kGfswKaam1ImqJMCZy5VU5SGS0SgibeaYI6Bn82LudJLFVt 31Sw== 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=MvTwoypjNGQfRJ39Ytfto7OGKNpgePP8gC0ZDdghGIE=; fh=QpfXcl1MWRNwK/PrSFDaf8vyLNOqSjtq+qtJ/l97qlo=; b=NW0h0Pc8doaT6ixo8U5tPdgK+7KxR921lnZQ0eEiidXtpwhDn6XgSnVg7PZSMFuL5n Cxi9jsgBArvngl/qw5dsO1hYzAaRXf59Uf+6/czu26wDwc8rd1spBcXxONbTwV5Tl9Vv 46jdaC5VADQCmsoUxoHH1Fr6NnXt4S1ejKvUJyUCh0NEyC1BQTvMapknBpYK1Xt3O+0t 6SlcIPRLToKVmaDzvgV85XcCp5B+hUVW2Q5Hdz3ij+fE2KAR6rkLP/SaCgwo1QWTRGXr 3Fxp/6XuhDCxqdWDunUxNqJRMlfaP1La0R9Vg7synJbUnKXa7kloyIjALZMg/9oQFjyx qHPg==; 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-140625-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140625-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o24-20020a17090ac09800b002a28c2409c1si3592239pjs.30.2024.04.11.07.22.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 07:22:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140625-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-140625-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140625-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C7780286D00 for ; Thu, 11 Apr 2024 14:18:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F7A714F10B; Thu, 11 Apr 2024 14:17:09 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64B6914E2DE for ; Thu, 11 Apr 2024 14:17:07 +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=1712845028; cv=none; b=VkZQZyemuehClQXX4k4uTa6ry7Cq6eKV0ZZlzEoQKZ+/T5sQpfoATB9tVMhErYjbC+/EMcTHTtLiHxHxDPrqC59FbyqNxTcwjeb9vH95B7EbPRnL7HxzIr3jhNhvxnkwRkDpkSm/VM6RtFErd4q/gp3c81WVWRfEu1B0dsZY1jo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712845028; c=relaxed/simple; bh=hFpPbCUdGEDxZtHZpIbjnwRnJOUcczaR3P0MhRNYSRY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Rg9nNH42zzAumwvOxtUc13GtngiT4aKemCGnFd7FpKcb0T4vMasJMTLn8KsKkL9BhCEO7AmjHQ2jXE3OVDeoEHqq9NARxI1bTnTetJG+GOr1qAGtTb9S8G4etYwaHC9ePySEW3goJp3qAuxMJ5/Y/SQdS0nlqHCyka8SGdaUiLg= 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 443A4339; Thu, 11 Apr 2024 07:17:36 -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 F1C953F64C; Thu, 11 Apr 2024 07:17:03 -0700 (PDT) Date: Thu, 11 Apr 2024 15:17:01 +0100 From: Dave Martin To: Reinette Chatre Cc: James Morse , x86@kernel.org, linux-kernel@vger.kernel.org, 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, 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 18/31] x86/resctrl: Allow resctrl_arch_mon_event_config_write() to return an error Message-ID: References: <20240321165106.31602-1-james.morse@arm.com> <20240321165106.31602-19-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 Mon, Apr 08, 2024 at 08:23:36PM -0700, Reinette Chatre wrote: > Hi James, > > On 3/21/2024 9:50 AM, James Morse wrote: > > resctrl_arch_mon_event_config_write() writes a bitmap of events provided > > by user-space into the configuration register for the monitors. > > > > This assumes that all architectures support all the features each bit > > corresponds to. > > > > MPAM can filter monitors based on read, write, or both, but there are > > many more options in the existing bitmap. To allow this interface to > > work for machines with MPAM, allow the architecture helper to return > > an error if an incompatible bitmap is set. > > > > When valid values are provided, there is no change in behaviour. If > > an invalid value is provided, currently it is silently ignored, but > > last_cmd_status is updated. After this change, the parser will stop > > at the first invalid value and return an error to user-space. This > > matches the way changes to the schemata file are made. > > > > Is this needed? With move of mbm_cfg_mask to rdt_resource I expect > MPAM would use it to set what the valid values are. With that done, > when user space provides a value, mon_config_write() compares user > provided value against mbm_cfg_mask and will already return early > (before attempting to write to hardware) with error > if value is not supported. This seems to accomplish the goal of this > patch? This sounds plausible. In a recent snapshot of James' MPAM code, it looks like we could be initialising rdt_resource::mbm_cfg_mask when setting up the rdt_resource struct for resctrl, though in fact this information is captured differently right now. I'm sure why (though James may have a reason). [1] I don't see an obvious reason though why we couldn't set mbm_cfg_mask and detect bad config values globally in mon_config_write(), the same as for the existing AMD BMEC case. Nothing in the MPAM architecture stops hardware vendors from randomly implementing different capabilities in different components of the system, but provided that we only expose the globally supported subset of event filtering capabilities to resctrl this approach looks workable. This consistent with the James' MPAM code deals with other feature mismatches across the system today. [1] 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#n730 > > > Signed-off-by: James Morse > > --- > > .. > > diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h > > index 8a7367d1ce45..6705d7960dfd 100644 > > --- a/include/linux/resctrl.h > > +++ b/include/linux/resctrl.h > > @@ -200,6 +200,7 @@ struct resctrl_mon_config_info { > > struct rdt_domain *d; > > u32 evtid; > > u32 mon_config; > > + int err; > > }; > > Please take care to use consistent spacing. > > Reinette Noted FWIW (though I guess this code might change or go away). Cheers ---Dave