Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp365558ybi; Wed, 19 Jun 2019 00:33:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhLb/pXTogI0H1lO2bAJ681n02KGSSeRw5vfJcj3Efk4lqhCzDdDYV/BkQTFWkMTyAdPgi X-Received: by 2002:a17:902:2ac8:: with SMTP id j66mr74639841plb.273.1560929587361; Wed, 19 Jun 2019 00:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560929587; cv=none; d=google.com; s=arc-20160816; b=CiyHsuWUVcxqEguA+S5Xy9pXT8Blzi2N2HOyzPXxgmMLl4QVkVD2IhMIHTur8S9yxD R59yuKsAb2wpG0zw1PDgDhguu2SJhUAJgvGZ0WMwWsyYGmGwqLYkJqNYCPFmafFb0vI4 j8UEmfkjpfVmfl+6rFrYPQ0MYZKCOSfLHV31jX/jgnlwreMkyaBWSg+/JWESPetOklgg OT30KJBFuT8Ny1OCg4Gb29h7GpiOv2hiHw0HjCoGpGcyKtSs8ZR4k0YyYpTz0rBxAqdu tsvWkLpYSFlV7QKjmJf2rolrG5nZdtO39BGJ9ZcYmkusyZ9LhMRNUWhJOI19msiGdYa8 3GQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=fTdj1HYoz+Ag8ogsG0vZVQ/JAHq194S4qWCi25pJ6z4=; b=jeVsJ8jg+sJ3Jpsk553NbKBDZX1IGxu0sMBXtRFhbzO3nW7Ln2Epe7/4QE/szouOSR 9FI9pIiGi2Y/wg0nGojq13Fwe1Gp3zY39EG+lhTsOKDQcK0uAdKzJK4jVHZOpjfTvrFR kNOuSibLIkUU7CrwkcMZ9ODkT3RloA3qr12VbQ4dPPZAabRvCVdk45qrqIrpPZYGuJUg 3/qG+wpnNQ06nfsRueW32tvhbGdHb0f5WU4rdU8k4LiyPZ8GUDa6IgRz2tN8MmzeCtq1 D4BxptTPkZM1JqcRsN+WpXPeCN/tGSn7mnqPhSc4yYrlnMXexxXz8jYWxhFegb+qGc9A ouCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b=KbEOrQLu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si592931pjs.98.2019.06.19.00.32.50; Wed, 19 Jun 2019 00:33:07 -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=@zytor.com header.s=2019051801 header.b=KbEOrQLu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731179AbfFSHcq (ORCPT + 99 others); Wed, 19 Jun 2019 03:32:46 -0400 Received: from terminus.zytor.com ([198.137.202.136]:34479 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731065AbfFSHcq (ORCPT ); Wed, 19 Jun 2019 03:32:46 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x5J7Vx7R247900 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 19 Jun 2019 00:31:59 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x5J7Vx7R247900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019051801; t=1560929520; bh=fTdj1HYoz+Ag8ogsG0vZVQ/JAHq194S4qWCi25pJ6z4=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=KbEOrQLuGBFqF4PG3lASHevC0/oDvaPNZB78UJ+F1DZOxRnhUnfIp1icDGbj+NHVk rivrti5HDUZo4i8b/WDdFQEtioPCJg168RFC1htcEL9vaXf7OExh+uiXMSVQevs08S HMGzF2JJjVxnlAqKEDwrMp22tk3zKFTUOaeltsezFq731uLWrOtoV1N7NvniUQwx3n bh9zUsgzVVajbP6OpMP9N7AJhc1+3d1+7l98Y4fY3BlPkAgmibNxO722R3tPv7/c2F fIJxAgtcT8B5A53L2lwEV5ycjim/c/2W2cmoZ3112FVH7UShuZoZFks8XuVMk5xLaH HNV3n04QkUpPQ== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x5J7Vx0r247897; Wed, 19 Jun 2019 00:31:59 -0700 Date: Wed, 19 Jun 2019 00:31:59 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Thomas Gleixner Message-ID: Cc: tglx@linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, mingo@kernel.org, hpa@zytor.com, bp@suse.de Reply-To: mingo@kernel.org, hpa@zytor.com, bp@suse.de, tglx@linutronix.de, x86@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/microcode: Fix the microcode load on CPU hotplug for real Git-Commit-ID: 5423f5ce5ca410b3646f355279e4e937d452e622 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 5423f5ce5ca410b3646f355279e4e937d452e622 Gitweb: https://git.kernel.org/tip/5423f5ce5ca410b3646f355279e4e937d452e622 Author: Thomas Gleixner AuthorDate: Tue, 18 Jun 2019 22:31:40 +0200 Committer: Borislav Petkov CommitDate: Wed, 19 Jun 2019 09:16:35 +0200 x86/microcode: Fix the microcode load on CPU hotplug for real 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 --- arch/x86/kernel/cpu/microcode/core.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index a813987b5552..cb0fdcaf1415 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -789,13 +789,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); @@ -872,7 +875,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);