Index | Thread | Search

From:
Jonathan Gray <jsg@jsg.id.au>
Subject:
Re: print intel core type info in dmesg
To:
David Gwynne <david@gwynne.id.au>, tech@openbsd.org
Date:
Thu, 24 Jul 2025 09:05:43 +1000

Download raw body.

Thread
On Wed, Jul 23, 2025 at 02:12:48PM -0300, Crystal Kolipe wrote:
> 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:

That assumes knowledge of the cpu model it is running on.

https://community.intel.com/t5/Mobile-and-Desktop-Processors/Detecting-LP-E-Cores-on-Meteor-Lake-in-software/td-p/1577956
"Currently, there is no documented or officially sanctioned solution
that can be deemed future-proof."

> 
> 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;
> 	}
> }
> 
>