From nobody Tue May 5 09:34:06 2026 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=1776707202; cv=none; d=zohomail.com; s=zohoarc; b=F7QXfP/pXfgE+Myao5cvgZTSZE0+jMvgGqPchkl1xCBkCadnret0cnH3zCRN3XuuxT5yBNtBNuXGDvaFpZHDhweJqBrpnVptfg8RvaltDpLjTJCo93btMtiWR39O9RtW9CtOIzfwxXnT5rFRdtLsSCJ64fuCbFfyQ/sZ/o5jp+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776707202; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nQ1dtS+UVA2Zj6+lVhX2vjjkpgXkpEEgSIyaxC0p6Kw=; b=cazHa7JT/VFCY/52O93+hObo3C8fz/rtvAPS+Z1P5kihgstwt30HDr+/TbyQVDjhAkGs+wO4Iws0DBV4NOLdcX2rc+QZCNdorTMkOwf9YTE1ze0JxHR7w2Ao6fQf6u8BHC90Si5fqfs6eHiKPIz2ue4hxucWSqFrXH3BO4TUO8A= 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 1776707202323133.5442116517595; Mon, 20 Apr 2026 10:46:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1286391.1567463 (Exim 4.92) (envelope-from ) id 1wEshH-0004ed-Nj; Mon, 20 Apr 2026 17:46:11 +0000 Received: by outflank-mailman (output) from mailman id 1286391.1567463; Mon, 20 Apr 2026 17:46:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wEshH-0004eW-KM; Mon, 20 Apr 2026 17:46:11 +0000 Received: by outflank-mailman (input) for mailman id 1286391; Mon, 20 Apr 2026 17:46:10 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wEshG-0004e7-6x for xen-devel@lists.xenproject.org; Mon, 20 Apr 2026 17:46:10 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wEshD-0090Zo-Ba for xen-devel@lists.xenproject.org; Mon, 20 Apr 2026 19:46:08 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69e6663b-e002-0a2a0a5209dd-0a2a4501cb2a-24 for ; Mon, 20 Apr 2026 19:46:08 +0200 Received: from [209.85.128.45] (helo=mail-wm1-f45.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 69e66660-c1f2-0a2a45010019-d155802de4ea-3 for ; Mon, 20 Apr 2026 19:46:08 +0200 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-488ad135063so26926565e9.0 for ; Mon, 20 Apr 2026 10:46:08 -0700 (PDT) Received: from localhost.localdomain (host-78-146-242-105.as13285.net. [78.146.242.105]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a0c13sm96463505e9.21.2026.04.20.10.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2026 10:46:07 -0700 (PDT) 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1776707168; x=1777311968; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nQ1dtS+UVA2Zj6+lVhX2vjjkpgXkpEEgSIyaxC0p6Kw=; b=nn0C7kY6Z+YdJS3Zo7Z1bmD/LMbrbmEdSjQK6jYSHTih26fbtrt/hSlvComNGKjRHC ++nz2fkge93vpdrn5ZzZOFiUEPoZZlZCfpdQ3NgdUkx/pODAhazAoXQ2wKMHcFU3AW7T pzVQ8fHmQGJE2Z/EdyH3U9Ho7wmMWil5Su5Q4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776707168; x=1777311968; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nQ1dtS+UVA2Zj6+lVhX2vjjkpgXkpEEgSIyaxC0p6Kw=; b=S+DieXm7aC19VK5KQxBzpNkeblyOKYIP2gwDCsF/r61DmjCZgA4R5n2TFLOkS7a7KE MR4i6wJDNhDRfbl/gb1Ne6sZZSJjXBhi8RPzLpIhBUrE8I185VoONty/Dl9caSVjajC6 jE8dx4IOg/bwi4ipJjL2RsfTiOLdmyJldupCLCt0hWXNn6rER1JIKa5LGQ7zKtIBXB75 1xXIYyWIFh2SuDsfb/35SDZomcNwTpL7B1ddWxwMY9VHkFsXPWOhe0FF2xhKv4KSknQP XAOGKRuf+rIqrJIbTK0TMIX56DAFSM1HwAnVe5y9DQOQo0QhKbXYFb32MenN0t4RrWN/ aD1A== X-Gm-Message-State: AOJu0YwxZq9VnRbYZAlpYAOmetI2zoYMjOsKIMQWsjn1iqbW0C4fnQbp q7T5bLJktPHdT+Pwfg51jNRVbGRdJNFQ/6W2HuLZ3qZmgPq2HwT2WnmMCsVXFIUHBGCtEuxVSc2 c2b18pL4Z9g== X-Gm-Gg: AeBDiesoSx6CWUcGE++IpQOz9M2G75uTumbIx85FFOi8EBnN2bpj60gwx+zt5ZayThB fQn1DXeJ0p8bAdNUoVMNAkvdOG7JZxmpfcJyXXkB1H+28EnnqAMT+vQUmtHeu0W/hKhMthNYUzZ YvaqpIL5QiNwoOvcgtTi0+3XsnhUN6a8yfN7kUxFZY/bECiME7VOR/0vXt7yCr1SnZvH8l6m1Ya PKyROhGzk46pJQnfHcCrBeI1VrgXnBkX/6Va2i6qH1MId76ycZn8DHmOK631C+YbcuNSSlFCjVA HdYbZDRn3A6zZVGjSrezpRhqAKb3X1uUmDxsfDram2BMGLIlTBFG68IOj/UdJtUhZAiLQPApJtI yHaFPPWtSgBIGV2aSDBjxqqM69yrs4veUdsg0A9U208n9KOnNee1n6JQcLTSGv5tmbYHk8wGrhC ubH1W2bFKLF1A2IsK4yEXFHN41DXGvFdBZI0O6dyhBcqmwsOVKWbenAQgTtvaEG34kaL4AqvA6l sKxIS/MRAon1jpwSwqekCaJHA== X-Received: by 2002:a05:600c:8909:b0:489:1b10:d896 with SMTP id 5b1f17b1804b1-4891b10dd45mr72830655e9.0.1776707167691; Mon, 20 Apr 2026 10:46:07 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie Subject: [PATCH Xen 4.20] x86/apic: Fix asm() constraints in TMICT calculation Date: Mon, 20 Apr 2026 18:46:05 +0100 Message-Id: <20260420174605.706329-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d62444/1776707168-B6862FF4-1804EAD3/0/0 X-purgate-type: clean X-purgate-size: 1925 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1776707203804154100 The encoded MUL is 64 bits, so writes %rdx too. At a minimum, this needs expressing as a clobber. Also fix a logical disconnect between 'overflow' being the carry flag not t= he overflow flag. CF and OF are always the same for MUL instructions, so use = the flag which matches the variable name. Fixes: d5c70a51bfbe ("x86/APIC: handle overflow in TMICT calculation") Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Teddy Astie Only affects 4.20 (and earlier) where __builtin_umull_overflow() can't be used. I've kept this form because it produces best code generation for GCCs which support flag outputs. An alternative would be to capture product_hi and check the nonzero-ness, as that's how OF/CF are produced in hardware, which would be better code generation on very old GCCs. --- xen/arch/x86/apic.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index daf597ed44b7..764ee1e98f77 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1317,9 +1317,10 @@ int reprogram_timer(s_time_t timeout) =20 apic_tmict =3D UINT32_MAX; asm ( "mul %[expire]\n\t" - ASM_FLAG_OUT(, "setc %[cf]") - : "=3Da" (product), [cf] ASM_FLAG_OUT("=3D@ccc", "=3Dqm") (o= verflow) - : "0" ((unsigned long)bus_scale), [expire] "r" (expire) ); + ASM_FLAG_OUT(, "seto %[of]") + : "=3Da" (product), [of] ASM_FLAG_OUT("=3D@cco", "=3Dqm") (o= verflow) + : "0" ((unsigned long)bus_scale), [expire] "r" (expire) + : "rdx" ); if ( !overflow && (product >>=3D BUS_SCALE_SHIFT) < apic_tmict ) apic_tmict =3D product; base-commit: 5f7054258c6937b74aee411f16db5eb54ce9fda1 --=20 2.39.5