Index | Thread | Search

From:
Crystal Kolipe <kolipe.c@exoticsilicon.com>
Subject:
Re: print intel core type info in dmesg
To:
David Gwynne <david@gwynne.id.au>, tech@openbsd.org
Date:
Wed, 23 Jul 2025 14:12:48 -0300

Download raw body.

Thread
On Wed, Jul 23, 2025 at 10:36:06AM -0600, Theo de Raadt wrote:
> Claudio Jeker <cjeker@diehard.n-r-g.com> wrote:
> 
> > On Wed, Jul 23, 2025 at 08:42:30AM -0600, Theo de Raadt wrote:
> > > I think this overstates the importance of this difference over other
> > > parts of the cpu description.  I think there's a lot of optimism that
> > > this matters for performing work.  Why do we need to print this, if
> > > we aren't taking this into account during processing because we have no
> > > code to make use of this difference?
> > 
> > Adding support for this can be only done if we have topology information
> > that has more information.
> 
> The provided diff does not place the information in a data structure so
> that the kernel can make a decision.

It also doesn't distinguish between E and LP-E cores.

For that, if I'm not mistaken, you need to check the cache bits of leaf 0x04:

int leaf;
int lpe;
lpe = 1;
if (cpuid_level >= 0x1a) {
	CPUID_LEAF(0x1a, 0, eax, ebx, ecx, edx);
	switch ((eax >> 24) & 0xff) {
	case 0x20:
		type = "efficiency";
		for (leaf = 0; leaf < 10; leaf++) {
			CPUID_LEAF(0x04, leaf, eax, ebx, ecx, edx);
			if (eax == 0)
				break ;
			if (((eax >> 5) & 0x07) == 3)
				lpe = 0;
		}
		if (lpe == 1)
			type = "low-power efficiency";
		break;
	case 0x40:
		type = "performance";
		break;
	}
}