From nobody Thu Sep 24 20:23:48 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=none dis=none) header.from=xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1788962726; cv=none; d=zohomail.com; s=zohoarc; b=jT3RAF3BC1OLp6V/weSJslYFBk3rDamCxYGu/RuybfT8MxrvFcs3xlk2lBoaD7Q9aB8QNmM629QUlNsAeN5tzEP+iYrCxU6y4J6DiFHbSyslAe6cu86FKgtZBIALuPrV4e/t9GPYvzaiKx3Vm+dI4qF2nOqJ6bugLATA9elrmg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788962726; 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=mSzuR5Ka/pPapr0FJwRJ5lPhaQWm8jB/vfBAH3X6m10=; b=IcPuMRe8y4JHYbcVbzAofmNn4ABdU/xqR1VF4Y0tVSMFv7ZMYcjeyHT8yGnGzcPlcaxGf2BD9vbXHg+Ck03ZXjiRj2h3ffJTPRwKbL+DL0mS+9TsWfx3qYQ1DmtFLXR88gRet+pn7D2mLYSASpViPO3Zk9Dn4uib529gWcHQllg= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1788962726977604.1373824862341; Wed, 9 Sep 2026 07:05:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1413153.1643401 (Exim 4.92) (envelope-from ) id 1x4IvG-0004wh-Hm; Wed, 09 Sep 2026 14:05:10 +0000 Received: by outflank-mailman (output) from mailman id 1413153.1643401; Wed, 09 Sep 2026 14:05:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x4IvG-0004wa-ED; Wed, 09 Sep 2026 14:05:10 +0000 Received: by outflank-mailman (input) for mailman id 1413153; Wed, 09 Sep 2026 14:05:09 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x4IvF-0004w5-8N for xen-devel@lists.xenproject.org; Wed, 09 Sep 2026 14:05:09 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.96) (envelope-from ) id 1x4IvD-006T2L-1e; Wed, 09 Sep 2026 14:05:07 +0000 Received: from 224.pool85-54-217.dynamic.orange.es ([85.54.217.224] helo=localhost) by xenbits.xenproject.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x4IvD-009AfJ-0Q; Wed, 09 Sep 2026 14:05:06 +0000 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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xenproject.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:Subject:Cc:To:From; bh=mSzuR5Ka/pPapr0FJwRJ5lPhaQWm8jB/vfBAH3X6m10=; b=ihbnoxw9Ktw/YprWK12X9Ke+75 tLY9HfBhd+tiisDs/3wpDxCyL12GpISN8dJAgd0KumEGu8Tkd2EAyHpqU8d8/Jb4Uw9uLVfDKFX6Q snJ7Eq8P/0SfwZhBn9CRaORlwzNETVFrlR0JgVs9+uJLD7P4+dcuRLyFZPMweWvEYgjo=; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v2] x86/mm: limit deferred TLB flushing to PV domain support Date: Wed, 9 Sep 2026 16:05:00 +0200 Message-ID: <20260909140500.73483-1-roger@xenproject.org> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xenproject.org) X-ZM-MESSAGEID: 1788962729579158500 The current logic on x86 will mark all domain owned pages as needing a TLB flush before being re-used. However such TLB flushing is only strictly needed when the pages might have been mapped by a PV domain, as those can keep a reference to the page in the TLB after it has been freed. Limit the flushing to builds with PV domain support, as tracking whether a page might have been mapped by a PV domain is not trivial (and possibly not worth the extra logic). Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- Changes since v1: - Only avoid the flush if there's no PV domain support. - Fix comment. --- xen/common/page_alloc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 62ac89b824de..cbb2af7f64ce 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1538,8 +1538,11 @@ static bool mark_page_free(struct page_info *pg, mfn= _t mfn) BUG(); } =20 - /* If a page has no owner it will need no safety TLB flush. */ - pg->u.free.need_tlbflush =3D (page_get_owner(pg) !=3D NULL); + /* + * If a page has no owner and there's no PV domain support it will nee= d no + * safety TLB flush, there can be no stale TLB entries. + */ + pg->u.free.need_tlbflush =3D IS_ENABLED(CONFIG_PV) && page_get_owner(p= g); if ( pg->u.free.need_tlbflush ) page_set_tlbflush_timestamp(pg); =20 --=20 2.55.0