Skip to contentSkip to conversation

rdma: Fix 32-bit compilation

PATCH In review Eric Blake 4 participants 10 messages Mar 19, 2018 – Mar 21, 2018

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

PATCH 1/1 rdma: Fix 32-bit compilation

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

---

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

 hw/rdma/rdma_backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/rdma/rdma_backend.c +2 -1
index e306fba5344..89020fdcf62 100644
@@ -656,7 +656,8 @@ void rdma_backend_destroy_qp(RdmaBackendQP *qp)
 #define CHK_ATTR(req, dev, member, fmt) ({ \
     pr_dbg("%s="fmt","fmt"\n", #member, dev.member, req->member); \
     if (req->member > dev.member) { \
-        warn_report("%s = 0x%lx is higher than host device capability 0x%lx", \
+        warn_report("%s = 0x%" PRIx64 " is higher than host device " \
+                    "capability 0x%" PRIx64, \
                     #member, (uint64_t)req->member, (uint64_t)dev.member); \
         req->member = dev.member; \
     } \
Signature · 1 line
2.14.3
author
#1 lore raw
Quoted 9 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

---

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

That fixes most of the warnings, but not:

/home/dummy/qemu/hw/rdma/rdma_backend.c: In function 'rdma_backend_create_mr':
/home/dummy/qemu/hw/rdma/rdma_backend.c:409:37: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

     m4->ibmr = ibv_reg_m4(pd->ibpd, (void *)addr, length, access);
                                     ^
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#2 lore raw
Quoted 5 lines · Eric Blake
Quoted 4 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

Quoted 7 lines
Quoted 5 lines

---

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

That fixes most of the warnings,

Thanks!

Quoted 8 lines

but not:

/home/dummy/qemu/hw/rdma/rdma_backend.c: In function 'rdma_backend_create_mr':
/home/dummy/qemu/hw/rdma/rdma_backend.c:409:37: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     m4->ibmr = ibv_reg_m4(pd->ibpd, (void *)addr, length, access);
                                     ^

So the compilation actually brakes on 32bit machines? I'll create a VM.

Thanks,
Marcel

Reviewed-by on v1 1/1
#3 lore raw
In reply to Eric Blake

Hi Eric,

Quoted 10 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

---

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

I couldn't run 'make vm-build-ubuntu.i368' either. (Stuck on "Booting from Hard Disk...")

I run make docker-test-build@debian-win32-cross to be sure it compiles on 32bit arch, however I found out the docker configuration results in 'RDMA support no', so it will not help.

Fam, is there any way the docker image can be updated with the RDMA libraries so we can check this too?

Quoted 9 lines
 hw/rdma/rdma_backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/rdma/rdma_backend.c +0 -0
index e306fba5344..89020fdcf62 100644

hw/rdma/rdma_backend.c void rdma_backend_destroy_qp(RdmaBackendQP *qp) · line 663

Quoted 9 lines
hw/rdma/rdma_backend.c +2 -1
@@ -656,7 +656,8 @@ void rdma_backend_destroy_qp(RdmaBackendQP *qp)
 #define CHK_ATTR(req, dev, member, fmt) ({ \
     pr_dbg("%s="fmt","fmt"\n", #member, dev.member, req->member); \
     if (req->member > dev.member) { \
-        warn_report("%s = 0x%lx is higher than host device capability 0x%lx", \
+        warn_report("%s = 0x%" PRIx64 " is higher than host device " \
+                    "capability 0x%" PRIx64, \
                     #member, (uint64_t)req->member, (uint64_t)dev.member); \
         req->member = dev.member; \
     } \

Thanks,
Marcel

#4 lore raw
Quoted 10 lines · Marcel Apfelbaum

Hi Eric,

Quoted 7 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

---

Quoted 8 lines
Quoted 3 lines

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

I couldn't run 'make vm-build-ubuntu.i368' either. (Stuck on "Booting from Hard Disk...")

I run make docker-test-build@debian-win32-cross to be sure it compiles on 32bit arch, however I found out the docker configuration results in 'RDMA support no', so it will not help.

Cc'ing Phil and Alex who know this image better than me. Meanwhile I'll take a look at why make vm-build-ubuntu.i386 is broken. Thanks.

Fam

#5 lore raw
In reply to Marcel Apfelbaum
Quoted 7 lines · Marcel Apfelbaum

Hi Eric,

Quoted 4 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

Quoted 8 lines
Quoted 6 lines

---

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

I couldn't run 'make vm-build-ubuntu.i368' either. (Stuck on "Booting from Hard Disk...")

I tried this now and it works for me. Could you delete "$HOME/.cache/qemu-vm" and do it again from a git tree, then pastbin the full log?

Fam

#6 lore raw
Quoted 11 lines · Fam Zheng
Quoted 10 lines · Marcel Apfelbaum

Hi Eric,

Quoted 7 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

---

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

I couldn't run 'make vm-build-ubuntu.i368' either. (Stuck on "Booting from Hard Disk...")

I tried this now and it works for me. Could you delete "$HOME/.cache/qemu-vm" and do it again from a git tree, then pastbin the full log?

Hi Fam,
I did that but it didn't help.

Here is the log: https://da.gd/8wJHj
I try to run the same command line, and it still stuck in the boot process. Problem is, the command line looks fine, may be another issue with my PC... I'll continue to debug it.

Thanks for the help,
Marcel

Quoted 2 lines

Fam

#7 lore raw
Quoted 22 lines · Marcel Apfelbaum
Quoted 11 lines · Fam Zheng
Quoted 10 lines · Marcel Apfelbaum

Hi Eric,

Quoted 7 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

---

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

I couldn't run 'make vm-build-ubuntu.i368' either. (Stuck on "Booting from Hard Disk...")

I tried this now and it works for me. Could you delete "$HOME/.cache/qemu-vm" and do it again from a git tree, then pastbin the full log?

Quoted 7 lines

Hi Fam,
I did that but it didn't help.

Here is the log: https://da.gd/8wJHj
I try to run the same command line, and it still stuck in the boot process. Problem is, the command line looks fine, may be another issue with my PC... I'll continue to debug it.

Maybe we are using different QEMU/seabios. What I used is built from qemu.git. The log has the QEMU arguments which you can try manually for debug.

Fam

#8 lore raw
In reply to Eric Blake
Quoted 18 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

---

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

 hw/rdma/rdma_backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/rdma/rdma_backend.c +0 -0
index e306fba5344..89020fdcf62 100644

hw/rdma/rdma_backend.c void rdma_backend_destroy_qp(RdmaBackendQP *qp) · line 661

Quoted 7 lines
hw/rdma/rdma_backend.c +2 -1
@@ -656,7 +656,8 @@ void rdma_backend_destroy_qp(RdmaBackendQP *qp)
 #define CHK_ATTR(req, dev, member, fmt) ({ \
     pr_dbg("%s="fmt","fmt"\n", #member, dev.member, req->member); \
     if (req->member > dev.member) { \
-        warn_report("%s = 0x%lx is higher than host device capability 0x%lx", \
+        warn_report("%s = 0x%" PRIx64 " is higher than host device " \
+                    "capability 0x%" PRIx64, \
                     #member, (uint64_t)req->member, (uint64_t)dev.member); \

Hmmm, interesting.
I wonder why in first place to cast all members to uint64_t. Can you try the method that is used above in the call to pr_dbg, i.e. to use the given argument fmt?

Something like this:

	warn_report("%s = "fmt" is higher than host device capability "fmt, \
	            #member, req->member, dev.member); \
Quoted 5 lines
hw/rdma/rdma_backend.c +0 -0
         req->member = dev.member; \
     } \
Signature · 1 line
2.14.3
#9 lore raw
Quoted 31 lines · Yuval Shaia
Quoted 18 lines · Eric Blake

Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Broken since initial commit ef6d4ccd.

---

I don't know if 'make vm-build-ubuntu.i368' would catch this (it failed for me for other reasons); I found it via a 32-bit rawhide VM.

 hw/rdma/rdma_backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/rdma/rdma_backend.c +0 -0
index e306fba5344..89020fdcf62 100644

hw/rdma/rdma_backend.c void rdma_backend_destroy_qp(RdmaBackendQP *qp) · line 661

Quoted 7 lines
hw/rdma/rdma_backend.c +2 -1
@@ -656,7 +656,8 @@ void rdma_backend_destroy_qp(RdmaBackendQP *qp)
 #define CHK_ATTR(req, dev, member, fmt) ({ \
     pr_dbg("%s="fmt","fmt"\n", #member, dev.member, req->member); \
     if (req->member > dev.member) { \
-        warn_report("%s = 0x%lx is higher than host device capability 0x%lx", \
+        warn_report("%s = 0x%" PRIx64 " is higher than host device " \
+                    "capability 0x%" PRIx64, \
                     #member, (uint64_t)req->member, (uint64_t)dev.member); \

Hmmm, interesting.
I wonder why in first place to cast all members to uint64_t. Can you try the method that is used above in the call to pr_dbg, i.e. to use the given argument fmt?

Quoted 6 lines
Quoted 1 line

Something like this:

	warn_report("%s = "fmt" is higher than host device capability "fmt, \
	            #member, req->member, dev.member); \
Quoted 2 lines
         req->member = dev.member; \
     } \

Right, it seems to be a better solution.

Eric/Yuval, will you send a patch for it?

Thanks!
Marcel

Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.14.3