Skip to contentSkip to conversation

public: xen: Define missing guest handle for int32_t

PATCH In review Michal Orzel 5 participants 10 messages Apr 17, 2024 – Apr 26, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 public: xen: Define missing guest handle for int32_t

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

  205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ## name
      |                                         ^~~~~~~~~~~~~~~~~~
./include/public/arch-arm.h:206:41: note: in expansion of macro ‘__XEN_GUEST_HANDLE’
  206 | #define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
      |                                         ^~~~~~~~~~~~~~~~~~

./include/public/memory.h:277:5: note: in expansion of macro ‘XEN_GUEST_HANDLE’
277 | XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Fixes afab29d0882f ("public: s/int/int32_t")
---
 xen/include/public/xen.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/public/xen.h +1 -1
index b47d48d0e2d6..8fd0cec880d5 100644
@@ -28,7 +28,6 @@
 /* Guest handles for primitive C types. */
 DEFINE_XEN_GUEST_HANDLE(char);
 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);
-DEFINE_XEN_GUEST_HANDLE(int);
 __DEFINE_XEN_GUEST_HANDLE(uint,  unsigned int);
 #if __XEN_INTERFACE_VERSION__ < 0x00040300
 DEFINE_XEN_GUEST_HANDLE(long);
@@ -36,6 +35,7 @@ __DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);
 #endif
 DEFINE_XEN_GUEST_HANDLE(void);
 
+DEFINE_XEN_GUEST_HANDLE(int32_t);
 DEFINE_XEN_GUEST_HANDLE(uint64_t);
 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
Signature · 1 line
2.25.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi Michal,

Quoted 12 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

 205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ## name
     |                                         ^~~~~~~~~~~~~~~~~~
./include/public/arch-arm.h:206:41: note: in expansion of macro ‘__XEN_GUEST_HANDLE’
 206 | #define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
     |                                         ^~~~~~~~~~~~~~~~~~
Quoted 8 lines

./include/public/memory.h:277:5: note: in expansion of macro ‘XEN_GUEST_HANDLE’
277 | XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Fixes afab29d0882f ("public: s/int/int32_t")

---

I’ve build it for arm64, arm32 and x86

#2 lore raw
In reply to Michal Orzel

Hi Michal,

Quoted 10 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

   205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ## name
       |                                         ^~~~~~~~~~~~~~~~~~
./include/public/arch-arm.h:206:41: note: in expansion of macro ‘__XEN_GUEST_HANDLE’
   206 | #define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
       |                                         ^~~~~~~~~~~~~~~~~~
Quoted 7 lines

./include/public/memory.h:277:5: note: in expansion of macro ‘XEN_GUEST_HANDLE’
277 | XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Fixes afab29d0882f ("public: s/int/int32_t")

