From patchwork Fri Jan 13 17:29:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashok Raj X-Patchwork-Id: 43502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp401292wrt; Fri, 13 Jan 2023 09:47:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyFH+9o12V76sOi7mydh5PLFllEJm1yUGX8x/sItW033HcHD2Cj8fIlOtH3Jv5ZixYnoQA X-Received: by 2002:a17:902:740b:b0:194:5068:ff1d with SMTP id g11-20020a170902740b00b001945068ff1dmr10052398pll.16.1673632047889; Fri, 13 Jan 2023 09:47:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673632047; cv=none; d=google.com; s=arc-20160816; b=apS/40+7z+Vq8Bk2qIYfoKvLslmu4jaWPm6YIWJZ9Cd+frVVe3R70+Ua+wpbB2D4b7 aJ7pe/cIapEx8QNKRVrr+D5/sMq/LIGSTuQQZHUHhcVANWNyWnu4btUkhcneUJP2g053 Hgy0c1YnyPokm5xFpkCx8Y9ptVRcNEPFKTcriUQcfJQBdKG4WrPiO1mfAb1RPHvkbZLr Q/J8XdvqDpA5CV1ZlZ+5O2NTZxLYGsYNssTqS36iMfF5UKMf/sHYmLRlDmIl+l4mEH9S +x4Qk5Gyy/mS1z5HN1ile6jhQ17vhfRiKjbTVTVHwZic5CS2U0/N8FENpOjhU67Awq9K YaIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ux1Xey2buJWvkhuTLMBtt5OXo2vB6Pu6JWTw5l/NP1U=; b=FBGGkcpX69q+kEyvWnicbFavEq8fL+ktYIklcKKL30ML3sjQlx3ob5cC019CZmEQa5 yZNLaW0h8yf6PNGe+lch+1I52Mx2ZHXQlh13nyk7otda/v1tFWqHNACIT1gwLub3lGd1 Zoa/uFpSAQQS0SCrD1SFQDkbXOp0LnQm94ICH/LLBXuZqbPs/PVIwMgpqJTVIUPVUwCA zgfcmIo/4p1m3obIjX/lYT//fFHyslNrOvC8LgjimjPD6MA0Jdw4N2in4FmNicteNhI1 hDg8Op0CIriZaWOPp0zo3Yd0bOBsBowW+EKUyEXMIsWJcBDihH/FGvGz5rWH5nlOce96 ODOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RYSW8+g2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a1709029a8a00b0018929930a0bsi4689978plp.414.2023.01.13.09.47.14; Fri, 13 Jan 2023 09:47:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RYSW8+g2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229708AbjAMRnp (ORCPT + 99 others); Fri, 13 Jan 2023 12:43:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbjAMRnK (ORCPT ); Fri, 13 Jan 2023 12:43:10 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F1AE6C053 for ; Fri, 13 Jan 2023 09:29:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673630973; x=1705166973; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4EqDfmlWSpjXzy20Qe0hd2hnLS19EqiJq6uAIZI/d1Q=; b=RYSW8+g2iqBhkqpAtnhLdScqjZnkUkq8ezWbOC1scR7TRGfYGFbBCE9Y rK+tqLgGeHOnWbActuc1OyE1yd8dbGFIVusMobWFGsnviXmzJ1xOtrn7y uBYDNYQNeu7UQxG/Me7Ova4zldrX3gYYZTDkmHIqZyPTFPJOvS2x1Uaqh Xxs3hauiMtzRCnqFhOoaRKrcZJ3lHnU8iNTG4wM3603/h6iGtKEpHwLGN 7NtVwJiuiKaj6mzD0NMIfNy2dVQGmAjYm8EbuKUYX+eOEhGqBqIkJ4T9N 8d3l9s3eC1xujt+QrZpsVExhOf1qRhDqE0dEjyAlg4W8hLfckaNC8x7Ic w==; X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="304429995" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="304429995" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 09:29:32 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="766089917" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="766089917" Received: from araj-ucode.jf.intel.com ([10.23.0.19]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 09:29:32 -0800 From: Ashok Raj To: Borislav Petkov , Thomas Gleixner Cc: Ashok Raj , Tony Luck , LKML , x86 , Ingo Molnar , Dave Hansen , Alison Schofield , Reinette Chatre , Tom Lendacky , Stefan Talpalaru , David Woodhouse , Benjamin Herrenschmidt , Jonathan Corbet , "Rafael J . Wysocki" , Peter Zilstra , Andy Lutomirski , Andrew Cooper Subject: [PATCH v1 Part2 1/5] x86/microcode: Move late load warning to the same function that taints kernel Date: Fri, 13 Jan 2023 09:29:16 -0800 Message-Id: <20230113172920.113612-2-ashok.raj@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113172920.113612-1-ashok.raj@intel.com> References: <20230113172920.113612-1-ashok.raj@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754930398424967674?= X-GMAIL-MSGID: =?utf-8?q?1754930398424967674?= Currently the warning about late loading and tainting are issued from two different functions. Later patches will re-enable microcode late-loading. Having both messages in the same function helps issuing warnings only when required. Move the warning from microcode_reload_late() -> reload_store() where the kernel tainting also happens. No functional changes. Signed-off-by: Ashok Raj Reviewed-by: Tony Luck Cc: LKML Cc: x86 Cc: Ingo Molnar Cc: Tony Luck Cc: Dave Hansen Cc: Alison Schofield Cc: Reinette Chatre Cc: Thomas Gleixner (Intel) Cc: Tom Lendacky Cc: Stefan Talpalaru Cc: David Woodhouse Cc: Benjamin Herrenschmidt Cc: Jonathan Corbet Cc: Rafael J. Wysocki Cc: Peter Zilstra (Intel) Cc: Andy Lutomirski Cc: Andrew Cooper --- arch/x86/kernel/cpu/microcode/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index d7cbc83df9b6..c361882baf63 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -441,9 +441,6 @@ static int microcode_reload_late(void) int old = boot_cpu_data.microcode, ret; struct cpuinfo_x86 prev_info; - pr_err("Attempting late microcode loading - it is dangerous and taints the kernel.\n"); - pr_err("You should switch to early loading, if possible.\n"); - atomic_set(&late_cpus_in, 0); atomic_set(&late_cpus_out, 0); @@ -494,6 +491,9 @@ static ssize_t reload_store(struct device *dev, if (tmp_ret != UCODE_NEW) goto put; + pr_err("Attempting late microcode loading - it is dangerous and taints the kernel.\n"); + pr_err("You should switch to early loading, if possible.\n"); + mutex_lock(µcode_mutex); ret = microcode_reload_late(); mutex_unlock(µcode_mutex);