[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/2] x86/p2m: make p2m_get_page_from_gfn() handle grant case correctly


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 23 Jun 2022 13:53:54 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1OxswrBk4M276hwZgUxG9p4J92lXbotQZzLwSqRbrQw=; b=i4VtSc0tB0S01PX+o/ytf1Jd/RxgiQiOyn26bTKYMe0HnguaZM3eF+/yzfjpx8ZyNlj/Gi3lBhffOyutt450oCgs+CtfC2FLkXgUNuN1hpXNvI6/1iVdFP6k9oX1Qo5dmAsrq+uEs5wECqRlI8ZwKoZ+FViwclyAJI1mF7NO5dQh3SjF5Tg2jdvXNi4to24/iZX0RvAcHIOlSoEEbUiWyrnUo9gCrZO0a2euqsfyKUCoVuBoVCR4MaWlDwlhtEza8j8/0uZ7IyRslgphZH8psFh9gbrxXB97p1NWz4yWiiFQkzNlLQdgu9Yz5qZHtUftUNwSYut/EMaQE/1AkSIGPw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jCfSS+LhFVbqkAUPNerbQkZbB/w2U0/qDxrRFdliNEFR/kszo8fN2L8srDYbV5THeSHF9II4lpGNFuZDFsdhS6ka8qhVUehFSrNZzuTE+ZVP5SvlB9R79BRWTxpBacsdxQOeTGJXN3qmnQTqYPE1h9whCQggaMF9qk4Dyox9fdfbUs8tZII4cGYVmlTwPIfhD56qSLofG2uGUTiHC6CFv5beHR2uN0fhqydhGKocJRQnplzb2Pbg1wGqsnkjmni47ISj6t1/nkKP8/O9Oev4O36QYzDT+/BVzRQbo7LHI/jjfC4yayUaO6FbU0MbnvBkb5t0QFIDJDs0uQjJS1X/bA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
  • Delivery-date: Thu, 23 Jun 2022 11:53:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Grant P2M entries, which are covered by p2m_is_any_ram(), wouldn't pass
the get_page() unless the grant was a local one. These need to take the
same path as foreign entries. Just the assertion there is not valid for
local grants, and hence it triggering needs to be avoided.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Using | instead of || helps the compiler fold the two p2m_is_*().
---
v2: The shared case was fine; limit to grant adjustment.

--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -357,11 +357,11 @@ struct page_info *p2m_get_page_from_gfn(
              && !((q & P2M_UNSHARE) && p2m_is_shared(*t)) )
         {
             page = mfn_to_page(mfn);
-            if ( unlikely(p2m_is_foreign(*t)) )
+            if ( unlikely(p2m_is_foreign(*t) | p2m_is_grant(*t)) )
             {
                 struct domain *fdom = page_get_owner_and_reference(page);
 
-                ASSERT(fdom != p2m->domain);
+                ASSERT(!p2m_is_foreign(*t) || fdom != p2m->domain);
                 if ( fdom == NULL )
                     page = NULL;
             }




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.