Ryzen 7000 Testing

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
I do not think so
results you have reached in few months for AM5 platform (but also with MSI problem ) are a gold medal for you

this problem we have now is a bit complex and it is not related to only Goldfish64 broken patch
I am confident in a solution but I hope also you do not give up with your scientific (and overall public and well detailed) testing way! ;)
I can try the following:
  • Attempt once again to get serial debug logs in Ventura
    • I hope there’s enough or useful output in the log
  • Wait for Apple to post kernel source code for 13.3, but this may not happen until 13.3 is released or nearly released
Have to attend a work-related event all day today (Sunday)…
 

mariettosun

Well-known member
AMD OS X Member
Joined
Oct 9, 2022
Messages
462
Attempt once again to get serial debug logs in Ventura
  • I hope there’s enough or useful output in the log
This is what also others involved in this task are trying to achieve
No evidence of any success

Other option is Apple get back kernel part it misses in this first beta :ROFLMAO::ROFLMAO:
 

Shaneee

The AMD Guy
Staff member
Administrator
Joined
Mar 13, 2020
Messages
2,167
@CaseySJ Forgot you had serial. Can you replace the Goldfish patch with the one I've attached and try boot the update and get a serial output please. DhinakG isn't available to run a serial output to narrow down the issue for us.
 

Attachments

  • patch_goldfish_updated.plist
    1 KB · Views: 4

ovenlite1

Active member
AMD OS X Member
Joined
Jun 22, 2020
Messages
106
Has been a while since I've been around here! The beginning of the year and the start of some new work projects have kept me away, but I'm glad to see more progress. Especially happy to see the patch for internal thunderbolt and wifi- I had been having some issues with wifi but hadn't made any connections as to what might be causing the problem. Just applied the patch and I'm hoping this will be the solution! So far so good! Appreciate the continued work being done here.
 

ovenlite1

Active member
AMD OS X Member
Joined
Jun 22, 2020
Messages
106
While I'm around... anyone have any good solutions for RGB control in MacOS on AM5 Ryzen 7000 based systems? Not trying to do anything fancy, just set to a single static color. In windows, I already hate basically all manufacturer's RGB control software and settled on OpenRGB opening on startup to change all lights to white. Unfortunately, the intel Mac version of OpenRGB doesn't seem to recognize any devices on my system.. Anyone else have any luck or experience in this area? I realize this is probably the lowest on the priority list of getting things working ha.

1677441244922.png
 

Shaneee

The AMD Guy
Staff member
Administrator
Joined
Mar 13, 2020
Messages
2,167
While I'm around... anyone have any good solutions for RGB control in MacOS on AM5 Ryzen 7000 based systems? Not trying to do anything fancy, just set to a single static color. In windows, I already hate basically all manufacturer's RGB control software and settled on OpenRGB opening on startup to change all lights to white. Unfortunately, the intel Mac version of OpenRGB doesn't seem to recognize any devices on my system.. Anyone else have any luck or experience in this area? I realize this is probably the lowest on the priority list of getting things working ha.

Liquidctl. Install it via brew the make a sh script with the settings to want for your RGB and have it run at startup. That's the setup I have.

 

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
@CaseySJ Forgot you had serial. Can you replace the Goldfish patch with the one I've attached and try boot the update and get a serial output please. DhinakG isn't available to run a serial output to narrow down the issue for us.
Certainly.

Currently attending a work-related event, but will get to this as soon as I can. Had some trouble yesterday with serial debug from Ventura, but it could have been a configuration issue with RS232 parameters. Will try again.
 

z-plane

New member
AMD OS X Member
Joined
Feb 26, 2021
Messages
20
Is there any indication if the iGPU on the Ryzen 7950X & 7950X3D will ever be functional to drive a 4k display for ITX boards without dedicated video card?

Radeon RX 5000 is RDNA2 graphics which is on the 7950X AFAIK so is it wishful hoping that the iGPU will have some possibility to work in future???

Intel side for iGPU only ended at 10th gen so stuck with PCIe 3.0 and old USB 3.x
 

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
Is there any indication if the iGPU on the Ryzen 7950X & 7950X3D will ever be functional to drive a 4k display for ITX boards without dedicated video card?

Radeon RX 5000 is RDNA2 graphics which is on the 7950X AFAIK so is it wishful hoping that the iGPU will have some possibility to work in future???

