Skip to contentSkip to conversation

xen: change the type of xen_vcpu_id to uint32_t

PATCH Superseded Vitaly Kuznetsov 2 participants 5 messages Jul 28, 2016 – Jul 29, 2016

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: change the type of xen_vcpu_id to uint32_t

We pass xen_vcpu_id mapping information to hypercalls which require uint32_t type so it would be cleaner to have it as uint32_t. The initializer to -1 can be dropped as we always do the mapping before using it and we never check the 'not set' value anyway.

---
 arch/arm/xen/enlighten.c | 2 +-
 arch/x86/xen/enlighten.c | 2 +-
 include/xen/xen-ops.h    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/xen/enlighten.c +1 -1
index 6d3a171..1752116 100644
@@ -47,7 +47,7 @@ DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
 static struct vcpu_info __percpu *xen_vcpu_info;
 
 /* Linux <-> Xen vCPU id mapping */
-DEFINE_PER_CPU(int, xen_vcpu_id) = -1;
+DEFINE_PER_CPU(uint32_t, xen_vcpu_id);
 EXPORT_PER_CPU_SYMBOL(xen_vcpu_id);
 
 /* These are unused until we support booting "pre-ballooned" */
arch/x86/xen/enlighten.c +1 -1
index 54eef1a..78a14a0 100644
@@ -120,7 +120,7 @@ DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
 DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);
 
 /* Linux <-> Xen vCPU id mapping */
-DEFINE_PER_CPU(int, xen_vcpu_id) = -1;
+DEFINE_PER_CPU(uint32_t, xen_vcpu_id);
 EXPORT_PER_CPU_SYMBOL(xen_vcpu_id);
 
 enum xen_domain_type xen_domain_type = XEN_NATIVE;
include/xen/xen-ops.h +1 -1
index a4926f1..648ce814 100644
@@ -9,7 +9,7 @@
 
 DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
 
-DECLARE_PER_CPU(int, xen_vcpu_id);
+DECLARE_PER_CPU(uint32_t, xen_vcpu_id);
 static inline int xen_vcpu_nr(int cpu)
 {
 	return per_cpu(xen_vcpu_id, cpu);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · Vitaly Kuznetsov

We pass xen_vcpu_id mapping information to hypercalls which require uint32_t type so it would be cleaner to have it as uint32_t. The initializer to -1 can be dropped as we always do the mapping before using it and we never check the 'not set' value anyway.

[...]

include/xen/xen-ops.h line 13

Quoted 9 lines
include/xen/xen-ops.h +1 -1
@@ -9,7 +9,7 @@
 
 DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
 
-DECLARE_PER_CPU(int, xen_vcpu_id);
+DECLARE_PER_CPU(uint32_t, xen_vcpu_id);
 static inline int xen_vcpu_nr(int cpu)

Should the return type of this change to uint32_t as well?

include/xen/xen-ops.h line 15

Quoted 3 lines
include/xen/xen-ops.h +0 -0
 {
 	return per_cpu(xen_vcpu_id, cpu);

David

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Vitaly Kuznetsov
Quoted 4 lines · Vitaly Kuznetsov

We pass xen_vcpu_id mapping information to hypercalls which require uint32_t type so it would be cleaner to have it as uint32_t. The initializer to -1 can be dropped as we always do the mapping before using it and we never check the 'not set' value anyway.

[...]

include/xen/xen-ops.h line 13

Quoted 9 lines
include/xen/xen-ops.h +1 -1
@@ -9,7 +9,7 @@
 
 DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
 
-DECLARE_PER_CPU(int, xen_vcpu_id);
+DECLARE_PER_CPU(uint32_t, xen_vcpu_id);
 static inline int xen_vcpu_nr(int cpu)

Should the return type of this change to uint32_t as well?

include/xen/xen-ops.h line 15

Quoted 3 lines
include/xen/xen-ops.h +0 -0
 {
 	return per_cpu(xen_vcpu_id, cpu);

David

#3 lore raw
Quoted 10 lines · David Vrabel
Quoted 4 lines · Vitaly Kuznetsov

We pass xen_vcpu_id mapping information to hypercalls which require uint32_t type so it would be cleaner to have it as uint32_t. The initializer to -1 can be dropped as we always do the mapping before using it and we never check the 'not set' value anyway.

[...]

Quoted 4 lines
include/xen/xen-ops.h +0 -0
@@ -9,7 +9,7 @@
 
Quoted 8 lines

include/xen/xen-ops.h line 13

Quoted 5 lines
include/xen/xen-ops.h +1 -1
 DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
 
-DECLARE_PER_CPU(int, xen_vcpu_id);
+DECLARE_PER_CPU(uint32_t, xen_vcpu_id);
 static inline int xen_vcpu_nr(int cpu)

Should the return type of this change to uint32_t as well?

Yes, missed that, will do v2. Sorry!

Quoted 3 lines
Quoted 3 lines
include/xen/xen-ops.h +0 -0
 {
 	return per_cpu(xen_vcpu_id, cpu);
Signature · 6 lines
  Vitaly

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw
In reply to David Vrabel
Quoted 10 lines · David Vrabel
Quoted 4 lines · Vitaly Kuznetsov

We pass xen_vcpu_id mapping information to hypercalls which require uint32_t type so it would be cleaner to have it as uint32_t. The initializer to -1 can be dropped as we always do the mapping before using it and we never check the 'not set' value anyway.

[...]

Quoted 4 lines
include/xen/xen-ops.h +0 -0
@@ -9,7 +9,7 @@
 
Quoted 8 lines

include/xen/xen-ops.h line 13

Quoted 5 lines
include/xen/xen-ops.h +1 -1
 DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
 
-DECLARE_PER_CPU(int, xen_vcpu_id);
+DECLARE_PER_CPU(uint32_t, xen_vcpu_id);
 static inline int xen_vcpu_nr(int cpu)

Should the return type of this change to uint32_t as well?

Yes, missed that, will do v2. Sorry!

Quoted 3 lines
Quoted 3 lines
include/xen/xen-ops.h +0 -0
 {
 	return per_cpu(xen_vcpu_id, cpu);
Signature · 1 line
  Vitaly