From nobody Wed Nov 19 01:56:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1763418116; cv=none; d=zohomail.com; s=zohoarc; b=LV0lo9nZJ+A0vgeDWqn13mLqaMQ27q33qe9jSgw0DH7Km9NqcgvFmZ1oJuF2Nn2B1wFPP+2lOzO2X6ziZFFjqTxqKsy8d5vWMwSV76N6AfeAd72tdQdB9OWnILq0UmdGGfPPIpTvkLHk8uAKmLhUzcdBsfayrnonF2qnRqZS3EU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763418116; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nS8Y4MW3jKPXjFOtHxgsnr3CWj4mFip+xBgOcDXCg/w=; b=ZMjBBx/6I3STqUzp6RyIiBVzRTKqEiey4d0K6CuDnFvZSuhn3Y3mq9dcFDIBN1xEMYHkVzYopLC6UHG/ohIdEDWVYD3AAXe4wO0RyTd3fkIldM4i/AiCef+Sxs7cVUt8fpUlYsZ7UhHX+rKTmF02jhQG2pZNlWbCJekZZ1TQKMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1763418116076942.5717190331147; Mon, 17 Nov 2025 14:21:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1164263.1491275 (Exim 4.92) (envelope-from ) id 1vL7bJ-0002r2-DZ; Mon, 17 Nov 2025 22:21:33 +0000 Received: by outflank-mailman (output) from mailman id 1164263.1491275; Mon, 17 Nov 2025 22:21:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vL7bJ-0002qv-9F; Mon, 17 Nov 2025 22:21:33 +0000 Received: by outflank-mailman (input) for mailman id 1164263; Mon, 17 Nov 2025 22:21:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vL7bH-0002p7-BT for xen-devel@lists.xenproject.org; Mon, 17 Nov 2025 22:21:31 +0000 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [2a00:1450:4864:20::42f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c0ea62a4-c403-11f0-980a-7dc792cee155; Mon, 17 Nov 2025 23:21:25 +0100 (CET) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-429c82bf86bso2782635f8f.1 for ; Mon, 17 Nov 2025 14:21:25 -0800 (PST) Received: from localhost.localdomain (host-92-29-237-183.as13285.net. [92.29.237.183]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42c9628ebacsm15223789f8f.30.2025.11.17.14.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 14:21:23 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c0ea62a4-c403-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1763418084; x=1764022884; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nS8Y4MW3jKPXjFOtHxgsnr3CWj4mFip+xBgOcDXCg/w=; b=vCNM3mELmO9dkmqS4UklfoWzfr7aU1qefk5gGP0pSJZbt1hbyMcm1KqWEKGc6KovzY x2hinKAr0yyh1MzlHUntiFaeCqR/FVLnA8DuKQkPkkp0sqDTGVa3hrKFt3fQE03XMX7R YghcsAT3iqDdFExi0PethJvuisTuQwfUf47yw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763418084; x=1764022884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=nS8Y4MW3jKPXjFOtHxgsnr3CWj4mFip+xBgOcDXCg/w=; b=va7q7I9HxsmatfocgUEKFuRfLck6sjCOG7CXwM7JMFUR/Av8Sou4b/OmbeAf1CDA7b MFcqhsLY9/dsIVuH16T7QSK3wGUv6gXKRuJxaQvdu0BKWlIM8YxUbex/JXS+0kzAaL21 7jCCgYZRueSLtailGe/W/APTXRh/whWRk/c82uH0HTKe39ukQtMVrxIyb0svkb/ppCI7 hEhb4CZm8k6Kty9yiJisInCrg4qo3b29ZPRtMrhQeA2oal+xAgkX0mGOoBhK7Ar1JCHA cDcnD5Qx1raq+xZdbD758QKAHiMM4V2ZTndatf0/CrKRkDxHeBrLCYjwBhp0ECyGSAAl /LFw== X-Gm-Message-State: AOJu0Yxa9unlpz24SLHRlSMKQbWZt0ZYU/JSzR9C6FuppfCsioBhLvaI TBX04732crKgKoQwdLRcxZ5Ov6erSipt/4Zc24wVhbtjW9SyEEnN8LL4xcNO5ASHVDom+cobdRi rG8VIJEc= X-Gm-Gg: ASbGncuYrGPjbX+mS7mBOJpOA9HMnasxKQwCaskLVv+m+M23I+7H/SGbw9dHR8CAXg6 khDvIQXjnG9iOtE9iXgjQcq8ShyZq7I7vCJO5DMn6lxhN9XAcvVfx3JuloQMB3G3mV2thFixpPN 0cINxDczpLo1cbrcwB3YgGptH0+BZKVx59dfSqACGzraqdmSZq8aoRuzDGTCquMC08ZMzq381YC j8/p4tM8OB9Aizz/soLB3KG59qIF/qrPzPMzYGZPU686HZPKl+sqnTX8B/YnamDi/vmp4PHO5i0 ghDOkNzTIdQu9ASEX387sMn0HnaN9TLL18oYTilMmEL4h/TEXGqc3esdGTS5Q/a7fDcsEBmwdNc 0z6Q0ZkXCNn3oyDv/u8BArLgrOx7lJMUnzz5Y9cA7KmqUDEdVrWqIG8cZKvAhRzVE6ZkNVwnxTs m/CzTlAQDFPJRh71e13FlFaU1s6RhYqTvPbVksZyl85odD17Xrkso= X-Google-Smtp-Source: AGHT+IGKIO4YFmGZgie5fFXUNyXGbFUx6hLPcXshfCgZof896k2szlOzsHZXIZ+ThS69AfHIHp29FQ== X-Received: by 2002:a05:6000:4284:b0:42b:3cc6:a4d7 with SMTP id ffacd0b85a97d-42b593742f2mr12502867f8f.37.1763418084180; Mon, 17 Nov 2025 14:21:24 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 1/3] x86/ucode: Fix error handling during parallel ucode load Date: Mon, 17 Nov 2025 22:21:18 +0000 Message-Id: <20251117222120.473451-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251117222120.473451-1-andrew.cooper3@citrix.com> References: <20251117222120.473451-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1763418117458153000 wait_for_state() returns false on encountering LOADING_EXIT. control_thread_fn() can move directly to this state in the case of an early error. It is not an error condition for APs, but right now the latest write into stopmachine_data.fn_result wins, causing the real error, -EIO, to get clobbered with -EBUSY. e.g.: # xen-ucode /lib/firmware/amd-ucode/microcode_amd_fam17h.bin --force Failed to update microcode. (err: Device or resource busy) (XEN) 256 cores are to update their microcode (XEN) microcode: CPU0 update rev 0x830107d to 0x830107c failed, result 0x= 830107d (XEN) Late loading aborted: CPU0 failed to update ucode: -5 Drop all the -EBUSY's, and treat hitting LOADING_EXIT as a success case. T= his causes only a single error to be returned through stop_machine_run(). e.g.: # xen-ucode /lib/firmware/amd-ucode/microcode_amd_fam17h.bin --force Failed to update microcode. (err: Input/output error) (XEN) 256 cores are to update their microcode (XEN) microcode: CPU0 update rev 0x830107d to 0x830107c failed, result 0x= 830107d (XEN) Late loading aborted: CPU0 failed to update ucode: -5 Fixes: 5ed12565aa32 ("microcode: rendezvous CPUs in NMI handler and load uc= ode") Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 Xen 4.19 and earlier hit this case naturally, without the need of --force. --- xen/arch/x86/cpu/microcode/core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 1d1a5aa4b097..ecee400f28a6 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -260,7 +260,9 @@ static int secondary_nmi_work(void) { cpumask_set_cpu(smp_processor_id(), &cpu_callin_map); =20 - return wait_for_state(LOADING_EXIT) ? 0 : -EBUSY; + wait_for_state(LOADING_EXIT); + + return 0; } =20 static int primary_thread_work(const struct microcode_patch *patch, @@ -271,7 +273,7 @@ static int primary_thread_work(const struct microcode_p= atch *patch, cpumask_set_cpu(smp_processor_id(), &cpu_callin_map); =20 if ( !wait_for_state(LOADING_ENTER) ) - return -EBUSY; + return 0; =20 ret =3D alternative_call(ucode_ops.apply_microcode, patch, flags); if ( !ret ) @@ -313,7 +315,7 @@ static int cf_check microcode_nmi_callback( static int secondary_thread_fn(void) { if ( !wait_for_state(LOADING_CALLIN) ) - return -EBUSY; + return 0; =20 self_nmi(); =20 @@ -336,7 +338,7 @@ static int primary_thread_fn(const struct microcode_pat= ch *patch, unsigned int flags) { if ( !wait_for_state(LOADING_CALLIN) ) - return -EBUSY; + return 0; =20 if ( ucode_in_nmi ) { --=20 2.39.5 From nobody Wed Nov 19 01:56:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1763418117; cv=none; d=zohomail.com; s=zohoarc; b=VZjf9jq/onPaM89eKWHh4duqiekTSUyNTVzs8K/nL6hq87pSraEXh64qqKamsZk//idHZeM7A59mP6pJcmjN0Ns87a612lkxGEWnI6VZRr2ZiNoK+k1XFw3qDat6bgdMXO05WY7y3So0r4lhiU6WlF7eNIOOJ0TI+Fry+rz9KxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763418117; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0Oyky22DR2eOVRpdxtWGlLFx/KrwmQftfBci2BIb+7E=; b=lhv1SDRu6Vt/3xQpIPpVMicEstzzENBaI4rwhCF7bYuONRJPFYLbADSlOUnonvm8J5poqGHuZ+GZBJQ4pN1COEIsKu9bbqzOXVcDbPBqRPn/eSsXiFIZcZVWE8dCG0XnbiwnIiy5OoqjMpDmYpNAh7hc7vlKBGoZoGD6R/1y1Mg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1763418116984777.6309596155197; Mon, 17 Nov 2025 14:21:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1164265.1491285 (Exim 4.92) (envelope-from ) id 1vL7bN-00039g-JJ; Mon, 17 Nov 2025 22:21:37 +0000 Received: by outflank-mailman (output) from mailman id 1164265.1491285; Mon, 17 Nov 2025 22:21:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vL7bN-00039Z-GW; Mon, 17 Nov 2025 22:21:37 +0000 Received: by outflank-mailman (input) for mailman id 1164265; Mon, 17 Nov 2025 22:21:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vL7bL-0002p7-RG for xen-devel@lists.xenproject.org; Mon, 17 Nov 2025 22:21:35 +0000 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [2a00:1450:4864:20::32e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c1703c2c-c403-11f0-980a-7dc792cee155; Mon, 17 Nov 2025 23:21:25 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4775ae5684fso24600025e9.1 for ; Mon, 17 Nov 2025 14:21:25 -0800 (PST) Received: from localhost.localdomain (host-92-29-237-183.as13285.net. [92.29.237.183]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42c9628ebacsm15223789f8f.30.2025.11.17.14.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 14:21:24 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c1703c2c-c403-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1763418085; x=1764022885; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0Oyky22DR2eOVRpdxtWGlLFx/KrwmQftfBci2BIb+7E=; b=hR3VCmkN8PPMazI78aaEG2OjdrUO4IhJQJiC4ibrQFCgleH/1y+tq5aUvtcKU98T6o pDV8p3kIXa/IlwraktA6gX/6MPC9ev2mL4Yy1gnFijqrwF8YaxEVdVMpyvda6HJuABxC 58/NzLYTqcGlHBdSXPHppWyp92190lyw2HA00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763418085; x=1764022885; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0Oyky22DR2eOVRpdxtWGlLFx/KrwmQftfBci2BIb+7E=; b=MXgPKo0ZZHOn6rZdw8QS+ONQ1KEjtvnhQ2i/JJsz97x91VD3nmYG4rmNHutNx9uiV9 wHxxD4ZhXyCLA4FytxU6+oBPMoD8lCEiZxDZgvWvlGsVE12oy1jzID+HJ+wxYMmnqRIJ YeTw9Ykru1PaJC+W16zKJB4wIOTFbC7lZUY5+e+7ZedLgrb9W9KZKx0Mih2PhWlo1oU8 scoggRRV4PHEZdUqEa6EufMy0NYncsSCJnZUOQnJB2dkbMS0TBxHE+l6DrOnpJTJ9wpY 8tICfCsTLqg6WGP+1j6LG4O0t6hg87stz/jGTnAxbn8jwfp/xhxMkRVv4gxMnEbMB04L KIkQ== X-Gm-Message-State: AOJu0Yz9IjiGco7N3xocd21WgiNw1msH9Kih0sdjeUhlSDsWQYKOALHi uHh9CHIc33TiWR6SG4Zgvtkthk0QDzDR96UnpjVxZstgB7dlw9RNYgCktXX31yip++Oe/WEsP2s EnSt3uR8= X-Gm-Gg: ASbGncvRgXfWSBsd88LKr/9bHk4FREcCWlEicFIxUwMypOWtzbtjtR1RhY8GOfie6jQ 5LOAzFlYzzmyUjmkC5/CmUbbF1qtP5MTPqKyNfHSjPeQB1KiV2iC+IuEsLgLIZgPTxSQrLJobKp 34wjL1v2inJNqIOXibaGMuXO6RiVH5Ma2YcK4t0io3l4UadeqCwln2B2itwWoYUh30cIvM/1PjP t5cCkt3HshwY20u3bzqJri/t4pBsfoMz0XCN5OzTXwnbfSm1yDhh+xK7ClU0UPGqSZDDgWpF0sk QwT3qdijNkyjuE7UpW6aTEgrich29KdkP560+mKe+tjx2s8k09CEY31IOeUGTG6Tg16P6USnbT1 7X8Az0WxISLxLLuCkP5lGdXX3qK2/KgscBSWcotN3AA5ixwEKQj+Fd0GzFtIUL2Nxu9yBSvHr1e rlnnbsorzsBKIyJ5/u+hSmBsvYkgj3akWOjM/STK3F8lgutbvm1MGgW7ZcYbAqew== X-Google-Smtp-Source: AGHT+IH5hdJmF4OZUnYXn9fedk7MQhwP9+GLhqI7ZFZ/TxlwYo0avPssMKexuH2SqnbyvjRoD9oU4A== X-Received: by 2002:a05:600c:8b4b:b0:477:63a4:88fe with SMTP id 5b1f17b1804b1-4778fe50df1mr126864095e9.2.1763418085122; Mon, 17 Nov 2025 14:21:25 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 2/3] x86/ucode: Drop structurally unreachable ASSERT()s Date: Mon, 17 Nov 2025 22:21:19 +0000 Message-Id: <20251117222120.473451-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251117222120.473451-1-andrew.cooper3@citrix.com> References: <20251117222120.473451-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1763418118523158500 It's impossible for wait_for_state() to return false when looking for LOADING_EXIT, so much so that the optimiser can drop the ASSERT()s. No functional change. Fixes: 5ed12565aa32 ("microcode: rendezvous CPUs in NMI handler and load uc= ode") Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpu/microcode/core.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index ecee400f28a6..7aaf62839f56 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -320,12 +320,10 @@ static int secondary_thread_fn(void) self_nmi(); =20 /* - * Wait for ucode loading is done in case that the NMI does not arrive - * synchronously, which may lead to a not-yet-updated CPU signature is - * copied below. + * NMIs may not be delivered synchronously. Wait for the primary thre= ads + * to be done. */ - if ( unlikely(!wait_for_state(LOADING_EXIT)) ) - ASSERT_UNREACHABLE(); + wait_for_state(LOADING_EXIT); =20 /* Copy update revision from the primary thread. */ this_cpu(cpu_sig).rev =3D @@ -345,12 +343,10 @@ static int primary_thread_fn(const struct microcode_p= atch *patch, self_nmi(); =20 /* - * Wait for ucode loading is done in case that the NMI does not ar= rive - * synchronously, which may lead to a not-yet-updated error is ret= urned - * below. + * NMIs may not be delivered synchronously. Wait for the primary + * threads to be done. */ - if ( unlikely(!wait_for_state(LOADING_EXIT)) ) - ASSERT_UNREACHABLE(); + wait_for_state(LOADING_EXIT); =20 return this_cpu(loading_err); } --=20 2.39.5 From nobody Wed Nov 19 01:56:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1763418118; cv=none; d=zohomail.com; s=zohoarc; b=BMDbbaixPwIt1SswrBSWDgRF+pBDKneXCuRQ0v+8eu5As1cgMUD236dqv9MKD9cgWLBVjJqmYDqRdMaqlbp+MYZEKoSiXbhsl9yBAh8TGmSUKWF4pzqJ+czF5UCCriDmBoAD28BduIQKp0XWhDmQHXsXgSC6u3Puq2GGXQ0wTIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763418117; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0EH5GucMwXGqWhJcPk1xUrIEMbDP0L0S0sWt+dj5pD8=; b=lcc8wttNDVD34seJ5qDAFRIp48wy/Cejuz7BN7bCBguLNTmuBW+5bbGMPpR7tfTuIwQhD+LlHLJgL/iblm96cFRfM4GGBo6v7waHaLMo9tpf3yKUvzdnKG1tnXsvbS+8tjTNVA/Vb+pGfozKehk87IDBtTLjoVyXw9cFi1lQk0Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1763418117990925.5388166816016; Mon, 17 Nov 2025 14:21:57 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1164262.1491264 (Exim 4.92) (envelope-from ) id 1vL7bF-0002bT-5q; Mon, 17 Nov 2025 22:21:29 +0000 Received: by outflank-mailman (output) from mailman id 1164262.1491264; Mon, 17 Nov 2025 22:21:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vL7bF-0002bM-3C; Mon, 17 Nov 2025 22:21:29 +0000 Received: by outflank-mailman (input) for mailman id 1164262; Mon, 17 Nov 2025 22:21:27 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vL7bD-0002Nh-BI for xen-devel@lists.xenproject.org; Mon, 17 Nov 2025 22:21:27 +0000 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [2a00:1450:4864:20::32c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c1f41323-c403-11f0-9d18-b5c5bf9af7f9; Mon, 17 Nov 2025 23:21:26 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-477632d9326so33051505e9.1 for ; Mon, 17 Nov 2025 14:21:26 -0800 (PST) Received: from localhost.localdomain (host-92-29-237-183.as13285.net. [92.29.237.183]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42c9628ebacsm15223789f8f.30.2025.11.17.14.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 14:21:25 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c1f41323-c403-11f0-9d18-b5c5bf9af7f9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1763418086; x=1764022886; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0EH5GucMwXGqWhJcPk1xUrIEMbDP0L0S0sWt+dj5pD8=; b=KLsytlqYBD4WA88bUHDYY/MmPNYHKi9ztastV9P6lF+bMAqMOyDmbx16QJeHi0WKTs h2gPEnixUshGtlXuC8ptETduFikZCZBN6oetTC9YJpxH7SKRRriNktr2QruR4j9iPsVT Bwe1eaGvog1gf5iHQPK2F0gbV8JllhwBhsV50= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763418086; x=1764022886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0EH5GucMwXGqWhJcPk1xUrIEMbDP0L0S0sWt+dj5pD8=; b=tSPmWDtIbUhVZnUVTAwm1E34q1RXY5mnGFrHtTWKiEz1ljwrAx2+NPf3R2F8Dl2Lee kKqksHxfuWXWZTJCGXAQ4opQqFNajXweyMnGVinX0HoYjCqpij6AaHhhkjseu9347lvH a72jHqfokYFFW3mh6bCNrVV1TKU9O0Ghl2f3yGmPgdkumxUM3MFpMrtCu8yYksg1zuQ+ NWTFzgf0adTo9nDR0QbMNo6F6ZQBzGn29yFRXynb4hQhtvDDaRdwfEPNTWyeKM+A+ics dT1mJKYhte/SznS30jD1YAMVb3CxQFkJdR6eIwy8S4VO8h21XcU6HrdOp98Qhrk6AV7s 0HUA== X-Gm-Message-State: AOJu0YwSfiooF7YQ+qQJQ5nJ3vi7hPIzgLfycCVWynxHZeWNgR7wyoXf bqQh0c4nUeR9j1hefOIKrbFogpxyu1Px4GIsMZYmOR7fZh6SOVn+YmXeSnNQmrFCNX2Er2QU/BQ NHmxdUeA= X-Gm-Gg: ASbGncsKoKb/wAro0/mtpmzMK0JRL06h1Y5ZnDuVMK3W63SbsodfybF1MGDPahq1gyD EqpuJPVm1LX4iFpanaG43a5IiDUMXMHyuzE/mGRPakN3JZLqVs/JlP0Re648WJgI6F6yBO2CJvR vgT962yWDs0sPhlvZriV1xTC6X5y4rhuA9SJYq6wiyFv2buI7M5balZtM/de3SF6cQRwAEGnlme SVPdXqpMcP4p7nplcsv/yAEG3SD/lalMC88yCJ78/z/XYE1q+XAjgvWj+QzRJ0jzW9TQlP3JpBf Cpa9/Vecx9m+luKeEcj0To8fiAA9x/ZnHKbLR8FMfEDnB5B6GR0nOx6FcwqjXvOEJ5+7BvrDD6G XjiuvojehM9Ak45MSZ2OS0wMhid5tzCh4BQaMZp+nlmKeLDHO0jviP+VxtF8wFKrgqf5EuD7qp8 FMbqy2yHMacxapzdZs6WdElFEn0cAD7EAbCM/Ke82wI8cJabeRqT0= X-Google-Smtp-Source: AGHT+IFMby+nD02SNTcy7GT8KlTdwfb6ZYI/udhxHT1ifds0MnlO/6g25QzPN4r7zPtISkr+ekvslA== X-Received: by 2002:a05:600c:4744:b0:46f:b327:ecfb with SMTP id 5b1f17b1804b1-4778fe5ebb8mr142554435e9.9.1763418086033; Mon, 17 Nov 2025 14:21:26 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 3/3] x86/ucode: Create a real type for loading_state Date: Mon, 17 Nov 2025 22:21:20 +0000 Message-Id: <20251117222120.473451-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251117222120.473451-1-andrew.cooper3@citrix.com> References: <20251117222120.473451-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1763418119078153000 Using typeof() in wait_for_state()/set_state() unnecesserily cryptic, and m= ore verbose than using a proper type. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpu/microcode/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 7aaf62839f56..fe47c3a6c18d 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -70,12 +70,13 @@ static unsigned int nr_cores; * - LOADING_ENTER: all CPUs have called in. Initiate ucode loading. * - LOADING_EXIT: ucode loading is done or aborted. */ -static enum { +typedef enum { LOADING_PREPARE, LOADING_CALLIN, LOADING_ENTER, LOADING_EXIT, -} loading_state; +} loading_state_t; +static loading_state_t loading_state; =20 struct patch_with_flags { unsigned int flags; @@ -237,9 +238,9 @@ static bool cf_check wait_cpu_callout(unsigned int nr) return atomic_read(&cpu_out) >=3D nr; } =20 -static bool wait_for_state(typeof(loading_state) state) +static bool wait_for_state(loading_state_t state) { - typeof(loading_state) cur_state; + loading_state_t cur_state; =20 while ( (cur_state =3D ACCESS_ONCE(loading_state)) !=3D state ) { @@ -251,7 +252,7 @@ static bool wait_for_state(typeof(loading_state) state) return true; } =20 -static void set_state(typeof(loading_state) state) +static void set_state(loading_state_t state) { ACCESS_ONCE(loading_state) =3D state; } --=20 2.39.5