From nobody Tue Nov 11 08:34:40 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; 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; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1569426656; cv=none; d=zoho.com; s=zohoarc; b=epJcOpdbuI9Gao7MocuVy0zgQAkQ0klpaLBU2v3umr70qkRyzWy6abyJUieKVUH8CzvPY07INnJ7aMbrdT6cl3XCbmlKtChohhv90SjS/PY2uxkswvRyhbI5RYLzATGavDwHw0oM93U78ANH0EDTFdtJgFZCya5YK/hucm1J0dk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569426656; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=+aSsId/8lTm+rrqIsgHmkXKR1n3qh2GCzgh4Fdk6EUE=; b=jrZeh0Rayk83CFfwW+fFndeoE0GhGWQvKLkqZZmeSjNTx2ieBf18qzr0ZxSPU2aUSzGqXmeAZ1c7NCy4a2S5aJ8VZzdWdfiOj/DMwAnxjm+bZCYCy2LKwLLjNOXStqnK+MxikQ/wrpEFkjO7aDAJi5JNOD70w3RPnbp4Sb6MXrY= ARC-Authentication-Results: i=1; mx.zoho.com; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1569426656082306.47514027110935; Wed, 25 Sep 2019 08:50:56 -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 1iD9Y5-0000wK-2N; Wed, 25 Sep 2019 15:49:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iD9Y3-0000v7-W6 for xen-devel@lists.xenproject.org; Wed, 25 Sep 2019 15:49:48 +0000 Received: from mga12.intel.com (unknown [192.55.52.136]) by localhost (Halon) with ESMTPS id 12ae8a4e-dfac-11e9-9637-12813bfff9fa; Wed, 25 Sep 2019 15:49:36 +0000 (UTC) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2019 08:49:35 -0700 Received: from tlengyel-mobl2.amr.corp.intel.com (HELO localhost.localdomain) ([10.252.129.153]) by orsmga006.jf.intel.com with ESMTP; 25 Sep 2019 08:49:34 -0700 X-Inumbo-ID: 12ae8a4e-dfac-11e9-9637-12813bfff9fa X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,548,1559545200"; d="scan'208";a="193812679" From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Wed, 25 Sep 2019 08:48:49 -0700 Message-Id: <4a503c85061b8fc76736047c1818e2efdd9f6042.1569425745.git.tamas.lengyel@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [RFC PATCH for-next 11/18] x86/mem_sharing: Convert MEM_SHARING_DESTROY_GFN to a bool 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: Tamas K Lengyel , Tamas K Lengyel , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Stefano Stabellini , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" MEM_SHARING_DESTROY_GFN is used on the 'flags' bitfield during unsharing. However, the bitfield is not used for anything else, so just convert it to a bool instead. Signed-off-by: Tamas K Lengyel --- xen/arch/x86/mm/mem_sharing.c | 7 +++---- xen/arch/x86/mm/p2m.c | 1 + xen/common/memory.c | 2 +- xen/include/asm-x86/mem_sharing.h | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index bb6a44413b..157a3a1303 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -1175,7 +1175,7 @@ err_out: */ int __mem_sharing_unshare_page(struct domain *d, unsigned long gfn, - uint16_t flags) + bool destroy) { p2m_type_t p2mt; mfn_t mfn; @@ -1231,7 +1231,7 @@ int __mem_sharing_unshare_page(struct domain *d, * If the GFN is getting destroyed drop the references to MFN * (possibly freeing the page), and exit early. */ - if ( flags & MEM_SHARING_DESTROY_GFN ) + if ( destroy ) { if ( !last_gfn ) mem_sharing_gfn_destroy(page, d, gfn_info); @@ -1321,8 +1321,7 @@ int relinquish_shared_pages(struct domain *d) if ( mfn_valid(mfn) && p2m_is_shared(t) ) { /* Does not fail with ENOMEM given the DESTROY flag */ - BUG_ON(__mem_sharing_unshare_page(d, gfn, - MEM_SHARING_DESTROY_GFN)); + BUG_ON(__mem_sharing_unshare_page(d, gfn, true)); /* * Clear out the p2m entry so no one else may try to * unshare. Must succeed: we just read the old entry and diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 3d27c6c91a..aee0347785 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -512,6 +512,7 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, uns= igned long gfn_l, */ if ( mem_sharing_unshare_page(p2m->domain, gfn_l) < 0 ) mem_sharing_notify_enomem(p2m->domain, gfn_l, false); + mfn =3D p2m->get_entry(p2m, gfn, t, a, q, page_order, NULL); } =20 diff --git a/xen/common/memory.c b/xen/common/memory.c index d5aff83f2d..04bcd84a15 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -352,7 +352,7 @@ int guest_remove_page(struct domain *d, unsigned long g= mfn) * might be the only one using this shared page, and we need to * trigger proper cleanup. Once done, this is like any other page. */ - rc =3D mem_sharing_unshare_page(d, gmfn, 0); + rc =3D mem_sharing_unshare_page(d, gmfn); if ( rc ) { mem_sharing_notify_enomem(d, gmfn, false); diff --git a/xen/include/asm-x86/mem_sharing.h b/xen/include/asm-x86/mem_sh= aring.h index 57db72376b..18302adbfa 100644 --- a/xen/include/asm-x86/mem_sharing.h +++ b/xen/include/asm-x86/mem_sharing.h @@ -76,17 +76,16 @@ struct page_sharing_info unsigned int mem_sharing_get_nr_saved_mfns(void); unsigned int mem_sharing_get_nr_shared_mfns(void); =20 -#define MEM_SHARING_DESTROY_GFN (1<<1) /* Only fails with -ENOMEM. Enforce it with a BUG_ON wrapper. */ int __mem_sharing_unshare_page(struct domain *d, unsigned long gfn, - uint16_t flags); + bool destroy); =20 static inline int mem_sharing_unshare_page(struct domain *d, unsigned long gfn) { - int rc =3D __mem_sharing_unshare_page(d, gfn, 0); + int rc =3D __mem_sharing_unshare_page(d, gfn, false); BUG_ON( rc && (rc !=3D -ENOMEM) ); return rc; } --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel