From nobody Fri Mar 29 05:45:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1567606902; cv=none; d=zoho.com; s=zohoarc; b=J7hYZ54g8NqhUMX+Nu0Qq28V9DLBBjgerYNXdJNZKWVUha8/vjABS9qbSYWceRdrSLxPNJ4ESGOgHsVNtU2jX0YMDYbhL5YU9HUeVHoITPRzXjYQiyl9POOZA/iTuDxK84cvnkCRVMNeSc0F5hW2V/E0RXaknaYszorxNhuVv34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567606902; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=8Z+l2D+iLmA7XoJqyYLaW8WpfQmwXE7nZ07TJ9seEJM=; b=YQdUZESvCnTmBcoCnHdEo2BaaSoqAS1rfur6qTsoxYWYcpAoSfS7rLQuTw9mKh8dG0ShEW3bqWGosD/v9FXdxSpLvzXO7AcEoEy6oUKgGxwWNj8nuAO2G1+/lOToHdafiB911Bdmjbk6GUypjkty02dm/k2LfsiQwPJo1cf0Xg0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1567606902003215.8763653354572; Wed, 4 Sep 2019 07:21:42 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i5W9C-0000VH-Dj; Wed, 04 Sep 2019 14:20:34 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i5W9B-0000VC-7z for xen-devel@lists.xenproject.org; Wed, 04 Sep 2019 14:20:33 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2723befe-cf1f-11e9-a337-bc764e2007e4; Wed, 04 Sep 2019 14:20:32 +0000 (UTC) X-Inumbo-ID: 2723befe-cf1f-11e9-a337-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1567606832; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZYX6wYx4qjiZh95p+nP0xj1a/b2Xi2vHwwmYJ0nSRQM=; b=QvrH0Wqc47p9LauGtFEa6POt0tDtnOYeTCfj22vSiwZznrIJxuHNrOK9 BswAIuDkhcXJOVeD3B3Uv7T+rj68b8FU5B7XRxrWrtryRLdunip19e0Y9 l8IypwX5H7gXfkSatvEyL+5TixdMFddVyuXJf4SNmhsO//hG6MLhdzlAg k=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: DLwzWs2bUOUrmz+ynIBA2ytAyJN8gCbOZtLFRg+9YefDezheUMUNgQ/I99ERjQiPlHREvR91fs RMIhRPV/10efT2OQJwBiEW31cOtZ4DmpA3vx8pTE2CKntivsujuTicjxikV7lkPRZ1+Vpn3++d f3RnLqE5OEwVk6hU1jwdxOSXNaGFEoORUwHsXquNuHhW/+XpfZbdq33KkBOAjC0aWiwVFswA5b rl2Wxwm+6e9tTE/2sUN/7E+rVe1FObF8Nvjod90lVGQMw+E9+ove7KTVfMTfWgkyuk4j99OOBX d60= X-SBRS: 2.7 X-MesageID: 5392662 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,467,1559534400"; d="scan'208";a="5392662" From: Roger Pau Monne To: Date: Wed, 4 Sep 2019 16:20:26 +0200 Message-ID: <20190904142026.9946-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] p2m/ept: add _subtree suffix to ept_invalidate_emt X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Jun Nakajima , Wei Liu , George Dunlap , Andrew Cooper , Jan Beulich , Roger Pau Monne Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) So that the name implies the function is used to walk the page table pointer passed as parameter. Drop the parent_ prefix from the level parameter, since the level passed is the one matching the EPT entry passed in the mfn parameter. While there also change bool_t to bool and add an assert to make sure no level 0 entries (ie: 4K EPT leaf entries) are passed as parameters. No functional change intended. Suggested-by: Kevin Tian Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Kevin Tian --- xen/arch/x86/mm/p2m-ept.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index 952ebad82f..d0e62905f8 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -348,13 +348,19 @@ static int ept_next_level(struct p2m_domain *p2m, boo= l_t read_only, * present entries in the given page table, optionally marking the entries * also for their subtrees needing P2M type re-calculation. */ -static bool_t ept_invalidate_emt(struct p2m_domain *p2m, mfn_t mfn, - bool_t recalc, unsigned int parent_level) +static bool ept_invalidate_emt_subtree(struct p2m_domain *p2m, mfn_t mfn, + bool recalc, unsigned int level) { int rc; ept_entry_t *epte =3D map_domain_page(mfn); unsigned int i; - bool_t changed =3D 0; + bool changed =3D false; + + if ( !level ) + { + ASSERT_UNREACHABLE(); + return false; + } =20 for ( i =3D 0; i < EPT_PAGETABLE_ENTRIES; i++ ) { @@ -367,9 +373,9 @@ static bool_t ept_invalidate_emt(struct p2m_domain *p2m= , mfn_t mfn, e.emt =3D MTRR_NUM_TYPES; if ( recalc ) e.recalc =3D 1; - rc =3D atomic_write_ept_entry(p2m, &epte[i], e, parent_level - 1); + rc =3D atomic_write_ept_entry(p2m, &epte[i], e, level - 1); ASSERT(rc =3D=3D 0); - changed =3D 1; + changed =3D true; } =20 unmap_domain_page(epte); @@ -378,7 +384,7 @@ static bool_t ept_invalidate_emt(struct p2m_domain *p2m= , mfn_t mfn, } =20 /* - * Just like ept_invalidate_emt() except that + * Just like ept_invalidate_emt_subtree() except that * - not all entries at the targeted level may need processing, * - the re-calculation flag gets always set. * The passed in range is guaranteed to not cross a page (table) @@ -574,7 +580,7 @@ static int resolve_misconfig(struct p2m_domain *p2m, un= signed long gfn) if ( e.emt =3D=3D MTRR_NUM_TYPES ) { ASSERT(is_epte_present(&e)); - ept_invalidate_emt(p2m, _mfn(e.mfn), e.recalc, level); + ept_invalidate_emt_subtree(p2m, _mfn(e.mfn), e.recalc, level); smp_wmb(); e.emt =3D 0; e.recalc =3D 0; @@ -1006,7 +1012,7 @@ static void ept_change_entry_type_global(struct p2m_d= omain *p2m, if ( !mfn ) return; =20 - if ( ept_invalidate_emt(p2m, _mfn(mfn), 1, p2m->ept.wl) ) + if ( ept_invalidate_emt_subtree(p2m, _mfn(mfn), 1, p2m->ept.wl) ) ept_sync_domain(p2m); } =20 @@ -1064,7 +1070,7 @@ static void ept_memory_type_changed(struct p2m_domain= *p2m) if ( !mfn ) return; =20 - if ( ept_invalidate_emt(p2m, _mfn(mfn), 0, p2m->ept.wl) ) + if ( ept_invalidate_emt_subtree(p2m, _mfn(mfn), 0, p2m->ept.wl) ) ept_sync_domain(p2m); } =20 --=20 2.22.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel