From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7E8767803E0 for ; Mon, 13 Nov 2023 11:31:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MkKKbhNmnebGYyHncS2SHvfJlKUKg+6nTwK/lK1EFc0=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1699875111; v=1; b=cyIXbX7JYHGJvGRB0WZmtJRaD6PaBOaWAF26wrXVrP2sWsZFgFkdytoyNrkRq+AlZXQBoARb MuWtTyaPgRHB1ZBX/2clY3wxVVzpLZoR8sDivMep1ExKI0DnWqbhKWSvw6SAfEsM8+llqZ5PD6K BUW2A05wj0hSWwc7PN8qrnEM= X-Received: by 127.0.0.2 with SMTP id gqS4YY7687511xDVdUGAZQxz; Mon, 13 Nov 2023 03:31:51 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.34769.1699875110450364342 for ; Mon, 13 Nov 2023 03:31:50 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-266-Ge1GQCDTNl2PL6isSUqQaw-1; Mon, 13 Nov 2023 06:31:46 -0500 X-MC-Unique: Ge1GQCDTNl2PL6isSUqQaw-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 23A49811E82; Mon, 13 Nov 2023 11:31:46 +0000 (UTC) X-Received: from [10.39.192.220] (unknown [10.39.192.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3351492BE0; Mon, 13 Nov 2023 11:31:44 +0000 (UTC) Message-ID: Date: Mon, 13 Nov 2023 12:31:43 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Use processor extended information To: devel@edk2.groups.io, jiaxin.wu@intel.com Cc: "Dong, Eric" , "Ni, Ray" , "Kumar, Rahul R" , Gerd Hoffmann , "Zeng, Star" References: <20231107024311.14424-1-jiaxin.wu@intel.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: AUGay6cibop1oldrAC6rAC6kx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=cyIXbX7J; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 11/8/23 05:11, Wu, Jiaxin wrote: > Hi Laszlo, >=20 >>> >>> The patch looks OK to me, but: >>> >>> - I would like to test it with CPU hotplug (later, likely under v2), an= d >>> >=20 > Sure, I can wait the update from you. >=20 >>> - I think this should be two patches. >>> >>> First, the SmmAddProcessor() function should be extended just to >>> complete commit 1fadd18d. (BTW I highly appreciate the reference to >>> commit 1fadd18d; otherwise I couldn't find where the *coldplugged* CPUs= ' >>> locations were retrieved!) >>> >>> Then the Package calculations should be updated separately -- mostly >>> because I would appreciate a concrete description in that separate >>> commit message why the difference matters. Clearly you have a use case >>> where the v1 and v2 package numbers differ, and recording that in the >>> commit history would be great. >=20 > Sure, let me explain more, there are 2 reason I did this change: >=20 > 1. the processor package ID retrieved from CPUID 0x0Bh may be not correct= /accurate if CPU has the module & die info, it depends on the CPUID impleme= ntation. See SDM statement: >=20 > EAX Bits 04 - 00: Number of bits to shift right on x2APIC ID to get a uni= que topology ID of the *next level type* > ECX Bits 15 - 08: *Level type* > Level type field has the following encoding: > 0: Invalid. > 1: SMT. > 2: Core. > 3-255: Reserved >=20 > So, if level type returned from ECX Bits 15 - 08 is 2 (Core), then what'= s the next level mean? Module or Die or Package? SDM doesn't has explanatio= n for the next level of Core. If so, the value will be decided by implement= ation.=20 > The value can be package info for compatibility consideration, but it's n= ot standardized. That's the reason we suggest use the leaf 1Fh. > =20 > 2. And according SDM declaration, "CPUID leaf 1FH is a preferred superset= to leaf 0BH. Intel recommends first checking for the existence of CPUID le= af 1FH before using leaf 0BH." > This is perfect match the existing GetProcessorLocation2ByApicId() implem= entation.=20 >=20 > That's the main reasons we switch to EFI_CPU_PHYSICAL_LOCATION2. >=20 >> >> Side note, just for completeness: the x2apic lib instance performs the >> v2 feature detection correctly since Gerd's commit 170d4ce8e90a >> ("UefiCpuPkg/BaseXApicX2ApicLib: fix CPUID_V2_EXTENDED_TOPOLOGY >> detection", 2023-10-25). Furthermore, OVMF uses the x2apic lib instance >> since commit decb365b0016 ("OvmfPkg: select LocalApicLib instance with >> x2apic support", 2015-11-30). Therefore, this patch looks fine for OVMF. >> >> However, for platforms that use the old xapic lib instance, there could >> be problems, as the v2 feature detection in *that* instance is not fixed >> -- it does not check EBX. >> >=20 > Great catch this! I can create the patch 3 for this porting to old xapic = lib instance if you no objection. Sure, sounds good, although I have no way of testing that. Laszlo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111144): https://edk2.groups.io/g/devel/message/111144 Mute This Topic: https://groups.io/mt/102436095/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-