Intel side for iGPU only ended at 10th gen so stuck with PCIe 3.0 and old USB 3.x
There are actually some people working on this, in a project called WhateverRed. There's no release timeframe and no available builds at this time. But the GitHub page is here:
 

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
While I'm around... anyone have any good solutions for RGB control in MacOS on AM5 Ryzen 7000 based systems? Not trying to do anything fancy, just set to a single static color. In windows, I already hate basically all manufacturer's RGB control software and settled on OpenRGB opening on startup to change all lights to white. Unfortunately, the intel Mac version of OpenRGB doesn't seem to recognize any devices on my system.. Anyone else have any luck or experience in this area? I realize this is probably the lowest on the priority list of getting things working ha.

View attachment 9825
Here's a post earlier in this thread of configuring static colors with liquidctl. We can configure dynamic modes as well. It supports a lot of devices, but in the motherboard category it supports Asus Aura LED and Gigabyte RGB Fusion.
 
Last edited:

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843

mariettosun

Well-known member
AMD OS X Member
Joined
Oct 9, 2022
Messages
462

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
Hey man, what’s the name of the iGPU in the 7950X, obviously not Vega as you say, but something else?
It's based off RDNA 2.
 

z-plane

New member
AMD OS X Member
Joined
Feb 26, 2021
Messages
20
It's based off RDNA 2.
RDNA 2 on Ryzen 7000 is mentioned to be ‘Raphael’ On TechPowerUp


so WhateverRed hoping supports Raphael RDNA 2 iGPU on Ryzen 7000.

TPU (TechPowerUp) have 7950X3D reviews up:

7800X3D review:
 
Last edited:

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
@CaseySJ Forgot you had serial. Can you replace the Goldfish patch with the one I've attached and try boot the update and get a serial output please. DhinakG isn't available to run a serial output to narrow down the issue for us.
Managed to get serial debug logs from the Ventura 13.3 installer. The new Goldfish/AlGrey patch was applied. Although the length of the log is short, hopefully there's some information here that can provide a direction for further troubleshooting.

Maybe this is the key:
/AppleInternal/Library/BuildRoots/5c29e835-a8f0-11ed-be3f-4ee8be90e9a8/Library/Caches/com.apple.xbs/Sources/xnu/osfmk/i386/cpu_threads.c: 201 Zero divisor: topoParms.nCoresSharingLLC Debugger: Unexpected kernel trap number: 0x0, RIP: 0xffffff801c9a1162, CR2: 0x0

Source file: cpu_threads.c
Line: 201

Code:
kprintf initialized

Serial mode specified: 00000003

version_variant = 0

version         = Darwin Kernel Version 22.4.0: Fri Feb 10 08:08:31 PST 2023; root:xnu-8796.100.721.505.3~4/RELEASE_X86_64

KASLR slide: 0x000000001c400000 dynamic

Hiding local relocations

WARNING: ignoring first page in [0x0:0x9f]

mem_actual: 0x800000000
 legacy sane_size: 0x7d0000000
Physical memory 32768 MB

avail_remaining = 0x7c7380

PMAP: Supervisor Mode Execute Protection enabled
PMAP: Supervisor Mode Access Protection enabled
Kernel virtual space from 0xffffff8000000000 to 0xffffffffffffefff.

Available physical space from 0x248f9000 to 0x857fff000

initialize_screen: b=F800000000, w=00000F00, h=00000870, r=00003C00, d=00000001

Darwin Kernel Version 22.4.0: Fri Feb 10 08:08:31 PST 2023; root:xnu-8796.100.721.505.3~4/RELEASE_X86_64
pmap_startup() delaying init/free of page nums > 0x200000
pmap_startup() init/release time: 16203 microsec
pmap_startup() delayed init/release of 6672874 pages
vm_page_bootstrap: 1331292 free pages, 7024548 wired pages, (up to 6672874 of which are delayed free)
VM boostrap: 73 maps, 153 entries and 128 holes available
Maximum number of VM swap files: 100
kext submap [0x<ptr> - 0x<ptr>], kernel text [0x<ptr> - 0x<ptr>]
"vm_compressor_mode" is 4
VM bootstrap done: 57 maps, 110 entries and 117 holes left
IOKit IOMD setownership ENABLED

ATM subsystem is initialized

Firehose configured: 16 chunks, 8 io pages
Log queues configured: slot count: 128, per-slot size: 32768, total size: 4194304
OSLog stream configured: stream: 8192 bytes, cache: 2112 bytes
Long logs support configured: size: 16384
Telemetry: Sampling all tasks once per 1 second

Scheduler: Default of dualq

Setting scheduler priority decay band limit 18

standard timeslicing quantum is 10000 us
standard background quantum is 2500 us
IPC_PTHREAD_PRIORITY subsystem is initialized

