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

Re: [XEN PATCH v4 12/14] x86/ioreq: guard VIO_realmode_completion with CONFIG_VMX


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Sergiy Kibrik <sergiy_kibrik@xxxxxxxx>
  • Date: Wed, 10 Jul 2024 13:10:51 +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=ERDALx3/dNAIti2FoW9con7z9jmPBqC88euLxc/I3BM=; b=f+Om5fRIm21PQIOt9nPrgvGA1PcCNJerUW7z5khnNY8ogIrrC9HN5ssr2H3P2wydIMLTbe0EOFM9WX5kfMNA2ODgmSk+KxN7TdjXYBUbLZ5B/TU7edXpgAX+HwEET3VPSlIQKt/k4DiWFUBxsH4CY9/rA4mvOjyKvihGvJnkIZ/7W2cuq0wZgYtw8Xqmb6HBAxxNdZEJtx03geNS/gxtoFiC+5jZtbF1yrPkoCJQnISGUb/7hV2Z0qgYVg2CHwOhUyOQr4NcJlhvJFmNmCUv87yN1bLn6MqZ/NlFYkp2Hq0hxzpnSdnDGQtoQzBFEVclDyWgTJ966t1Rn+Wvw/ZwuA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z2ifTAd6GsYr0UjpBSZX2i3JU7CCXxV6bJddOCNth5CceLIPgkyYVKNxllB6I2pog3aPmo3jAqIu00Y1aMAxFYIk9Ycq9/5wkFFM8VMpNaG0icpJzrQCHJWW/4fSQtzKLaG6plb6H43WQ+uaqxuxs6GczfmntC18T5j5Qt/RF3HkeIY3oRZuk+ZI1JwXyIceIKt4rda0eb+021S3h5vFzo8Mq8WAcpXZt0PEk+HLUdD6+9NfaW0UUM+j8MbI3cQQH2kojW4M4RZRsKHZIFg37VcBNUaN2vCYgtV8gINRaJfqbYvB2z4Sl1AXjrsBrWbxpCyqmxHWOXrjQbKtYjM+bA==
  • Cc: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>, Julien Grall <julien@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 10 Jul 2024 10:11:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

09.07.24 10:28, Jan Beulich:
On 09.07.2024 08:09, Sergiy Kibrik wrote:
--- a/xen/arch/x86/include/asm/hvm/ioreq.h
+++ b/xen/arch/x86/include/asm/hvm/ioreq.h
@@ -13,6 +13,11 @@
  #define IOREQ_STATUS_UNHANDLED   X86EMUL_UNHANDLEABLE
  #define IOREQ_STATUS_RETRY       X86EMUL_RETRY
+#ifdef CONFIG_VMX
+bool arch_vcpu_ioreq_completion(enum vio_completion completion);
+#define arch_vcpu_ioreq_completion
+#endif

Putting the (or some kind of) #define here is certainly fine, but moving ...

--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -111,7 +111,6 @@ void ioreq_domain_init(struct domain *d);
  int ioreq_server_dm_op(struct xen_dm_op *op, struct domain *d, bool 
*const_op);
bool arch_ioreq_complete_mmio(void);
-bool arch_vcpu_ioreq_completion(enum vio_completion completion);
  int arch_ioreq_server_map_pages(struct ioreq_server *s);
  void arch_ioreq_server_unmap_pages(struct ioreq_server *s);
  void arch_ioreq_server_enable(struct ioreq_server *s);

... the declaration from here requires that all architectures wanting to
implement the function need to have identical copies. That's unnecessary
risk of going out of sync.

As to the #define itself: It expanding to nothing means the call site
de-generates to

#ifdef arch_vcpu_ioreq_completion
         res = (completion);
#else

which hardly is what is meant (despite compiling fine, and it likely
only being Eclair which would then tell us about the issue). Further
there you're also removing a blank line, I don't see why you're doing
that.


looking through these changes once again I wonder why can't we just move stub to the header like this:

in xen/include/xen/ioreq.h:

#ifdef arch_vcpu_ioreq_completion

#ifdef CONFIG_VMX
bool arch_vcpu_ioreq_completion(enum vio_completion completion);
#else
static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
{
    ASSERT_UNREACHABLE();
    return true;
}
#endif


and avoid additional pre-processor variables & conditionals, because it looks like we do need some kind of stub that does ASSERT_UNREACHABLE() anyway.

  -Sergiy



 


Rackspace

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