Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp57920rwb; Wed, 17 Aug 2022 22:45:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR50uFLTt/03DRfAxM7P95pBncPHy6r4JHFlWQVSCidjM5Cvyfu+CLwB1KaEbE4MietSl76x X-Received: by 2002:a17:906:3bd2:b0:731:3f03:1697 with SMTP id v18-20020a1709063bd200b007313f031697mr883424ejf.289.1660801499933; Wed, 17 Aug 2022 22:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660801499; cv=none; d=google.com; s=arc-20160816; b=W8qZ4+fxLY2HNcSQn+1FE98zg41hiK3FlnkrXIh0S+ZgiCw8wp7BNCygpJDPYRyYuU c8KOsExvtCRvyNxi82kgI0amp7t9CZn8a5UPqc4vVHrX8GqH3mGCVN+KgnGVqXGmpu+G 5+59KrEtATbYkuzYXlaWhsDCCwtOP+NcJbib035zIohtTXwTqxwk/r5B6asCdTnYMlSa wVbWpRj+32T5RL3/5gxR+UFvv14Qlv80BffwRaAyP/6dvn5dMgggG+JrJvnXjrmBldOs 2RcnBEMO3bOlAY5/DeK7OSaAC1INCVjoJnuf/5nvniGdqvnjZ8gUiJ1w8ZaBQHpZmKds RfnA== 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:dkim-filter; bh=19gsCUzsN5HOJUS1vhGJZKzrpOTtBM64G0vkIVanNwY=; b=R5WW9Idy45m22UV+R4G/alygwSFDte19XoMZKQA0kMANEtWuoxpgyy5FBuNHgwlHJ3 bMywoKKMeiO/TytOSM6VbYB/K00hgy0B2JtOpF1Dzaac/QHIH3KWxc3i5W42ldyeM5C4 bhp6Fhi6Lqf/tjHuP5B72ol1wXwjQuKwSVJ/p4sJFUHRPaHLLnCfXJu09jZP0YmI5TiF mXAFgXA9C2vi9/S2YsYLASb4FER8F52frhY6emq9x/3YcAqA3RtNO2moV9D6h9dE8+31 SCHIoEUddNlNYfT72Yq/Lljk3TK9H4pozOZjhZ/LyeYzg9SxsCjqycX14A3YzFrwwdpa LjKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=D7hGhdbC; 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=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt44-20020a1709072dac00b007317756bbffsi477095ejc.779.2022.08.17.22.44.33; Wed, 17 Aug 2022 22:44:59 -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=@linux.microsoft.com header.s=default header.b=D7hGhdbC; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239415AbiHREw2 (ORCPT + 99 others); Thu, 18 Aug 2022 00:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233628AbiHREw0 (ORCPT ); Thu, 18 Aug 2022 00:52:26 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AA4458A1FF for ; Wed, 17 Aug 2022 21:52:25 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1127) id 54C70213B620; Wed, 17 Aug 2022 21:52:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 54C70213B620 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1660798345; bh=19gsCUzsN5HOJUS1vhGJZKzrpOTtBM64G0vkIVanNwY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D7hGhdbCGwb3+Ao6l2vPGpUN3m7NEnIYTweIZnqRCnOUFpLAI8NcM56nZRDBGq1eh I9HnEaUju08Ccwa3Yxh1e2RytwycZxpkxIy74Vf388WfLvNymN3tZu8HCuEXciXQ3z N3vNqJUnFrRpTFEUY7xusrxY+Eo2a4GWkorwjfNU= Date: Wed, 17 Aug 2022 21:52:25 -0700 From: Saurabh Singh Sengar To: Borislav Petkov Cc: ssengar@microsoft.com, mikelley@microsoft.com, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, peterz@infradead.org, tim.c.chen@linux.intel.com, will@kernel.org, song.bao.hua@hisilicon.com, suravee.suthikulpanit@amd.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/cacheinfo: Don't use cpu_llc_shared_map for !CONFIG_SMP Message-ID: <20220818045225.GA9054@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1660148115-302-1-git-send-email-ssengar@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham 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 Thanks for review, please find my comments inline. On Wed, Aug 17, 2022 at 09:40:29PM +0200, Borislav Petkov wrote: > On Wed, Aug 10, 2022 at 09:15:15AM -0700, Saurabh Sengar wrote: > > cpu_llc_shared_map is always declared and defined, but populated in > > arch/x86/kernel/smpboot.c which only builds for CONFIG_SMP=y. For > > UniProcessor builds this mask is never populated and hence invalid. > > Current code doesn't handle the case of AMD UniProcessor correctly, > > What is "AMD UniProcessor"? Shall I mention here "Non-SMP AMD processor" instead ? > > > which results "shared_cpu_map" and "shared_cpu_list" files missing from > > sysfs entries for l3 cache. This patch fixes this issue. > > What issue exactly? > > What is the real life use case for this? We observed that lscpu version 2.34 was causing segfault with latest kernel, which motivate us to debug this issue. Root cause being shared_cpu_map file missing. There could be more usecases where this file is getting queried for L3 cache information but at the moment I am aware of only lscpu. Do we need to add this info in commit. > > > This code used to work because of a another bug in 'cpumask_next', > > where in the CONFIG_SMP=n case the cpumask_next() ignores empty mask > > that results as if CPU 0 was set. This bug in 'cpumask_next' was fixed by > > following commit, which exposes the cpu_llc_shared_map bug. > > > > b81dce77ced ("cpumask: Fix invalid uniprocessor mask assumption") > > > > Fixes: 2b83809a5e ("x86/cpu/amd: Derive L3 shared_cpu_map from cpu_llc_shared_mask") > > Add > > --- > [core] > abbrev = 12 > > [alias] > one = show -s --pretty='format:%h (\"%s\")' > --- > > to your git .config so that when you do > > $ git one > > you can get the proper formatting and abbreviated sha1 for commits. Thanks for suggestion, will fix this in V2. > > Thx. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette