Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp506824lqt; Thu, 6 Jun 2024 09:41:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVXkvbxmPg9YkVo37BWUMC3jD4aqGz7hHU5P7Tljtu8SF0w0K49NbzQWY+d8oCanYXpZOsVxN5QWTDsW/fO8QxIIj5s5EKHP05VbplDaA== X-Google-Smtp-Source: AGHT+IHhEMC3xxW7vbbILfLTD/rFAfUSKrmEKZ2s5UuIsFkzE/e8dAUIP5SM8m+pXmdPLXSJ3GyW X-Received: by 2002:a05:6512:3d9e:b0:52a:f0e7:65ae with SMTP id 2adb3069b0e04-52bb9fc5dc3mr141552e87.46.1717692067240; Thu, 06 Jun 2024 09:41:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717692067; cv=pass; d=google.com; s=arc-20160816; b=Mcuvha2RMEz12GDyOf0JBy1Xsd9cYU0DJuOpiEMUzLTW5Yeuh+X0XFYmYZRVrEXmLF dAspIChJiWtyajlHC0Zpj8PbiTCQj0AUtt8NA+XLjZB/h1Yra08yfwpq5mA+B9I9raCW RpEgJ1D/GsMJ3osz4wYg+NJLJGzVPkQImfuUBgM/yX0vMwhIdcq/EyIkCt7r8cLm08Mh +jMgX2kg5RnKkg0OdBxEKdk6bOWoZ8q08NCh7FSzBcON7p45TxyeOiWYTZmb4Nxh/43b P/3fdWy1NjYK+AWUTkl4EZv2ekQLnWwNIWhmO5tQKfq1/Kib5oADppJGpXm+/78pkAx5 vSQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=P9qRTjL1IPD937AbFU19zLNMZ787eCsbPibCKyFxEFA=; fh=zrVDlrC06DAIec5BvDl2IM9WrZzuc2uxw+nPFYRCHpQ=; b=wWF2JrtSVubjPCUrwaoGsuXbaLcPu3hwVYotEBl9y3otAqLNDUEun1KVT80aDGgmIp tvmpJ6nrgI5JcK8LwUU9WDnpNipu1Ao2KlH6Mi83DLY08xjkRFgzjv8vBrzEbRjfjLTs e2WDfvSk13CSQMj5XBgXC0HGJhTyKrwVWqnCrRVqnnQVNGEiRXClH1cykjOxWiqhF5Rk 0DtVvCpPZR1ucM0gKiEEu5+P3lFKbn/9Nx6Oz6PaEBaBwFbmkW/CCCxwQyBCgCIFlzi1 6bmKGYdSrvcXgakhJyQXENgNQ4qZjOSzC89wnpSVKsttsoRkXD96JqqFp1I72CRHyzS+ Eh1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Nfclylo3; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c80728730si81029466b.804.2024.06.06.09.41.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Nfclylo3; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id D4D301F23DAB for ; Thu, 6 Jun 2024 16:41:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83391198A30; Thu, 6 Jun 2024 16:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Nfclylo3" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6261419885E for ; Thu, 6 Jun 2024 16:40:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717692057; cv=none; b=Z66REWcpvKZNqy9mFlcIF6xCGeVt5Nqo+fYiZIZuORhxtWfJU7qTQikfgDpQqXBmt6DsMfJ2fU8bINZyP+OtEB+I3+CTXpPrY4Ft2NrQIokciP7XQAYHEf5eyX/rbsovpFEoFQAm7TT8vXkevKGRfRA8SEvtJ/xDNPY4XvH010w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717692057; c=relaxed/simple; bh=Tmd4QY5T/e3nEEkLhLHnslTNEt9LzYjz5iyl8yEdajM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ax3zQSJxU0B/EIoVurvUvdqXf88355R3EgAYTIRf7fOQ3kBJIfHBQjZX1YFGiKtyyOE/vt7YYjKKkdFjoqiXI31ElA4gDaKuLlpGkyN8v4Vlv3moO/qGv62I8LuSvC1ocfAhNFq79omiZG+MPWEupF+VtlfIKlsbhib1GP/BDNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Nfclylo3; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717692055; x=1749228055; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Tmd4QY5T/e3nEEkLhLHnslTNEt9LzYjz5iyl8yEdajM=; b=Nfclylo3rYRvAP6s+BhKrJi4/o+A7p02ayOeIsMuQU0zYJm9+asX6702 vjJAsz5UsggZy0QVy201mZM+nlB77AZMGI0SXrM914gMDLuExX5VitR02 tp/sZgrpOwRY+l4XhdamURF+Ou24C9+bzW7srSXRqPDXI0CMUQv29Upjg 78aETfcsg9WdzMNzTS8yojoEXLSmnGJNDz6+7HAJF2fnw6xgGt3lIxi5F xbClkuRoGsZLqQQr9ebnsm+EgU/SRdf+v1boKqTAMowDx+PX09Z3xjp7u Caqg2FkMNkO1fAyeOeYBK/8ieThT6dIYDc10GfaEYwBGYNwuuHxrORB2C g==; X-CSE-ConnectionGUID: EepVNBW4RaWfYgzaPwL9ww== X-CSE-MsgGUID: e2NdUwDBTrmPIkD2wSrkHg== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14214908" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14214908" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:40:55 -0700 X-CSE-ConnectionGUID: h3W48DblTlWbxb0o5m/wfA== X-CSE-MsgGUID: 5QazQ67pT4eIApzhqXCodg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38033088" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:40:54 -0700 From: Tony Luck To: Borislav Petkov Cc: x86@kernel.org, Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v3 0/2] Add and use get_cpu_cacheinfo_level() Date: Thu, 6 Jun 2024 09:40:45 -0700 Message-ID: <20240606164047.318378-1-tony.luck@intel.com> X-Mailer: git-send-email 2.45.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This helper function came up in discussion of the resctrl patches for Sub-NUMA Cluster (SNC) support. Reinette pointed out[1] that there are already two places where it would clean things up by avoiding open coding. The SNC patches will add two additional call sites. So rather than have this jammed up as part of the SNC series, I'm posting it as a simple standalone cleanup. Signed-off-by: Tony Luck [1] https://lore.kernel.org/all/050c64b3-20b3-4db6-b782-f5124ebaab31@intel.com/ --- Changes since v2: Add lockdep_assert_cpus_held() to enforce what was simply a comment. Combine patches 2 & 3. Both functions using get_cpu_cacheinfo_level() are called inside rdtgroup_kn_lock_live()/rdtgroup_kn_unlock() code blocks. So cpuhp lock is held. Tony Luck (2): cacheinfo: Add function to get cacheinfo for a given (cpu, cachelevel) x86/resctrl: Replace open code cacheinfo searches include/linux/cacheinfo.h | 25 ++++++++++++++++++----- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 17 ++++++--------- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 14 +++++-------- 3 files changed, 31 insertions(+), 25 deletions(-) base-commit: c3f38fa61af77b49866b006939479069cd451173 -- 2.45.0