Message ID | 20230103180212.333496-4-ashok.raj@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4747453wrt; Tue, 3 Jan 2023 10:03:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXuPRbkd9mIzOex3PTma/o5ATw9G3ug6/Gg2LexO8GKPNfXLZM81IL1tF7n2t3nYtHGdFigR X-Received: by 2002:a05:6402:528e:b0:481:420e:206d with SMTP id en14-20020a056402528e00b00481420e206dmr33929547edb.42.1672768999249; Tue, 03 Jan 2023 10:03:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672768999; cv=none; d=google.com; s=arc-20160816; b=iPoq+yPWF94e8nIjuQoomePys9jG3o1ljBGw9Dj0pyYIU0iFI/m5YwNwMG+AqtVtdl DJQa8JANt+iJAYgkwLQgdnisw0nHjV7DxclyXSmEEg7lPctTCcd/FDcbB88aeqfE9pF/ uPflG8uFqMng/lWuELrB77P0QyXKmw4/TEIv6RpCLw0S8i2uREvikAHRQ94jSkUqxWiX PIdEgvSbICRUBv8zNOVKUPoYnRx0HaPuEmqmJkfWKLsbma0gt3AGnuWwGf5I4qIWJ1Mp ZjFvlU+lrzIzLfsy8oibznjDDLn2fWaQS8jRbODVjoR2xMUpq81EjZd/XFBq7JHkHkom TxPA== 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=FX1033HgNG5U9BgqSogetv30AcC4J0cS1LbQekYGHZ8=; b=dF3YeDm9lGF5wer/F6W0Gf6mYnv3cULnRDezx2EP7Df7blJ2Auad3sHODJDbG+sPEi DvB0HMpRivd1ghRCahRYHGMoGe3hJA0AAbXiwRcKtBg6zLSr1Nc/TbsWP/K43Jg2UBxc wgFRahdy2cOAjOHB/T8x4LxyHnCqERlX8yQ9IthUf1oiRdcuTFeBmnvIdKFuOT6z847G VnPVs4h0X0U7L8OB5F4w4oY2t4gev6rdczXn0q13vSVM27x+G3DuCbkPSZdNM/wu+YIA Vb+PxJlNJ7LYK9Gd//YkFtnJL95MDQ2nKKa0UJaYid+Zq0EkXabjM+ndC1w4UuJGiTFk xPhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=U47aOgG9; 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 l23-20020a056402029700b0045938ab7129si24751901edv.330.2023.01.03.10.02.55; Tue, 03 Jan 2023 10:03:19 -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=U47aOgG9; 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 S238568AbjACSCa (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Tue, 3 Jan 2023 13:02:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238527AbjACSC1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 3 Jan 2023 13:02:27 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A72A11A2A for <linux-kernel@vger.kernel.org>; Tue, 3 Jan 2023 10:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672768944; x=1704304944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ksdr92gH6DZ8dyITiXCe+MBzgbUi62N2nRt+rCqGjeE=; b=U47aOgG99MHa+KoPh5oq37PvW/zwKn/8w2g/HoY1b/2kOqYLWB+nBY21 NgGKLb57YQCAaKMxhTQWSe7ed6uGkIkmE0ccT+85RMBFQHgw/J5h2xT9f t1N4WqUXgqnhBEJMl/zl0rQOWUTcXMusZcdQ3N+AdGVnGu563NBkoDHNf qUEA7LgXahVoMjy1Gsg1zdXQOYt8GSx5fV131RZfzCtwRgdHDLyqonoe1 L6bQLIFT3WLF5VM06ajQC+EFyQn4oekejpHGMkIzP1jcqx1XXk8XpNnja yBX6Z8H9+SJhXCrvTuDM6oPFgXc19nrt3h+m60WD7DrLWOpWcPLXS7vSp g==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="384010646" X-IronPort-AV: E=Sophos;i="5.96,297,1665471600"; d="scan'208";a="384010646" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 10:02:22 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="654876885" X-IronPort-AV: E=Sophos;i="5.96,297,1665471600"; d="scan'208";a="654876885" Received: from araj-ucode.jf.intel.com ([10.23.0.19]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 10:02:24 -0800 From: Ashok Raj <ashok.raj@intel.com> To: Borislav Petkov <bp@alien8.de>, Thomas Gleixner <tglx@linutronix.de> Cc: X86-kernel <x86@kernel.org>, LKML Mailing List <linux-kernel@vger.kernel.org>, Ashok Raj <ashok.raj@intel.com>, Dave Hansen <dave.hansen@intel.com>, Tony Luck <tony.luck@intel.com>, Alison Schofield <alison.schofield@intel.com>, Reinette Chatre <reinette.chatre@intel.com>, Tom Lendacky <thomas.lendacky@amd.com> Subject: [PATCH v3 3/6] x86/microcode: Display revisions only when update is successful Date: Tue, 3 Jan 2023 10:02:09 -0800 Message-Id: <20230103180212.333496-4-ashok.raj@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230103180212.333496-1-ashok.raj@intel.com> References: <20230103180212.333496-1-ashok.raj@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754025426302390247?= X-GMAIL-MSGID: =?utf-8?q?1754025426302390247?= |
Series |
Some fixes and cleanups for microcode
|
|
Commit Message
Ashok Raj
Jan. 3, 2023, 6:02 p.m. UTC
Right now, microcode loading failures and successes print the same message "Reloading completed". This is misleading to users. Display the updated revision number only if an update was successful. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ashok Raj <ashok.raj@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/lkml/874judpqqd.ffs@tglx/ Cc: LKML <linux-kernel@vger.kernel.org> Cc: x86 <x86@kernel.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Alison Schofield <alison.schofield@intel.com> Cc: Reinette Chatre <reinette.chatre@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tom Lendacky <thomas.lendacky@amd.com> --- arch/x86/kernel/cpu/microcode/core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Comments
On Tue, Jan 03, 2023 at 10:02:09AM -0800, Ashok Raj wrote: > Right now, microcode loading failures and successes print the same > message "Reloading completed". This is misleading to users. 9bd681251b7c ("x86/microcode: Announce reload operation's completion")
On Wed, Jan 04, 2023 at 08:00:05PM +0100, Borislav Petkov wrote: > On Tue, Jan 03, 2023 at 10:02:09AM -0800, Ashok Raj wrote: > > Right now, microcode loading failures and successes print the same > > message "Reloading completed". This is misleading to users. > > 9bd681251b7c ("x86/microcode: Announce reload operation's completion") Thanks.. yes I can add when I resent the series. Cheers, Ashok
On Fri, Jan 06, 2023 at 11:42:32AM -0800, Ashok Raj wrote: > > 9bd681251b7c ("x86/microcode: Announce reload operation's completion") > > Thanks.. yes I can add when I resent the series. No, you should read the commit message: "issue a single line to dmesg after the reload ... to let the user know that a reload has at least been attempted." and drop your patch. We issue that line unconditionally to give feedback to the user that the attempt was actually tried. Otherwise, you don't get any feedback and you wonder whether it is doing anything. The prev and next revision: "microcode revision: 0x%x -> 0x%x\n", will tell you whether something got loaded or not.
On Fri, Jan 06, 2023 at 08:54:30PM +0100, Borislav Petkov wrote: > On Fri, Jan 06, 2023 at 11:42:32AM -0800, Ashok Raj wrote: > > > 9bd681251b7c ("x86/microcode: Announce reload operation's completion") > > > > Thanks.. yes I can add when I resent the series. > > No, you should read the commit message: > > "issue a single line to dmesg after the reload ... to let the user know that a > reload has at least been attempted." > > and drop your patch. > > We issue that line unconditionally to give feedback to the user that the attempt > was actually tried. Otherwise, you don't get any feedback and you wonder whether > it is doing anything. > > The prev and next revision: > > "microcode revision: 0x%x -> 0x%x\n", > > will tell you whether something got loaded or not. Yes, that makes sense, Do you think we can add a note that the loading failed? since the old -> new, new is coming from new microcode rev. Reload failed/completed ?
On Fri, Jan 06, 2023 at 12:29:00PM -0800, Ashok Raj wrote: > Yes, that makes sense, Do you think we can add a note that the loading > failed? since the old -> new, new is coming from new microcode rev. It has failed when old == new. I.e., "microcode revision: 0x1a -> 0x1a" when the current revision on the CPU is 0x1a.
On Fri, Jan 06, 2023 at 09:45:24PM +0100, Borislav Petkov wrote: > On Fri, Jan 06, 2023 at 12:29:00PM -0800, Ashok Raj wrote: > > Yes, that makes sense, Do you think we can add a note that the loading > > failed? since the old -> new, new is coming from new microcode rev. > > It has failed when > > old == new. > > I.e., > > "microcode revision: 0x1a -> 0x1a" > > when the current revision on the CPU is 0x1a. That's fine too. I'll drop the patch.
> We issue that line unconditionally to give feedback to the user that the attempt > was actually tried. Otherwise, you don't get any feedback and you wonder whether > it is doing anything. > > The prev and next revision: > > "microcode revision: 0x%x -> 0x%x\n", > > will tell you whether something got loaded or not. Seems like a very subtle indication of a possibly important failure. E.g. There is some security update with new microcode to mitigate. User downloads the new microcode. Runs: # echo 1 > /sys/devices/system/cpu/microcode/reload [This fails for some reason] Looks at console # dmesg | tail -1 microcode revision: 0x40001a -> 0x4001a User doesn't notice that the version didn't change and thinks that all is well. Is there an earlier message that says something like this? microcode: initiating update to version 0x5003f -Tony
On Fri, Jan 06, 2023 at 09:35:41PM +0000, Luck, Tony wrote: > # dmesg | tail -1 > microcode revision: 0x40001a -> 0x4001a > > User doesn't notice that the version didn't change and thinks > that all is well. The version did change. One '0' less. Users don't read even if you put in there: "Corrected error, no action required." User still complains about maybe her hardware going bad and "should I replace my CPU" yadda yadda... But whatever, since both of you think this is sooo important, then pls do this: Success: "Reload completed, microcode revision: 0x%x -> 0x%x\n" Failure: "Reload failed, current microcode revision: 0x%x\n" Or something along those lines.
* Borislav Petkov <bp@alien8.de> wrote: > On Fri, Jan 06, 2023 at 12:29:00PM -0800, Ashok Raj wrote: > > Yes, that makes sense, Do you think we can add a note that the loading > > failed? since the old -> new, new is coming from new microcode rev. > > It has failed when > > old == new. > > I.e., > > "microcode revision: 0x1a -> 0x1a" > > when the current revision on the CPU is 0x1a. So wouldn't it make sense to also display the fact that the microcode loading failed? Seeing '0x1a -> 0x1a' one might naively assume from the wording alone that it got "reloaded" or somehow reset, or that there's some sub-revision update that isn't visible in the revision version - when in fact nothing happened, right? The kernel usually tries to tell users unambigiously when some requested operation didn't succeed - not just hint at it somewhat passive-aggressively. Thanks, Ingo
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 14d9031ed68a..e67f8923f119 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -455,11 +455,12 @@ static int microcode_reload_late(void) microcode_store_cpu_caps(&info); ret = stop_machine_cpuslocked(__reload_late, NULL, cpu_online_mask); - if (ret == 0) - microcode_check(&info); - pr_info("Reload completed, microcode revision: 0x%x -> 0x%x\n", - old, boot_cpu_data.microcode); + if (ret == 0) { + pr_info("Reload completed, microcode revision: 0x%x -> 0x%x\n", + old, boot_cpu_data.microcode); + microcode_check(&info); + } return ret; }