So it turned out that I committed v1 from Stefano. I was meant to commit the patch at all, but I think I started with a dirty staging :(. Sorry for that.

I have reverted Stefano's commit for now so we can take the correct patch.

Now, from my understanding, Andrew suggested on Matrix that this solution may actually be a good way to handle GUEST_HANLDEs (they were removed in v2). Maybe this can be folded in Stefano's patch?

Cheers,

Signature · 1 line
Julien Grall
Reviewed-by
#3 lore raw
Quoted 23 lines · Julien Grall

Hi Michal,

Quoted 20 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

   205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ## name
       |                                         ^~~~~~~~~~~~~~~~~~
./include/public/arch-arm.h:206:41: note: in expansion of macro
‘__XEN_GUEST_HANDLE’
   206 | #define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
       |                                         ^~~~~~~~~~~~~~~~~~

./include/public/memory.h:277:5: note: in expansion of macro ‘XEN_GUEST_HANDLE’
277 | XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Fixes afab29d0882f ("public: s/int/int32_t")
Quoted 8 lines

So it turned out that I committed v1 from Stefano. I was meant to commit the patch at all, but I think I started with a dirty staging :(. Sorry for that.

I have reverted Stefano's commit for now so we can take the correct patch.

Now, from my understanding, Andrew suggested on Matrix that this solution may actually be a good way to handle GUEST_HANLDEs (they were removed in v2). Maybe this can be folded in Stefano's patch?

v1 together with Michal's fix is correct. Also v2 alone is correct, or v2 with Michal's fix is also correct.

My preference is v2 with Michal's fix, they can be committed as separate patches. Also the others options are fine.

#4 lore raw

Hi Stefano,

Quoted 31 lines · Stefano Stabellini
Quoted 23 lines · Julien Grall

Hi Michal,

Quoted 20 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

    205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ## name
        |                                         ^~~~~~~~~~~~~~~~~~
./include/public/arch-arm.h:206:41: note: in expansion of macro
‘__XEN_GUEST_HANDLE’
    206 | #define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
        |                                         ^~~~~~~~~~~~~~~~~~
./include/public/memory.h:277:5: note: in expansion of macro
‘XEN_GUEST_HANDLE’
    277 |     XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Fixes afab29d0882f ("public: s/int/int32_t")
Quoted 3 lines

So it turned out that I committed v1 from Stefano. I was meant to commit the patch at all, but I think I started with a dirty staging :(. Sorry for that.

Quoted 8 lines
Quoted 5 lines

I have reverted Stefano's commit for now so we can take the correct patch.

Now, from my understanding, Andrew suggested on Matrix that this solution may actually be a good way to handle GUEST_HANLDEs (they were removed in v2). Maybe this can be folded in Stefano's patch?

v1 together with Michal's fix is correct. Also v2 alone is correct, or v2 with Michal's fix is also correct.

I am slightly confused, v2 + Michal's fix means that XEN_GUEST_HANDLE(int) is removed and we introduce XEN_GUEST_INT(int32_t) with no user. So wouldn't this break the build?

Quoted 3 lines

My preference is v2 with Michal's fix, they can be committed as separate patches. Also the others options are fine.

I am fine if you want to commit them separately. However, I am not sure your suggestion about using v2 + Michal's fix is actually correct.

Cheers,

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 45 lines · Julien Grall

Hi Stefano,

Quoted 42 lines · Stefano Stabellini
Quoted 25 lines · Julien Grall

Hi Michal,

Quoted 22 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

    205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ##
name
        |                                         ^~~~~~~~~~~~~~~~~~

./include/public/arch-arm.h:206:41: note: in expansion of macro ‘__XEN_GUEST_HANDLE’
206 | #define XEN_GUEST_HANDLE(name)
__XEN_GUEST_HANDLE(name)

        |                                         ^~~~~~~~~~~~~~~~~~
./include/public/memory.h:277:5: note: in expansion of macro
‘XEN_GUEST_HANDLE’
    277 |     XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Fixes afab29d0882f ("public: s/int/int32_t")
Quoted 11 lines

So it turned out that I committed v1 from Stefano. I was meant to commit the
patch at all, but I think I started with a dirty staging :(. Sorry for that.

I have reverted Stefano's commit for now so we can take the correct patch.

Now, from my understanding, Andrew suggested on Matrix that this solution may
actually be a good way to handle GUEST_HANLDEs (they were removed in v2). Maybe this can be folded in Stefano's patch?

Quoted 5 lines
Quoted 2 lines

v1 together with Michal's fix is correct. Also v2 alone is correct, or v2 with Michal's fix is also correct.

I am slightly confused, v2 + Michal's fix means that XEN_GUEST_HANDLE(int) is removed and we introduce XEN_GUEST_INT(int32_t) with no user. So wouldn't this

You are right I apologize. I looked at Michal's patch too quickly and I thought it was just adding XEN_GUEST_INT(int32_t) without removing anything.

In that case, if you are OK with it, please ack and commit v2 only.

#6 lore raw
Quoted 49 lines · Stefano Stabellini
Quoted 48 lines · Julien Grall

Hi Stefano,

Quoted 44 lines · Stefano Stabellini
Quoted 25 lines · Julien Grall

Hi Michal,

Quoted 22 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

    205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ##
name
        |                                         ^~~~~~~~~~~~~~~~~~

./include/public/arch-arm.h:206:41: note: in expansion of macro ‘__XEN_GUEST_HANDLE’
206 | #define XEN_GUEST_HANDLE(name)
__XEN_GUEST_HANDLE(name)

        |                                         ^~~~~~~~~~~~~~~~~~
./include/public/memory.h:277:5: note: in expansion of macro
‘XEN_GUEST_HANDLE’
    277 |     XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Fixes afab29d0882f ("public: s/int/int32_t")
Quoted 11 lines

So it turned out that I committed v1 from Stefano. I was meant to commit the
patch at all, but I think I started with a dirty staging :(. Sorry for that.

I have reverted Stefano's commit for now so we can take the correct patch.

Now, from my understanding, Andrew suggested on Matrix that this solution may
actually be a good way to handle GUEST_HANLDEs (they were removed in v2). Maybe this can be folded in Stefano's patch?

v1 together with Michal's fix is correct. Also v2 alone is correct, or v2 with Michal's fix is also correct.

Quoted 8 lines
Quoted 2 lines

I am slightly confused, v2 + Michal's fix means that XEN_GUEST_HANDLE(int) is removed and we introduce XEN_GUEST_INT(int32_t) with no user. So wouldn't this

You are right I apologize. I looked at Michal's patch too quickly and I thought it was just adding XEN_GUEST_INT(int32_t) without removing anything.

In that case, if you are OK with it, please ack and commit v2 only.

Just to mention it: Committing would apparently be premature, as I can't spot any response to comments I gave to the patch. I'm okay with those being addressed verbally only, but imo they cannot be dropped on the floor.

Jan

#7 lore raw
Quoted 57 lines · Jan Beulich
Quoted 56 lines · Stefano Stabellini
Quoted 45 lines · Julien Grall

Hi Stefano,

Quoted 42 lines · Stefano Stabellini
Quoted 25 lines · Julien Grall

Hi Michal,

Quoted 22 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

    205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ##
name
        |                                         ^~~~~~~~~~~~~~~~~~

./include/public/arch-arm.h:206:41: note: in expansion of macro ‘__XEN_GUEST_HANDLE’
206 | #define XEN_GUEST_HANDLE(name)
__XEN_GUEST_HANDLE(name)

        |                                         ^~~~~~~~~~~~~~~~~~
./include/public/memory.h:277:5: note: in expansion of macro
‘XEN_GUEST_HANDLE’
    277 |     XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Fixes afab29d0882f ("public: s/int/int32_t")
Quoted 11 lines

So it turned out that I committed v1 from Stefano. I was meant to commit the
patch at all, but I think I started with a dirty staging :(. Sorry for that.

I have reverted Stefano's commit for now so we can take the correct patch.

Now, from my understanding, Andrew suggested on Matrix that this solution may
actually be a good way to handle GUEST_HANLDEs (they were removed in v2). Maybe this can be folded in Stefano's patch?

Quoted 5 lines
Quoted 2 lines

v1 together with Michal's fix is correct. Also v2 alone is correct, or v2 with Michal's fix is also correct.

I am slightly confused, v2 + Michal's fix means that XEN_GUEST_HANDLE(int) is removed and we introduce XEN_GUEST_INT(int32_t) with no user. So wouldn't this

You are right I apologize. I looked at Michal's patch too quickly and I thought it was just adding XEN_GUEST_INT(int32_t) without removing anything.

Quoted 5 lines
Quoted 1 line

In that case, if you are OK with it, please ack and commit v2 only.

Just to mention it: Committing would apparently be premature, as I can't spot any response to comments I gave to the patch. I'm okay with those being addressed verbally only, but imo they cannot be dropped on the floor.

I agree with your comments but I prefer to keep this patch smaller and focused on doing one thing only. I don't want to mix non-mechanical changes with the mechanical substitutions. For sure, there will be follow ups to address your comments and other outstanding issues.

#8 lore raw
In reply to Michal Orzel
Quoted 10 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

  205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ## name
      |                                         ^~~~~~~~~~~~~~~~~~
./include/public/arch-arm.h:206:41: note: in expansion of macro ‘__XEN_GUEST_HANDLE’
  206 | #define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
      |                                         ^~~~~~~~~~~~~~~~~~
Quoted 4 lines

./include/public/memory.h:277:5: note: in expansion of macro ‘XEN_GUEST_HANDLE’
277 | XEN_GUEST_HANDLE(int32_t) errs;

Fix it. Also, drop guest handle definition for int given no further use.

Such cannot be done like this. Consumers of the header may have grown their own uses. The declaration needs to remain active for any consumers supplying __XEN_INTERFACE_VERSION__ < 0x00041900. Which means you need to bump __XEN_LATEST_INTERFACE_VERSION__ and wrap the handle type declaration in #ifdef. Provided the removal of that handle type for newer interface versions is really warranting all this effort.

Jan

#9 lore raw

Hi Jan,

Quoted 16 lines · Jan Beulich
Quoted 13 lines · Michal Orzel

Commit afab29d0882f ("public: s/int/int32_t") replaced int with int32_t in XEN_GUEST_HANDLE() in memory.h but there is no guest handle defined for it. This results in a build failure. Example on Arm:

./include/public/arch-arm.h:205:41: error: unknown type name ‘__guest_handle_64_int32_t’

  205 | #define __XEN_GUEST_HANDLE(name)        __guest_handle_64_ ## name
      |                                         ^~~~~~~~~~~~~~~~~~
./include/public/arch-arm.h:206:41: note: in expansion of macro ‘__XEN_GUEST_HANDLE’
  206 | #define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
      |                                         ^~~~~~~~~~~~~~~~~~

./include/public/memory.h:277:5: note: in expansion of macro ‘XEN_GUEST_HANDLE’
277 | XEN_GUEST_HANDLE(int32_t) errs;

Quoted 8 lines
Quoted 1 line

Fix it. Also, drop guest handle definition for int given no further use.

Such cannot be done like this. Consumers of the header may have grown their own uses. The declaration needs to remain active for any consumers supplying __XEN_INTERFACE_VERSION__ < 0x00041900. Which means you need to bump __XEN_LATEST_INTERFACE_VERSION__ and wrap the handle type declaration in #ifdef. Provided the removal of that handle type for newer interface versions is really warranting all this effort.

I think we could just leave this guest handle definition as is then.

~Michal