From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E7FDC4708D for ; Wed, 7 Dec 2022 20:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbiLGU0D (ORCPT ); Wed, 7 Dec 2022 15:26:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiLGU0B (ORCPT ); Wed, 7 Dec 2022 15:26:01 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C5C58BFA for ; Wed, 7 Dec 2022 12:26:00 -0800 (PST) Received: from zn.tnic (p200300ea9733e73d329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e73d:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 2E18B1EC0426; Wed, 7 Dec 2022 21:25:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1670444759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=FN5Arro5cGI7t/lnI9RReHnWb8Kmqs2yj4TIbTdUO00=; b=XTjyC1xD6dPYsokY9eeYwTRLhSfHNMnVZwQRwYs9/ZQUU2q57DNHJGRAeNXTTkJkSFuNtO YVDDiKbc+iIypc0XMSbFN19CIJjuR2HnSdDmLPl/FLcY9QwCL5RCmtU3FRGTQ0amSMpmaQ m8POq8pvlWQiFRUv23ZUoIqaQpql6/I= Date: Wed, 7 Dec 2022 21:25:54 +0100 From: Borislav Petkov To: Ashok Raj Cc: X86-kernel , LKML Mailing List , Dave Hansen , Tony Luck , alison.schofield@intel.com, reinette.chatre@intel.com Subject: Re: [Patch V1 4/7] x86/microcode/core: Take a snapshot before and after applying microcode Message-ID: References: <20221129210832.107850-1-ashok.raj@intel.com> <20221129210832.107850-5-ashok.raj@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221129210832.107850-5-ashok.raj@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 29, 2022 at 01:08:29PM -0800, Ashok Raj wrote: > The kernel caches features about each CPU's features at boot in an > x86_capability[] structure. The microcode update takes one snapshot and > compares it with the saved copy at boot. > > However, the capabilities in the boot copy can be turned off as a result of > certain command line parameters or configuration restrictions. This can > cause a mismatch when comparing the values before and after the microcode > update. Hmm, but if that has happened, the capabilities will be turned off in your @orig argument below? Or are you saying that this copy_cpu_caps() read before the update will overwrite the cleared bits with the their actual values from CPUID so that what you really wanna compare here is *hardware* CPUID bits before and after and not our potentially modified copy? I.e., some bit in CPUID is 1 and we have cleared it in our copy. Close? If so, then this should be specifically called out in the commit message. > +static void copy_cpu_caps(struct cpuinfo_x86 *info) If anything, that function should be called store_cpu_caps() and store it into its parameter *info. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette