Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3053010ybi; Tue, 2 Jul 2019 01:12:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAeP+4q/YUT729aROgbqG0iQRfpKVKTzqhZo8gqQhmuVhpzE2iqv6xfDSiCxxT6J/nAqwv X-Received: by 2002:a63:1046:: with SMTP id 6mr10280398pgq.111.1562055143717; Tue, 02 Jul 2019 01:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055143; cv=none; d=google.com; s=arc-20160816; b=XehnCY13NHGBlvwyeVK76F7/gFLqq0ICKXjCjt+dfKHkBtKL6MBslG8ZEbA8T0k2an adSm4q1qlP7dtwWRsmv/CSc2c9DC/nDYFlrKQZMFEYcTgeh776nNu0gYaaIOK9xHrz10 1AUjDLq3cGta8e4oEi3rtvbNdaXIzyktFNB+e9m1zi9sGX2Ds1l3qzdNortz+7tkjJwb DYxFzPZ7iLH0vRiqUTylZVzRrbFEthVFpy7Ypx6BNC6XQx/kq5QtuNfP+IBNlC1zkKXD /KX0EwGtx75CXNJNAnt3uGZVKRNbE+/4JQUaNdnlQTR9bUdemyShOmlH2nTKJsnGTegD ciJg== 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=fCiVKCkeYTjoOzwaxyeHbWTEIeO01oz2jsp4RceWm/w=; b=yDl7qEAsi4m5bwloo1O/rctRvrWsZIn+uBNwQGsRSwIWNpzpYag9sXQtxCqGg0gaCa kRlwx4RZqQF7/27odgnP1FonYQn2egbKjbtNAG4zHD0NOxwWDBEbfrgUC+iSNxuh4ECt ZRJYj3GpRhZAMEA304ZZgeEtYShu88zLjYhccasXARtU1WKOrnwXX6xKcoLSl1Pu+RJr EtXVx6F/3VKtDgIoA9GVxR6wsnvjWQeZ5UHp26S4P9iD9g5Jn3JRKn8ZTRAjKplvRPGV dwRlrHlj2oI/8qkNq2GbghyV/E+1M7+K6B0gWu/RnzY5gfb6N3stkMqi9ARe3HBMuV1v /lnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rRHWIw+4; 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 g22si13573477pfh.219.2019.07.02.01.12.09; Tue, 02 Jul 2019 01:12:23 -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=rRHWIw+4; 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 S1728853AbfGBIKj (ORCPT + 99 others); Tue, 2 Jul 2019 04:10:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:59262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728072AbfGBIKh (ORCPT ); Tue, 2 Jul 2019 04:10:37 -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 3D8722189F; Tue, 2 Jul 2019 08:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562055036; bh=UGiJQGJTx3wkmG+1excLzEVoivEDKBu/VMBZYlSklB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRHWIw+4ZP1gIxevItJZguFNpKuICZQe8nIsXmNGyyNowZOkcoOZs5uRlV3qcNWSK YyEC0abrL6Rxfw4Me7qs+jAUkuGrlfeljl6J9UUyi6NjpwWQl0aPQLb2UuCHLxj2Bs 6xxr+XnjrFEA7eUSrljuu/MJuXhxkYVtQnMOOp0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , x86-ml Subject: [PATCH 4.14 23/43] x86/microcode: Fix the microcode load on CPU hotplug for real Date: Tue, 2 Jul 2019 10:02:03 +0200 Message-Id: <20190702080125.017051610@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080123.904399496@linuxfoundation.org> References: <20190702080123.904399496@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: Thomas Gleixner commit 5423f5ce5ca410b3646f355279e4e937d452e622 upstream. A recent change moved the microcode loader hotplug callback into the early startup phase which is running with interrupts disabled. It missed that the callbacks invoke sysfs functions which might sleep causing nice 'might sleep' splats with proper debugging enabled. Split the callbacks and only load the microcode in the early startup phase and move the sysfs handling back into the later threaded and preemptible bringup phase where it was before. Fixes: 78f4e932f776 ("x86/microcode, cpuhotplug: Add a microcode loader CPU hotplug callback") Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: stable@vger.kernel.org Cc: x86-ml Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1906182228350.1766@nanos.tec.linutronix.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/microcode/core.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -790,13 +790,16 @@ static struct syscore_ops mc_syscore_ops .resume = mc_bp_resume, }; -static int mc_cpu_online(unsigned int cpu) +static int mc_cpu_starting(unsigned int cpu) { - struct device *dev; - - dev = get_cpu_device(cpu); microcode_update_cpu(cpu); pr_debug("CPU%d added\n", cpu); + return 0; +} + +static int mc_cpu_online(unsigned int cpu) +{ + struct device *dev = get_cpu_device(cpu); if (sysfs_create_group(&dev->kobj, &mc_attr_group)) pr_err("Failed to create group for CPU%d\n", cpu); @@ -873,7 +876,9 @@ int __init microcode_init(void) goto out_ucode_group; register_syscore_ops(&mc_syscore_ops); - cpuhp_setup_state_nocalls(CPUHP_AP_MICROCODE_LOADER, "x86/microcode:online", + cpuhp_setup_state_nocalls(CPUHP_AP_MICROCODE_LOADER, "x86/microcode:starting", + mc_cpu_starting, NULL); + cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "x86/microcode:online", mc_cpu_online, mc_cpu_down_prep); pr_info("Microcode Update Driver: v%s.", DRIVER_VERSION);