Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp375757rwl; Thu, 23 Mar 2023 17:58:10 -0700 (PDT) X-Google-Smtp-Source: AKy350bOO3dFfYKbjUpQfTLLM2DIOyAbmBSXHhdV9H67vc1iUtRAETsfqzM6i7DjvF8InTmENUmH X-Received: by 2002:a17:90a:1042:b0:23f:e165:3452 with SMTP id y2-20020a17090a104200b0023fe1653452mr1038515pjd.0.1679619490577; Thu, 23 Mar 2023 17:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679619490; cv=none; d=google.com; s=arc-20160816; b=xzKdR0N9RSbUac1uCRTV39KhNeB2ustKnBMJgrPON672zBQmDnER4HJxiypVRr+3M+ NaiXR7AMurTDgfWzWjeGffIewmRo6Giw702ydcw5q0UqepTDst65lVLPQFTgm/yQyGuJ qGZNtY0B3kApvjvF9pYOWefmZdApfZsi3AuUUva1He7ss/c6IcqsxrI5Svln/Bejomn5 akZoq6mAXBODFyQJf4awDUjGrxOKRl0trLUQVpBgW8vMvhPZPwldM7CNDAVSduJ+EIE2 4LWeIAbagjEEQMNY29bIve9gyeBzDle7gQ37z9ItPf+/Oke++SB95B2hpNP+nAEDWFsk yUPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=afnQeDIPMIhdAyYnd6EkaIRoQw2aDgbZrKhHDlrnCJU=; b=l9baFuV4EpyetL0dlHCi3V1OjpXKBHypeypzqymivdGj3lHZCcqNx9pKvvEl0kFjjp 9JZKLTbMbXG0BGMkUEFg7Gdk+AWPqHZ8RsFO9fo5sydpjHjktAcVkt/US5Nv5YqyphLX +jf1/uX6ojj8jh+kbZoFioPYBEDHave22bt4hP1/XHJ86l8zvO5O8kdP8WHj6J889jWU rZhf27l6K8lWCCX6h4QJy+yjuizHZ4C69fy2tq+XmqjwfSXuvCPUk+NzngCPXqIBLKvB 8X7sE2tpNKCELjT5QKqM5L/iVguuW4+LV1zt1tl5BWWQ62kaeS9B8RY4XmropfsiYrda HPiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UsRhfFhu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx17-20020a170903139100b001a04b5ad759si3255407plb.616.2023.03.23.17.57.56; Thu, 23 Mar 2023 17:58:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UsRhfFhu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbjCXA47 (ORCPT + 99 others); Thu, 23 Mar 2023 20:56:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbjCXA47 (ORCPT ); Thu, 23 Mar 2023 20:56:59 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56BA3199D6; Thu, 23 Mar 2023 17:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679619418; x=1711155418; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=tfCFzHtoYhPDMNyF0OvUPDP5DF5D0hdEmFTrK9vJ/Yk=; b=UsRhfFhu864TrtRVw5ETvsBTXz/NNoet5ZlRAyqmsypxl9cO/IzVnB1+ 1Hwanb/F+p17RKDWiyk9x7lkm048ISP1kaxaZ5il3H4T8C2s1ID0FPKdp L1faiKPTY3Q8BlfPHYCXl8UAA/UesHtBR46zU35xAA3uWzPfq4DBbayAD uEAwB/5S6qO7E0JSQ5SsL76U/y1DL0X+lvd6OzoA5AG0BmesWknNHDMkV wlylOQnvubtF3CJq2kz6DzR0MYAvKwI+uMByP7SCwnWttxF1GfqyqtDUQ dRM6hizhRjx61A0yJzz7l4XUnXTeZX+ZewQI1jsHRnQPCKU/aI8uplI1P w==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="342050855" X-IronPort-AV: E=Sophos;i="5.98,286,1673942400"; d="scan'208";a="342050855" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 17:56:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="806471132" X-IronPort-AV: E=Sophos;i="5.98,286,1673942400"; d="scan'208";a="806471132" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga004.jf.intel.com with ESMTP; 23 Mar 2023 17:56:55 -0700 Date: Thu, 23 Mar 2023 18:07:26 -0700 From: Ricardo Neri To: Dave Hansen Cc: x86@kernel.org, Ricardo Neri , linux-kernel@vger.kernel.org, Srinivas Pandruvada , Len Brown , "Rafael J. Wysocki" , Zhang Rui , Chen Yu , stable@vger.kernel.org Subject: Re: [PATCH] x86/cacheinfo: Define per-CPU num_cache_leaves Message-ID: <20230324010726.GA7459@ranerica-svr.sc.intel.com> References: <20230314231658.30169-1-ricardo.neri-calderon@linux.intel.com> <2b1b5ded-522f-1fcf-6daa-354796bedb74@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b1b5ded-522f-1fcf-6daa-354796bedb74@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 20, 2023 at 09:44:04AM -0700, Dave Hansen wrote: > On 3/14/23 16:16, Ricardo Neri wrote: > > -static unsigned short num_cache_leaves; > > +static DEFINE_PER_CPU(unsigned short, num_cache_leaves); > > + > > +static inline unsigned short get_num_cache_leaves(unsigned int cpu) > > +{ > > + return per_cpu(num_cache_leaves, cpu); > > +} Thank you very much for your feedback Dave! > > I know it's in generic code, but we do already have this: > > static DEFINE_PER_CPU(struct cpu_cacheinfo, ci_cpu_cacheinfo); > > which has a num_leaves in it: > > struct cpu_cacheinfo { > struct cacheinfo *info_list; > unsigned int num_levels; > unsigned int num_leaves; > bool cpu_map_populated; > }; > > That's currently _populated_ from the arch code that you are modifying. > Do we really need this data stored identically in two different per-cpu > locations? That is a good observation. As you state, the ci_cpu_cacheinfo is already initialized in the arch code. I can certainly modify the patch to make use of it instead adding a new per-CPU variable. > > I'd also love to hear some more background on "Intel Meteor Lake" and > _why_ it has an asymmetric cache topology. Meteor Lake has cores in more than one die. The cache to which these cores are connected is different in each die. This is reflected in CPUID leaf 4. Thanks and BR, Ricardo