Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4967517rwb; Mon, 31 Jul 2023 15:46:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlGOQAg+HLFRdfQjen3NI76i/6uXj8+OnRyvkpcVFf1fA4WEV2AaBiE/erAIAHBtQevkV4Pb X-Received: by 2002:a17:907:a062:b0:99b:5574:7d0f with SMTP id ia2-20020a170907a06200b0099b55747d0fmr801169ejc.23.1690843610728; Mon, 31 Jul 2023 15:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690843610; cv=none; d=google.com; s=arc-20160816; b=kVW6+MI9W4vsG/zIr3CcP4npqfO+grXWORBg6jSpCspdEenb8Deqhs7S4S0qjSw4gv MssycBt6TqjPOyQdxxRtZpk0zOyu/GVvGIGLkE48XRC6np9CQhLS6opZl9/N0n4s7hCR FH5rFaW3qBPlazcV9NsGitBxfxNLkM78oquvg6X/aVINIVpvkTtHT5XgqGDCgyTw7Fm9 yk5c2H7OjNoIYikH1XSW5vXv+meOq9TYwtwIWuf53L9E+usDIGrPVlj0IcGkvw/OD0sQ oBmZ86Yp8gBe6sMznLouwyw1Ito/hJsvVROmhHTfZ4xQ5tkGENEjIld7KWhh6PbtExrQ w6yg== 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=a57aOMuoSA19D/1RvYx/fw5xehQ8MOOaj2fZT0pRM38=; fh=tqsBilkV3CQQNngZMP5W2waSif8nZ0btjksvzhDdTw0=; b=Yrei929z6VGOSvPvuYQOndms0u3oGn3llFDtYjUEkEs0PTvh5y3WDf9Og+eeAPYD/K 1bghO2QqD/q4/mWBh4RLSJ+18SEI09Q7aszlsOWhlc4wD5FXWxlCRI1snfRgva8RhUTg aymhpUv29B15nScJ1hVTaQMgc9rgREqBXVrC+xWYhueB5KavvmdUjFXr8juxOdWrh2E+ zRypx3EChTyE1WRvRW9dtRUYs1h1yK14mCaKNWT8d0jUn71HAYbEGbx2m176Cn5gm+/y SKMyBysE5jYvf56pY3BO8bimoPPnggKPY1VrZF1ZOfb8a6a9ZIJtLbPAtytnn0TjNTB6 8wXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=tIHZwtSe; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=PwhvK953; 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 a26-20020a1709065f9a00b0099bc8c11d20si4467865eju.248.2023.07.31.15.46.26; Mon, 31 Jul 2023 15:46:50 -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=tIHZwtSe; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=PwhvK953; 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 S231828AbjGaWNA (ORCPT + 99 others); Mon, 31 Jul 2023 18:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjGaWM6 (ORCPT ); Mon, 31 Jul 2023 18:12:58 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8917A1736; Mon, 31 Jul 2023 15:12:40 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690841558; 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=a57aOMuoSA19D/1RvYx/fw5xehQ8MOOaj2fZT0pRM38=; b=tIHZwtSe8XcItSxrCKH1rtoRXOwh0yJltki1mAAGk5sPAAngNaQrtnH15IChhzx95Y6X+R erTZcajrnzm9SYBONwTyQ7lg9CbgE7DEf49e3IOiI8HYOTdb6uaATjJm6+8kH6rCyzXWYR vtihuwjxMCxVWC+yOWM6PPKWnasG/Fp/C8XtbzFDR0sd07snVt6s+WZSjhrbi125K0FUtz SObnnoXe2BEnxK2Jsk6OPvaKTTukAKovj+C2krtUnq3T4xFW+ojQDM5fdJCAFCcSpO6Vj0 6tSwdLg30F7qXDmtQCnJYsrdWbM52jLaq604iaZhbpUcIkDq/r7EMWBMJmTfXg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690841558; 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=a57aOMuoSA19D/1RvYx/fw5xehQ8MOOaj2fZT0pRM38=; b=PwhvK953X/fbo78hs5vJj2d2ph4pIv5b8KCDD6zDX2WmFCGBgaBDweVd1jE8Yje+chDEtL qIkhD97LkwjYq4BA== To: "Michael Kelley (LINUX)" , Peter Zijlstra Cc: LKML , "x86@kernel.org" , Tom Lendacky , Andrew Cooper , Arjan van de Ven , "James E.J. Bottomley" , Dick Kennedy , James Smart , "Martin K. Petersen" , "linux-scsi@vger.kernel.org" , Guenter Roeck , "linux-hwmon@vger.kernel.org" , Jean Delvare , Huang Rui , Juergen Gross , Steve Wahl , Mike Travis , Dimitri Sivanich , Russ Anderson Subject: RE: [patch v2 21/38] x86/cpu: Provide cpu_init/parse_topology() In-Reply-To: References: <20230728105650.565799744@linutronix.de> <20230728120930.839913695@linutronix.de> <871qgop8dc.ffs@tglx> <20230731132714.GH29590@hirez.programming.kicks-ass.net> <87sf94nlaq.ffs@tglx> <87fs53n6xd.ffs@tglx> Date: Tue, 01 Aug 2023 00:12:37 +0200 Message-ID: <873513n31m.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Mon, Jul 31 2023 at 21:27, Michael Kelley wrote: > From: Thomas Gleixner Sent: Monday, July 31, 2023 1:49 PM >> Is there any indication in some other CPUID leaf which lets us deduce this >> wreckage? > > You can detect being a Hyper-V guest with leaf 0x40000000. See Linux > kernel function ms_hyperv_platform(). But I'm not aware of anything > to indicate that a specific Hyper-V VM has the APIC numbering problem > vs. doesn't have the problem. That's what I said :) here: >> I don't think the hypervisor space (0x40000xx) has anything helpful, but >> staring at the architectural ones provided by hyper-V to the guest might >> give us an hint. Can you provide a cpuid dump for the boot CPU please? >> > > I'm not sure if you want the raw or decoded output. Here's both. Either way is fine. Clearly the hyper-v BIOS people put a lot of thoughts into this: > x2APIC features / processor topology (0xb): > extended APIC ID = 0 > --- level 0 --- > level number = 0x0 (0) > level type = thread (1) > bit width of level = 0x1 (1) > number of logical processors at level = 0x2 (2) > --- level 1 --- > level number = 0x1 (1) > level type = core (2) > bit width of level = 0x6 (6) > number of logical processors at level = 0x40 (64) FAIL: ^^^^^ While that field is not meant for topology evaluation it is at least expected to tell the actual number of logical processors at that level which are actually available. The CPUID APIC ID aka initial_apicid clearly tells that the topology has 36 logical CPUs in package 0 and 36 in package 1 according to your table. On real hardware this looks like this: --- level 1 --- level number = 0x1 (1) level type = core (2) bit width of level = 0x6 (6) number of logical processors at level = 0x38 (56) Which corresponds to reality and is consistent. But sure, consistency is overrated. Thanks, tglx