[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [WARNING] Intel Skylake/Kaby Lake processors: broken hyper-threading



(updated perl script, it now needs the "liblist-moreutils-perl" package)

On Sun, 25 Jun 2017, Henrique de Moraes Holschuh wrote:
> On Sun, 25 Jun 2017, Henrique de Moraes Holschuh wrote:
> > This warning advisory is relevant for users of systems with the Intel
> > processors code-named "Skylake" and "Kaby Lake".  These are: the 6th and
> > 7th generation Intel Core processors (desktop, embedded, mobile and
> > HEDT), their related server processors (such as Xeon v5 and Xeon v6), as
> > well as select Intel Pentium processor models.
> 
> Attached, you will find a perl script that can help detect if your
> system is affected or not.  Many thanks to Uwe Kleine-König for
> suggesting, and writing this script.

Uwe Kleine-König was kind enough to update the perl script to fix the
broken hyper-threading detection.  The new version is attached.

NOTE: You may need to install the liblist-moreutils-perl package for the
script to work.

-- 
  Henrique Holschuh
#!/usr/bin/perl
# Copyright 2017 Uwe Kleine-König
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the
# Free Software Foundation.

use List::MoreUtils 'uniq';

open(my $cpuinfo, "</proc/cpuinfo") or die "failed to open cpuinfo\n";

my @cpus;
my %cpu;

while (<$cpuinfo>) {
	if (/^$/) {
		push @cpus, { %cpu };
		undef %cpu;
	}
	
	$cpu{'cpunum'} = $1 if /^processor\s*:\s(.*)/;
	$cpu{'vendor'} = $1 if /^vendor_id\s*:\s(.*)/;
	$cpu{'family'} = $1 if /^cpu family\s*:\s(.*)/;
	$cpu{'model'} = $1 if /^model\s*:\s(.*)/;
	$cpu{'stepping'} = $1 if /^stepping\s*:\s(.*)/;
	$cpu{'microcode'} = $1 if /^microcode\s*:\s(.*)/;
	$cpu{'core id'} = $1 if /^core id\s*:\s(.*)/;
}

my $num_cpus = @cpus;
my $num_cores = uniq map { $_->{'core id'} } @cpus;

foreach (@cpus) {
	print "cpu " . $_->{cpunum} . ": ";
	if ($_->{'vendor'} eq "GenuineIntel" and $_->{'family'} == 6) {
		my $model = $_->{'model'};
		if ($model == 78 or $model == 94) {
			if ($_->{'stepping'} eq "3") {
				my $microcoderev = $_->{'microcode'};
				print "Your CPU is affected, ";
				if (hex($microcoderev) >= 0xb9) {
					print "but your microcode is new enough\n";
				} elsif ($num_cpus == $num_cores) {
					print "but hyper threading is off, which works around the problem\n";
				} else {
					print "you should install the latest intel-microcode\n";
				}
			} else {
				print "You may need a BIOS/UEFI update (unknown Skylake-Y/H/U/S stepping)\n";
			}
		} elsif ($model == 85 or $model == 142 or $model == 158) {
			print "You may need a BIOS/UEFI update (Kaby Lake, or Skylake-X processor)\n";
			print "Note: Kaby Lake X-series processors (i7-7740X, etc) are not affected\n";
		} else {
			print "You're likely not affected\n";
		}
	} else {
		print "You're not affected\n";
	}
}

Reply to: