Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2789445rdb; Fri, 22 Sep 2023 08:25:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFW60UB8YAZKFzekO8Tq9FrigBIC8UItEInyAA8wyE1Dt4tEyios5Up5IZyT5TiU7MgLzTP X-Received: by 2002:a05:6a21:271c:b0:14c:c393:402d with SMTP id rm28-20020a056a21271c00b0014cc393402dmr6877904pzb.34.1695396343988; Fri, 22 Sep 2023 08:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695396343; cv=none; d=google.com; s=arc-20160816; b=jBXKYyaDNdpOiB8xevCOGvHCaExD1kh1ZT1rtnxMLYcI1fT+05Hh01BVyfwHF9U1+J bHGP7551OZjbfc5liiOIwY1gvO3Bk4BA88dYrOuHpJcEEiHHrNUDonBYfKFaXOTSPsHi WFpBYnL2nVdhihv7FdQNj92VabMN30cEKMatz0MTix4ZeEEUVA1E/Jyti7A0SBx6l2mr YzpvdmFcKvexAeAh25d4XWF9yzm3VxJ5WdWMB1lLLsn9+nNb4zolLFhZfPRaaqvFHhrB vXY/mLAPnTI3PBHLFmka5Qznh5G9Afpxm3FcIlhihbItIu8uNaMay5HCO3CPR4UhhMCo /z9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YP/GpBaY3aJ3tL35B85TIBU2s0KkU0hbtRyFI9Ecda0=; fh=GAw9pbIAZIwCH32PQjszcv6fk+98j3/7OwMbKqyoAZI=; b=L1O7/NCw0fXz42sYeNY1tITiNT/H/5BoxDo0ni/o6pUpWO3PnQN74k9kshbr58Oeay h1SyNuygPU7rwCWOj2xSQKZ+6Q6lQIQ4ShqOdgYT+bn7vAHymd1JSOfPTdlDC+iCER3O bEk7Dr+wu5jCPXnUUdXtyoLgJewm/eXFl5+nLdNzHa7AaZGfEvH0M/Crm8YgzOnN2sJq ummg5GirDWTAuVkmJ3/s8ydxGCkCoaLjNq4QkQ12r/y9jCW4bEX2j2ysILC+gXork/n2 OwJ74daMS//a0Fwf+UPkYv4uZ/JXulOZxo1MMzTn4uRMZsz1pX2xgOf5BIK1XiBU5meo N/gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=bFtPNWap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id fo10-20020a056a00600a00b0068fa57cc15bsi4005708pfb.124.2023.09.22.08.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 08:25:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=bFtPNWap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A1B3083D25B2; Fri, 22 Sep 2023 06:42:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234152AbjIVNmY (ORCPT + 99 others); Fri, 22 Sep 2023 09:42:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234124AbjIVNmW (ORCPT ); Fri, 22 Sep 2023 09:42:22 -0400 Received: from mail.alien8.de (mail.alien8.de [IPv6:2a01:4f9:3051:3f93::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86967195 for ; Fri, 22 Sep 2023 06:42:16 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id BED6F40E01AC; Fri, 22 Sep 2023 13:42:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id eBn7QlVu5tOr; Fri, 22 Sep 2023 13:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1695390132; bh=YP/GpBaY3aJ3tL35B85TIBU2s0KkU0hbtRyFI9Ecda0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bFtPNWapK5HnoRZVwOurOhvDdloKFJnED+Y+eAShLa7SJaJapLEXbE0LV3gCgSXkA sjQuY9YGxRllFMICUa2mdzWF2FbdcB1lk1X5fq7XnCancG4Ni998bonb84kQmF2iAr BVgU64PuGmgo4mB0rQ2hLUYhb8prnLHpMNPzKZM3wnSTjmdHEbqlCQns4h8RRt9bIF SJqZiBFj2leOPiB9vLUsmY7lYooSU9AWVidkNh4JEaeEKmBbDPYdzhYLC4VAXGFyjN QuAy3Ho8BFyDoWfgb4Tfj34aOTdzV9RnncvbGVrma1BtgOkCPwqUwAu8EVJjj2/HgG AXChfsLsqDgsoGGPdPREecrMXBBbODtN0rb+olvFt2cgw+ykcuVkSFjUgNyRzL2p69 F0Z8d3C1CIjjehzrdkZG2H5MpSbysvS4Gq/FJ5kfwa6F/WOaQr/9Ytpjscfz2zDub+ 2my3XeEp/sbG9oauwMaiRePz7Ti3OoU06Jc+I1dIVKVoA2Y2mnZUxsAvp1kk7UmdNI 2m0fYSc0Iz5Hk6DTjC2P3w686czElvvXEGpwtXnKS0FKXGVTI3J/5B20Rt44Il8z78 K5mOdCuVWaKRRQg4Op0oASjKMvAynNaCoyfHlPX0/Ge7MNo/xGnZhVLhRsUVvlTaAi Boa31w1iofHvULqUs22zpFDw= Received: from zn.tnic (pd953036a.dip0.t-ipconnect.de [217.83.3.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 044C240E01A1; Fri, 22 Sep 2023 13:42:05 +0000 (UTC) Date: Fri, 22 Sep 2023 15:42:00 +0200 From: Borislav Petkov To: Thomas Gleixner Cc: LKML , x86@kernel.org, "Chang S. Bae" , Arjan van de Ven , Nikolay Borisov Subject: Re: [patch V3 18/30] x86/microcode: Handle "nosmt" correctly Message-ID: <20230922134200.GIZQ2ZqKbKM/bZHbQ4@fat_crate.local> References: <20230912065249.695681286@linutronix.de> <20230912065501.899886649@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230912065501.899886649@linutronix.de> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 22 Sep 2023 06:42:28 -0700 (PDT) Just textual nitpicks. Otherwise looks nice. On Tue, Sep 12, 2023 at 09:58:12AM +0200, Thomas Gleixner wrote: > From: Thomas Gleixner > > On CPUs where microcode loading is not NMI safe the SMT sibling which is > parked in one of the play_dead() variants, these parked CPUs still react > on NMIs. s/, these parked CPUs still react/still reacts/. Simpler. > So if a NMI hits while the primary thread updates the microcode > the resulting behaviour is undefined. The default play_dead() > implementation on modern CPUs is using MWAIT, which is not guaranteed to > be safe against an microcode update which affects MWAIT. s/an // > +/* > + * Ensure that all required CPUs which are present and have been booted > + * once are online. > + * > + * To pass this check, all primary threads must be online. > + * > + * If the microcode load is not safe against NMI then all SMT threads > + * must be online as well because they still react on NMI when they are s/react on NMI/react to NMIs/ > + * soft-offlined and parked in one of the play_dead() variants. So if a > + * NMI hits while the primary thread updates the microcode the resulting > + * behaviour is undefined. The default play_dead() implementation on > + * modern CPUs is using MWAIT, which is also not guaranteed to be safe s/is using/uses/ > --- a/arch/x86/kernel/cpu/microcode/internal.h > +++ b/arch/x86/kernel/cpu/microcode/internal.h > @@ -20,18 +20,17 @@ enum ucode_state { > > struct microcode_ops { > enum ucode_state (*request_microcode_fw)(int cpu, struct device *dev); > - > void (*microcode_fini_cpu)(int cpu); > > /* > - * The generic 'microcode_core' part guarantees that > - * the callbacks below run on a target cpu when they > - * are being called. > + * The generic 'microcode_core' part guarantees that the callbacks > + * below run on a target cpu when they are being called. s/cpu/CPU/ while at it. > * See also the "Synchronization" section in microcode_core.c. > */ > - enum ucode_state (*apply_microcode)(int cpu); > - int (*collect_cpu_info)(int cpu, struct cpu_signature *csig); > - void (*finalize_late_load)(int result); > + enum ucode_state (*apply_microcode)(int cpu); > + int (*collect_cpu_info)(int cpu, struct cpu_signature *csig); > + void (*finalize_late_load)(int result); > + unsigned int nmi_safe : 1; > }; -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette