Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3327173rwo; Fri, 4 Aug 2023 03:11:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzUn7rcojssxAh86NUWDtbuj7M3n+WVXjNyYAcl9AUUO7LNyVsS456q9xEo8N6yfQwiMcD X-Received: by 2002:a05:6a20:96ce:b0:12d:4c17:bb2d with SMTP id hq14-20020a056a2096ce00b0012d4c17bb2dmr867783pzc.26.1691143908628; Fri, 04 Aug 2023 03:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691143908; cv=none; d=google.com; s=arc-20160816; b=pAf5EQuG0U5RKsi5/QajWHU9qdhuPPFtUIuCIEIOv066Diw5vZZeKN7AGMzSrALXG+ Urwg94HKC/cG50QwnXoZ/9K0vdqQv8Cw7lMR7ApEkyTiq/pilD0jJWLAv1lU1uRcgavo JYpks2MIirI2M11o2fXfqklCXYON6PRIC4EtJnkHHdjRdeYRi34hbawLQzIfXG+kV7mn XSicUJBPSIurJq5bymUCiIOvfaKY8qJY9DYSlA4qDvU83HXsFRPg4hYO+Z4+2JSCHACp D5mYlHFYFeqCxl0arplrCRkKQE1KTlJ1O+PwlUAwMe11+j5M7/pe0BRrBwW+8TXhTZMz cprQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=nG9NMi09qPiIVhfxyVq6fbFzAi3GlRiV5e3SNDBnopg=; fh=DPPRtEtjueKfiXBU/ec0n6oSshZK6yx3J788sVLccoU=; b=jl8EEcfxbcRXiukK7okNES59uxxxvKGPEvq1L4APhwZecYqoXLDgwLEj5c83TNlHcS HpkKJdFMON1LE3FMpL3A4oDJNR0GeLBuR91SyYV0iussZ3nqE2ERAoI+9aBUyYIjJgiy z428PF7MbfXtMvOvcMDDtiA9iIuKDh25RZNXc7o+8Rfs5ieP5YjXhngMIh8CFkIeFllm WjJwmh9BMcUdLutTvlGKLK9pYvCWAS4lNa8bDwjWBjr6HKR4l67OKHbKccz8Rti9pde9 2tRR6Ebzm9Wrh3b9N8UgQ4ils7Whgve4k2YlD/XtSpFfmY0PBAhMlx5cz7fZsxgyNlWc Obyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rerbYvlR; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m2-20020a632602000000b005649f303b60si1540245pgm.279.2023.08.04.03.11.36; Fri, 04 Aug 2023 03:11:48 -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=@linutronix.de header.s=2020 header.b=rerbYvlR; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234675AbjHDI3S (ORCPT + 99 others); Fri, 4 Aug 2023 04:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234673AbjHDI25 (ORCPT ); Fri, 4 Aug 2023 04:28:57 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 170551FCF for ; Fri, 4 Aug 2023 01:28:32 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691137711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nG9NMi09qPiIVhfxyVq6fbFzAi3GlRiV5e3SNDBnopg=; b=rerbYvlRKutJP0T8x0WBfoLxwL0joDr+jxOh/9VQrrPlG1FjmCEAlRWBoEpu++pvFFinbn sg8maeIsS1Geyr3QdGP8uyzRE2gsnwRKXfYKt3S6B/38rvug1CxwOp9MhyECvBjLW9HDzM nHqOQy57vtfY4qEPEJMA1l9vIggjumOy5xLE/0iktwYHAbPKaOv0EdpVItUtakJd65nL6T Sc+ufa+ZSMACNq4fd+GaXNq2qMww9GIqZCsWUzQEWgHfKJalWd/ymzOI8HpQWzXVU45AIT aICGEDc8rE4lUtI4YAai98o68GvXFCAFa1pyOoo1fPa+WgG1jUibncZIzgubpA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691137711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nG9NMi09qPiIVhfxyVq6fbFzAi3GlRiV5e3SNDBnopg=; b=XUmCnEdMsEoHLAVk5r5mhdmoZhZ/CI9eJwfSr3BIoUHKSOUZOS53NecZj/TBdTGysJFTds GORyTHH18R74BnBA== To: K Prateek Nayak , LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Wei Liu Subject: Re: [patch V3 23/40] x86/cpu: Provide cpu_init/parse_topology() In-Reply-To: <03ded839-a746-b741-02dd-c10fe37460bf@amd.com> References: <20230802101635.459108805@linutronix.de> <20230802101934.026097251@linutronix.de> <03ded839-a746-b741-02dd-c10fe37460bf@amd.com> Date: Fri, 04 Aug 2023 10:28:30 +0200 Message-ID: <87leer1aa9.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 On Fri, Aug 04 2023 at 13:44, K Prateek Nayak wrote: > On 8/2/2023 3:51 PM, Thomas Gleixner wrote: >> >> [..snip..] >> >> +static void topo_set_max_cores(struct topo_scan *tscan) >> +{ >> + /* >> + * Bug compatible for now. This is broken on hybrid systems: >> + * 8 cores SMT + 8 cores w/o SMT >> + * tscan.dom_ncpus[TOPO_CORE_DOMAIN] = 24; 24 / 2 = 12 !! >> + * >> + * Cannot be fixed without further topology enumeration changes. >> + */ >> + tscan->c->x86_max_cores = tscan->dom_ncpus[TOPO_CORE_DOMAIN] >> >> + x86_topo_system.dom_shifts[TOPO_SMT_DOMAIN]; >> +} >> > > In Documentation/arch/x86/topology.rst, "cpuinfo_x86.x86_max_cores" is > described as "The number of cores in a package". In which case, > shouldn't the above be: > > tscan->c->x86_max_cores = tscan->dom_ncpus[TOPO_PKG_DOMAIN] >> > x86_topo_system.dom_shifts[TOPO_SMT_DOMAIN]; > > since, with extended topology, there could be other higher domains and > dom_ncpus[TOPO_CORE_DOMAIN] >> dom_shifts[TOPO_SMT_DOMAIN] should only > give number of cores within the next domain (TOPO_MODULE_DOMAIN). You're right in principle. > Am I missing something here? The fact, that this is bug compatible. It's broken in several aspects. The real fix is in the next series, where this function goes away and actually uses real topology data to compute this. I could change this to be more "accurate" as you suggested, but that's not making much of a difference. Thanks, tglx