Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1501349lqm; Thu, 2 May 2024 18:08:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlAN50x+uZtwHWftPkUUjMQvXUN/LNcnHIzFYuqH9DAYxzLC8icOrzYkxiCmgqW7PaB6uqkgfbkTPtkqASm0xPXe9pD0E+bkAh2j/low== X-Google-Smtp-Source: AGHT+IEZa9umIbaD7uzOWJ0qEwoeV53py710R/61zgCISpsU1GjoJHptLeAKgEr2XgtF15KLmNuC X-Received: by 2002:a05:6a20:e687:b0:1a9:8836:ae37 with SMTP id mz7-20020a056a20e68700b001a98836ae37mr1600178pzb.12.1714698508460; Thu, 02 May 2024 18:08:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714698508; cv=pass; d=google.com; s=arc-20160816; b=zHAqdUmzD1MhyazBZ/5R/phH/s1th3hTwJNxu+3eKLIdoHCDzTEVw/CwsCBNlLa5PU iqVtYdgWoWvYgZrvkGLLTGRnYtpru0/OWUd7SyCdQneJtmAVn824R6mt944sGb9IxZ16 Jqc+87GJ7F62iSVErqA9Ly1QeWyt1xT2Pkp8XqZc3G0dI2uk/w5FfI9ut8YtRARAsbu9 SVduft1gYzrbwtDJOgmVJmzO1DKDEXJdP1zlPsp+414ONuteQOK1mjW2t6jjoO4IxhDW PtenFXVOEF/TbbRYW+px4qkPUOHzDc2UvLOPKWdj7iIw9DKrrvPKpLkItVkFbl98uMWt h0Ww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=zu/Iz/dAMUjaxd9jmVYTC2Y3lCKhZRQ76joBN91gdNA=; fh=fqleqMIijE2iHZdx7YJkEYvj+uXZ1FAT5s2rMRfPnbQ=; b=glR3uYgjfT4Y0wy0t/CbJnRZe1xpwxV8MEvD8MJGaJAYh7nbep2/dKrYW0uGhmbgCK 1W6mbiPcEaMwc58yFPXX4HTXg6E5h6jrX9mgzW++sV9B7axT1kxkaqhn14/NuRgiTyiv 30TsE1XhLp9SZcXAkkKDp0ty9Gr2tl3vB5Xi0lAI2eNxn9m6Yx4KS2YMzFrgpz7zmRKc hewyzgP3oYeyeKA0tKZJN+PwvL5xrnZqgy56IrFl8eSYAzvXJPo4qz8BciA7s2JRQON1 mL2jXzEnbxcTpw2dKP61Wjfah9YMKlNDdvnsp6S7N+qfx8nE61gavpEOofPhQ724E5B4 kYxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=KvJdKPvT; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-167126-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 v10-20020a170902b7ca00b001eb30bf744bsi1900399plz.429.2024.05.02.18.08.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 18:08:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167126-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; dkim=pass header.i=@google.com header.s=20230601 header.b=KvJdKPvT; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-167126-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 A3AF72864B3 for ; Fri, 3 May 2024 00:58:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AD3BF9C8; Fri, 3 May 2024 00:58:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KvJdKPvT" Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDCDAE556 for ; Fri, 3 May 2024 00:58:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714697892; cv=none; b=sr28gRbZaW9fxQgmhDq05FZQRfxs0+spyeVhfckUTP2oIMIlTljs55QuGmL+bZuI2uTesZdGdj55DQ8sC9yzheB6Q31neBM9uYdjSsAO68aQ5EXrX/zRtWqlYUgvmD9RYXIAduO1ZFcBnrMr106TuFPiX9FxVcxlSaCfr38dRYo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714697892; c=relaxed/simple; bh=91Dfm01knwvPbmaIVdIV3JLbaaYPHycwfWHt/+jD++8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=BZC9ommOdbYrYSTopv20jiqjUxxVWGRETqMAo1AdKxODbUt43v1YM8a23ll0j8XYv+ji/nymRDmJZfMZOb/q2cNFrnffaQd136Axy8yAXIZV7xfLnYwiYlVLIuAF3XStqoBnWIMhwf1HSIAQ0GRZRleAYmZ2NzMzqXoyanj4y44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=KvJdKPvT; arc=none smtp.client-ip=209.85.160.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-439b1c72676so158621cf.1 for ; Thu, 02 May 2024 17:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714697890; x=1715302690; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zu/Iz/dAMUjaxd9jmVYTC2Y3lCKhZRQ76joBN91gdNA=; b=KvJdKPvTExB7djESZim61U0r0wsdBgRGWnxPBFT62P2+50QVa6WiygXDdmhyjl2bm5 ODX6hQBYrJMNNsvhWvvZ/4Eq04sXfqTVftw+cwp7yTxdAul8W0RsVftMM7lSfsQ5HKKq hC6UUFyxYjc8aCzNM+slawglnFHe9phI72cDJQ4Dcr9Gk3Z7PQO4t65vVpddpBAtasFf 4HZesr8Lkvd7Zxf8DF2Nz9g9BMdbYk6AMd57ZCUJe2mn3TjtABnk/xqkj+AQ0Cso7QNG AFx/fRPuQ133/1DoHB5WWlwci5m7Ob5zER7GPZOHxYRV0GmPk4DXqhjgTo/W5M+e5zdR jX2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714697890; x=1715302690; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zu/Iz/dAMUjaxd9jmVYTC2Y3lCKhZRQ76joBN91gdNA=; b=Fj+V9oRz7pboSbvNfAIGC1Y6MaUxwm60ZjiGn0Wjri/Io4GOSrFTUjruy7dqptbYTd cZnyYNsqE1YLRuG69QpF8/BFHPL80cANpL48EF3/4joSZLm9on/rDBJHC9LnM3ww2TPd HV76Z82vVc3YBH/hdgvlOFSxryCxEiUwqqbNT3B5xV6TIj8X9EhIhzQwCqf1IRojCg+x K4+qCF8MzuHtHezXut6v7boipqqFLU/DxF109xlWmQZ7xfIMJlOym2AAL9ipN/LFiW2v hoJa7W8rI7OnlyaeAp9hTV74m/kT+bn89ndj4Ng1jR+uSKtYXqbHed2MPENZQsdN09OM vNYA== X-Forwarded-Encrypted: i=1; AJvYcCXQUrmhXyheHT48NclA2c9AMQZ0px08axbKsPuRQuk1dFm2JCXMwFzUAYuD3KFrxMZX7ByqIHYwbGCTqGiT8dlRZmYmJlpuzVlJFfL4 X-Gm-Message-State: AOJu0YxWMTMvnepEJk5TLX5Rxlhokds9jtOGP3oFfCo2m4yf5rgbkeEI 719SpHC5egE6olapLN2A66s+nlirlC8XDleOZCkvjk8UYqv/dbHCHXgTuQH45SrWUwh5J7v8E+l emuX+TJESdhg5sNDe6uKWpl+zsjI6nAiai5qk X-Received: by 2002:ac8:7e84:0:b0:43a:b547:9f7a with SMTP id d75a77b69052e-43cd71b1567mr1387091cf.22.1714697889514; Thu, 02 May 2024 17:58:09 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <6edffe1b-e9a9-4995-8172-353efc189666@amd.com> In-Reply-To: From: Peter Newman Date: Thu, 2 May 2024 17:57:58 -0700 Message-ID: Subject: Re: [RFC PATCH v3 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) To: Reinette Chatre Cc: babu.moger@amd.com, corbet@lwn.net, fenghua.yu@intel.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, paulmck@kernel.org, rdunlap@infradead.org, tj@kernel.org, peterz@infradead.org, yanjiewtw@gmail.com, kim.phillips@amd.com, lukas.bulwahn@gmail.com, seanjc@google.com, jmattson@google.com, leitao@debian.org, jpoimboe@kernel.org, rick.p.edgecombe@intel.com, kirill.shutemov@linux.intel.com, jithu.joseph@intel.com, kai.huang@intel.com, kan.liang@linux.intel.com, daniel.sneddon@linux.intel.com, pbonzini@redhat.com, sandipan.das@amd.com, ilpo.jarvinen@linux.intel.com, maciej.wieczor-retman@intel.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, eranian@google.com, james.morse@arm.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Reinette, On Thu, May 2, 2024 at 4:21=E2=80=AFPM Reinette Chatre wrote: > > Hi Peter and Babu, > > On 5/2/2024 1:14 PM, Moger, Babu wrote: > > Are you suggesting to enable ABMC by default when available? > > I do think ABMC should be enabled by default when available and it looks > to be what this series aims to do [1]. The way I reason about this is > that legacy user space gets more reliable monitoring behavior without > needing to change behavior. I don't like that for a monitor assignment-aware user, following the creation of new monitoring groups, there will be less monitors available for assignment. If the user wants precise control over where monitors are allocated, they would need to manually unassign the automatically-assigned monitor after creating new groups. It's an annoyance, but I'm not sure if it would break any realistic usage model. Maybe if the monitoring agent operates independently of whoever creates monitoring groups it could result in brief periods where less monitors than expected are available because whoever just created a new monitoring group hasn't given the automatically-assigned monitors back yet. > > I thought there was discussion about communicating to user space > when an attempt is made to read data from an event that does not > have a counter assigned. Something like below but I did not notice this > in this series. > > # cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes > Unassigned > > > > > Then provide the mount option switch back to legacy mode? > > I am fine with that if we all agree on that. > > Why is a mount option needed? I think we should avoid requiring a remount > unless required and I would like to understand why it is required here. > > Peter: could you please elaborate what you mean with it makes it more > difficult for the FS code to generically manage monitor assignment? > > Why would user space be required to recreate all control and monitor > groups if wanting to change how memory bandwidth monitoring is done? I was looking at this more from the perspective of whether it's necessary to support the live transition of the groups' configuration back and forth between programming models. I find it very unlikely for the userspace controller software to change its mind about the programming model for monitoring in a running system, so I thought this would be in the same category as choosing at mount time whether or not to use CDP or the MBA software controller. Also, in the software implementation of monitor assignment for older AMD processors, which is based on allocating a subset of RMIDs, I'm concerned that the context switch handler would want to read the monitors associated with the incoming thread's current group to determine whether it should use one of the tracked RMIDs. I believe it would be cleaner if the lifetime of the generic monitor-tracking structures would last until the static branches gating __resctrl_sched_in() could be disabled. > > From this implementation it has been difficult to understand the impact > of switching between ABMC and legacy. I'll see if there's a good way to share my software monitor assignment prototype so it's clearer how the user interface would interact with diverse implementations. Unfortunately, it's difficult to see the required abstraction boundaries without the fs/resctrl refactoring changes[1] applied. It would also require my changes[2] for reading a thread's RMID from the FS structures to prevent monitor assignments from forcing an update of all task_structs in the system. -Peter [1] https://lore.kernel.org/lkml/20240426150537.8094-1-Dave.Martin@arm.com/ [2] https://lore.kernel.org/lkml/20240325172707.73966-1-peternewman@google.= com/