BANK subsystem is initialized

mig_table_max_displ = 54 mach_kobj_count = 374
Reallocated master cpu data: 0xffffff801d4a6900, interrupt stack: 0xffffff8122034000, fault stack: 0xffffff801c50c800

CPU identification: AMD Ryzen 7 7700X 8-Core Processor         

CPU features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 HTT SSE3 PCLMULQDQ MON SSSE3 FMA CX16 SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES XSAVE AVX1.0 RDRAND F16C RDWRFSGS BMI1 AVX2 SMEP BMI2 ERMS INVPCID PQM PQE AVX512F AVX512DQ RDSEED ADX SMAP AVX512IFMA CLFSOPT CLWB AVX512CD SHA AVX512BW AVX512VL AVX512VBMI UMIP PKU GFNI VAES VPCLMULQDQ AVX512VNNI AVX512BITALG AVX512VPOPCNTDQ RDPID FSREPMOV L1DF

  HTT: 1 core per package; 16 logical cpus per package

CPU extended features: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT PREFETCHW RDTSCP TSCI

Initializing EFI runtime services

MSR_IA32_APIC_BASE 0xfee00000 enabled legacy mode BSP

x2APIC supported but will not be enabled

ID: 0x0 LDR: 0x0

Boot cpu local APIC id 0x0

/AppleInternal/Library/BuildRoots/5c29e835-a8f0-11ed-be3f-4ee8be90e9a8/Library/Caches/com.apple.xbs/Sources/xnu/osfmk/i386/cpu_threads.c: 201 Zero divisor: topoParms.nCoresSharingLLCDebugger: Unexpected kernel trap number: 0x0, RIP: 0xffffff801c9a1162, CR2: 0x0

CPU 0 panic trap number 0x0, rip 0xffffff801c9a1162

cr0 0x0000000080010011 cr2 0x0000000000000000 cr3 0x00000000248d0000 cr4 0x00000000003000e0

mp_kdp_enter() can't get x86_topo_lock! Debugging anyway! #YOLO
Debugger called: <panic>

panic(cpu 0 caller 0xffffff801c9b6463): Kernel trap at 0xffffff801c9a1162, type 0=divide error, registers:
CR0: 0x0000000080010011, CR2: 0x0000000000000000, CR3: 0x00000000248d0000, CR4: 0x00000000003000e0
RAX: 0x0000000000000001, RBX: 0x0000000000000001, RCX: 0x0000000000000010, RDX: 0x0000000000000000
RSP: 0xffffff801c599e80, RBP: 0xffffff801c599ed0, RSI: 0x0000000000000000, RDI: 0x0000000000000000
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x0000000000000001, R11: 0x000000000000000a
R12: 0xffffff8000000000, R13: 0x000000000000003c, R14: 0x0000000000000000, R15: 0xffffff801d6f8100
RFL: 0x0000000000010046, RIP: 0xffffff801c9a1162, CS:  0x0000000000000008, SS:  0x0000000000000000
Fault CR2: 0x0000000000000000, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 1, VF: 0

NULL thread->t_tro pointer
Backtrace (CPU 0), panicked thread: 0xffffff801d71af28, Frame : Return Address
0xffffff801c599840 : 0xffffff801c8726ad mach_kernel : _handle_debugger_trap + 0x4ad
0xffffff801c599890 : 0xffffff801c9c6524 mach_kernel : _kdp_i386_trap + 0x114
0xffffff801c5998d0 : 0xffffff801c9b5fa9 mach_kernel : _kernel_trap + 0x3c9
0xffffff801c599930 : 0xffffff801c812951 mach_kernel : _return_from_trap + 0xc1
0xffffff801c599950 : 0xffffff801c87298d mach_kernel : _DebuggerTrapWithState + 0x5d
0xffffff801c599a40 : 0xffffff801c872037 mach_kernel : _panic_trap_to_debugger + 0x1a7
0xffffff801c599aa0 : 0xffffff801cfddbfb mach_kernel : _panic + 0x84
0xffffff801c599b90 : 0xffffff801c9b6463 mach_kernel : _sync_iss_to_iks + 0x2c3
0xffffff801c599d10 : 0xffffff801c9b6154 mach_kernel : _kernel_trap + 0x574
0xffffff801c599d70 : 0xffffff801c812951 mach_kernel : _return_from_trap + 0xc1
0xffffff801c599d90 : 0xffffff801c9a1162 mach_kernel : _cpu_thread_alloc + 0x232
0xffffff801c599ed0 : 0xffffff801c9a2469 mach_kernel : _cpu_thread_init + 0x39
0xffffff801c599ef0 : 0xffffff801c9bfbe7 mach_kernel : _smp_init + 0x37
0xffffff801c599f00 : 0xffffff801c8ac81b mach_kernel : _max_valid_stack_address + 0x95b
0xffffff801c599f80 : 0xffffff801c9bb174 mach_kernel : _machine_startup + 0xe4
0xffffff801c599fa0 : 0xffffff801c9a8d31 mach_kernel : _i386_init + 0x571
0xffffff801c599ff0 : 0xffffff801c8121b8 mach_kernel : _x86_init_wrapper + 0x8
         can't perform kext scan: no kext summaryNULL thread->t_tro pointer

