Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp130554rdb; Thu, 25 Jan 2024 10:11:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFppsk5Dx/PFsX66PTLnKStsoerlnDKQcilKo3OZTf5pMp76bS+yz9xzAWlheXZou+OQNZ6 X-Received: by 2002:aa7:c6d5:0:b0:55c:f699:538 with SMTP id b21-20020aa7c6d5000000b0055cf6990538mr10813eds.84.1706206281932; Thu, 25 Jan 2024 10:11:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706206281; cv=pass; d=google.com; s=arc-20160816; b=nfcGv7Q6Aw/GxffcwY7InnvZbDf7GO/O59Rdik/WdtJRL01V9mqCiwXypgxMshbL5v ywUh+q2EgfD4lYwYoBfjGZW1Xtm+qD2b4bAZjE3diFeSNiQTKQhoLA5oe21VJTuUFdyl wZsPgtZI/036eU3eospBNUu9pALp/rxCDbWXZc57a0+hSq1AuZ/2baTuzwZcRaXvqGOC 2zrJvMyfNFAAEnPpoPr6mmjhImIk/PuFTebirdWRQHnDFeu2xL5dyf7aEBSxNLWdC/Z7 vV7XODSGo9RBiCd8pmpHk8MBSUZjc+YnJUXyfc9CL9WvZ3zwiEedunN7Kf9G4F6QkTs9 UwsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent: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=i5sJbrU0kQkTL2oUR+VAjWBfjdQHNW0UWOfDHT9jaNg=; fh=+xfHThSWIRZBSJEXHFqEirJOi45OCdqPkV91gvJVxRU=; b=irOgDJCdzG/hoCxaRRWLBerHPlZ9J/h6L9z7mo9mqS4GO8mZw5hAoEzMXzas/e78GL 3vDYT5yaXEXMJpuHtEPzHSlBwLO4g/Y/ZCHkxYyvwJTj76ZAXIkLNXLgC9vJo09RnTk8 gEBugSwR/PdVCa4g+vVUEBHUVyXhrRyKULen+CxwHuMRk+fkZ+zHswOf49e7TruoF3qY B4w1m9las4dkw3nKFhxhXmwwVSd4nyLsBK/5XtiAr9kSJ7dSTK+fmyGm95h8q17ritdW W9AyPa2eea2nnqbNI24INaGL93PmpWcwYaWcbfc6mYBIapKVr25XAbR0WXK4oIDsixS/ LD2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VrhpNdaS; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38728-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38728-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 q4-20020a50aa84000000b0055cc148e559si2191698edc.439.2024.01.25.10.11.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 10:11:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38728-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=VrhpNdaS; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38728-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38728-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 1C34D1F2649C for ; Thu, 25 Jan 2024 14:34:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD1B96EB40; Thu, 25 Jan 2024 14:34:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VrhpNdaS" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) (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 0669A6E2D0; Thu, 25 Jan 2024 14:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.115 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706193267; cv=none; b=JZ9YUbgUxGe5MI9STRcHpC3R+TeQK1/weoykaWX04QWNawaACaxKk8S0Ge5ofvCsJM/rdRoe7Xy0M4rsdfP4NevmFLFgXHvrXnhCJjVjp7nUgvetH7zJCScebvT+rXUz3jzQ6cqO6P6HlHBbh961v02skTwXUvWqg1+75Mf4sIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706193267; c=relaxed/simple; bh=Vd0x1kY54QPZtj97cg5M3RjCoccZzQjOZTpbb5617AI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FAa+X+sUvKdhgwulp16miSqGoagGETelPa+XLWP/i+TxgMVHT8DQawpRDHn17mLpcPx+/hWG9x6Uxgz8VbEG5TfNF8SUDsS/5HVoLPykEZD/80LZn9D6/+XiSS5N5ZAngrN1fW1YOHSH1S+dk4vNVz97VRG99qI8BnIVpwOMTvw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VrhpNdaS; arc=none smtp.client-ip=192.55.52.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706193266; x=1737729266; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Vd0x1kY54QPZtj97cg5M3RjCoccZzQjOZTpbb5617AI=; b=VrhpNdaSorJ8OHKvOJVZajF8hNHN/HM/2UDqEcSYEp7FsnaznTDXiFEG Pqk5rFV2k3m52g8pq2Pgu6e2fC+MIiTgc/jg6cOecJCIdlBAK53BPJUyy NzMBEwX2InpxHwlVTQV8ygLxMwoPoIcDqGZAf8dvjSPmf5l0WPuQLdiHb R0U6aLLW3DKl0dCaGXxB0bIDkEWOvYhdhVRQ9T+GhqDHw8BVoVcgprVuv 9xgXYs1D+Cc6bOnq9HREwdkLepr/dLvcitNVd/TsxT2LEbXMuuPSRlIWl EYnLdlFU5/hVQFUwT6Xu8v9wIWHSUwcspgMngyPEJOWEvheYQbi04s/zs A==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="401827557" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="401827557" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 06:34:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="2438122" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orviesa004.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 06:34:08 -0800 Date: Thu, 25 Jan 2024 06:35:33 -0800 From: Ricardo Neri To: Sudeep Holla Cc: x86@kernel.org, Andreas Herrmann , Catalin Marinas , Chen Yu , Len Brown , Radu Rendec , Pierre Gondois , Pu Wen , "Rafael J. Wysocki" , Srinivas Pandruvada , Will Deacon , Zhang Rui , Huang Ying , "Ravi V. Shankar" , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 1/4] cacheinfo: Check for null last-level cache info Message-ID: <20240125143533.GA16226@ranerica-svr.sc.intel.com> References: <20231212222519.12834-1-ricardo.neri-calderon@linux.intel.com> <20231212222519.12834-2-ricardo.neri-calderon@linux.intel.com> <20240125111544.xhiomitgeazxm7cw@bogus> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240125111544.xhiomitgeazxm7cw@bogus> User-Agent: Mutt/1.9.4 (2018-02-28) On Thu, Jan 25, 2024 at 11:15:44AM +0000, Sudeep Holla wrote: > On Tue, Dec 12, 2023 at 02:25:16PM -0800, Ricardo Neri wrote: > > Before determining the validity of the last-level cache info, ensure that > > it has been allocated. Simply checking for non-zero cache_leaves() is not > > sufficient, as some architectures (e.g., Intel processors) have non-zero > > cache_leaves() before allocation. > > > > Dereferencing NULL cacheinfo can occur in update_per_cpu_data_slice_size(). > > This function iterates over all online CPUs. However, a CPU may have come > > online recently, but its cacheinfo may not have been allocated yet. > > > > Cc: Andreas Herrmann > > Cc: Catalin Marinas > > Cc: Chen Yu > > Cc: Huang Ying > > Cc: Len Brown > > Cc: Radu Rendec > > Cc: Pierre Gondois > > Cc: Pu Wen > > Cc: "Rafael J. Wysocki" > > Cc: Sudeep Holla > > If you respin, you can address the below minor nit. I am fine as is as > well. > > Reviewed-by: Sudeep Holla Thank you for your review Sudeep! > > [...] > > > diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c > > index f1e79263fe61..967c5cf3fb1d 100644 > > --- a/drivers/base/cacheinfo.c > > +++ b/drivers/base/cacheinfo.c > > @@ -61,6 +61,9 @@ bool last_level_cache_is_valid(unsigned int cpu) > > if (!cache_leaves(cpu)) > > return false; > > > > + if (!per_cpu_cacheinfo(cpu)) > > + return false; > > + > > [nit] You can even combine this with above if condition. Sure, I can take care of this if a new version is needed as per feedback from the x86 maintainers.