Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2160144rbb; Tue, 27 Feb 2024 12:34:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUuniayQifl4bMuKEfWAF1Q84Py0w+R2O5ILw1q00WWF8Fki9ACTK1r0CFrzke/fsi1V1B7eJDN8aALlFq4JJdxtX0apFQVIJhkfizIQQ== X-Google-Smtp-Source: AGHT+IFzBajUwso9SJGqAjUKhTLFHMJ9V8QYEXV9eYB8Epla4I7cIgZzELRB2YRK9tVzYEHVSpQL X-Received: by 2002:a17:90b:1492:b0:29a:e90e:244b with SMTP id js18-20020a17090b149200b0029ae90e244bmr1757983pjb.30.1709066046542; Tue, 27 Feb 2024 12:34:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709066046; cv=pass; d=google.com; s=arc-20160816; b=aZXl/j5xPgFqGuRPFtA1f71FjMf1HWgLnOj0rnPgz4pednIJBc0gmu15SbTmi5ewZT dqGH8Eam55yCJT9jj8nvl4qMVE1RutFECnS3cEIiO7kCGotPYn3prYM4uwL9XNO9WcDb Y05XUY7DacX6Wuk6rVRtpdwgFWiK+OHIjlorT0KVwiaQPuRc0TdVVz8k5m95vKru8hOe icX5dvpa+SaefmWh+nFK9+NRkWZ4jqHB7Dso9Briv4jY960LfIXT7tY0wjKdfyP0tola 82udOcUQQb4E7J7kKbqi9Rp5bCtRgUfvHoFi1kBzJlApWce9kJxNB/Ku8Fm/ogrZUYrP 16cg== 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=CZ/hnz7jNJ+BokDp//ndsV+GCXe8JmWh6tNQWgFFeig=; fh=aNwNNeLKgj+gy8KWcu5OoWIBzB8ZfVHiKlAwg3tPmBQ=; b=ekjTyxy8rfNH78b0ttxMLgO8Q3ZiRKwg04j94XIoit+KlR9zC2iQci3xqHfzWc1Q1U P2dTLu6bkks5jCrO9HtcNtWt74KbTocJttA8/OIi+KoELiuSqmqwqVU5Rm+lxczRfgJF 8TKNdF8MS7ZixQRosUiosUwP0TjpVZTTEp1fH+5cENE5+ynl/NqZd0ltoetWvFSnopR3 E8i+7QgG6U9hkWZ2F896sqNhAtsU+AIwe9ssU/lmq+twaKBldaduuTVnmJuikdwvNnFi /74o5mh7yjtFnumzVkdipzyJxFaG8eipcLolsJ5mAgA3PYOt3r2fUdqZz5ZF8BSr+eCQ ByWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=R65UT8oM; 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-83965-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id pi4-20020a17090b1e4400b0029ae289e594si1692400pjb.123.2024.02.27.12.34.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 12:34:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83965-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; dkim=pass header.i=@google.com header.s=20230601 header.b=R65UT8oM; 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-83965-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83965-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5B8E0B22DDB for ; Tue, 27 Feb 2024 20:06:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34A8114A4C1; Tue, 27 Feb 2024 20:06:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="R65UT8oM" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 D7BE02D60B for ; Tue, 27 Feb 2024 20:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709064391; cv=none; b=M1OGlD/RTfeIrGwgAq3Nnj5Dazvi9vxbc/cO15PQLu9Lj7pzTh7+clnXEQ6042M+oGrSrunN7wI7EKTSoPRPL3nwpYBXJrHgdrigMH0XBqkMdIKnB43DCxtQRFv954RiGQh+ntg+iWmbUePHtvNURuxgtcL8OXtI5snUZksBTA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709064391; c=relaxed/simple; bh=d9xLwO7g+4iyBmG+rDlHh3o1ro7B0g6XOQxfQO0bh5I=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=MuzaibO2IRefSnkvocZkDWzZCF0gvqvdb7/KO0vEl0l7uP+9db5h2HIOWmxsxjytYfOiC7PHk9sPy69jj/O+TVx1EpEkvc5NirqUP72AWjkoUQZqJVbXz3LdUDOeQXPGB7VZTixcGCoBZ+5Up649LAP1mC1UDheIChs90GOzyfs= 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=R65UT8oM; arc=none smtp.client-ip=209.85.214.178 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-pl1-f178.google.com with SMTP id d9443c01a7336-1dc929e5d99so39055ad.1 for ; Tue, 27 Feb 2024 12:06:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709064389; x=1709669189; 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=CZ/hnz7jNJ+BokDp//ndsV+GCXe8JmWh6tNQWgFFeig=; b=R65UT8oMqITAmOZ3YZa9j7lRSQFCGu8GjAJSsX9/g2j4E5JYKeXCugOmH1IJYZTZlu 7n+6SozwcBV3c5ORqieGFmcqkssJ776uptr3P0ZupVRdV+X2tWOvKhFDZFVWRNba5aDp ZzLWsXbXHjkv/FeMwwhA1hKxnBC/vV8UFFCaJRRDTY3ohalDAv8Zxh/LSMgFHUAmiYKf MA/88VX+8gLUptNAyU3ZL6gJSLfAMsNo6U1vDd4ACHNQc3509U7fJr8qe8tr1Uq0IDxw w33GWJcWt4WxoA6+YQBmjih6S59KXBsG+bLFBYCieb0O6YIFV9kzQVrdXLN5MMk8UT3r QVwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709064389; x=1709669189; 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=CZ/hnz7jNJ+BokDp//ndsV+GCXe8JmWh6tNQWgFFeig=; b=s07RAGSZWaG/MjaZo1HuS3nb3f8oir1btU6oKclvmb45V3Frfc3kqp4i1Bj+j4e8Qi P8NxMXX6Wgx2O+oqRGkymqsctZIGjr/LgTInrJytDPXA7eTYM1PLq4rpxVsA2ue80sSA jZhCDVk2AXjm0yBJY8lozLYze/bSTSwKQB5eTC7JgjfmARVqZiEp1ELNQ4D8X1sIvPq4 Bqbj45WKuMvkXeNiBQK7GkSJ47zK4fEQtobSwuu/aLiphiG9lfsq2k8wvAgUCZ5Rlfw5 OSq1qIYjyV1uVVd4L4z6Le522FK0PwZ/CIsp5iphWTgnfIXqN3x4RUhZfMk9aZAPbvgV DSUQ== X-Forwarded-Encrypted: i=1; AJvYcCX7kiNkvbp3thjHkUomEG2UmKYRllEdOx2jOb7bBc+8sMls1jesIIgJ+M+jbLly8LTJhRYR+YOoEQyv0egq6qB2xmbEk8Q0ctoSbH82 X-Gm-Message-State: AOJu0YxabOT3vBMgZY5O9gE2jFUo15e4qzZSvl2QuRNejTiJZy88y3+0 kxwJM5hppn0BcRv0fonplNF5bBUOQzA7IaB3iJU6CdlJkGZBJfV8ji7nqYcp2AZ3k7dBk7dahfF 8/A3X9Rni8LDtpgsc46l+ScKjNUutITZT0hx/ X-Received: by 2002:a17:903:3385:b0:1db:9fed:c591 with SMTP id kb5-20020a170903338500b001db9fedc591mr343160plb.22.1709064388879; Tue, 27 Feb 2024 12:06:28 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231201005720.235639-1-babu.moger@amd.com> <2f373abf-f0c0-4f5d-9e22-1039a40a57f0@arm.com> <474ebe02-2d24-4ce3-b26a-46c520efd453@amd.com> <3fe3f235-d8a6-453b-b69d-6b7f81c07ae1@amd.com> <9b94b97e-4a8c-415e-af7a-d3f832592cf9@intel.com> <1ae73c9a-cec4-4496-86c6-3ffcef7940d6@amd.com> <32a588e2-7b09-4257-b838-4268583a724d@intel.com> <088878bd-7533-492d-838c-6b39a93aad4d@amd.com> In-Reply-To: From: Peter Newman Date: Tue, 27 Feb 2024 12:06:17 -0800 Message-ID: Subject: Re: [PATCH v2 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) To: babu.moger@amd.com Cc: Reinette Chatre , James Morse , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Babu, On Tue, Feb 27, 2024 at 11:37=E2=80=AFAM Moger, Babu w= rote: > On 2/27/24 12:26, Peter Newman wrote: > > On Tue, Feb 27, 2024 at 10:12=E2=80=AFAM Moger, Babu wrote: > >> > >> On 2/26/24 15:20, Reinette Chatre wrote: > >>> > >>> For example, if I understand correctly, theoretically, when ABMC is e= nabled then > >>> "num_rmids" can be U32_MAX (after a quick look it is not clear to me = why r->num_rmid > >>> is not unsigned, tbd if number of directories may also be limited by = kernfs). > >>> User space could theoretically create more monitor groups than the nu= mber of > >>> rmids that a resource claims to support using current upstream enumer= ation. > >> > >> CPU or task association still uses PQR_ASSOC(MSR C8Fh). There are only= 11 > >> bits(depends on specific h/w) to represent RMIDs. So, we cannot create > >> more than this limit(r->num_rmid). > >> > >> In case of ABMC, h/w uses another counter(mbm_assignable_counters) wit= h > >> RMID to assign the monitoring. So, assignment limit is > >> mbm_assignable_counters. The number of mon groups limit is still r->nu= m_rmid. > > > > That is not entirely true. As long as you don't need to maintain > > bandwidth counts for unassigned monitoring groups, there's no need to > > allocate a HW RMID to a monitoring group. > > We don't need to allocate a h/w counter for unassigned group. > My proposal is to allocate h/w counter only if user requests a assignment= . > The limit for assigned events at time is mbm_assignable_counters(32 righ= t > now). I said "RMID", not "counter". The point is, the main purpose served by the RMID in an unassigned mongroup is providing a unique value to write into the task_struct to indicate group membership. > > > > > In my soft-ABMC prototype, where a limited number of HW RMIDs are > > allocated to assigned monitoring groups, I was forced to replace the > > HW RMID value stored in the task_struct to a pointer to the struct > > mongroup, since the RMID value assigned to the mongroup would > > frequently change, resulting in excessive walks down the tasklist to > > find all of the tasks using the previous value. > > > > However, the number of hardware monitor group identifiers supported > > (i.e., RMID, PARTID:PMG) is usually high enough that I don't think > > there's much motivation to support unlimited monitoring groups. In > > both soft-RMID and soft-ABMC, I didn't bother supporting more groups > > than num_rmids, because the number was large enough. > > What is soft-ABMC? It's the term I'm using to describe[1] the approach of using the monitor assignment interface to allocate a small number of RMIDs to monitoring groups. -Peter [1] https://lore.kernel.org/lkml/CALPaoCiRD6j_Rp7ffew+PtGTF4rWDORwbuRQqH2i-= cY5SvWQBg@mail.gmail.com/