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

Re: [XEN][PATCH 2/5] x86: hvm: compat: introduce vcpu_is_hcall_compat() helper


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Thu, 13 Nov 2025 15:07:45 +0200
  • 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=arcselector10001; 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=wzy8FownzoRAvU99db6E6GX1e7LSO8GhdaElH9T9Me8=; b=aqIrAMv8mGb4P5j5Iirmbl93XYGlIjjMgc5Nm6DKzvBrjVcZxVK/tClf1e+h+mxSGITatR1I/9DSM7cFlANAP7zs8u2lpXDTKvguIvF1MiUh1VYXvoTleinaBQibTSzTPOAGiujf2Z2fDysh1sD+WOxAlBjvYVqYsVuuCPE5oeIq5P1Jp01o2OdsSSyQNQUn1bcnzBakwhvqoU1WXkAhNTjyF1o5ThLGdgtVY6BrfQEiRczZ9kGynX+GL7naeB0wheIIG/gCv649+RvdVaoSHGiFzffoovdIn4ZgvoUjoxJDB4vIRcz9F917hdA9TdfmWCX1PEu/Q0GaBeUt3d1EXQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u0QngciImuDokVHLlADAk/d69qypSWbz/L1j6ddfIYAzgP1oQvqd6kecXeWFsFM8uCZ6xl4uvY1GCiNt9Ms+z+PB97us1ZXD+gFOTmh79pyfS3E28UO36bzfGBQcoTp+MXsn5MyHJwuuh0LYLL9/617UOcSbnWQIMmvAsdtUV8AqzEjDCnil1SXV36693u1FL0qcCu7Y0nnSs3H3A71Q43nADdnAF53ioqlXkNNZLxQW95tRUgzAviuKzSBENiyFM85HnCdXwLiVRihRQy/0jjb1Xna2lRXeJVXQdeBLLHNduzQcqLSv4/GzyarMpwKqol5R3RO3iS0aDuzs9dZuaQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 13 Nov 2025 13:07:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 13.11.25 14:22, Jan Beulich wrote:
On 11.11.2025 18:54, Grygorii Strashko wrote:
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -311,6 +311,15 @@ struct vcpu
  #endif
  };
+static inline bool vcpu_is_hcall_compat(const struct vcpu *v)

Does the vcpu_ prefix really buy us much here? The per-vCPU aspect is already
conveyed by the function parameter, I'd say.

Such annotation makes it clear that operation is performed on struct vcpu 
object,
which improves readability and code analyze (might help also if somebody will 
ever
try split sched.h).

For example:

is_hcall_compat(curr) in the code doesn't say too much - need parse code
(or have modern editor which can parse and highlight parameter type for us,
 still need some mouse manipulations:))

vcpu_is_hcall_compat(curr) - is kinda absolutely clear from the first look.

Actually - is a parameter in fact needed? It's always current afaics. (Then,
if the parameter was to stay for some reason, it would want naming "curr".)

"curr" it be


+{
+#ifdef CONFIG_COMPAT
+    return v->hcall_compat;

As long as you don't remove the struct field, ...

It is already under
#ifdef CONFIG_COMPAT
    /* A hypercall is using the compat ABI? */
    bool             hcall_compat;
    /* Physical runstate area registered via compat ABI? */
    bool             runstate_guest_area_compat;
#endif

which is the main reason for vcpu_is_hcall_compat() introduction.


+#else
+    return false;
+#endif /* CONFIG_COMPAT */

... why not

     return IS_ENABLED(CONFIG_COMPAT) && v->hcall_compat;


--
Best regards,
-grygorii




 


Rackspace

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