Process name corresponding to current thread (0xffffff801d71af28): Unknown
Boot args: -v keepsyms=1 #rtcfx_exclude=20-3F revpatch=cpuname #wdt=-1 #ixgbe=0 e1000=0 #debug=0x100 #kcsuffix=development agdpmod=pikera debug=0x12a mmio_uart=0 serial=3 serialbaud=115200 msgbuf=1048576 io=0xff -dbgenhdbg -dbgenhiolog -no_panic_dialog -restore -log

Mac OS version:
Not yet set

Kernel version:
Darwin Kernel Version 22.4.0: Fri Feb 10 08:08:31 PST 2023; root:xnu-8796.100.721.505.3~4/RELEASE_X86_64
Kernel UUID: 68BC51AD-BF4F-3798-9550-35EA4F91E6DB
roots installed: 0
KernelCache slide: 0x000000001c400000
KernelCache base:  0xffffff801c600000
Kernel slide:      0x000000001c4dc000
Kernel text base:  0xffffff801c6dc000
__HIB  text base: 0xffffff801c500000
System shutdown begun: NO
Panic diags file unavailable, panic occurred prior to initialization
Hibernation exit count: 0

System uptime in nanoseconds: 1149713415
Warning: clock is not configured. Can't get time
Compressor Info: 0% of compressed pages limit (OK) and 0% of segments limit (OK) with 0 swapfiles and OK swap space
Zone info:
  Zone map: 0xffffff88f8edf000 - 0xffffffa8f8edf000
  . PGZ   : 0xffffff88f8edf000 - 0xffffff88fcee0000
  . VM    : 0xffffff88fcee0000 - 0xffffff8dc9213000
  . RO    : 0xffffff8dc9213000 - 0xffffff8f62879000
  . GEN0  : 0xffffff8f62879000 - 0xffffff942ebac000
  . GEN1  : 0xffffff942ebac000 - 0xffffff98faedf000
  . GEN2  : 0xffffff98faedf000 - 0xffffff9dc7212000
  . GEN3  : 0xffffff9dc7212000 - 0xffffffa293545000
  . DATA  : 0xffffffa293545000 - 0xffffffa8f8edf000
  Metadata: 0xffffff8083c0a000 - 0xffffff80a3c0a000
  Bitmaps : 0xffffff80a3c0a000 - 0xffffff80a9c0a000
  Extra   : 0 - 0

Attempting to commit panic log to NVRAM

** In Memory Panic Stackshot Succeeded ** Bytes Traced 888 (Uncompressed 992) **
Attempting to commit panic log to NVRAM

Please go to https://panic.apple.com to report this panic
 
Last edited:

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
Here's the relevant source code from Ventura 13.2:
  • Source file: cpu_threads.c
  • Line: 201
  • Location in source tree: xnu-xnu-8792.81.2/osfmk/i386/cpu_threads.c
In line 202 we see that nCoresSharingLLC is used as a divisor, which is why line 201 makes sure it isn't zero.

Line 201:
  • DIVISOR_GUARD(topoParms.nCoresSharingLLC);

Line 202:
  • topoParms.nLDiesPerPackage = cpuinfo->core_count / topoParms.nCoresSharingLLC;

Screen Shot 2023-02-28 at 5.43.39 AM.png

This is where nCoresSharingLLC is calculated (but this is from 13.2, not 13.3):

Screen Shot 2023-02-28 at 5.51.45 AM.png

The only way for nCoresSharingLLC to be zero in line 158 is if nCPUsSharing is zero. But nCPUsSharing is set to 1 by default in Line 121 and is modified in Line 143:

nCPUsSharing = cpuinfo->cache_sharing[/i];

But cache_sharing is an element of cpuinfo structure. It is set in file cupid.c, function cupid_set_cache_info (line 328).
 
