Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934107AbcKIQgM (ORCPT ); Wed, 9 Nov 2016 11:36:12 -0500 Received: from mx0b-000f0801.pphosted.com ([67.231.152.113]:37378 "EHLO mx0a-000f0801.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932553AbcKIQgM (ORCPT ); Wed, 9 Nov 2016 11:36:12 -0500 Subject: Re: [PATCH] x86/cpuid: Deal with broken firmware once more To: Peter Zijlstra , Thomas Gleixner References: <20161102122557.qs4rl6mb7n7l7j7p@linutronix.de> <24e69019-60d0-29e7-e31f-c6f00f9ed98a@brocade.com> <58e229e2-91f4-a97f-1b9f-089f48ef994a@brocade.com> <86609338-2b45-ed7e-fb07-99421e43a2f1@brocade.com> <20161109160324.GR3142@twins.programming.kicks-ass.net> CC: Sebastian Andrzej Siewior , , LKML , "M. Vefa Bicakci" , Borislav Petkov From: "Charles (Chas) Williams" Message-ID: <9badae12-f07e-b2e3-c1ce-c2017cd5e510@brocade.com> Date: Wed, 9 Nov 2016 11:34:52 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161109160324.GR3142@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: hq1wp-excas11.corp.brocade.com (10.70.36.102) To BRMWP-EXMB12.corp.brocade.com (172.16.59.130) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-09_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611090298 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1527 Lines: 42 On 11/09/2016 11:03 AM, Peter Zijlstra wrote: > On Wed, Nov 09, 2016 at 04:35:51PM +0100, Thomas Gleixner wrote: >> Both ACPI and MP specifications require that the APIC id in the respective >> tables must be the same as the APIC id in CPUID. >> >> The kernel retrieves the physical package id from the APIC id during the >> ACPI/MP table scan and builds the physical to logical package map. >> >> There exist Virtualbox and Xen implementations which violate the spec. As a > > ISTR it was VMware, not VirtualBox, but whatever.. they're both crazy > virt stuff. Yes, this was VMware in particular. It would be good to get this comment right so as not to mislead anyone. >> /* >> + * The physical to logical package id mapping is initialized from the >> + * acpi/mptables information. Make sure that CPUID actually agrees with >> + * that. >> + */ >> +static void sanitize_package_id(struct cpuinfo_x86 *c) >> +{ >> +#ifdef CONFIG_SMP >> + unsigned int pkg, apicid, cpu = smp_processor_id(); >> + >> + apicid = apic->cpu_present_to_apicid(cpu); >> + pkg = apicid >> boot_cpu_data.x86_coreid_bits; >> + >> + if (apicid != c->initial_apicid) { >> + pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x CPUID: %x\n", >> + cpu, apicid, c->initial_apicid); > > Should we not also 'fix' c->initial_apicid ? Since we have c->apicid and c->initial_apicid it seems reasonable to keep one set to the "correct" value. I don't think c->initial_apicid is used past this. I should have some tests on this patch later today.