From nobody Thu Sep 24 20:23: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=none dis=none) header.from=xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1788938721; cv=none; d=zohomail.com; s=zohoarc; b=NqrObI+eEGzkansU1TTlOYvO0wtL7T1Xe94emWq/OW/6mFugzPiF142V/srAcGU5kX2D5J1oGD8/n/PO6abb9EOzU1reucep+6Ni8UOCTYoZ2tEGQjl+pNBCs+t9x/c9yimVvLjTrPRK5zk8dNFYSVRNuOTcOtbDXwg6857sBb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788938721; 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=3jw4iKButHJPwaMb26bDfnz2RJqz2Vwhjbbd7CxUQaM=; b=FbRTK7w69nXuRxSXJwBjamptmM+c5ne5jNd/BCupio3eRL5T+LXR+uGBCUpjj/tgsLFGEgq8UL6zacrjIX3LG0vwQFXLbwJNt69zad+TmtApdFwU/PYQW8cCrcoM9heErDKg/0fPNBjh2TDalkIJo2wq0vp/d0EIHMnOPebCeYU= 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 1788938721896795.4331223889988; Wed, 9 Sep 2026 00:25:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1412628.1643024 (Exim 4.92) (envelope-from ) id 1x4Cg1-0004mY-VI; Wed, 09 Sep 2026 07:25:01 +0000 Received: by outflank-mailman (output) from mailman id 1412628.1643024; Wed, 09 Sep 2026 07:25:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x4Cg1-0004mR-Rx; Wed, 09 Sep 2026 07:25:01 +0000 Received: by outflank-mailman (input) for mailman id 1412628; Wed, 09 Sep 2026 07:24:59 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x4Cfz-0004mK-UQ for xen-devel@lists.xenproject.org; Wed, 09 Sep 2026 07:24:59 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.96) (envelope-from ) id 1x4Cfy-006KtE-21; Wed, 09 Sep 2026 07:24:58 +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 1x4Cfz-007Wbw-0J; Wed, 09 Sep 2026 07:24:58 +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=3jw4iKButHJPwaMb26bDfnz2RJqz2Vwhjbbd7CxUQaM=; b=MCYOSvEzycmvGW87zaA1Lt2fWF Wq3Ry7QlufSuSOU7/JIHoaAqiF+9eNg12bm0AVqczoXX4abFxhlrRStsPFSvL/6q+jdDYvJzhMT4N TI+7iUZQO3/03kYKcEkUoJ0AhkvEtW8iVVxwHsZvN2ZQ7nq9dJ2wOtLOLhV+Nxy5grXI=; 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] x86/mm: limit deferred TLB flushing to PV owned pages Date: Wed, 9 Sep 2026 09:24:51 +0200 Message-ID: <20260909072451.67324-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: 1788938724099158500 The current logic on x86 will mark all domain owned pages as needed a TLB flush before being re-used. However such TLB flushing is only strictly needed for PV domain owned pages, as those can keep a reference to the page in the TLB after it has been freed. Limit the requirement of a flush to pages that are owned by PV domains. Signed-off-by: Roger Pau Monn=C3=A9 --- xen/common/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 62ac89b824de..be202f0b8d1e 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1501,6 +1501,7 @@ bool scrub_free_pages(void) =20 static bool mark_page_free(struct page_info *pg, mfn_t mfn) { + const struct domain *owner =3D page_get_owner(pg); bool pg_offlined =3D false; =20 ASSERT(mfn_x(mfn) =3D=3D mfn_x(page_to_mfn(pg))); @@ -1539,7 +1540,7 @@ static bool mark_page_free(struct page_info *pg, mfn_= t mfn) } =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); + pg->u.free.need_tlbflush =3D owner && is_pv_domain(owner); if ( pg->u.free.need_tlbflush ) page_set_tlbflush_timestamp(pg); =20 --=20 2.55.0