Last edited:

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
I applied a quick-and-dirty kernel patch to get past the nCoresSharingLLC division-by-zero error by setting nCoresSharing to 16 for my Ryzen 7 7700X. Also added boot argument -cpuid so that processor information is logged. The resulting serial debug log is as follows:

Code:
kprintf initialized

Serial mode specified: 00000003

version_variant = 0

version         = Darwin Kernel Version 22.4.0: Fri Feb 10 08:08:31 PST 2023; root:xnu-8796.100.721.505.3~4/RELEASE_X86_64

KASLR slide: 0x0000000015a00000 dynamic

Hiding local relocations

WARNING: ignoring first page in [0x0:0x9f]

mem_actual: 0x800000000
 legacy sane_size: 0x7d0000000
Physical memory 32768 MB

avail_remaining = 0x7c7380

PMAP: Supervisor Mode Execute Protection enabled
PMAP: Supervisor Mode Access Protection enabled
Kernel virtual space from 0xffffff8000000000 to 0xffffffffffffefff.

Available physical space from 0x1deef000 to 0x857fff000

initialize_screen: b=F800000000, w=00000F00, h=00000870, r=00003C00, d=00000001

Darwin Kernel Version 22.4.0: Fri Feb 10 08:08:31 PST 2023; root:xnu-8796.100.721.505.3~4/RELEASE_X86_64
pmap_startup() delaying init/free of page nums > 0x200000
pmap_startup() init/release time: 16527 microsec
pmap_startup() delayed init/release of 6645728 pages
vm_page_bootstrap: 1358438 free pages, 6997402 wired pages, (up to 6645728 of which are delayed free)
VM boostrap: 73 maps, 153 entries and 128 holes available
Maximum number of VM swap files: 100
kext submap [0x<ptr> - 0x<ptr>], kernel text [0x<ptr> - 0x<ptr>]
"vm_compressor_mode" is 4
VM bootstrap done: 57 maps, 110 entries and 117 holes left
IOKit IOMD setownership ENABLED

ATM subsystem is initialized

Firehose configured: 16 chunks, 8 io pages
Log queues configured: slot count: 128, per-slot size: 32768, total size: 4194304
OSLog stream configured: stream: 8192 bytes, cache: 2112 bytes
Long logs support configured: size: 16384
Telemetry: Sampling all tasks once per 1 second

Scheduler: Default of dualq

Setting scheduler priority decay band limit 18

standard timeslicing quantum is 10000 us
standard background quantum is 2500 us
IPC_PTHREAD_PRIORITY subsystem is initialized

BANK subsystem is initialized

mig_table_max_displ = 54 mach_kobj_count = 374
Reallocated master cpu data: 0xffffff8016aa6900, interrupt stack: 0xffffffc05d974000, fault stack: 0xffffff8015b0c800

CPU identification: AMD Ryzen 7 7700X 8-Core Processor             

CPU features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 HTT SSE3 PCLMULQDQ MON SSSE3 FMA CX16 SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES XSAVE AVX1.0 RDRAND F16C RDWRFSGS BMI1 AVX2 SMEP BMI2 ERMS INVPCID PQM PQE AVX512F AVX512DQ RDSEED ADX SMAP AVX512IFMA CLFSOPT CLWB AVX512CD SHA AVX512BW AVX512VL AVX512VBMI UMIP PKU GFNI VAES VPCLMULQDQ AVX512VNNI AVX512BITALG AVX512VPOPCNTDQ RDPID FSREPMOV L1DF

  HTT: 1 core per package; 16 logical cpus per package

CPU extended features: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT PREFETCHW RDTSCP TSCI

Initializing EFI runtime services

MSR_IA32_APIC_BASE 0xfee00000 enabled legacy mode BSP

x2APIC supported but will not be enabled

ID: 0x0 LDR: 0x0

Boot cpu local APIC id 0x0

AVX512 supported and enabled

cpuid_fn(0x00000007) eax:0x00000001 ebx:0xf1bf97a9 ecx:0x00405fce edx:0x10000010

cpuid_set_generic_info(0xffffff8016cf8100)

cpuid_fn(0x00000000) eax:0x00000010 ebx:0x68747541 ecx:0x444d4163 edx:0x69746e65

cpuid_fn(0x80000000) eax:0x80000028 ebx:0x68747541 ecx:0x444d4163 edx:0x69746e65

cpuid_fn(0x80000002) eax:0x20444d41 ebx:0x657a7952 ecx:0x2037206e edx:0x30303737

cpuid_fn(0x80000003) eax:0x2d382058 ebx:0x65726f43 ecx:0x6f725020 edx:0x73736563

