Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp634332rdg; Thu, 10 Aug 2023 14:17:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGV75CWZtKbWlJLwFarlF+yemvjia9iYiR6oBDLnH7mGRQXiUxhzxYutDq3CJOBJjTB8fjz X-Received: by 2002:a05:6a00:392a:b0:682:5e8f:d8ba with SMTP id fh42-20020a056a00392a00b006825e8fd8bamr4862574pfb.11.1691702275177; Thu, 10 Aug 2023 14:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691702275; cv=none; d=google.com; s=arc-20160816; b=d0x/k14WpSzSeOA7odovRaXC0tVtiLb/+XCTiP67zYt/4yHC8d9GgCf0rOJ9F/PRcm wrH/7msg/rliIsdnL2mjRdlgNQ/XxKMzPfhMYAzKKBNi19sY+WwxoOFZLAHihnwKsdMa 5f3oDizz0xiEO9czaDuxNMCLoi9QMPA9KIFO4H3mwpZmCukMyHCbSq742nsyF11pTxAK fXQVykpF8GXB2ODNRyYx4w7Sqwc1LuUBt1udlQgG3jf84OJAI6OraDbfTqX+F+zampH0 c1SSdkUQl/f6BZr5o7fw+RCwpu8GE7pW6uGSSYPiYnYXrsIBJI1VjuRBVojqc4iOUa5B Qi6w== 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=UWztl8vcPVfgGLDZDopQZ0wWq6wwFiGeSa4nVGSnH6A=; fh=9i6Q/vAb7deqNLOk4h4K88kq3iIWJkCrNUaKz07yt/I=; b=vpyIwvkURXBK+lh4WgGcCA4kIJ9EKZDuaGhVB3s70Rir8x5+ECDBQhRCq2rTOjboPx zukyWM7DfbvXxLCi9VDlXWF7lKYAzpO1BKq0RK+7iaCGKdwH+qXvgKIlF9Lq+2rZX5xr 1dmqhTJ4TcgR7ZxEfMcNloT9oYtpcEOcBkJei56esSTpv1rZlWt7ro52zHUACxcbpwIL SjRzmfDW3vlhyNoS3hQMd1QDnlg+gIM67hyJ++sGuXXpkmr4BRMxcHcQ7tKlCckn+DK9 ON8nOoFiaO8h71TzvdjeuRdO6sAglrgHBiOIW8GdlV3x62jtY6ubTusxspasVWxa+HFT RplQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=c8LOJjdq; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr8-20020a056a000f0800b0067af445c0dfsi2161038pfb.290.2023.08.10.14.17.43; Thu, 10 Aug 2023 14:17:55 -0700 (PDT) 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=@infradead.org header.s=desiato.20200630 header.b=c8LOJjdq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235364AbjHJUqk (ORCPT + 99 others); Thu, 10 Aug 2023 16:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235579AbjHJUqj (ORCPT ); Thu, 10 Aug 2023 16:46:39 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC5492123 for ; Thu, 10 Aug 2023 13:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=UWztl8vcPVfgGLDZDopQZ0wWq6wwFiGeSa4nVGSnH6A=; b=c8LOJjdqF708E+FvlCRMMhvThL gpg3qKds+0OobOq9HDnVOvxVLbmLhTiQANTR8cXHaVKySSNhSavq+VhlzTpmuUv6EooV2mWSETnOM pJPkdwSojnamSJrOWcha6akEczmY0xkIBqAhB8o0H1sUadmapZgStIwy5JjH13wTTv11KPQQTEqdi g/WWWYPF+crG3Xs6Kby4lElfth70hRkqmxU2bo9b9v8W/hZUdRN3glBRe91pEmkZALmuzlCpJWsTV 6GyNXC4Ng9JKhcLLRiEP8I9GXDiVoBvuVx5mlDmVHeOIXoUFPfMlb9VRBQcj1mJxACo7o8X5fu2Td 9H6xxjpw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qUCXm-006kNF-2d; Thu, 10 Aug 2023 20:46:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1953B30026C; Thu, 10 Aug 2023 22:46:06 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EC1E92103B6B3; Thu, 10 Aug 2023 22:46:05 +0200 (CEST) Date: Thu, 10 Aug 2023 22:46:05 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , x86@kernel.org, Borislav Petkov , Ashok Raj , Arjan van de Ven Subject: Re: [patch 28/30] x86/microcode: Handle "offline" CPUs correctly Message-ID: <20230810204605.GF212435@hirez.programming.kicks-ass.net> References: <20230810153317.850017756@linutronix.de> <20230810160806.562016788@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230810160806.562016788@linutronix.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 On Thu, Aug 10, 2023 at 08:38:07PM +0200, Thomas Gleixner wrote: > for_each_cpu_and(cpu, cpu_present_mask, &cpus_booted_once_mask) { > + /* > + * Offline CPUs sit in one of the play_dead() functions > + * with interrupts disabled, but they still react on NMIs > + * and execute arbitrary code. Also MWAIT being updated > + * while the offline CPU sits there is not necessarily safe > + * on all CPU variants. > + * > + * Mark them in the offline_cpus mask which will be handled > + * by CPU0 later in the update process. > + * > + * Ensure that the primary thread is online so that it is > + * guaranteed that all cores are updated. > + */ > if (!cpu_online(cpu)) { > + if (topology_is_primary_thread(cpu) || !allow_smt_offline) { > + pr_err("CPU %u not online, loading aborted\n", cpu); We could make the NMI handler do the ucode load, no? Also, you just need any thread online, don't particularly care about primary thread or not afaict. > return false; > } > + cpumask_set_cpu(cpu, &cpu_offline_mask); > + per_cpu(ucode_ctrl, cpu) = ctrl; > + continue; > }