From nobody Thu Nov 5 07:29:38 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=1793719807; cv=none; d=zohomail.com; s=zohoarc; b=iyj/x47fqKZvxzqGkVkLKEcZWwugsTDsbvNH3ZbOcm5UujsMtiB51D8YIBGbtBdcNIQwlGGTxu0NaSEmmDH2wpLyII0p76AS8RSRif1XEyNK/7qEF3ACbV9GFTdNS93VyqdFjr1us2NHk0IVJ8LMHr1nseejwVFMrfGnNOb4Mi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793719807; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LlONDbpAh5pNQ0fTDZFEV0XEM4VMcy0VXMNJpoTJmPI=; b=fUpftKhuSKAtCYP5RjmvQAdrnfhditzKqtx0TSeWmQjSiCvtClSDjZNtRCvYaRgZ6npkTDVx2hb/scNfxYZiJYiuk2IFm28CImw5EYVmQQ6Cif4x633LI0w2dniou12aIT/NhYqWndE+EZAps8xNin7X9z7yVmwAkksVIYmou4Q= 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 1793719807218738.4469616709757; Tue, 3 Nov 2026 07:30:07 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1470115.1678862 (Exim 4.92) (envelope-from ) id 1xOGSA-00068o-Nk; Tue, 03 Nov 2026 15:29:38 +0000 Received: by outflank-mailman (output) from mailman id 1470115.1678862; Tue, 03 Nov 2026 15:29:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xOGSA-00068g-KA; Tue, 03 Nov 2026 15:29:38 +0000 Received: by outflank-mailman (input) for mailman id 1470115; Tue, 03 Nov 2026 15:29:37 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) id 1xOGS9-0005w9-3H for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 15:29:37 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xOGS8-00Ba9X-Fx for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 16:29:36 +0100 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae9fdcd-8faa-0a2a0a5109dd-0a2a450c8b10-38 for ; Tue, 03 Nov 2026 16:29:36 +0100 Received: from [209.85.221.41] (helo=mail-wr1-f41.google.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae9fde0-f479-0a2a450c0019-d155dd29d431-3 for ; Tue, 03 Nov 2026 16:29:36 +0100 Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-48e00eee27dso2305976f8f.0 for ; Tue, 03 Nov 2026 07:29:36 -0800 (PST) Received: from localhost.localdomain (host-78-146-248-75.as13285.net. [78.146.248.75]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b959c1sm25430467f8f.45.2026.11.03.07.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 07:29:34 -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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1793719776; x=1794324576; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=LlONDbpAh5pNQ0fTDZFEV0XEM4VMcy0VXMNJpoTJmPI=; b=qqd6yftQ2wDRqX1v2HfvFWlfQuaKMqQKg1siG50XeOFNViHO73Y1pVkiyJnFceHBER qjOIbWxTvLxfaju/gWjn3x6PNPPubTwzbpeaU8NSuzBRLYGCsLU/IY5y1cHJ1GEbpyEa +Q76Kfr46yrnz13XKeO3Ibhl9FOgCj8o5g9Iw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793719776; x=1794324576; h=content-transfer-encoding:content-type: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 :content-type; bh=LlONDbpAh5pNQ0fTDZFEV0XEM4VMcy0VXMNJpoTJmPI=; b=01jFpMLTblbw8sbKbkJxZFR/JGi5VHE9hms4r0B8ONIR6EzDIFKkdD+7W/7Tmnb3yr B3vMSeX5Jq7bgdG3L7ebRfWOauQSP2CxdPyZY5PbO/zUE5l3ervcHqibzuC+TA+G9y9Y rxtDHiCg4hnLbDih3HkWSYTWbJdT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ad5mr28401206f8f.21.1793719775453; Tue, 03 Nov 2026 07:29:35 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Yehyeong Lee , Jan Beulich , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Oleksii Kurochko , Baptiste Le Duc Subject: [PATCH 1/6] xen/gnttab: Drop owner->grant_table check in _cache_flush() Date: Tue, 3 Nov 2026 15:29:23 +0000 Message-Id: <20261103152928.2142176-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261103152928.2142176-1-andrew.cooper3@citrix.com> References: <20261103152928.2142176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d25034/1793719776-01CC3A5B-EBF076D4/10/78276251493 X-purgate-type: spam X-purgate-size: 1724 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1793719808317158500 The "owner && !owner->grant_table" case needs a put_page() in it's error handling. In Xen 4.20 and earlier, this was addressed by XSA-520. Since the addition= of CONFIG_HAS_GRANT_CACHE_FLUSH in Xen 4.21, this path is only reachable on AR= M, and system domains on ARM do not own any memory. Therefore delete the check, rather than inserting unreachable error handlin= g. No functional change. This issue was also independently reported by Yehyeong Lee as the security team was already working on XSA-519/520. Reported-by: Yehyeong Lee Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Teddy Astie CC: Oleksii Kurochko CC: Baptiste Le Duc --- xen/common/grant_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 5e79c012b695..2285c4aee8d6 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -3633,7 +3633,7 @@ static int _cache_flush(gnttab_cache_flush_t *cflush,= grant_ref_t *cur_ref) =20 page =3D mfn_to_page(mfn); owner =3D page_get_owner_and_reference(page); - if ( !owner || !owner->grant_table ) + if ( !owner ) { rcu_unlock_domain(d); return -EPERM; --=20 2.39.5 From nobody Thu Nov 5 07:29:38 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=1793719814; cv=none; d=zohomail.com; s=zohoarc; b=deCHFIzsrlRp0n8/g72W1VWtCLuAdldqSWfmho3yifhNa+DsxwcQNhcD/tJSA3F+qOoXW+hbzef2c732jVZdiTD+3pjI95M//PpZmKii0JEmQpfOiEl3lLWJEmxW27L7j7QRBTUUgmDE93SkWyrTXJEnUq7hLfaeWUEdNxIocy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793719814; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wbHE2rBAxfkr80jQZ87SabR6WnxTq5XMFgXbtGAFDsI=; b=l0S1KHLTzm9NS/4qHYTPT097mHMEOPOTuMIpO96h4EAsOnID42QzDSYMlG042L9wg+BmcSSgyqZlCmL3A43Afnu63MVp1XffiU+1waPCn4g9B2yQ9kvxC6JAfYqMoVZjkWgjUDwFUP8vOR7ds1duJf7IxmI+9aLgcE2TKxcJoGs= 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 1793719814355986.0334608070572; Tue, 3 Nov 2026 07:30:14 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1470116.1678867 (Exim 4.92) (envelope-from ) id 1xOGSB-0006BF-0i; Tue, 03 Nov 2026 15:29:39 +0000 Received: by outflank-mailman (output) from mailman id 1470116.1678867; Tue, 03 Nov 2026 15:29:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xOGSA-0006B7-RU; Tue, 03 Nov 2026 15:29:38 +0000 Received: by outflank-mailman (input) for mailman id 1470116; Tue, 03 Nov 2026 15:29:38 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) id 1xOGSA-00065H-Ak for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 15:29:38 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xOGS9-007igP-Nd for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 16:29:37 +0100 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae9fdd4-2eae-0a2a0a5409dd-0a2a4501856c-30 for ; Tue, 03 Nov 2026 16:29:37 +0100 Received: from [209.85.128.43] (helo=mail-wm1-f43.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae9fde1-5984-0a2a45010019-d155802ba98b-3 for ; Tue, 03 Nov 2026 16:29:37 +0100 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4a2072b9832so5261365e9.1 for ; Tue, 03 Nov 2026 07:29:37 -0800 (PST) Received: from localhost.localdomain (host-78-146-248-75.as13285.net. [78.146.248.75]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b959c1sm25430467f8f.45.2026.11.03.07.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 07:29:35 -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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1793719777; x=1794324577; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=wbHE2rBAxfkr80jQZ87SabR6WnxTq5XMFgXbtGAFDsI=; b=K1TV/iqX+aST+wPfXTm9zgmJ0B6zqTcB3Y7MqxtzPebxDUXfuG/qAPTMrkXwmxZrma g4XN9ugt6oWBvbjVm1HfgMpjZBJDnyJyimQzAPaU5yIPmzMZGeEt853qa5I7R5vK2TFV ISMUN4z0smZ7rEEbsBBLrd+8Bo9lGowOCcuS0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793719777; x=1794324577; h=content-transfer-encoding:content-type: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 :content-type; bh=wbHE2rBAxfkr80jQZ87SabR6WnxTq5XMFgXbtGA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eOvUgKjp/IgdmgyiLefUZace+IAZuzalVIw7sgM1SV d+mcfBWyTJl4KNI9y0Aa7z/sU0o4ZqIchExIXk0EagaarlvMInJ0JuYPDiJarzUcsl3OW9EFaxs m+Wg= X-Received: by 2002:a7b:c051:0:b0:4a1:d766:758 with SMTP id 5b1f17b1804b1-4aa8b0609cfmr314854055e9.16.1793719776504; Tue, 03 Nov 2026 07:29:36 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie Subject: [PATCH 2/6] xen/gnttab: Disallow GNTTABOP_cache_flush from non-direct-mapped domains Date: Tue, 3 Nov 2026 15:29:24 +0000 Message-Id: <20261103152928.2142176-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261103152928.2142176-1-andrew.cooper3@citrix.com> References: <20261103152928.2142176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d62444/1793719777-BD87F757-835B5CCA/10/78276251493 X-purgate-type: spam X-purgate-size: 1334 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1793719816262158500 cache_flush() opereates on maddr_to_mfn(cflush->a.dev_bus_addr), which is an address space layering violation. Restrict the hypercall to direct-mapped domains. Signed-off-by: Andrew Cooper --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Teddy Astie It also malfunctions when an SMMU is using non-identity mappings. Linux never checks for errors, which hides all the ways in which this hypercall is broken. --- xen/common/grant_table.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 2285c4aee8d6..d42bd5fb83fd 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -3704,6 +3704,9 @@ gnttab_cache_flush(XEN_GUEST_HANDLE_PARAM(gnttab_cach= e_flush_t) uop, unsigned int i; gnttab_cache_flush_t op; =20 + if ( !is_domain_direct_mapped(current->domain) ) + return -EOPNOTSUPP; + for ( i =3D 0; i < count; i++ ) { if ( i && hypercall_preempt_check() ) --=20 2.39.5 From nobody Thu Nov 5 07:29:38 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=1793719801; cv=none; d=zohomail.com; s=zohoarc; b=JqfLgLSikpaqv6hD7CxDeL58SbAe9FW3q0h6McnLEsHYbzyMPn9ZHmpa8DCX1L3QLCnAFl6pYJrX/2MT5LybCUhSp20ZmCA8fE0NtNmWjSDesB9AfrXsXjQ8/nc7uq9zEOPgG11n7az7SHV1Yn+dwvTX7zZcT7m+BUTiSazDWMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793719801; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jqcJnOexiDNGMSUvzMhvIFHRbCx2t1wbpBkIduHSZ8E=; b=dBJhod55i+icwJ5U9JAkOV+FTXsMqnmMGyN1v9EDL3tbcyCaeemHVe6RTGYv0VM1MQ7bqyJqS8I0CYudyNzPJstrBLzpaHgnE7wNSOB7h5tnFV9wgJLF9sFkLbYlvaJp8Xos6QqQuN/ORghpQWWszNG8B4YHYXfl9bgk/MLGwL0= 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 1793719801059422.676830743677; Tue, 3 Nov 2026 07:30:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1470117.1678880 (Exim 4.92) (envelope-from ) id 1xOGSC-0006Y2-5Z; Tue, 03 Nov 2026 15:29:40 +0000 Received: by outflank-mailman (output) from mailman id 1470117.1678880; Tue, 03 Nov 2026 15:29:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xOGSC-0006Xv-2X; Tue, 03 Nov 2026 15:29:40 +0000 Received: by outflank-mailman (input) for mailman id 1470117; Tue, 03 Nov 2026 15:29:39 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) id 1xOGSA-00069N-Uy for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 15:29:38 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xOGSA-007igP-Bs for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 16:29:38 +0100 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae9fdde-2eae-0a2a0a5409dd-0a2a450ba9e2-14 for ; Tue, 03 Nov 2026 16:29:38 +0100 Received: from [209.85.218.52] (helo=mail-ej1-f52.google.com) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae9fde2-b7e8-0a2a450b0019-d155da34b95c-3 for ; Tue, 03 Nov 2026 16:29:38 +0100 Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-c43373ae89aso645546766b.3 for ; Tue, 03 Nov 2026 07:29:38 -0800 (PST) Received: from localhost.localdomain (host-78-146-248-75.as13285.net. [78.146.248.75]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b959c1sm25430467f8f.45.2026.11.03.07.29.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 07:29:36 -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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1793719778; x=1794324578; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=jqcJnOexiDNGMSUvzMhvIFHRbCx2t1wbpBkIduHSZ8E=; b=Oh5DlJEsaOuLz7zpcFedGp9Fmd2YqTYT3Z8Nal5PgT0DzfQf1pV3WshAtH+p/Z3qaB 6/rEDFV4P8H72gr3Avs9WLZphZEaZXkCkUkJE0bu9LnA6KBE0oWY0pNdVuuFpMlG0dV+ t7m9MV7AyBcYw6HzoF5U+HGQFlvrz+DdVlILg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793719778; x=1794324578; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:sub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2OfHMG2tgF8GKNDE1E7 HW77fXmyoR97eO2esno/onvFYCwfqNS+LQWyd7f6MEhCTeycFmqzzB2tDcyGrPuL+CmSldWtn4m XeUbCXzAIpnR1VZYKFJns8bKMR5aXbc8w5uhttZUYewp0NgkZY+gpQJX9dn1LdjkdUgg7QFvCaS S1Wg= X-Received: by 2002:a17:907:dab:b0:c40:dfec:50b6 with SMTP id a640c23a62f3a-c4ca7b83f7emr1198124266b.49.1793719777384; Tue, 03 Nov 2026 07:29:37 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Oleksii Kurochko , Baptiste Le Duc Subject: [PATCH 3/6] xen/gnttab: Remove explicit rcu_lock_current_domain() Date: Tue, 3 Nov 2026 15:29:25 +0000 Message-Id: <20261103152928.2142176-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261103152928.2142176-1-andrew.cooper3@citrix.com> References: <20261103152928.2142176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-42698a/1793719778-A9CC79EA-FE1F8462/10/78276251493 X-purgate-type: spam X-purgate-size: 2798 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1793719802241158500 rcu_lock_current_domain() is always a nop, while rcu_unlock_domain() is not. GNTTAB ops swap_grant_ref and cache_flush are the only two paths in Xen whi= ch explicitly RCU lock themselves. Drop this behaviour. No functional change. Signed-off-by: Andrew Cooper --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Teddy Astie CC: Oleksii Kurochko CC: Baptiste Le Duc --- xen/common/grant_table.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index d42bd5fb83fd..f4ec7524140a 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -3498,7 +3498,7 @@ gnttab_get_version(XEN_GUEST_HANDLE_PARAM(gnttab_get_= version_t) uop) static int16_t swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b) { - struct domain *d =3D rcu_lock_current_domain(); + struct domain *d =3D current->domain; struct grant_table *gt =3D d->grant_table; struct active_grant_entry *act_a =3D NULL; struct active_grant_entry *act_b =3D NULL; @@ -3573,8 +3573,6 @@ swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b) active_entry_release(act_a); grant_write_unlock(gt); =20 - rcu_unlock_domain(d); - return rc; } =20 @@ -3622,22 +3620,16 @@ static int _cache_flush(gnttab_cache_flush_t *cflus= h, grant_ref_t *cur_ref) if ( cflush->op & GNTTAB_CACHE_SOURCE_GREF ) return -EOPNOTSUPP; =20 - d =3D rcu_lock_current_domain(); + d =3D current->domain; mfn =3D maddr_to_mfn(cflush->a.dev_bus_addr); =20 if ( !mfn_valid(mfn) ) - { - rcu_unlock_domain(d); return -EINVAL; - } =20 page =3D mfn_to_page(mfn); owner =3D page_get_owner_and_reference(page); if ( !owner ) - { - rcu_unlock_domain(d); return -EPERM; - } =20 if ( d !=3D owner ) { @@ -3647,7 +3639,6 @@ static int _cache_flush(gnttab_cache_flush_t *cflush,= grant_ref_t *cur_ref) if ( IS_ERR_OR_NULL(act) ) { grant_read_unlock(owner->grant_table); - rcu_unlock_domain(d); put_page(page); return act ? PTR_ERR(act) : 1; } @@ -3691,7 +3682,6 @@ static int _cache_flush(gnttab_cache_flush_t *cflush,= grant_ref_t *cur_ref) =20 unmap_domain_page(v); put_page(page); - rcu_unlock_domain(d); =20 return ret; } --=20 2.39.5 From nobody Thu Nov 5 07:29:38 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=1793719812; cv=none; d=zohomail.com; s=zohoarc; b=IoNXCy9XDmIEIs32V9xh44torlkwGlziaUgm5D7ZmY2sKOc6OAdr1awNR0WRmMPuVB08d9TeDLSn/sZHjVUdTx9TAoUnClnhWakzE90rDT7nqALws4rtSI29hl9IrlW9I6L0WkdF7R+URyUFoyCz96l1bdlc8cb5NOKMNV5CpWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793719812; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MDGy6hwgwHq8pad19ORCb8mC88V7O5aQmcoI2A6x98Q=; b=Y4ODJ665XJsTihFV7gn+Xj1zdR668XvsR7ixM6J4K9ElS6tJgRt8SbPWZzoFJuzLVM/g1nyltDq3bPQpahmBhuEVVnPO9qb299zOsPPrvtJ7iW6iJN8vLlFnSkkZppxVbtQRhfIbhHrFBsNOpWmu0Ng0vuOo0xlV6l1CSH0Vw8s= 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 1793719812850415.5252549731881; Tue, 3 Nov 2026 07:30:12 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1470118.1678889 (Exim 4.92) (envelope-from ) id 1xOGSD-0006lI-DM; Tue, 03 Nov 2026 15:29:41 +0000 Received: by outflank-mailman (output) from mailman id 1470118.1678889; Tue, 03 Nov 2026 15:29:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xOGSD-0006l6-A7; Tue, 03 Nov 2026 15:29:41 +0000 Received: by outflank-mailman (input) for mailman id 1470118; Tue, 03 Nov 2026 15:29:39 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) id 1xOGSB-0006Sk-Rj for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 15:29:39 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xOGSB-007igP-8Z for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 16:29:39 +0100 Received: from [10.42.69.8] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae9fdcc-2eae-0a2a0a5409dd-0a2a4508e184-30 for ; Tue, 03 Nov 2026 16:29:39 +0100 Received: from [209.85.128.43] (helo=mail-wm1-f43.google.com) by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae9fde3-f659-0a2a45080019-d155802bf0b5-3 for ; Tue, 03 Nov 2026 16:29:39 +0100 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4a35d5d4a20so47974865e9.2 for ; Tue, 03 Nov 2026 07:29:39 -0800 (PST) Received: from localhost.localdomain (host-78-146-248-75.as13285.net. [78.146.248.75]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b959c1sm25430467f8f.45.2026.11.03.07.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 07:29:37 -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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1793719779; x=1794324579; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=MDGy6hwgwHq8pad19ORCb8mC88V7O5aQmcoI2A6x98Q=; b=U+b8X8pRqqMNx4E1TKPy/u6B9dTRbqQBNUfo/OaQPPZw0HLjyksls9WJVOGaNo2Ir4 SiqrZsbNMu6Jp/c94W3Z2LVygu7HQn8jn5xYpVtm32wz2vLJ/6U0YS80VIcfr5q5oKAP wcPeuh8fknP1OWKjcRL/pcknGE6ACdRJclbcg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793719779; x=1794324579; h=content-transfer-encoding:content-type: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 :content-type; bh=MDGy6hwgwHq8pad19ORCb8mC88V7O5aQmcoI2A6x98Q=; b=Cn7NtgwAyIggeXviPMfQWkWyd3AvT9HJ2UhPXkSnqdonStMHsXjG5Ry8NHmnqfLT94 g9b9mpM/pFcdRCuj+8vjs+enDWOf2Zd/ULUN4PdiY7cgQL5dWgl2dmau4R58wJF/daSu Ru8DvDlr/ObflhluZmLRv6TvQ1NMaX25hiX4dGkbwA3KrTnnMkwBvwmTByetsXg4ruim BuoXfDbqbcq5xOMIGBRpzr3AiASHQSxZUSa4chuzdCvCjvohxo8dQg1uwrc8LDbORLEi BeB2KRVKsSaDAfat59RGDRZxKIthuIYj2+C8sf0RblEks9OrbPToBHBnuikL4MrPYsk4 4HDQ== X-Gm-Message-State: APuU4Z/YiDeey8iAJ3JdvjOEcRodxC4mpXIgJbSA5rHDs39/YwYW0BXB f7i9t6HwVFaq36qNWuMaEjsiewT4+d0mEhIGTLzVx2mF2tfLXyMqAM/hug1FAph176kIS0FQL3X z4QUymu8= X-Gm-Gg: AYBFou2q21JIAfnf6ZXKM110A71vu6AwEYPViEuqPN6wvrIV0BQfJ+ooyJQ/ENLo6oo r6NIfVvcOdHtAHBYHLw/og7doPirM40aNu4Bs6B6qg8KABei5h6XdIs7VScciviUsIQf3Jd0egD 7rRJgWFTaoqLgWm55Sll+qidkP1045pTXo51ej0qS+0tnCrA+gJnf/s/mthN8NAyhFSZy4J1AZS CE6psuEJXS5xV1c4+B4AMWz9yeRHfirsiRx+gu3FUFaymR2adGjPfNLdD7IS82TcWHuCPQeQKhw SvLdSc10h43bgnSpUGyRPlIdt8jiFOjgwcUx008bY7keG0oP74WHfRbNRql99/svisMBxAaNIQt HTKcYD1A0DDB8+VQdTGMon/cvYDNHuDoRHbJuWXv+r1fkKGea9s70+qxG8KlcI9UD0/cX8Uhe3D F2hOy6ZUAyQxyiViTUpgolEMvRhAIRCR64FxNNTNfQqIJ4SVB82xoymg2FSq4s6pBVdcJB1/i+x I6Fkpm8LCKJG1fOmTLcSZRW4GZ0ao9wf3uFXXLkqS8PPuTyi+LFCISwGdvT0TeDNM9xqJKkYoiZ 6YQJwXzpOh18KeWPRdhHMbYxQzQAaC8dUL3AtsAobjI4zUwkSF6t8AyG9zI9rb4rMKiYLzqS3uT GRxkqgM/RraEpWYS0WL7Lsbl9 X-Received: by 2002:a05:600c:470d:b0:4a7:9006:b176 with SMTP id 5b1f17b1804b1-4ac17471285mr304579455e9.7.1793719778359; Tue, 03 Nov 2026 07:29:38 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Oleksii Kurochko , Baptiste Le Duc Subject: [PATCH 4/6] xen/gnttab: Document how _cache_flush() works Date: Tue, 3 Nov 2026 15:29:26 +0000 Message-Id: <20261103152928.2142176-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261103152928.2142176-1-andrew.cooper3@citrix.com> References: <20261103152928.2142176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-c1860d/1793719779-DF6D687B-FB76ABCA/10/78276251493 X-purgate-type: spam X-purgate-size: 1387 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1793719814322158500 Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Teddy Astie CC: Oleksii Kurochko CC: Baptiste Le Duc --- xen/common/grant_table.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index f4ec7524140a..4cc23f9231e6 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -3598,6 +3598,15 @@ gnttab_swap_grant_ref(XEN_GUEST_HANDLE_PARAM(gnttab_= swap_grant_ref_t) uop, } =20 #ifdef CONFIG_HAS_GRANT_CACHE_FLUSH +/* + * Issue a cache flush operation on memory owned by the domain, or a mapped + * grant from another domain. The caller must pass in cur_ref =3D 0 initi= ally, + * and preserve the value across continuations. + * + * Returns: 0 for success + * 1 for a continuation while searching the mapped grants + * -errno for error + */ static int _cache_flush(gnttab_cache_flush_t *cflush, grant_ref_t *cur_ref) { struct domain *d, *owner; --=20 2.39.5 From nobody Thu Nov 5 07:29:38 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=1793719802; cv=none; d=zohomail.com; s=zohoarc; b=EG1M3tE3SF4UoQugWUM+zDauCgJLgFZDR+xAfEUQ37cocQGjM9Edm1vqYvLljVyMOcWZNCNLMPKh9+NqAqtLZ/BsPcDP7j6teLTnvnAs+tkfG7fkKbvVNrBHQutOmoBHTEDaXYDr5DduYwDmlKqDOhHVJbc5Qr6XMqNlc1eBdkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793719802; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YXonRJiUpIIQUGfPHULNa0+riN0YTsjAc2+s6FHrnD0=; b=CF9P/wRxDYy7WY4+XstsSFssXk5UtBZqyck+2uwqv1ys9gcattfRh49KdEgv4Bz+4c3lN5fx+Vr7bsOFaozZMG97PJ5kzqWBZ5HhQVX2BORGmfdgBucmXx1TDeULrH+SmK/TygbetDX2kiD2TYAD04BNkFN7y1/N4YyTibCOkL4= 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 1793719802785640.3984329934509; Tue, 3 Nov 2026 07:30:02 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1470119.1678898 (Exim 4.92) (envelope-from ) id 1xOGSE-0006zq-Qi; Tue, 03 Nov 2026 15:29:42 +0000 Received: by outflank-mailman (output) from mailman id 1470119.1678898; Tue, 03 Nov 2026 15:29:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xOGSE-0006zb-Mm; Tue, 03 Nov 2026 15:29:42 +0000 Received: by outflank-mailman (input) for mailman id 1470119; Tue, 03 Nov 2026 15:29:41 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) id 1xOGSD-0006jS-EP for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 15:29:41 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xOGSC-0040rM-KI for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 16:29:40 +0100 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae9fdcd-bab6-0a2a0a5309dd-0a2a4509d89c-48 for ; Tue, 03 Nov 2026 16:29:40 +0100 Received: from [209.85.218.44] (helo=mail-ej1-f44.google.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae9fde4-be1a-0a2a45090019-d155da2cb5f2-3 for ; Tue, 03 Nov 2026 16:29:40 +0100 Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-c414e5d282eso516700766b.1 for ; Tue, 03 Nov 2026 07:29:40 -0800 (PST) Received: from localhost.localdomain (host-78-146-248-75.as13285.net. [78.146.248.75]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b959c1sm25430467f8f.45.2026.11.03.07.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 07:29:38 -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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1793719780; x=1794324580; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=YXonRJiUpIIQUGfPHULNa0+riN0YTsjAc2+s6FHrnD0=; b=Z4jsgKUCt1nv4RpXDOqlxCB6LJCLwIfUv7rZF95n7suf2jP85wjXv2679FoYhszdYg T8/RYMiR0TEpDdIQAPQBTWk/ONdhCZaS7nXKnNHwEDEAUU9XGbxd3phu3TG4K3fRElG2 i0h9eePot8KFdlni9E6l5UOFBW2+98b/94ZlU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793719780; x=1794324580; h=content-transfer-encoding:content-type: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 :content-type; bh=YXonRJiUpIIQUGfPHULNa0+riN0YTsjAc2+s6FHrnD0=; b=CeLRrQJ1NN7WIX+qYVSWJmuseua4LikYkNssPrmtN51i+VaTzs01RT3T3uZt9mKves bIdKnu6uEeFTJyQRKs0pLMDlwBCkqjQN1ZtTWtjzpjgpAd/8hYRQiyd6HaZKs+XpBeUO K8cFOOAT6etfzPCpydq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a17:906:99c9:b0:c2d:c247:5400 with SMTP id a640c23a62f3a-c4ca7b405c5mr1089032866b.27.1793719779322; Tue, 03 Nov 2026 07:29:39 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Oleksii Kurochko , Baptiste Le Duc Subject: [PATCH 5/6] xen/gnttab: Fold error handling in _cache_flush() Date: Tue, 3 Nov 2026 15:29:27 +0000 Message-Id: <20261103152928.2142176-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261103152928.2142176-1-andrew.cooper3@citrix.com> References: <20261103152928.2142176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-bad1c0/1793719780-FC610034-42FF5581/10/78276251493 X-purgate-type: spam X-purgate-size: 1656 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1793719806211158500 No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Teddy Astie CC: Oleksii Kurochko CC: Baptiste Le Duc --- xen/common/grant_table.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 4cc23f9231e6..d453c38556fc 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -3647,9 +3647,8 @@ static int _cache_flush(gnttab_cache_flush_t *cflush,= grant_ref_t *cur_ref) act =3D grant_map_exists(d, owner->grant_table, mfn, cur_ref); if ( IS_ERR_OR_NULL(act) ) { - grant_read_unlock(owner->grant_table); - put_page(page); - return act ? PTR_ERR(act) : 1; + ret =3D act ? PTR_ERR(act) : 1; + goto gnt_unlock; } =20 /* @@ -3683,13 +3682,15 @@ static int _cache_flush(gnttab_cache_flush_t *cflus= h, grant_ref_t *cur_ref) else ret =3D 0; =20 + unmap_domain_page(v); + if ( d !=3D owner ) { active_entry_release(act); + gnt_unlock: grant_read_unlock(owner->grant_table); } =20 - unmap_domain_page(v); put_page(page); =20 return ret; --=20 2.39.5 From nobody Thu Nov 5 07:29:38 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=1793719809; cv=none; d=zohomail.com; s=zohoarc; b=Xt9LpLgi0/YBcXsgPBrxCW5OsjK1OC3jhHhZml3Qdg10+2Jmn1qBVg3CQf622N8obMvu4fdNUgjacslVeIZwChgoKS01nxszCu7fmtb2Lg5bwxtODnlE82qOFruLf7qVZJRU4RvPFUfYsIE4LqcvLTKVXQupQYRO4idKVsXsM5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793719809; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OjGu8aNJSa9hiinv/RFb747MCnsH5+RZhfhHhZ40tAg=; b=CJpHQU2WL2iMwmpnM9YjRxTyvZX6LWmu8CAwEGT85i4w5ZzQmAkTyU4hDI4i29XRVKjFXjPK/458Q0NhROq2oqEgpX311Crfek/JnQtHuQKQ7ub6C48OYuqFcwBqnVdhcK30aKrn9E1ZJ3orSgzAYxACPWGWq9y3N2duTAb8zNs= 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 1793719809065310.3737786831408; Tue, 3 Nov 2026 07:30:09 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1470120.1678908 (Exim 4.92) (envelope-from ) id 1xOGSG-0007E7-4Y; Tue, 03 Nov 2026 15:29:44 +0000 Received: by outflank-mailman (output) from mailman id 1470120.1678908; Tue, 03 Nov 2026 15:29:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xOGSF-0007Dy-W7; Tue, 03 Nov 2026 15:29:44 +0000 Received: by outflank-mailman (input) for mailman id 1470120; Tue, 03 Nov 2026 15:29:41 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) id 1xOGSD-0006nn-Qr for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 15:29:41 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xOGSD-00Ba9X-6p for xen-devel@lists.xenproject.org; Tue, 03 Nov 2026 16:29:41 +0100 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae9fddb-8faa-0a2a0a5109dd-0a2a450aa786-36 for ; Tue, 03 Nov 2026 16:29:41 +0100 Received: from [209.85.128.41] (helo=mail-wm1-f41.google.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae9fde5-f2d2-0a2a450a0019-d1558029e0cd-3 for ; Tue, 03 Nov 2026 16:29:41 +0100 Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4a3517554f7so32674355e9.2 for ; Tue, 03 Nov 2026 07:29:41 -0800 (PST) Received: from localhost.localdomain (host-78-146-248-75.as13285.net. [78.146.248.75]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b959c1sm25430467f8f.45.2026.11.03.07.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 07:29:39 -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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1793719780; x=1794324580; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=OjGu8aNJSa9hiinv/RFb747MCnsH5+RZhfhHhZ40tAg=; b=C3llkoZ/OjuUMcB5+1TOb9A4rQfR/yLzTUR8zT4SuWpHi8JxSIrQ4z8SPO0PJAxMHz XuWleRUifPeuk0CSvdhsw2ipKFxynyZ1lfOwMpAysgagKNBwwK7TzUdRQA2Ht8sLCMWH eswd54S06l+3FRXtKLJwfjusXSldkCeDP6JAA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793719780; x=1794324580; h=content-transfer-encoding:content-type: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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zcWdn/ia PTYFkLN/pAYfe+77m75tXbeRYjV+z8TPQ+vGrXBXo+HcKbFJoPTD/kZvuFJMxuXFH5WNkdWvSJk HNTwouWus99DtPjgK4dljKakZc0OsejRT44iaszS1DWJboJs5sQfqJf8wxD4hHf0bcxCjGhyaFd 3ILzuxrIxG2mgq+gUV/ZgMzvP X-Received: by 2002:a05:600c:4e50:b0:4a9:2a92:231f with SMTP id 5b1f17b1804b1-4ac16bc461emr311760895e9.7.1793719780169; Tue, 03 Nov 2026 07:29:40 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Oleksii Kurochko , Baptiste Le Duc Subject: [PATCH 6/6] treewide: Make {invalidate/clean}_dcahce_va_range() void Date: Tue, 3 Nov 2026 15:29:28 +0000 Message-Id: <20261103152928.2142176-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261103152928.2142176-1-andrew.cooper3@citrix.com> References: <20261103152928.2142176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-4011c0/1793719781-514C7CFC-829990DE/10/78276251493 X-purgate-type: spam X-purgate-size: 6429 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1793719810385158500 Precisely two functions - RISC-V's flush_page_to_ram() and ARM's _cache_flush() - check the return value of these functions, yet all implementations return success, and ARM documents this as a requirement. Make them void and simply the callers which care. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Michal Orzel --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Teddy Astie CC: Oleksii Kurochko CC: Baptiste Le Duc --- xen/arch/arm/include/asm/page.h | 20 +++++++------------- xen/arch/riscv/include/asm/page.h | 10 +++------- xen/arch/riscv/mm.c | 4 +--- xen/common/grant_table.c | 11 +++++------ 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/xen/arch/arm/include/asm/page.h b/xen/arch/arm/include/asm/pag= e.h index 6da4745736a2..b719c2ed4c12 100644 --- a/xen/arch/arm/include/asm/page.h +++ b/xen/arch/arm/include/asm/page.h @@ -165,13 +165,13 @@ static inline size_t read_dcache_line_bytes(void) * if 'range' is large enough we might want to use model-specific * full-cache flushes. */ =20 -static inline int invalidate_dcache_va_range(const void *p, unsigned long = size) +static inline void invalidate_dcache_va_range(const void *p, unsigned long= size) { size_t cacheline_mask =3D dcache_line_bytes - 1; unsigned long partial_head; =20 if ( !size ) - return 0; + return; =20 /* Passing a region that wraps around is illegal */ ASSERT(((uintptr_t)p + size - 1) >=3D (uintptr_t)p); @@ -208,17 +208,15 @@ static inline int invalidate_dcache_va_range(const vo= id *p, unsigned long size) =20 done: dsb(sy); /* So we know the flushes happen before continuing = */ - - return 0; } =20 -static inline int clean_dcache_va_range(const void *p, unsigned long size) +static inline void clean_dcache_va_range(const void *p, unsigned long size) { size_t cacheline_mask =3D dcache_line_bytes - 1; unsigned long idx =3D 0; =20 if ( !size ) - return 0; + return; =20 /* Passing a region that wraps around is illegal */ ASSERT(((uintptr_t)p + size - 1) >=3D (uintptr_t)p); @@ -231,18 +229,16 @@ static inline int clean_dcache_va_range(const void *p= , unsigned long size) idx +=3D dcache_line_bytes, size -=3D dcache_line_bytes ) asm_inline volatile ( __clean_dcache_one(0) : : "r" (p + idx) ); dsb(sy); /* So we know the flushes happen before continuing = */ - /* ARM callers assume that dcache_* functions cannot fail. */ - return 0; } =20 -static inline int clean_and_invalidate_dcache_va_range - (const void *p, unsigned long size) +static inline void +clean_and_invalidate_dcache_va_range(const void *p, unsigned long size) { size_t cacheline_mask =3D dcache_line_bytes - 1; unsigned long idx =3D 0; =20 if ( !size ) - return 0; + return; =20 /* Passing a region that wraps around is illegal */ ASSERT(((uintptr_t)p + size - 1) >=3D (uintptr_t)p); @@ -255,8 +251,6 @@ static inline int clean_and_invalidate_dcache_va_range idx +=3D dcache_line_bytes, size -=3D dcache_line_bytes ) asm volatile (__clean_and_invalidate_dcache_one(0) : : "r" (p + id= x)); dsb(sy); /* So we know the flushes happen before continuing */ - /* ARM callers assume that dcache_* functions cannot fail. */ - return 0; } =20 /* Macros for flushing a single small item. The predicate is always diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm= /page.h index f9e59e61de30..770410085fd9 100644 --- a/xen/arch/riscv/include/asm/page.h +++ b/xen/arch/riscv/include/asm/page.h @@ -196,23 +196,19 @@ static inline bool pte_is_superpage(pte_t p, unsigned= int level) return (level > 0) && pte_is_mapping(p); } =20 -static inline int clean_and_invalidate_dcache_va_range(const void *p, - unsigned long size) +static inline void +clean_and_invalidate_dcache_va_range(const void *p, unsigned long size) { #ifndef CONFIG_QEMU_PLATFORM # error "should clean_and_invalidate_dcache_va_range() be updated?" #endif - - return 0; } =20 -static inline int clean_dcache_va_range(const void *p, unsigned long size) +static inline void clean_dcache_va_range(const void *p, unsigned long size) { #ifndef CONFIG_QEMU_PLATFORM # error "should clean_dcache_va_range() be updated?" #endif - - return 0; } =20 static inline void invalidate_icache(void) diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 6f7dcd10b2c6..78f23392cc35 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -618,9 +618,7 @@ void flush_page_to_ram(unsigned long mfn, bool sync_ica= che) { const void *v =3D map_domain_page(_mfn(mfn)); =20 - if ( clean_and_invalidate_dcache_va_range(v, PAGE_SIZE) ) - BUG(); - + clean_and_invalidate_dcache_va_range(v, PAGE_SIZE); unmap_domain_page(v); =20 if ( sync_icache ) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index d453c38556fc..eebf8850d062 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -3673,14 +3673,13 @@ static int _cache_flush(gnttab_cache_flush_t *cflus= h, grant_ref_t *cur_ref) v =3D map_domain_page(mfn); v +=3D cflush->offset; =20 + ret =3D 0; if ( (cflush->op & GNTTAB_CACHE_INVAL) && (cflush->op & GNTTAB_CACHE_C= LEAN) ) - ret =3D clean_and_invalidate_dcache_va_range(v, cflush->length); + clean_and_invalidate_dcache_va_range(v, cflush->length); else if ( cflush->op & GNTTAB_CACHE_INVAL ) - ret =3D invalidate_dcache_va_range(v, cflush->length); - else if ( cflush->op & GNTTAB_CACHE_CLEAN ) - ret =3D clean_dcache_va_range(v, cflush->length); - else - ret =3D 0; + invalidate_dcache_va_range(v, cflush->length); + else /* cflush->op & GNTTAB_CACHE_CLEAN */ + clean_dcache_va_range(v, cflush->length); =20 unmap_domain_page(v); =20 --=20 2.39.5