cpuid_fn(0x80000004) eax:0x2020726f ebx:0x20202020 ecx:0x20202020 edx:0x00202020

cpuid_fn(0x80000006) eax:0x5c002200 ebx:0x6c004200 ecx:0x04006140 edx:0x01009140

cpuid_fn(0x80000008) eax:0x00003030 ebx:0x191ef257 ecx:0x0000400f edx:0x00010000

cpuid_fn(0x00000001) eax:0x00a60f12 ebx:0x00100800 ecx:0x7ef8320b edx:0x178bfbff

cpuid_fn(0x80000001) eax:0x00a60f12 ebx:0x00000000 ecx:0x75c237ff edx:0x2fd3fbff

 max_basic           : 16

 max_ext             : 0x80000028

 vendor              : AuthenticAMD

 brand_string        : AMD Ryzen 7 7700X 8-Core Processor             

 signature           : 0x00a60f12

 stepping            : 2

 model               : 1

 family              : 25

 type                : 0

 extmodel            : 6

 extfamily           : 10

 brand               : 0

 features            : 0x7ef8320b178bfbff

 extfeatures         : 0x75c237ff2fd3fbff

 logical_per_package : 16

 microcode_version   : 0x00000000

cpuid_fn(0x80000007) eax:0x00000000 ebx:0x0000003b ecx:0x00000000 edx:0x00006799

 extfeatures         : 0x75c237ff2fd3fbff

cpuid_fn(0x00000005) eax:0x00000040 ebx:0x00000040 ecx:0x00000003 edx:0x00000011

 Monitor/Mwait Leaf:

  linesize_min : 64

  linesize_max : 64

  extensions   : 3

  sub_Cstates  : 0x00000011

cpuid_fn(0x00000006) eax:0x00000004 ebx:0x00000000 ecx:0x00000001 edx:0x00000000

 Thermal/Power Leaf:

  sensor               : 0

  dynamic_acceleration : 0

  invariant_APIC_timer : 1

  core_power_limits    : 0

  fine_grain_clock_mod : 0

  package_thermal_intr : 0

  thresholds           : 0

  ACNT_MCNT            : 1

  ACNT2                : 0

  energy_policy        : 0

cpuid_fn(0x0000000a) eax:0x00000000 ebx:0x00000000 ecx:0x00000000 edx:0x00000000

 Architectural Performance Monitoring Leaf:

  version       : 0

  number        : 0

  width         : 0

  events_number : 0

  events        : 0

  fixed_number  : 0

  fixed_width   : 0

 XSAVE Main leaf:

  EAX           : 0x2e7

  EBX           : 0x980

  ECX           : 0x988

  EDX           : 0x0

 XSAVE Sub-leaf1:

  EAX           : 0xf

  EBX           : 0x980

  ECX           : 0x1800

  EDX           : 0x0

cpuid_fn(0x00000007) eax:0x00000001 ebx:0xf1bf97a9 ecx:0x00405fce edx:0x10000010

 Feature Leaf7:

  EBX           : 0xf1bf97a9

  ECX           : 0x405fce

  EDX           : 0x10000010

cpuid_set_cpufamily(0xffffff8016cf8100) returning 0x78ea4fbc

cpuid_set_cache_info(0xffffff8016cf8100)

cpuid_fn(0x00000002) eax:0x00000000 ebx:0x00000000 ecx:0x00000000 edx:0x00000000

cpuid_fn(0x00000000) eax:0x00000010 ebx:0x68747541 ecx:0x444d4163 edx:0x69746e65

cpuid(4) index=0 eax=0x4121

cpuid(4) index=1 eax=0x4122

cpuid(4) index=2 eax=0x4143

cpuid(4) index=3 eax=0x3c163

cpuid(4) index=4 eax=0x0

 vm_cache_geometry_colors: 0

Debugger called: <panic>

