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

Re: [PATCH v3 2/2] xen: introduce CONFIG_HAS_SHARED_INFO for archs without a shared page





On 6/17/26 3:26 PM, Jan Beulich wrote:
+#define shared_info(d, field) \
+    (*(typeof(__shared_info(d, (d)->shared_info, field)) 
*)shared_info_absent())
How about the simpler

extern struct shared_info *shared_info_absent;
#define shared_info(d, field) (shared_info_absent->field)

?

This could lead to compilation error:

common/domain.c: In function 'vcpu_info_reset':
common/domain.c:316:20: error: unused variable 'd' [-Werror=unused-variable]
  316 |     struct domain *d = v->domain;
      |                    ^
cc1: all warnings being treated as errors

One of fixes could be just drop usage of local variable d in vcpu_info_reset():

diff --git a/xen/common/domain.c b/xen/common/domain.c
index fba8e9161937..d3b0bd571609 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -313,11 +313,9 @@ static void vcpu_check_shutdown(struct vcpu *v)

 void vcpu_info_reset(struct vcpu *v)
 {
-    struct domain *d = v->domain;
-
     v->vcpu_info_area.map =
IS_ENABLED(CONFIG_HAS_SHARED_INFO) && v->vcpu_id < XEN_LEGACY_MAX_VCPUS
-        ? (vcpu_info_t *)&shared_info(d, vcpu_info[v->vcpu_id])
+        ? (vcpu_info_t *)&shared_info(v->domain, vcpu_info[v->vcpu_id])
         : &dummy_vcpu_info;
 }


OR shared_info() defintion should be updated to:

#define shared_info(d, field) (*((void)(d), &shared_info_absent->field))

IMO, an update of macros defintion looks a little bit more common.

Which one do you prefer? Any better suggestion?

Thanks.

~ oleksii



 


Rackspace

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