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

Re: [XEN PATCH v3 04/16] x86: introduce CONFIG_ALTP2M Kconfig option


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Sergiy Kibrik <sergiy_kibrik@xxxxxxxx>
  • Date: Mon, 10 Jun 2024 13:48:49 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=o7ch+KUupsGWBalC7hP5erJUYI2POY1MW1Bg21YSMJU=; b=nKJ8lphR5YuRB0utbeQTrmklpdp8tBw1vMPKKz5rJmRs/fx1gAGPwqZ9b+8BAr+7Q1VucEHkLhYyF1A0CCjdbjUedLx7EKpo1d8xCoh4L0nqr8b0OSF/soBiGvv8Dn8z2Z/zaSFqkQ/ZOYG4VvkQkvRWzKNCPXSL3GfmHZSmscKVhdJfD8ThAW9NaOUVGtXZMeitCNeAPqAx2oAIzox33cCde97h/h7tgfhiOrgWWp1Hkw40pK1fH2NCEfJV/G89yITW3mkrzcOg2li6PpzW4vn221dxXbjuresjp72HEiF390uHGWzAftP4qblSWByYdx03R+xioJ5ABI+Dt1oULQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lCPIXS/11gaFq4AMvFuX69wkD6YU9aYTnkOMzf5Uvd2eNED0C9U7VWBiAsW9xJcrLwHj0MCvIlbnNh9kTVlEtPChinuk0U0uTldZ4MG1TxWMWhvg+wArA0cnNGQO7wtCyusgCysbdtGAcAGLuo2LPJT2d09I12lJh52SwL82dquXkS2qjxV6vd3TX5Mo5foEbvH0bgFwf22e+7b9eJo4QKwOjkvVKOr9guokuZYwkTmnxxCuxmVN67j+zzHR4VBz7+r1lqGXBjupgJtq/QhEW1HhiZ1qYAMp5uhHO8idUG2CDmUYMvCPbPUXETAWrTuerDOCBnrOp5uOV0x3hX+xUg==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 10 Jun 2024 10:49:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

07.06.24 10:47, Jan Beulich:
On 03.06.2024 13:13, Sergiy Kibrik wrote:
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -577,10 +577,10 @@ static inline gfn_t mfn_to_gfn(const struct domain *d, 
mfn_t mfn)
          return _gfn(mfn_x(mfn));
  }
-#ifdef CONFIG_HVM
  #define AP2MGET_prepopulate true
  #define AP2MGET_query false
+#ifdef CONFIG_ALTP2M
  /*
   * Looks up altp2m entry. If the entry is not found it looks up the entry in
   * hostp2m.

In principle this #ifdef shouldn't need moving. It's just that the
three use sites need taking care of a little differently. E.g. ...

@@ -589,6 +589,15 @@ static inline gfn_t mfn_to_gfn(const struct domain *d, 
mfn_t mfn)
  int altp2m_get_effective_entry(struct p2m_domain *ap2m, gfn_t gfn, mfn_t *mfn,
                                 p2m_type_t *t, p2m_access_t *a,
                                 bool prepopulate);
+#else
+static inline int altp2m_get_effective_entry(struct p2m_domain *ap2m,
+                                             gfn_t gfn, mfn_t *mfn,
+                                             p2m_type_t *t, p2m_access_t *a,
+                                             bool prepopulate)
+{
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
+}

static inline int altp2m_get_effective_entry(struct p2m_domain *ap2m,
                                              gfn_t gfn, mfn_t *mfn,
                                              p2m_type_t *t, p2m_access_t *a)
{
     ASSERT_UNREACHABLE();
     return -EOPNOTSUPP;
}
#define altp2m_get_effective_entry(ap2m, gfn, mfn, t, a, prepopulate) \
         altp2m_get_effective_entry(ap2m, gfn, mfn, t, a)

Misra doesn't like such shadowing, so the inline function may want
naming slightly differently, e.g. _ap2m_get_effective_entry().


I can do that, sure.
Though here I'm curious what benefits we're getting from little complication of an indirect call to an empty stub -- is avoiding of AP2MGET_* defines worth it?

  -Sergiy



 


Rackspace

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