From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0A23606A32A for ; Tue, 1 Dec 2026 16:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=edera.dev header.i=@edera.dev header.a=rsa-sha256 header.s=google header.b=Pz+6QYZW Received: from list by lists.xenproject.org with outflank-mailman.1508783.1701641 (Exim 4.92) (envelope-from ) id 1xYQPO-0000ms-Cr; Tue, 01 Dec 2026 16:08:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1508783.1701641; Tue, 01 Dec 2026 16:08:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xYQPO-0000ml-A9; Tue, 01 Dec 2026 16:08:46 +0000 Received: by outflank-mailman (input) for mailman id 1508783; Tue, 01 Dec 2026 16:08:45 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xYQPN-0000mf-0T for xen-devel@lists.xenproject.org; Tue, 01 Dec 2026 16:08:45 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xYQPL-00ErIQ-U7 for xen-devel@lists.xenproject.org; Tue, 01 Dec 2026 17:08:43 +0100 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6b0ef107-e002-0a2a0a5209dd-0a2a45099e88-22 for ; Tue, 01 Dec 2026 17:08:43 +0100 Received: from [209.85.221.41] (helo=mail-wr1-f41.google.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6b0ef10b-be1a-0a2a45090019-d155dd29d57e-3 for ; Tue, 01 Dec 2026 17:08:43 +0100 Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-48e47347279so7345107f8f.1 for ; Tue, 01 Dec 2026 08:08:43 -0800 (PST) Received: from framework13.home ([2a01:e11:3:1ff0:831:b00b:e409:f875]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6baa3c4dsm60426533f8f.46.2026.12.01.08.08.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 08:08:42 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Post: List-Help: List-Subscribe: , Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=edera.dev header.i="@edera.dev" 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=edera.dev; s=google; t=1796141323; x=1796746123; 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:content-type; bh=pXNRSNWk2vWaSr/CghafmYLcHxVPNhxwsQ7sPDqsInE=; b=Pz+6QYZWbXxdZGU2XzdkzTtcZva0rqXi5uWCr4WgRdeqlvduj0KAiCcx0KmPHbYBU9 c6Ai/l/5t8BHGUlcMgQYGGvdZ+1daNcx+yoOTVO+xqwg1MyUEDKOVLbedKem1aYomvF+ YWjUB/PYDWg9KaZZJCPXAUP6sju+jW2ayY5Q0IDsGUo1IW3iYxotj2DyYofQx7VKNO4v 5h35UFuwLMIlJR/xRNFXTJhpGieDnw59V0w+NZu/RMUminMGa8V0lE/paENK6/rPlSkw A4DkDIJ/FPnEvwT3hXabtqrl/f3FWR3GYJrH9kxRZR/LkZ9OCi7hcUDs1c7gv8ukQG24 jRPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796141323; x=1796746123; 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:content-type; bh=pXNRSNWk2vWaSr/CghafmYLcHxVPNhxwsQ7sPDqsInE=; b=RyxaWtyTL5CBWD36gia7NISL8hC4z8tFeVOfyOcmbPomojygiVCGD7qjmpY03SLnjS 05Rvbak+FXQYu8DX4Jjhv1rtxOTYsKJbZnKtL90OCUhwR18sa0AVS/OS0Mu6mModk88O etLBwGuHJQD9GlBvWqlpe8JJueFc99uicR4Rv0dZEi/gYqInpDaA3l0GjX96TGFzmAGX K/F0PZqhFBTt4rXPQ/tsjflOM7ZKY3Z3+Y+npZNHf3glLHvOEVXjikLju1M3cS6HY+cQ YXwzBoxtp3nkg9XGkRiANiYonbmH70XLjqPZ0Sb9iADSgfkRFYJ5K/3XFw4d3UsaSTcs 5mHw== X-Gm-Message-State: APuU4Z+jz/xxk5HYsS6UUPpfg+rmjjpsnrqKtMLXy4V0wn4HPLi4trkq Vav3nTvFw/KodN51CGZhNyiGcVQN0BvM2bne+UJWF/1Jl6EcgxZMf6xqeTRXPfvFAylO4+KZXN0 t1c8CPss= X-Gm-Gg: AZFdTZdGIyWI/iCre0xbkOuaCAqIlS+sJiY+uQcE9Uz4EdJVaH/78EEV1l9VXd/fjfL Wkk58PvZH9knvnAumEqatgQBk8zjezcb/beGugbqOQQNVribL23lrOR8MyCu9sVEzo6WdoPgHhm /heOoZ6wVNtlOFdoy9F4jKamrIKNBPlS8qKUK5CsG+z3D+CTzxh1GLm+XC322AC6AlEQ9gEArFD YKi8J97eXai7S8wf4JjCCLdbgnlGwCiFs8BZCFJ4fU0w8D+kxdGiXgcsxjdOVZ7CIoMAsOJ4GsI goBeZXZa1nyT9qPOA5t9JfTfdDQbIbNdqVUFnwI9yPweyumtCk/0YhEkv4QuPsrPH/WrM5G5fTD DyyQUUBmqaYWbt+MshJ/ET+jlCQ4j0XReebrw9G3yuByyYHzjLU5o9ZWtkeTjhVXM5YPYGP2R4N UFBGnwiKTMINjNeWT/PM0KMirxYfIVmXaVDeUHko3UWk2fM82uHzNxqdh8xKTsd9eNEGiybJ+Kc DJ//QWyMoy6dG9sFaoS0Cq2Xgut9Q3EI+K1cjpZzAKOI8HIvfF8o+FXbRlgxpLFy291+V/QSQNO 7mHJY1YsgCyWpVMoeajiFhxGhg== X-Received: by 2002:a05:600c:848d:b0:4bb:52d8:73ef with SMTP id 5b1f17b1804b1-4bb88940f1bmr741223985e9.34.1796141323162; Tue, 01 Dec 2026 08:08:43 -0800 (PST) From: Luca Di Maio To: xen-devel@lists.xenproject.org Cc: Luca Di Maio , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Alex Zenla , "Alexander M. Merritt" , Andres Rodriguez , Simon Veith , Steven Noonan Subject: [PATCH v2 0/5] xen/arm64: use LSE atomics when the CPU has them Date: Tue, 1 Dec 2026 17:08:10 +0100 Message-ID: <20261201160817.466800-1-luca@edera.dev> X-Mailer: git-send-email 2.53.0 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-purgate-ID: tlsNG-bad1c0/1796141323-FD469034-2E5AA546/0/0 X-purgate-type: clean X-purgate-size: 2023 X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On a two-socket Graviton4 (AWS c8g.metal-48xl, 192 Neoverse V2 cores), dom0 hangs about two minutes into its boot. All 96 pCPUs of one socket spin in the exclusive loop of atomic_add_return() on dom0's p2m rwlock: nobody holds the lock, the increment itself never completes. The lock is hot because every trapped-WFI block copies the vCPU's runstate to a guest virtual address, and that translation takes the p2m read lock. LSE atomics guarantee forward progress, and with them dom0 came up in every boot I tried. Following Linux, the series detects LSE at boot and puts a check patched by the alternatives in front of each existing exclusive loop, so CPUs without LSE run the same code as today. Each LSE sequence keeps the barriers of the loop it bypasses, so the ordering is the same or stronger. Tested on the 48xl with our 4.22-based tree, with guests running, and on staging under QEMU with and without LSE (neoverse-n2, cortex-a57). Changes in v2: - Patch 1: check the assembler for LSE in Kconfig instead of arch.mk (Jan). Luca Di Maio (5): xen/arm64: detect the LSE atomic instructions xen/arm64: use LSE in the atomic_t operations xen/arm64: use LSE in xchg() and cmpxchg() xen/arm64: use LSE in the bitops xen/arm64: use LSE for arch_fetch_and_add() xen/arch/arm/Kconfig | 4 ++ xen/arch/arm/arm64/lib/bitops.c | 47 ++++++++++++++++---- xen/arch/arm/cpufeature.c | 10 +++++ xen/arch/arm/include/asm/arm64/atomic.h | 55 ++++++++++++++++++++++++ xen/arch/arm/include/asm/arm64/cmpxchg.h | 41 ++++++++++++++++++ xen/arch/arm/include/asm/arm64/lse.h | 31 +++++++++++++ xen/arch/arm/include/asm/arm64/system.h | 20 +++++++++ xen/arch/arm/include/asm/cpufeature.h | 3 +- xen/arch/arm/include/asm/system.h | 2 + 9 files changed, 204 insertions(+), 9 deletions(-) create mode 100644 xen/arch/arm/include/asm/arm64/lse.h base-commit: 091d3c200281ea44846ccdf1e5d39985321c643e -- 2.47.3