panic(cpu 0 caller 0xffffff8015f9f998): no linesize @cpuid.c:515
NULL thread->t_tro pointer
Backtrace (CPU 0), panicked thread: 0xffffff8016d1af28, Frame : Return Address
0xffffff8015b99a20 : 0xffffff8015e726ad mach_kernel : _handle_debugger_trap + 0x4ad
0xffffff8015b99a70 : 0xffffff8015fc6524 mach_kernel : _kdp_i386_trap + 0x114
0xffffff8015b99ab0 : 0xffffff8015fb5fa9 mach_kernel : _kernel_trap + 0x3c9
0xffffff8015b99b10 : 0xffffff8015e12951 mach_kernel : _return_from_trap + 0xc1
0xffffff8015b99b30 : 0xffffff8015e7298d mach_kernel : _DebuggerTrapWithState + 0x5d
0xffffff8015b99c20 : 0xffffff8015e72037 mach_kernel : _panic_trap_to_debugger + 0x1a7
0xffffff8015b99c80 : 0xffffff80165ddbfb mach_kernel : _panic + 0x84
0xffffff8015b99d70 : 0xffffff8015f9f998 mach_kernel : _cpuid_wa_required + 0x858
0xffffff8015b99e10 : 0xffffff8015f9e90e mach_kernel : _cpuid_set_info + 0x121e
0xffffff8015b99ee0 : 0xffffff8015fa3e90 mach_kernel : _init_fpu + 0x180
0xffffff8015b99f00 : 0xffffff8015eac820 mach_kernel : _max_valid_stack_address + 0x960
0xffffff8015b99f80 : 0xffffff8015fbb174 mach_kernel : _machine_startup + 0xe4
0xffffff8015b99fa0 : 0xffffff8015fa8d31 mach_kernel : _i386_init + 0x571
0xffffff8015b99ff0 : 0xffffff8015e121b8 mach_kernel : _x86_init_wrapper + 0x8
         can't perform kext scan: no kext summaryNULL thread->t_tro pointer

Process name corresponding to current thread (0xffffff8016d1af28): Unknown
Boot args: -v keepsyms=1 #rtcfx_exclude=20-3F revpatch=cpuname #wdt=-1 e1000=0 #debug=0x100 agdpmod=pikera debug=0x12a mmio_uart=0 serial=3 serialbaud=115200 msgbuf=1048576 -cpuid io=0xff #-dbgenhdbg #-dbgenhiolog -no_panic_dialog -restore -logOnCrash -rootdmg-ramdi

Mac OS version:
Not yet set

Kernel version:
Darwin Kernel Version 22.4.0: Fri Feb 10 08:08:31 PST 2023; root:xnu-8796.100.721.505.3~4/RELEASE_X86_64
Kernel UUID: 68BC51AD-BF4F-3798-9550-35EA4F91E6DB
roots installed: 0
KernelCache slide: 0x0000000015a00000
KernelCache base:  0xffffff8015c00000
Kernel slide:      0x0000000015adc000
Kernel text base:  0xffffff8015cdc000
__HIB  text base: 0xffffff8015b00000
System shutdown begun: NO
Panic diags file unavailable, panic occurred prior to initialization
Hibernation exit count: 0

System uptime in nanoseconds: 811599372
Warning: clock is not configured. Can't get time
Compressor Info: 0% of compressed pages limit (OK) and 0% of segments limit (OK) with 0 swapfiles and OK swap space
Zone info:
  Zone map: 0xffffff805d2ff000 - 0xffffffa05d2ff000
  . PGZ   : 0xffffff805d2ff000 - 0xffffff8061300000
  . VM    : 0xffffff8061300000 - 0xffffff852d633000
  . RO    : 0xffffff852d633000 - 0xffffff86c6c99000
  . GEN0  : 0xffffff86c6c99000 - 0xffffff8b92fcc000
  . GEN1  : 0xffffff8b92fcc000 - 0xffffff905f2ff000
  . GEN2  : 0xffffff905f2ff000 - 0xffffff952b632000
  . GEN3  : 0xffffff952b632000 - 0xffffff99f7965000
  . DATA  : 0xffffff99f7965000 - 0xffffffa05d2ff000
  Metadata: 0xffffffff93a0c000 - 0xffffffffb3a0c000
  Bitmaps : 0xffffffffb3a0c000 - 0xffffffffb9a0c000
  Extra   : 0 - 0

Attempting to commit panic log to NVRAM

** In Memory Panic Stackshot Succeeded ** Bytes Traced 877 (Uncompressed 976) **
Attempting to commit panic log to NVRAM

Please go to https://panic.apple.com to report this panic
Yes it still crashes -- in a different place. But this point of this exercise was to get cpuid information to be logged, in the hope that some of this information might affect nCoresSharing.
 

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
The quick-and-dirty patch is as follows:
  • Identifier: Kernel
  • Base: _cpu_thread_alloc
  • Comment: CaseySJ - nCPUsSharing Patch
  • Find: 8B88DC00 0000BA02 00000083 B8800000 0000740B 8B88E000 0000
  • Replace: B9100000 0090BA02 00000083 B8800000 0000740B B9100000 0090
  • MinKernel: 22.4.0
  • MaxKernel: 22.99.99
  • Count: 1
  • Enabled: True
