From nobody Fri Jan 20 03:23:54 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NylG25Bjmz30vkJ; Fri, 20 Jan 2023 03:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NylG23XJVz3p0v; Fri, 20 Jan 2023 03:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674185034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=umZBbA7wJG+G4TeQbRoml4/fw7TPt7OTvb0ltF+44Sw=; b=BDUUwrYDG6TEZ725NVi0C8ix4O8DUwgXbEE+yG/P0xfLFWE6twN2n94VU6LyOxkI1x6wb1 Lr2DZanSGuS+JuikV9rMWlDE+8AZElAq8cjW9/A/zQX0tDcU/1iL9en57oHyYYemMFUVEB xHi9frCpl0/PVz0Vj6c1A53m6oMrYR7LDyE3dTv/Je+epLluZjaopnOQmWSMpwU1sysaA3 ga3tqnip8Edu/yiA/FVpxcckXETRiD/1dZeZ4bnbhlwVlycQcYoO4yFQvXQXnm5M3UaYva y76aPdps5sbgCT7Iw/XpzvNPjBr9WwWpk/cfr8spFNBkkjA8LkI1HMz/ZEhxtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674185034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=umZBbA7wJG+G4TeQbRoml4/fw7TPt7OTvb0ltF+44Sw=; b=AfuV+i+rTQBB5PAbk6KM3hyOTX9ms2/pzfkRIBilpkb/VHl2FG+MsOo9Iouqhx4coPefdr jjjcrbbhtMaexvSFW8oLbqqhjeIexKH4q+pRR9z9Hgaz84HGaPo3tZRqZ5BWIm/+9fBK1R 3jOmmOvUiLMqI2lfqsxa0nsBlyQYynwNtAiMhylK2pwFOu0AjaMz6u9I5415jSd0K/3uta Ov+KVxIPJi9awNWVIlu/NyO5OARrbGpbAAFdt+D49x19Kb9k7wIZxc2XhrKbg0hpIZ4PUd n3P6EnoRsVfzEn2yFFytCV7Nz0nKuMf8BKsAOvHLqsy5cklgxq/uiEJ2lmwoiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674185034; a=rsa-sha256; cv=none; b=uGLa3omHcM/vG7OK0kfgTgq9Ky0Cj9YCAYz6CPYcAgN/ez8MbohQ5Vth9hAOeQ5lHfIeRr PqD6xXIDIVTH+69BpOebTr89b+q5zw15pLNx7OPKqUC37nhlrTHY+Lj7mXupJCsq/u9c0U Cs11jTdjfkmYrt5ykEmoJrN2rvd1Mti4FSb3yu4C5ZDKbV8Yya1D8oMZW5dfIZEJzcYYXP Wqca4Qhh2vNhyHs4JFA+wWWC54pNFTZ1Mh9r7rzB9xMQyQEX9haAFxUJN0UP00SaiQosgc GSBL5B5uCuf1Qc2Luz5egXcaVMipY62aAlMCExRb4hcXBBJPgTvShNhYovlOzA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NylG22LprzGDS; Fri, 20 Jan 2023 03:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30K3NsV5042796; Fri, 20 Jan 2023 03:23:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30K3NspS042795; Fri, 20 Jan 2023 03:23:54 GMT (envelope-from git) Date: Fri, 20 Jan 2023 03:23:54 GMT Message-Id: <202301200323.30K3NspS042795@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: eb2e82b9ca8e - stable/13 - amd64: identify small cores List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eb2e82b9ca8e39c0c2045b19cf93489063d57beb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eb2e82b9ca8e39c0c2045b19cf93489063d57beb commit eb2e82b9ca8e39c0c2045b19cf93489063d57beb Author: Konstantin Belousov AuthorDate: 2022-12-21 11:04:14 +0000 Commit: Konstantin Belousov CommitDate: 2023-01-20 03:21:52 +0000 amd64: identify small cores Tested by: pho (cherry picked from commit 45ac7755a7c5d8508176b3d015bb27ff58485c80) --- sys/amd64/amd64/initcpu.c | 9 +++++++++ sys/amd64/include/pcpu.h | 3 ++- sys/x86/include/specialreg.h | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index 1a251208cfd6..1b731821889e 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -255,6 +255,7 @@ initializecpu(void) { uint64_t msr; uint32_t cr4; + u_int r[4]; cr4 = rcr4(); if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) { @@ -317,6 +318,14 @@ initializecpu(void) if ((amd_feature & AMDID_RDTSCP) != 0 || (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0) wrmsr(MSR_TSC_AUX, cpu_auxmsr()); + + if (cpu_high >= 0x1a) { + cpuid_count(0x1a, 0, r); + if ((r[0] & CPUID_HYBRID_CORE_MASK) == + CPUID_HYBRID_SMALL_CORE) { + PCPU_SET(small_core, 1); + } + } } void diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h index 6326fbdae0be..c0b8ee456f25 100644 --- a/sys/amd64/include/pcpu.h +++ b/sys/amd64/include/pcpu.h @@ -99,7 +99,8 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); uint32_t pc_smp_tlb_gen; \ u_int pc_smp_tlb_op; \ uint64_t pc_ucr3_load_mask; \ - char __pad[2916] /* pad to UMA_PCPU_ALLOC_SIZE */ + u_int pc_small_core; \ + char __pad[2912] /* pad to UMA_PCPU_ALLOC_SIZE */ #define PC_DBREG_CMD_NONE 0 #define PC_DBREG_CMD_LOAD 1 diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h index ddac2b9ea2b2..bc3fd2e563a1 100644 --- a/sys/x86/include/specialreg.h +++ b/sys/x86/include/specialreg.h @@ -490,6 +490,11 @@ #define CPUID_STDEXT3_CORE_CAP 0x40000000 #define CPUID_STDEXT3_SSBD 0x80000000 +/* CPUID_HYBRID_ID leaf 0x1a */ +#define CPUID_HYBRID_CORE_MASK 0xff000000 +#define CPUID_HYBRID_SMALL_CORE 0x20000000 +#define CPUID_HYBRID_LARGE_CORE 0x40000000 + /* MSR IA32_ARCH_CAP(ABILITIES) bits */ #define IA32_ARCH_CAP_RDCL_NO 0x00000001 #define IA32_ARCH_CAP_IBRS_ALL 0x00000002