Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp281295lqt; Thu, 6 Jun 2024 03:31:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfU6tsdNthb3aCekgBp6+xhAaohrCw4vkw7KGCV30Y/D9PSyaxcSqp0nVPtdUlDR9ebWboBMaDd1qgI5QaYmRI+zitwKSfOAkK+da+rg== X-Google-Smtp-Source: AGHT+IHTR2y2ovvRXPFM0vi7ZeORv2kMAEK6MazAh8HNy/E/CN9rN2fdcmTqqNdAwTa6tJPFT1Tt X-Received: by 2002:a17:906:840a:b0:a68:adab:101f with SMTP id a640c23a62f3a-a699fa9c13bmr321753866b.18.1717669913493; Thu, 06 Jun 2024 03:31:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717669913; cv=pass; d=google.com; s=arc-20160816; b=ify6mSIh49gueJaD8U1dkoJkhYJByCRp7VPHx6ZuEYteK2J7ZFITYY4PrGZdq/qilG zZQKRaipms348CzCcaP2NZgy6/3JGRC9yw5zqRbCmToPqia1HCerSHSkrwN+iMg03mGI 0j/NULBlhKsqnWSP3gqRnxPcyYPxuaSXMd2u5N025jCY7RueONlEplPudr7wNX/dKNmX Q+0Z8EkA+YufULjqz1Pc4b8p2A/JdMJWYc/t6wLwd6xvdwQsLnfMGCss4G0p3O8kJxkw J9WVc51AJ8mLQZ59SbC39BmEYDknX8vVseKKuvTTVwvTx6WUt24Sozm5+GfAwavtOz58 GK4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KSCrX9oB1sfb0YE4irfnaZKrDq58FuJQTvrmtflRjIs=; fh=hVzz3Td5WQsdtkAyovk7gd/kUt2uIZpHm8yL7qct2nk=; b=ObQNogsI7DnJHJDqvKqYlWROy0sw02j78g+RCb9UAiYKOmjGwWpS8BKwdxTzhpiTv+ 2yhWLnwZS51u22w3VDBFb36GLMawcJMrE0wvpCP1xZyMQfni5kICNbAxkEklQBD1Lxy3 nSToDUKTh3V7/ApTQzhObXCC5INis2XkQ+VgtWXu1nNk3uHfgCQwzKr5zeQPQyPvTH8t W2KNf+VdbC/xmeBq17nICyigmNEjvdREvHHU5/2B2xmKz9wbQF4NYmuXwFt3twivLSwM 47/sXKbL7V+tBWroN+FWfP3FN92Nh9UnArQOx0yljNLVM4VuH8ph6pg6LhD17Q3Reajk 0Lig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=S7nT68Vm; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-204111-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204111-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c8059ce68si54601766b.58.2024.06.06.03.31.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 03:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204111-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=S7nT68Vm; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-204111-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204111-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de 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 3B78F1F2782D for ; Thu, 6 Jun 2024 10:31:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03006194C93; Thu, 6 Jun 2024 10:31:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="S7nT68Vm" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 AB6D9194C7F for ; Thu, 6 Jun 2024 10:31:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717669895; cv=none; b=GeAnya3q/G7hCtqmFi7gDr9t5tSCzHKlvcPlqocwWV7IxTe7dWGw1ntGrFbTyvqBabmnynKo0tos9frQeH48hvE6CpbjAT6Ol20FqePuq+D7L88IujhhVYGO5tBKl1wWnRfNQmI4iQv+T+4ien8HPF+zZ4TQkT5e1pbYEUy3oWs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717669895; c=relaxed/simple; bh=QG+XegQ1/r/iVUT6bSZGmh9xwOPL3hEw8L1Gf5xCFcg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lSLMweDk+78svzn/59J7d3haJBSERj18yI/KOLBgMBbAH4i61n1gQJE09oCQJTKNA/yXl+1EiB7PP324Ni+aC8EPUeC+J2g1Ls+AjQBZMkYslVX7BjeYVACRy/n8Y1Ne8He4lPXSuNGAn6GOFIqUXc/Fw4/kE0T2gmkZpezQeo8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=S7nT68Vm; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id DD16A40E016C; Thu, 6 Jun 2024 10:31:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id cSr9dqY6uZdE; Thu, 6 Jun 2024 10:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1717669880; bh=KSCrX9oB1sfb0YE4irfnaZKrDq58FuJQTvrmtflRjIs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S7nT68Vm6PWiPQK/kUXGHOV1a00Ckv/4KaHfLScjWjmWMCC/ATZbacSh3u/jKJS58 tNwSQI20buLwtv0EU0iKWJ/g0GB04GbFj/Wlf/tdT0IWsmPzRMXNr43ibDKEXicH8n Y9hJrhyPiEqOFNaBwbs82pk4GPUU6kf3LsvXN9IdZzzZi5PXKY03sJGa9uX3Wl0m/w eBHvTNTqfsPnInKov9xduRnVM3xCGgbU1pkJOm5or/DNPB8lG0dADT9zNsYgWW+a88 ENwez2SRaerxhwQUzFSlQ1rtkzoV+zRCXaii1DEh3Je3B8RBTMmqIbKnu1CKP8svbJ bA59Z6ux9rVclmfriVWlSOjDDDS4HS4+18tSUkHQrpC/hMLaLDRIdxFsxZN4hfoozr BtQkmnfAfxlOvdwetpo9YYYd4MHD7lHh7vn1oTpw+Q0xYvcwo3xyYal2P6KOq1hb+V +lLin/DEkPntkH9buKfhP82rfHWjFobsn9bcVqPlGRaudFW4ioNfz2S5s9dPX4qszX VcGXAg4j0xYvJf5S8ny8f/lSGXjyt9Z6AECRUJ9fW4e4DEYpmGZXE+rV3zwnbP7MYF M6Iv8/lMyoM0T7VuHfqaj+WGsWhPSzoMnzfRlMYNmY4Jn7AafOuV8xDs0GbtlBHhfV GU9sv8Dzd2hF13dY32/upY/Q= Received: from zn.tnic (p5de8ee85.dip0.t-ipconnect.de [93.232.238.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 14C7F40E0027; Thu, 6 Jun 2024 10:31:08 +0000 (UTC) Date: Thu, 6 Jun 2024 12:31:01 +0200 From: Borislav Petkov To: Tony Luck 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 Subject: Re: [PATCH v2 1/3] cacheinfo: Add function to get cacheinfo for a given (cpu, cachelevel) Message-ID: <20240606103101.GAZmGP5Y6389EvCb8S@fat_crate.local> References: <20240605161427.312994-1-tony.luck@intel.com> <20240605161427.312994-2-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240605161427.312994-2-tony.luck@intel.com> On Wed, Jun 05, 2024 at 09:14:25AM -0700, Tony Luck wrote: > /* > - * Get the id of the cache associated with @cpu at level @level. > + * Get the cacheinfo structure for the cache associated with @cpu at > + * level @level. > * cpuhp lock must be held. > */ > -static inline int get_cpu_cacheinfo_id(int cpu, int level) > +static inline struct cacheinfo *get_cpu_cacheinfo_level(int cpu, int level) > { > struct cpu_cacheinfo *ci = get_cpu_cacheinfo(cpu); > int i; > @@ -124,12 +125,23 @@ static inline int get_cpu_cacheinfo_id(int cpu, int level) So: lockdep_assert_cpus_held() ? > for (i = 0; i < ci->num_leaves; i++) { > if (ci->info_list[i].level == level) { > if (ci->info_list[i].attributes & CACHE_ID) > - return ci->info_list[i].id; > - return -1; > + return &ci->info_list[i]; > + return NULL; > } > } > > - return -1; > + return NULL; > +} -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette