Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3000949ybi; Mon, 17 Jun 2019 14:24:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcI0KBml1NAWxPbVQKNVO0gv/8PZ3lDpgxPOM9lY7PHXKHdhu3tt7bYMLvlJei/ZKxjyU7 X-Received: by 2002:a62:764d:: with SMTP id r74mr94913609pfc.110.1560806673042; Mon, 17 Jun 2019 14:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560806673; cv=none; d=google.com; s=arc-20160816; b=ESXiTRwebDL9PdcDQXePuRzNDbaOQY0UVr+dqfI6XYMndm9Cp/BlVpWkySP3HEcFwT OX+UjeHVxHm9NeeIjWlWwPk9DNwgk3WKE9c559YNq75uypYykHq4AsarFCN8aT1t/kxA X9H+ImCeKJekcXLRE156dedzCBZ5/DEBj4neudc1HQcHGTpAe0aB6zoUXB/pxNeGS3bE +KEBkBqEyDbLnIl+Yu2DnGL/cJqDM0uMg6rw5HngW/dSWReQ+wLBbS9w3QJpPNqcrg8i MqvRSU8Shn3nhZPGZYjqF6vntxiojTXvuXVkQGqR/w6WIi12tYHz2St60SOu25J0/KTI dsgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gTp5ppe6TduMmO5FoXhQyKmXu09GNCphvUVSUKxgQz0=; b=PmGdqMGrzJSySKj0GFSNorxZwTZoMlQ0zBYBv5J1Wbo/JHHFI+aUHLWOe1w5eTjAxi YARYE2Npc3ZFLU2lH/RoXMS5Qgz9kEzfUAEQoiFb8qvGZ+4JBYgMQPpJQfEGuNq4d59x A/Vp4JvI/Ecdr0XqyAOks/ot+jyprzvyrBHPjF9adPvCh3maYTPMRaguamQTL1kiFHjz pKPXbS4sQa23qinvEfmcbGKXi81bjsZkpr0pKkIxkouZMhfiXUiq+DcoIeq5gaat9DEL lJ/dodlUvT5q7mQQNEVR8dU0UAtKRgdVMwmwq3OVSEXwUZG5dVtYKH2Fn3BzZBk9RIZl ESqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VenRDgw2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si11260225pfi.276.2019.06.17.14.24.18; Mon, 17 Jun 2019 14:24:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VenRDgw2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729704AbfFQVXU (ORCPT + 99 others); Mon, 17 Jun 2019 17:23:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:48328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbfFQVXS (ORCPT ); Mon, 17 Jun 2019 17:23:18 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0000420B1F; Mon, 17 Jun 2019 21:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806597; bh=AsC9uVI1BfZ0FNcxfLRwf9ePKz/nbVlobG9IK3mJHXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VenRDgw2ym2haB/H5fKGh/uxzjF/sRTm/0j7830SzhcoMfB+ZPOS4tKyfBTwaQ8bf ZmJ5ol48En09+LB0i75a3N/vdASEvVJLFH967/rVmROGEKCKMOGyr8oTTv2Su1TQZH ZhiVyb/48x1C7T7mZyTtD7CQJMkFOplywnQwGkUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adric Blake , Borislav Petkov , Thomas Gleixner , Peter Zijlstra , x86@kernel.org Subject: [PATCH 5.1 108/115] x86/microcode, cpuhotplug: Add a microcode loader CPU hotplug callback Date: Mon, 17 Jun 2019 23:10:08 +0200 Message-Id: <20190617210805.460259072@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210759.929316339@linuxfoundation.org> References: <20190617210759.929316339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov commit 78f4e932f7760d965fb1569025d1576ab77557c5 upstream. Adric Blake reported the following warning during suspend-resume: Enabling non-boot CPUs ... x86: Booting SMP configuration: smpboot: Booting Node 0 Processor 1 APIC 0x2 unchecked MSR access error: WRMSR to 0x10f (tried to write 0x0000000000000000) \ at rIP: 0xffffffff8d267924 (native_write_msr+0x4/0x20) Call Trace: intel_set_tfa intel_pmu_cpu_starting ? x86_pmu_dead_cpu x86_pmu_starting_cpu cpuhp_invoke_callback ? _raw_spin_lock_irqsave notify_cpu_starting start_secondary secondary_startup_64 microcode: sig=0x806ea, pf=0x80, revision=0x96 microcode: updated to revision 0xb4, date = 2019-04-01 CPU1 is up The MSR in question is MSR_TFA_RTM_FORCE_ABORT and that MSR is emulated by microcode. The log above shows that the microcode loader callback happens after the PMU restoration, leading to the conjecture that because the microcode hasn't been updated yet, that MSR is not present yet, leading to the #GP. Add a microcode loader-specific hotplug vector which comes before the PERF vectors and thus executes earlier and makes sure the MSR is present. Fixes: 400816f60c54 ("perf/x86/intel: Implement support for TSX Force Abort") Reported-by: Adric Blake Signed-off-by: Borislav Petkov Reviewed-by: Thomas Gleixner Cc: Peter Zijlstra Cc: Cc: x86@kernel.org Link: https://bugzilla.kernel.org/show_bug.cgi?id=203637 Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/microcode/core.c | 2 +- include/linux/cpuhotplug.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -876,7 +876,7 @@ int __init microcode_init(void) goto out_ucode_group; register_syscore_ops(&mc_syscore_ops); - cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "x86/microcode:online", + cpuhp_setup_state_nocalls(CPUHP_AP_MICROCODE_LOADER, "x86/microcode:online", mc_cpu_online, mc_cpu_down_prep); pr_info("Microcode Update Driver: v%s.", DRIVER_VERSION); --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -101,6 +101,7 @@ enum cpuhp_state { CPUHP_AP_IRQ_BCM2836_STARTING, CPUHP_AP_IRQ_MIPS_GIC_STARTING, CPUHP_AP_ARM_MVEBU_COHERENCY, + CPUHP_AP_MICROCODE_LOADER, CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, CPUHP_AP_PERF_X86_STARTING, CPUHP_AP_PERF_X86_AMD_IBS_STARTING,