Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2856518lqp; Mon, 25 Mar 2024 11:08:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIgRv4ABydxQcw70nxHpVdx5NAQTmSHbsSHBA5HT4jBoHc8tpXPgfdEpV5Y5rnojb1ClMQC9m3xK03hCjAnpGLryA4mOmDR8SMHAuybA== X-Google-Smtp-Source: AGHT+IGQ4rj9giTh1JdN2SznbfHQ9wOw2yebp+pRRmD9RiYEXgkvjYmWQtrqQDmva3YML58VvjUY X-Received: by 2002:a05:620a:470e:b0:78a:5d4d:78c9 with SMTP id bs14-20020a05620a470e00b0078a5d4d78c9mr2632796qkb.25.1711390102938; Mon, 25 Mar 2024 11:08:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711390102; cv=pass; d=google.com; s=arc-20160816; b=zovhIOwNWdj5Jp+80m+zo6qCCX3gnKs90P0TKMJkaBZ+pF/rCqZRkoYXXIr8BuWDcC maosUoz21vIlK9FT/kTE+PCxwarspGzrNjE7WeJS9tVrmozyPXHnqlxE29f63oAPdvfm vZnqKNbaJIFoEFgGWpvV9vTfMzI5OEfMysqkiOVTWgzCKUUUAR1lk4tNNJmmbFdi1kM7 BBjdTWNtGrzK4VztcAkIzL0Abk+m0fbq8wCiUNoGQXAnqcvmYKRNoVeI/QV4qUY2KZCl I1gqsbX8dZFMCB09gUOLvi/W4Z6uHFSXSuNPces77g4UgXctddzdnoXRVI+zXfjjxYwH qQPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=Z+xKnD/Hk5bulpibeGFuTyXe+4qbZ8qSnGUgzX6Q+tg=; fh=AK69QAGo6s7XDzlVu+a2iCMPkfW+uanTx3lSbNIpMXw=; b=ituuBaHvMMAEg8fzzp3JvaO8BZD7v53TqJ39jO5h+QRR7SiI+i0n/pC1rH/5Puz0zl R/JY4j0F/sB+7KfS21k25Z2zyv6uqZCggC3EirOvlcHNe0pUc2QZd5hajM0ohgui9MNX gszdvsQ0NjxVRRzNaTx1F+Dcug3nP0DvPP/4BgT18EJxi4NLNlZaM/shnTu3/kwJ7xmN ZcmhcO9baKNyVAh/j8UluEBskBtMCdShYfgaN3PPBLlIyjRGWeGO06/H/7ReoU+1d2TI H8tYXs+NBELoAm1BR8AvWU6j2xJhaIS/raBgJ2J0AkkHkocbpLzAQGiS0s1kLqWyUsZ9 7rrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=tWFgFCu+; arc=pass (i=1 spf=pass spfdomain=flex--peternewman.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-117599-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117599-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s2-20020a05620a16a200b0078a31969e8asi5702235qkj.596.2024.03.25.11.08.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 11:08:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117599-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=tWFgFCu+; arc=pass (i=1 spf=pass spfdomain=flex--peternewman.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-117599-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117599-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 165731C607C7 for ; Mon, 25 Mar 2024 18:07:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 130F112FB15; Mon, 25 Mar 2024 17:27:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tWFgFCu+" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 8CDDD12F5B6 for ; Mon, 25 Mar 2024 17:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387664; cv=none; b=bUR1elUgHZFR6ehAHOc4VITr5afFp30e0t94cpzD/bvZRSVjpMowKts0gmtfgtuyUJQA+nQ+GYCiZ8wMV2TqJqa27yzVq5Y5du8Vv5XP8BsvcvfctZT5ZE6efMyUoiHRRr6nZVH+h5R/4//EkV7eP9/2qJ8jQZDHNVCYlYapYLI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387664; c=relaxed/simple; bh=r3fjiYp+AgZHV3ei77GMW6DjlOuXQfdqooVdsxOJZz8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JeQJMtsDn7XCrdex1pT7m3YBgoRf08UbEyyStwwTz5GpgmPHLe1QpoRCAgfU6vdX3fYx1UNpImVhEeYSWdkOax+Gdqb0ypQGuCrq94n68DZ5970kM97GGz3kYT2z+G3A2biyKI77a8lPmARa82LV2QnHrZumrHKPPuuwqi7WEnk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--peternewman.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=tWFgFCu+; arc=none smtp.client-ip=209.85.128.202 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=flex--peternewman.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-60a3bb05c9bso74651097b3.1 for ; Mon, 25 Mar 2024 10:27:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711387661; x=1711992461; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Z+xKnD/Hk5bulpibeGFuTyXe+4qbZ8qSnGUgzX6Q+tg=; b=tWFgFCu+7+B8iCj4l+XNvEkD6WEFf837r+nJK2b9bKdKyecR4o6DmXl8TeRq8iLfHN QS1ETtisUldJfyfqDSZvaA/ZJjadZRdeDUGvuqD35eeBEoc4yBaY1T4Ka3sBu7AhlXHU CF6L/84pzItEDEBrsmMqmiJws1J5dA+E4XY6nKpZp8hThPwoR/253VFmTDdVpvnBiUvn FyXbsWATbxD+Z6cGQ6REWOT9XjmW+CmRrSxNxTzpcPgzDwpZEhSje9AETBNgVyLCC0R4 53wi/PoD5mqvao6C0HQsdVNbHj5oStlH5UiNX6pCLvRmLl95/1TPLEekK/85KkmK5AGi KXbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711387661; x=1711992461; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z+xKnD/Hk5bulpibeGFuTyXe+4qbZ8qSnGUgzX6Q+tg=; b=ZVU2EP9FaBZInAuEEwI4VC/ZsCYHuaRGOUb4Rq0WmyBVWyBIPmyhsl1OLf0bJ1Rjeb DmxwVzSODfEF/OQM8TxNtOHnOKsMuhDda/6mF4ikY4GZ8Hr/W6Lw+DprmomxR0tuHEEl TzenSWvd4rMgfWO3rbcVEsnfSm2167Lkc3LyDS7PBhbtI/21CApUQa7+YhJuizSTHv9t +U4Utg/nXCgNHWBP/JkY/lOW1Cxsptab9wNm8pvmZzHqJA+a/AlkXJP6nFojx+FMpZ0X aOupjzXwRtCMCl7RXYriuxS0dh+Og/xT18j/Ie861OxnENmQg7r+Tq0BbpYDF2qxeGW1 ZheA== X-Forwarded-Encrypted: i=1; AJvYcCX+U0ENzV6P5snj0Sz6EO0+JfeVF106u5dI4bBtFQFux2cXr8c/xAuExdj0glJ4F3PB4v/D5844jOpDACjtYj97+WuO1hfDN9gjcvRI X-Gm-Message-State: AOJu0Yz0B5QJBur+XKKRfuNcWMYpNqB+q4GFi0WQhgc+EVGMjToUjdRg 6lgzJMaUTx/ZpxZnmgV2J7K75CIXCPtkBRIMexd312jLpBRLxt9a8CEh5se3hIJ7VK4Q7tUFnmT jaGcBvB4GGD1apHFJJjaSTA== X-Received: from peternewman-us.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:3dcc]) (user=peternewman job=sendgmr) by 2002:a81:8387:0:b0:611:a290:b8e3 with SMTP id t129-20020a818387000000b00611a290b8e3mr157140ywf.0.1711387661638; Mon, 25 Mar 2024 10:27:41 -0700 (PDT) Date: Mon, 25 Mar 2024 10:27:04 -0700 In-Reply-To: <20240325172707.73966-1-peternewman@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240325172707.73966-1-peternewman@google.com> X-Mailer: git-send-email 2.44.0.396.g6e790dbe36-goog Message-ID: <20240325172707.73966-4-peternewman@google.com> Subject: [PATCH v1 3/6] x86/resctrl: Disallow mongroup rename on MPAM From: Peter Newman To: Fenghua Yu , Reinette Chatre , James Morse Cc: Stephane Eranian , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Uros Bizjak , Mike Rapoport , "Kirill A. Shutemov" , Rick Edgecombe , Xin Li , Babu Moger , Shaopeng Tan , Maciej Wieczor-Retman , Jens Axboe , Christian Brauner , Oleg Nesterov , Andrew Morton , Tycho Andersen , Nicholas Piggin , Beau Belgrave , "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, Peter Newman Content-Type: text/plain; charset="UTF-8" Moving a monitoring group to a different parent control assumes that the monitors will not be impacted. This is not the case on MPAM where the PMG is an extension of the PARTID. Detect this situation by requiring the change in CLOSID not to affect the result of resctrl_arch_rmid_idx_encode(), otherwise return -EOPNOTSUPP. Signed-off-by: Peter Newman --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 9b1969e4235a..8d6979dbfd02 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3879,6 +3879,19 @@ static int rdtgroup_rename(struct kernfs_node *kn, goto out; } + /* + * If changing the CLOSID impacts the RMID, this operation is not + * supported. + */ + if (resctrl_arch_rmid_idx_encode(rdtgrp->mon.parent->closid, + rdtgrp->mon.rmid) != + resctrl_arch_rmid_idx_encode(new_prdtgrp->closid, + rdtgrp->mon.rmid)) { + rdt_last_cmd_puts("changing parent control group not supported\n"); + ret = -EOPNOTSUPP; + goto out; + } + /* * If the MON group is monitoring CPUs, the CPUs must be assigned to the * current parent CTRL_MON group and therefore cannot be assigned to -- 2.44.0.396.g6e790dbe36-goog