See those two boldfaced 10 in the "Replace" section above? This is the logical core count in hex (0x10 = 16). It is physical cores plus threads or 8 + 8 = 16 on Ryzen 7 7700X.

XML:
            <dict>
                <key>Arch</key>
                <string>x86_64</string>
                <key>Base</key>
                <string>_cpu_thread_alloc</string>
                <key>Comment</key>
                <string>CaseySJ - nCPUsSharing Patch</string>
                <key>Count</key>
                <integer>1</integer>
                <key>Enabled</key>
                <true/>
                <key>Find</key>
                <data>i4jcAAAAugIAAACDuIAAAAAAdAuLiOAAAAA=</data>
                <key>Identifier</key>
                <string>kernel</string>
                <key>Limit</key>
                <integer>0</integer>
                <key>Mask</key>
                <data></data>
                <key>MaxKernel</key>
                <string>22.99.99</string>
                <key>MinKernel</key>
                <string>22.4.0</string>
                <key>Replace</key>
                <data>uRAAAACQugIAAACDuIAAAAAAdAu5EAAAAJA=</data>
                <key>ReplaceMask</key>
                <data></data>
                <key>Skip</key>
                <integer>0</integer>
            </dict>

Screen Shot 2023-02-28 at 5.51.45 AM.png
 
Last edited:

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,265
The serial debug log from 2 posts above has this nice confirmation:

"AVX512 supported and enabled"

If we look at the cpuid.c source file, we see that some key parameters are extracted from bitfields:
C:
        reg[eax] = 4;           /* cpuid request 4 */
        reg[ecx] = index;       /* index starting at 0 */
        cpuid(reg);

        DBG("cpuid(4) index=%d eax=0x%x\n", index, reg[eax]);

        cache_type = bitfield32(reg[eax], 4, 0);
        if (cache_type == 0) {
            break;          /* no more caches */
        }

        cache_level             = bitfield32(reg[eax], 7, 5);
        cache_sharing           = bitfield32(reg[eax], 25, 14) + 1;
        info_p->cpuid_cores_per_package
                = bitfield32(reg[eax], 31, 26) + 1;
        cache_linesize          = bitfield32(reg[ebx], 11, 0) + 1;
        cache_partitions        = bitfield32(reg[ebx], 21, 12) + 1;
        cache_associativity     = bitfield32(reg[ebx], 31, 22) + 1;
        cache_sets              = bitfield32(reg[ecx], 31, 0) + 1;
This code loops from Index=0 to Index=4, and we can see this from the bottom of the serial debug logs:

cpuid(4) index=0 eax=0x4121 --> 0000 0100 0001 0010 0001
cpuid(4) index=1 eax=0x4122 --> 0000 0100 0001 0010 0010
cpuid(4) index=2 eax=0x4143 --> 0000 0100 0001 0100 0011
cpuid(4) index=3 eax=0x3c163 --> 0011 1100 0001 0110 0011
cpuid(4) index=4 eax=0x0

  • cache_type is bitfield (4, 0)
    • Index 0 = cache_type 1
    • Index 1 = cache_type 2
    • Index 2 = cache_type 3
    • Index 3 = cache_type 3
These are all valid because the code recognizes them:
C:
        /* Map type/levels returned by CPUID into cache_type_t */
        switch (cache_level) {
        case 1:
            type = cache_type == 1 ? L1D :
                cache_type == 2 ? L1I :
                Lnone;
            break;
        case 2:
            type = cache_type == 3 ? L2U :
                Lnone;
            break;
        case 3:
            type = cache_type == 3 ? L3U :
                Lnone;
            break;
        default:
            type = Lnone;
        }

  • cache_level is bitfield (7, 5)
    • Index 0 = 1
    • Index 1 = 1
    • Index 2 = 2
    • Index 3 = 3
    • The highest cache level is 3 at index 3
    • This is important because "cache_sharing" below will also be taken from this index

  • cache_sharing is bitfield (25, 14) and then we add 1
    • Index 0 = 1 + 1 = 2
    • Index 1 = 1 + 1 = 2
    • Index 2 = 1 + 1 = 2
    • Index 3 = 15 + 1 = 16 <-- this is hex 0x10 which I used in the kernel patch
... more to come later ...
 
Last edited:
Back
Top Bottom
  AdBlock Detected
Sure, ad-blocking software does a great job at blocking ads, but it also blocks some useful and important features of our website. For the best possible site experience please take a moment to disable your AdBlocker.