Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1715994rdb; Wed, 20 Sep 2023 18:31:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEr7yvs+NGp3Q5xZj6bvVtkL1CszaAdEuwuaHc6tZVJZL6RLpCL84nWcJoNFEH2Bsv0Y5AU X-Received: by 2002:a9d:7582:0:b0:6bc:6389:b07 with SMTP id s2-20020a9d7582000000b006bc63890b07mr4337394otk.23.1695259886086; Wed, 20 Sep 2023 18:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695259886; cv=none; d=google.com; s=arc-20160816; b=F7nrQuyrwjg+RDDTsSmaNjlYpg/pvVomuRnw8ab6nWwICFjnQRUjCmbT/4pUd5V2IU Ar1CCIJA2RuSA0miSClt0GO9TRX3yToZxhEA9ahSh5Gahhfb3XkKrs2mhJ2Zqdj4WtF1 Pjn6lYqKzBIRxWOgU8XeejlSz9+PVuP6IaCzQmfsoYecuWHtiYfFfQLfrJwDK0R0UpJG DpyYh2XRRzJVNcjrbvy4bqvq4kHrgaUvlgSLAE1t9S8w+Yts+1lBy2ivwNpPoks8ASvC 43oD7sEkPXwGxzylxG6A40PcBBujz5Dg+gB2h717G2IUudF0iFBnzyUTNSsMSVRGdJdX vmVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=azVzVFJMpW3zWuIBtZrnjv/SdFMYIxsP/56vGexnexE=; fh=9nDJBQkaq7OMAv/PVn0VSgqvPCvK3c9sRmeP1ZAH+gQ=; b=AEwLKkO5o4hTCxObj4keHaOQROpByPbLP30Ro343JadYex2+DfKt3E8A9PHwFq+Vdf GDEWDNt+Reb7JXoWIRqpFI6ds4usfwEjOm2XjnjaGzhQ+1E3n7hU9mqqy/QLYJb3nidj NGirMuQOsnnqVU0L6CVa2yhf4HEevEQeHGZe9dMauPrGrXBCNf7l4SFbsmP4exavyB0p n337HZXq4GMAtE4hxxOm8FlLBbcS2Ct/+bMzJn/EA+3KYlPKY/EjSVAzEnn7PUXWwOn3 nU0LNe3tYNZBq+EKEaxMCDrog7eQhMQ4jkw0XR0cvc9kP5ShlJD15DK65+zlEeWMqszO x0kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QzsKVTJW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y72-20020a638a4b000000b00578e98deca3si354566pgd.37.2023.09.20.18.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 18:31:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QzsKVTJW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8BC8C806E5E7; Wed, 20 Sep 2023 17:25:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229594AbjIUAVV (ORCPT + 99 others); Wed, 20 Sep 2023 20:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjIUAVU (ORCPT ); Wed, 20 Sep 2023 20:21:20 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19B3CC for ; Wed, 20 Sep 2023 17:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695255674; x=1726791674; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=HM+uOoZk64Z4WIVFmaIOtHvJb14KM46fqD4q873r+vA=; b=QzsKVTJWqdRpicnb/VOkA4C8YqCIl+j8QYBHTdZKx9PYcwwyH9+Uw4vD btTi8QghFdUCaAX6K3/Ol/NBwpqpEe5rcwQglnRzdkjhNnJzioFXXW4ZK u/Xa9iepd9Dx5et+Q5UyjJrCgjJgEbtRO8pIDCHf0HcaR2pj4b93iXAvp jFmvm53q+OjsGvL1YMmZaJdb4LHkfS/jtM2dJNdPmArBL0YuTaAioGR8N NuIImxDmRMBVNfBbMPZrpYbWn/NgAN2rrEfuO837KWp+/FQWKStvOmgfN C6I6ZCzlLnF9Y0VmQt8RV9lSwHOrCFkeasigxVJdvEl7AsOmO1XNTQ6// A==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="384216538" X-IronPort-AV: E=Sophos;i="6.03,162,1694761200"; d="scan'208";a="384216538" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 17:21:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="890156991" X-IronPort-AV: E=Sophos;i="6.03,162,1694761200"; d="scan'208";a="890156991" Received: from agluck-desk3.sc.intel.com (HELO agluck-desk3) ([172.25.222.74]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 17:20:23 -0700 Date: Wed, 20 Sep 2023 17:21:12 -0700 From: Tony Luck To: James Morse Cc: Reinette Chatre , Babu Moger , Amit Singh Tomar , "Yu, Fenghua" , George Cherian , "robh@kernel.org" , "peternewman@google.com" , Drew Fustini , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: resctrl2 - status Message-ID: References: <9742f177-a0ce-c5d3-5d92-90dda32f5d07@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 20 Sep 2023 17:25:42 -0700 (PDT) On Fri, Sep 15, 2023 at 01:38:16PM -0700, Tony Luck wrote: > My PoC code went full throttle on pushing all the schemata code to the > driver. But you are right that this may be too drastic. Drivers could > just indicate that they need one of the basic types "bitmap, percentage, > number, bandwidth" together with some parameters (number of bits for > bitmap, granularity for percentage, high/low values for number, ditto > for bandwidth) and have core code handle the inital parsing. Then give > to the module for validation (e.g. for the Intel requirement that > cache bit masks have contiguous "1" bits), and some CPU models require > that a minimum of two bits are set). Also pass to the module to apply > (wrmsr() on a CPU in the domain for x86, MMIO from anywhere for ARM). > > For bitmasks - MPAM seems to allow very long masks. Perhaps the kernel > can make use of the "%*pb" format to scanf/printk to cope with those? > It would mean commas in the masks like 0000,00000fff,ffffff00,0000000f James, Your earlier e-mail came at a fortuitous moment. I am breaking my giant patches into smaller pieces. I had just got to the "add the schemata file" section of the series. I took your advice and put the majority of the parsing code into the core, leaving the arch specific modules just a hook to handle weird quirks. Modules specify the "type" of their schemata entries, together with a parameter that the core can use. I implemented two types so far. But should be easy to add additional types like "bandwidth" as you had suggested. 1) Bitmask. Parameter is the number of bits. 2) Unsigned long. Parameter is the max value. Examples of quirks: 1) Intel L3 CAT requires all "1" bits to be in a consecutive block. In this case core code will accept any bitmask that doesn't exceed the number of bits. The module can reject if the user doesn't follow the consecutive bits rule. 2) Intel L3 MBA requires that throttle percentage values be a multiple of the h/w enumerated granularity (e.g. 10%). Here the module does a roundup() to quietly fix invalid input (same as legacy resctrl). I've only got through the "control" section of converting to patches. But I think this is well past the halfway point. Current snapshot of code is here: git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git resctrl2_patches * Comes with just the rdt_l3_cat and rdt_l3_mba modules. Without the AMD support bits at this point. * No "cpus", "mode", "size" files yet. * Just CTRL_MON directories. * No monitoring support yet. -Tony