Skip to contentSkip to conversation

Fixes for compiling with clang

PATCH Superseded Roger Pau Monne 5 participants 58 messages Apr 26, 2016 – May 18, 2016

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fixes for compiling with clang

Hello,

This is a set of bug fixes for compiling both the hypervisor and the toolstack with clang. I've only tested it with clang 3.8.0 from base FreeBSD, so I'm not sure if it's going to work with _all_ clang versions, but should be better than nothing.

AFAICT, most of the issues that clang found on the toolstack are actual bugs, so it's worth trying to fix them before the release.

Patches 1-4 are for the hypervisor, while patches 5-14 are for the toolstack.

Thanks, Roger.

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

#1 lore raw

PATCH v2 1/14 build: make HOSTCC conditional on the value of clang

Previously HOSTCC was always hardcoded to gcc

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Keir Fraser <[email protected]>
Cc: Tim Deegan <[email protected]>
---
Changes since v1:
- Use ?= instead of =

---
 Config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Config.mk +2 -1
index a0e6d4e..fd8371a 100644
@@ -36,7 +36,6 @@ CONFIG_$(XEN_OS) := y
 SHELL     ?= /bin/sh
 
 # Tools to run on system hosting the build
-HOSTCC      = gcc
 HOSTCFLAGS  = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCFLAGS += -fno-strict-aliasing
 
@@ -50,8 +49,10 @@ DESTDIR     ?= /
 clang ?= n
 ifeq ($(clang),n)
 gcc := y
+HOSTCC ?= gcc
 else
 gcc := n
+HOSTCC ?= clang
 endif
 
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Reviewed-by on v2 1/14
#3 lore raw

Re: [PATCH v2 for-4.7 01/14] build: make HOSTCC conditional on the value of clang

In reply to Roger Pau Monne
Quoted 3 lines · Roger Pau Monne

Previously HOSTCC was always hardcoded to gcc

Signature · 1 line
Doug Goldstein

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

#4 lore raw

PATCH v2 2/14 build: set HOSTCXX based on clang value for Kconfig xconfig target

In reply to Roger Pau Monne

The xconfig Kconfig target requires a C++ compiler because it uses Qt.

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Keir Fraser <[email protected]>
Cc: Tim Deegan <[email protected]>

---
 Config.mk | 2 ++
 1 file changed, 2 insertions(+)
Config.mk +2 -0
index fd8371a..4a5ebed 100644
@@ -50,9 +50,11 @@ clang ?= n
 ifeq ($(clang),n)
 gcc := y
 HOSTCC ?= gcc
+HOSTCXX ?= g++
 else
 gcc := n
 HOSTCC ?= clang
+HOSTCXX ?= clang++
 endif
 
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Reviewed-by on v2 2/14
#6 lore raw

Re: [PATCH v2 for-4.7 02/14] build: set HOSTCXX based on clang value for Kconfig xconfig target

In reply to Roger Pau Monne
Quoted 3 lines · Roger Pau Monne

The xconfig Kconfig target requires a C++ compiler because it uses Qt.

Signature · 1 line
Doug Goldstein

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

#7 lore raw

PATCH v2 3/14 build: pass HOST{CC/CXX} value down to Kconfig

In reply to Roger Pau Monne

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Keir Fraser <[email protected]>
Cc: Tim Deegan <[email protected]>

---
 xen/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/Makefile +3 -3
index c908544..b483823 100644
@@ -242,14 +242,14 @@ kconfig := silentoldconfig oldconfig config menuconfig defconfig \
 	randconfig
 .PHONY: $(kconfig)
 $(kconfig):
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) $@
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) $@
 
 include/config/%.conf: include/config/auto.conf.cmd $(KCONFIG_CONFIG)
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) silentoldconfig
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) silentoldconfig
 
 # Allow people to just run `make` as before and not force them to configure
 $(KCONFIG_CONFIG):
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) defconfig
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) defconfig
 
 # Break the dependency chain for the first run
 include/config/auto.conf.cmd: ;
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#10 lore raw

PATCH v2 4/14 build: remove Kconfig forced gcc selection

In reply to Roger Pau Monne

---
Cc: Doug Goldstein <[email protected]>

---
 xen/tools/kconfig/Makefile.kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/tools/kconfig/Makefile.kconfig +2 -2
index 815f306..dbd8912 100644
@@ -36,8 +36,8 @@ KBUILD_DEFCONFIG := $(ARCH)_defconfig
 CONFIG_SHELL := $(SHELL)
 
 # provide the host compiler
-HOSTCC := gcc
-HOSTCXX := g++
+HOSTCC ?= gcc
+HOSTCXX ?= g++
 
 # force target
 PHONY += FORCE
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 4/14
#11 lore raw

Re: [PATCH v2 for-4.7 04/14] build: remove Kconfig forced gcc selection

Quoted 13 lines · Roger Pau Monne

---
Cc: Doug Goldstein <[email protected]>

---
 xen/tools/kconfig/Makefile.kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/tools/kconfig/Makefile.kconfig +0 -0
index 815f306..dbd8912 100644

xen/tools/kconfig/Makefile.kconfig KBUILD_DEFCONFIG := $(ARCH)_defconfig · line 43

Quoted 10 lines
xen/tools/kconfig/Makefile.kconfig +2 -2
@@ -36,8 +36,8 @@ KBUILD_DEFCONFIG := $(ARCH)_defconfig
 CONFIG_SHELL := $(SHELL)
 
 # provide the host compiler
-HOSTCC := gcc
-HOSTCXX := g++
+HOSTCC ?= gcc
+HOSTCXX ?= g++
 
 # force target
 PHONY += FORCE

Regardless of the other patches in this series, this one should be merged in.

Signature · 1 line
Doug Goldstein

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

#13 lore raw

PATCH v2 5/14 tools/headers: prevent adding two __align8__ to uint64_t in ARM headers

In reply to Roger Pau Monne

Due to the fact that on ARM headers types are substituted to uint64_t and then uint64_t is also substituted to contain the aligment, this would lead to some types containing two __align8__ directives. Fix this by first expanding Xen specific types to uint64_t only, and then replacing all the uint64_t types to __align8__ uint64_t. This relies on the fact that all Xen-specific types will have longer names, so they will always be replaced first.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/include/xen-foreign/mkheader.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/include/xen-foreign/mkheader.py +4 -4
index 0504cb8..0e42e14 100644
@@ -20,8 +20,8 @@ footer = {};
 inttypes["arm32"] = {
     "unsigned long" : "__danger_unsigned_long_on_arm32",
     "long"          : "__danger_long_on_arm32",
-    "xen_pfn_t"     : "__align8__ uint64_t",
-    "xen_ulong_t"   : "__align8__ uint64_t",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
 };
 header["arm32"] = """
@@ -41,8 +41,8 @@ footer["arm32"] = """
 inttypes["arm64"] = {
     "unsigned long" : "__danger_unsigned_long_on_arm64",
     "long"          : "__danger_long_on_arm64",
-    "xen_pfn_t"     : "__align8__ uint64_t",
-    "xen_ulong_t"   : "__align8__ uint64_t",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
 };
 header["arm64"] = """
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Reviewed-by on v2 5/14
#14 lore raw

Re: [PATCH v2 for-4.7 05/14] tools/headers: prevent adding two __align8__ to uint64_t in ARM headers

Quoted 9 lines · Roger Pau Monne

Due to the fact that on ARM headers types are substituted to uint64_t and then uint64_t is also substituted to contain the aligment, this would lead to some types containing two __align8__ directives. Fix this by first expanding Xen specific types to uint64_t only, and then replacing all the uint64_t types to __align8__ uint64_t. This relies on the fact that all Xen-specific types will have longer names, so they will always be replaced first.

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

Acked-by on v2 5/14
#15 lore raw

Re: [PATCH v2 for-4.7 05/14] tools/headers: prevent adding two __align8__ to uint64_t in ARM headers

In reply to Roger Pau Monne
Quoted 8 lines · Roger Pau Monne

Due to the fact that on ARM headers types are substituted to uint64_t and then uint64_t is also substituted to contain the aligment, this would lead to some types containing two __align8__ directives. Fix this by first expanding Xen specific types to uint64_t only, and then replacing all the uint64_t types to __align8__ uint64_t. This relies on the fact that all Xen-specific types will have longer names, so they will always be replaced first.

Quoted 4 lines

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

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

Reviewed-by on v2 5/14
#16 lore raw

Re: [PATCH v2 for-4.7 05/14] tools/headers: prevent adding two __align8__ to uint64_t in ARM headers

In reply to Roger Pau Monne
Quoted 9 lines · Roger Pau Monne

Due to the fact that on ARM headers types are substituted to uint64_t and then uint64_t is also substituted to contain the aligment, this would lead to some types containing two __align8__ directives. Fix this by first expanding Xen specific types to uint64_t only, and then replacing all the uint64_t types to __align8__ uint64_t. This relies on the fact that all Xen-specific types will have longer names, so they will always be replaced first.

Signature · 1 line
Doug Goldstein

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

#17 lore raw

PATCH v2 6/14 xen/tools: fix substitution of __align8__ uint64_t inside of headers

In reply to Roger Pau Monne

The current seedery doesn't work with BSD sed, so remove the try to match int64_t also (since there's none at the moment). Also, apply the same treatment to all arch headers, currently this is only done to x86_64 headers.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/include/xen-foreign/Makefile | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
tools/include/xen-foreign/Makefile +16 -4
index 270a975..e395011 100644
@@ -25,18 +25,30 @@ check-headers: checker
 	rm tmp.size
 
 arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
+	rm [email protected]
+	$(call move-if-changed,[email protected],$@)
 
 arm64.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
+	rm [email protected]
+	$(call move-if-changed,[email protected],$@)
 
 x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
+	rm [email protected]
+	$(call move-if-changed,[email protected],$@)
 
 x86_64.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_64.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
 	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
 	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
-	sed 's/(__align8__ \(u\?int64_t\))/(\1)/g' < [email protected] > [email protected]
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
 	rm [email protected]
 	$(call move-if-changed,[email protected],$@)
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Reviewed-by on v2 6/14
#18 lore raw

Re: [PATCH v2 for-4.7 06/14] xen/tools: fix substitution of __align8__ uint64_t inside of headers

Quoted 6 lines · Roger Pau Monne

The current seedery doesn't work with BSD sed, so remove the try to match int64_t also (since there's none at the moment). Also, apply the same treatment to all arch headers, currently this is only done to x86_64 headers.

That is likely a side effect of me only getting the x86 bit of tools+clang working.

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

Acked-by on v2 6/14
#19 lore raw

Re: [PATCH v2 for-4.7 06/14] xen/tools: fix substitution of __align8__ uint64_t inside of headers

In reply to Roger Pau Monne
Quoted 9 lines · Roger Pau Monne

The current seedery doesn't work with BSD sed, so remove the try to match int64_t also (since there's none at the moment). Also, apply the same treatment to all arch headers, currently this is only done to x86_64 headers.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

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

Reviewed-by on v2 6/14
#20 lore raw

Re: [PATCH v2 for-4.7 06/14] xen/tools: fix substitution of __align8__ uint64_t inside of headers

In reply to Roger Pau Monne
Quoted 6 lines · Roger Pau Monne

The current seedery doesn't work with BSD sed, so remove the try to match int64_t also (since there's none at the moment). Also, apply the same treatment to all arch headers, currently this is only done to x86_64 headers.

Signature · 1 line
Doug Goldstein

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

#21 lore raw

PATCH v2 7/14 libxc: fix uninitialized variable

In reply to Roger Pau Monne

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_dom_bzimageloader.c +1 -1
index 7fde42a..0a4041c 100644
@@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, 0) )
                 break;
 
             return 0;
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#22 lore raw

Re: [PATCH v2 for-4.7 07/14] libxc: fix uninitialized variable

Quoted 13 lines · Roger Pau Monne

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_dom_bzimageloader.c +0 -0
index 7fde42a..0a4041c 100644

tools/libxc/xc_dom_bzimageloader.c static int xc_try_lzo1x_decode( · line 485

Quoted 5 lines
tools/libxc/xc_dom_bzimageloader.c +1 -1
@@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, 0) )

I fail to figure out why this is correct.

I think the out_len should be moved out of the loop and initialise as 0. We still need to use out_len here.

Wei.

Quoted 6 lines
tools/libxc/xc_dom_bzimageloader.c +0 -0
                 break;
 
             return 0;
Signature · 1 line
2.6.4 (Apple Git-63)

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

#23 lore raw

Re: [PATCH v2 for-4.7 07/14] libxc: fix uninitialized variable

Quoted 22 lines · Wei Liu
Quoted 13 lines · Roger Pau Monne

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_dom_bzimageloader.c +0 -0
index 7fde42a..0a4041c 100644

tools/libxc/xc_dom_bzimageloader.c static int xc_try_lzo1x_decode( · line 485

Quoted 5 lines
tools/libxc/xc_dom_bzimageloader.c +1 -1
@@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, 0) )

I fail to figure out why this is correct.

Quoted 2 lines

I think the out_len should be moved out of the loop and initialise as 0. We still need to use out_len here.

I'm not following here. AFAICT out_len is always uninitialized at this point (from loop 0 to N), so I assume 0 is what was intended to be passed here. Or it this supposed to be passing in the last out_len value from the previous iteration of the loop?

Roger.

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

#24 lore raw

Re: [PATCH v2 for-4.7 07/14] libxc: fix uninitialized variable

Quoted 22 lines · Roger Pau Monne
Quoted 21 lines · Wei Liu
Quoted 13 lines · Roger Pau Monne

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_dom_bzimageloader.c +0 -0
index 7fde42a..0a4041c 100644

tools/libxc/xc_dom_bzimageloader.c static int xc_try_lzo1x_decode( · line 485

Quoted 5 lines
tools/libxc/xc_dom_bzimageloader.c +1 -1
@@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, 0) )

I fail to figure out why this is correct.

Quoted 6 lines
Quoted 2 lines

I think the out_len should be moved out of the loop and initialise as 0. We still need to use out_len here.

I'm not following here. AFAICT out_len is always uninitialized at this point (from loop 0 to N), so I assume 0 is what was intended to be passed here. Or it this supposed to be passing in the last out_len value from the previous iteration of the loop?

xc_dom_register_external() is completely mad, and it is not obvious as to its purpose; tt is doing some kind of allocation tracking for
malloc()-allocated blocks. It looks like the output length is only
uses for stats purposes, as the memory in out_buf will be freed properly by free().

So I think the correct value should be the actual size of the allocation of out_buf, but I also don't think it makes any real difference either way.

~Andrew

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

#25 lore raw

Re: [PATCH v2 for-4.7 07/14] libxc: fix uninitialized variable

In reply to Roger Pau Monne
Quoted 23 lines · Roger Pau Monne
Quoted 22 lines · Wei Liu
Quoted 13 lines · Roger Pau Monne

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_dom_bzimageloader.c +0 -0
index 7fde42a..0a4041c 100644

tools/libxc/xc_dom_bzimageloader.c static int xc_try_lzo1x_decode( · line 485

Quoted 5 lines
tools/libxc/xc_dom_bzimageloader.c +1 -1
@@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, 0) )

I fail to figure out why this is correct.

Quoted 8 lines
Quoted 2 lines

I think the out_len should be moved out of the loop and initialise as 0. We still need to use out_len here.

I'm not following here. AFAICT out_len is always uninitialized at this point (from loop 0 to N), so I assume 0 is what was intended to be passed here. Or it this supposed to be passing in the last out_len value from the previous iteration of the loop?

Note that out_buf is defined out of the scope of this loop, which points to the buffer returns to caller when decompression completes (note the return 0 in that block). The second argument to xc_dom_register_external should reflect the true size of the buffer.

I got confused by the name of out_len because it is actually used for something else. So please ignore what I said in my earlier email about using out_len. From reading the code I think we need to use *size or something. Does this make sense?

Wei.

Quoted 1 line

Roger.

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

#26 lore raw

PATCH v2 8/14 libxl: fix shutdown_reason type in list_domains

In reply to Roger Pau Monne

It should be an enum, not an unsigned.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/xl_cmdimpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/xl_cmdimpl.c +1 -1
index 6346017..8ff54e1 100644
@@ -4254,7 +4254,7 @@ static void list_domains(bool verbose, bool context, bool claim, bool numa,
     printf("\n");
     for (i = 0; i < nb_domain; i++) {
         char *domname;
-        unsigned shutdown_reason;
+        libxl_shutdown_reason shutdown_reason;
         domname = libxl_domid_to_name(ctx, info[i].domid);
         shutdown_reason = info[i].shutdown ? info[i].shutdown_reason : 0;
         printf("%-40s %5d %5lu %5d     %c%c%c%c%c%c  %8.1f",
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 8/14
#27 lore raw

Re: [PATCH v2 for-4.7 08/14] libxl: fix shutdown_reason type in list_domains

Quoted 3 lines · Roger Pau Monne

It should be an enum, not an unsigned.

Quoted 23 lines

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/xl_cmdimpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/xl_cmdimpl.c +1 -1
index 6346017..8ff54e1 100644
@@ -4254,7 +4254,7 @@ static void list_domains(bool verbose, bool context, bool claim, bool numa,
     printf("\n");
     for (i = 0; i < nb_domain; i++) {
         char *domname;
-        unsigned shutdown_reason;
+        libxl_shutdown_reason shutdown_reason;
         domname = libxl_domid_to_name(ctx, info[i].domid);
         shutdown_reason = info[i].shutdown ? info[i].shutdown_reason : 0;
         printf("%-40s %5d %5lu %5d     %c%c%c%c%c%c  %8.1f",
Signature · 1 line
2.6.4 (Apple Git-63)

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

Reviewed-by on v2 8/14
#28 lore raw

Re: [PATCH v2 for-4.7 08/14] libxl: fix shutdown_reason type in list_domains

In reply to Roger Pau Monne
Quoted 3 lines · Roger Pau Monne

It should be an enum, not an unsigned.

I had to drop the shutdown_reason >= 0 check a few lines below in my version of this patch. But maybe its not necessary after all.

Signature · 1 line
Doug Goldstein

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

#29 lore raw

PATCH v2 9/14 xl: fix usage of libxl_get_scheduler

In reply to Roger Pau Monne

It returns an int, not a libxl_scheduler.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/xl_cmdimpl.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
tools/libxl/xl_cmdimpl.c +7 -3
index 8ff54e1..2ebca0a 100644
@@ -5894,16 +5894,18 @@ static void output_xeninfo(void)
 {
     const libxl_version_info *info;
     libxl_scheduler sched;
+    int sched_rc;
 
     if (!(info = libxl_get_version_info(ctx))) {
         fprintf(stderr, "libxl_get_version_info failed.\n");
         return;
     }
 
-    if ((sched = libxl_get_scheduler(ctx)) < 0) {
+    if ((sched_rc = libxl_get_scheduler(ctx)) < 0) {
         fprintf(stderr, "get_scheduler sysctl failed.\n");
         return;
     }
+    sched = sched_rc;
 
     printf("xen_major              : %d\n", info->xen_version_major);
     printf("xen_minor              : %d\n", info->xen_version_minor);
@@ -7991,7 +7993,7 @@ int main_cpupoolcreate(int argc, char **argv)
     libxl_scheduler sched = 0;
     XLU_ConfigList *cpus;
     XLU_ConfigList *nodes;
-    int n_cpus, n_nodes, i, n;
+    int n_cpus, n_nodes, i, n, sched_rc;
     libxl_bitmap freemap;
     libxl_bitmap cpumap;
     libxl_uuid uuid;
@@ -8084,10 +8086,12 @@ int main_cpupoolcreate(int argc, char **argv)
             goto out_cfg;
         }
     } else {
-        if ((sched = libxl_get_scheduler(ctx)) < 0) {
+        if ((sched_rc = libxl_get_scheduler(ctx)) < 0) {
             fprintf(stderr, "get_scheduler sysctl failed.\n");
+            rc = EXIT_FAILURE;
             goto out_cfg;
         }
+        sched = sched_rc;
     }
 
     if (libxl_get_freecpus(ctx, &freemap)) {
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#31 lore raw

Re: [PATCH v2 for-4.7 09/14] xl: fix usage of libxl_get_scheduler

In reply to Roger Pau Monne
Quoted 6 lines · Roger Pau Monne

It returns an int, not a libxl_scheduler.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

At the risk of nitpicking too much, I think we should enforce more consistent style, especially in xl which is already quite messy at the moment.

Quoted 9 lines
---
 tools/libxl/xl_cmdimpl.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
tools/libxl/xl_cmdimpl.c +0 -0
index 8ff54e1..2ebca0a 100644

tools/libxl/xl_cmdimpl.c static void output_xeninfo(void) · line 5898

Quoted 5 lines
tools/libxl/xl_cmdimpl.c +1 -0
@@ -5894,16 +5894,18 @@ static void output_xeninfo(void)
 {
     const libxl_version_info *info;
     libxl_scheduler sched;
+    int sched_rc;
 

CODING_STYLE says that variable holds return value of libxl API should be rc, so sched_rc should be rc.

Quoted 15 lines
tools/libxl/xl_cmdimpl.c +2 -1
     if (!(info = libxl_get_version_info(ctx))) {
         fprintf(stderr, "libxl_get_version_info failed.\n");
         return;
     }
 
-    if ((sched = libxl_get_scheduler(ctx)) < 0) {
+    if ((sched_rc = libxl_get_scheduler(ctx)) < 0) {
         fprintf(stderr, "get_scheduler sysctl failed.\n");
         return;
     }
+    sched = sched_rc;
 
     printf("xen_major              : %d\n", info->xen_version_major);
     printf("xen_minor              : %d\n", info->xen_version_minor);

tools/libxl/xl_cmdimpl.c int main_cpupoolcreate(int argc, char **argv) · line 7996

Quoted 5 lines
tools/libxl/xl_cmdimpl.c +1 -1
@@ -7991,7 +7993,7 @@ int main_cpupoolcreate(int argc, char **argv)
     libxl_scheduler sched = 0;
     XLU_ConfigList *cpus;
     XLU_ConfigList *nodes;
-    int n_cpus, n_nodes, i, n;
+    int n_cpus, n_nodes, i, n, sched_rc;

Same here.

The code itself is fine.

Let me know if changing sched_rc to rc would cause a lot of troubles...

Wei.

Quoted 20 lines
tools/libxl/xl_cmdimpl.c +3 -1
     libxl_bitmap freemap;
     libxl_bitmap cpumap;
     libxl_uuid uuid;
@@ -8084,10 +8086,12 @@ int main_cpupoolcreate(int argc, char **argv)
             goto out_cfg;
         }
     } else {
-        if ((sched = libxl_get_scheduler(ctx)) < 0) {
+        if ((sched_rc = libxl_get_scheduler(ctx)) < 0) {
             fprintf(stderr, "get_scheduler sysctl failed.\n");
+            rc = EXIT_FAILURE;
             goto out_cfg;
         }
+        sched = sched_rc;
     }
 
     if (libxl_get_freecpus(ctx, &freemap)) {
Signature · 1 line
2.6.4 (Apple Git-63)

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

#32 lore raw

PATCH v2 10/14 libxl: add the printf-like attributes to a couple of functions

In reply to Roger Pau Monne

Or else clang complains with:

error: format string is not a string literal

This looks quite pedantic, but I don't know of any other way to get rid of those errors.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_internal.c    | 16 ----------------
 tools/libxl/libxl_internal.h    | 11 ++++++-----
 tools/libxl/libxl_save_helper.c |  1 +
 3 files changed, 7 insertions(+), 21 deletions(-)
tools/libxl/libxl_internal.c +0 -16
index e7b765b..3b30f8a 100644
@@ -554,22 +554,6 @@ void libxl__update_domain_configuration(libxl__gc *gc,
     dst->b_info.video_memkb = src->b_info.video_memkb;
 }
 
-char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                  uint32_t domid, const char *format,  ...)
-{
-    char *s, *fmt;
-    va_list ap;
-
-    fmt = GCSPRINTF("/local/domain/%u/device-model/%u%s", dm_domid,
-                    domid, format);
-
-    va_start(ap, format);
-    s = libxl__vsprintf(gc, fmt, ap);
-    va_end(ap);
-
-    return s;
-}
-
 /*
  * Local variables:
  * mode: C
tools/libxl/libxl_internal.h +6 -5
index 8e2cf3e..0879e4c 100644
@@ -636,7 +636,7 @@ _hidden void *libxl__realloc(libxl__gc *gc_opt, void *ptr, size_t new_size) NN1;
 /* print @fmt into an allocated string large enoughto contain the result.
  * (similar to gc'd asprintf(3)). */
 _hidden char *libxl__sprintf(libxl__gc *gc_opt, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3) NN1;
-_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap);
+_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0);
 /* duplicate the string @c (similar to a gc'd strdup(3)). */
 _hidden char *libxl__strdup(libxl__gc *gc_opt,
                             const char *c /* may be NULL */) NN1;
@@ -709,7 +709,7 @@ _hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid);
  */
 
 int libxl__xs_vprintf(libxl__gc *gc, xs_transaction_t t,
-                      const char *path, const char *fmt, va_list ap);
+                      const char *path, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(4, 0);
 int libxl__xs_printf(libxl__gc *gc, xs_transaction_t t,
                      const char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
 
@@ -1995,9 +1995,10 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s);
 _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
   /* Return the system-wide default device model */
 _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc);
-_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                          uint32_t domid,
-                                          const char *format, ...) PRINTF_ATTRIBUTE(4, 5);
+
+#define libxl__device_model_xs_path(gc, dm_domid, domid, fmt, _a...)       \
+    libxl__sprintf(gc, "/local/domain/%u/device-model/%u" fmt, dm_domid,   \
+                   domid, ##_a)
 
 /*
  * Calling context and GC for event-generating functions:
tools/libxl/libxl_save_helper.c +1 -0
index 5fe642a..d3def6b 100644
@@ -52,6 +52,7 @@
 
 /*----- logger -----*/
 
+__attribute__((format(printf, 5, 0)))
 static void tellparent_vmessage(xentoollog_logger *logger_in,
                                 xentoollog_level level,
                                 int errnoval,
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#33 lore raw

Re: [PATCH v2 for-4.7 10/14] libxl: add the printf-like attributes to a couple of functions

On Tue, Apr 26, 2016 at 04:52:19PM +0200, Roger Pau Monne wrote:
[...]

tools/libxl/libxl_internal.h _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s); · line 2000

Quoted 7 lines
tools/libxl/libxl_internal.h +0 -3
@@ -1995,9 +1995,10 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s);
 _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
   /* Return the system-wide default device model */
 _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc);
-_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                          uint32_t domid,
-                                          const char *format, ...) PRINTF_ATTRIBUTE(4, 5);

Why does this not work with clang?

Wei.

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

#34 lore raw

Re: [PATCH v2 for-4.7 10/14] libxl: add the printf-like attributes to a couple of functions

Quoted 10 lines · Wei Liu

On Tue, Apr 26, 2016 at 04:52:19PM +0200, Roger Pau Monne wrote:
[...]

tools/libxl/libxl_internal.h _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s); · line 2000

Quoted 7 lines
tools/libxl/libxl_internal.h +0 -3
@@ -1995,9 +1995,10 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s);
 _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
   /* Return the system-wide default device model */
 _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc);
-_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                          uint32_t domid,
-                                          const char *format, ...) PRINTF_ATTRIBUTE(4, 5);

Why does this not work with clang?

It is a security consideration.

Passing anything other than a string literal to a printf-style function is opening a can of worms if an untrusted entity can influence the content of the string.

I guess clang is better at spotting parameters passed like this than GCC.

~Andrew

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

#35 lore raw

Re: [PATCH v2 for-4.7 10/14] libxl: add the printf-like attributes to a couple of functions

Quoted 12 lines · Andrew Cooper
Quoted 10 lines · Wei Liu

On Tue, Apr 26, 2016 at 04:52:19PM +0200, Roger Pau Monne wrote:
[...]

tools/libxl/libxl_internal.h _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s); · line 2000

Quoted 7 lines
tools/libxl/libxl_internal.h +0 -3
@@ -1995,9 +1995,10 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s);
 _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
   /* Return the system-wide default device model */
 _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc);
-_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                          uint32_t domid,
-                                          const char *format, ...) PRINTF_ATTRIBUTE(4, 5);

Why does this not work with clang?

Quoted 6 lines

It is a security consideration.

Passing anything other than a string literal to a printf-style function is opening a can of worms if an untrusted entity can influence the content of the string.

I see. I didn't look closely into the function body.

Quoted 2 lines

I guess clang is better at spotting parameters passed like this than GCC.

Sigh. I can't say I like turning that into a macro though. On the other hand there doesn't seem to be an elegant way of solving that.

Roger, please at least make it look like a macro. Say, name it DEVICE_MODEL_XS_PATH or something.

Wei.

Quoted 1 line

~Andrew

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

#36 lore raw

Re: [PATCH v2 for-4.7 10/14] libxl: add the printf-like attributes to a couple of functions

Wei Liu writes ("Re: [Xen-devel] [PATCH v2 for-4.7 10/14] libxl: add the printf-like attributes to a couple of functions"):

Quoted 2 lines

Sigh. I can't say I like turning that into a macro though. On the other hand there doesn't seem to be an elegant way of solving that.

Well, other than suppressing the warning somehow.

Quoted 2 lines

Roger, please at least make it look like a macro. Say, name it DEVICE_MODEL_XS_PATH or something.

I'm not sure I agree. I think if we can make it a function-like macro, then it is fine to give it a function-like name. (Note that many libc functions might be macros; getc is traditionally a #define.)

Obviously it can't be function-like in that you must always pass it a literal, but violations of that constraint will be detected by the compiler.

Ian.

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

#37 lore raw

Re: [PATCH v2 for-4.7 10/14] libxl: add the printf-like attributes to a couple of functions

Quoted 6 lines · Ian Jackson

Wei Liu writes ("Re: [Xen-devel] [PATCH v2 for-4.7 10/14] libxl: add the printf-like attributes to a couple of functions"):

Quoted 2 lines

Sigh. I can't say I like turning that into a macro though. On the other hand there doesn't seem to be an elegant way of solving that.

Well, other than suppressing the warning somehow.

I don't think we want to suppress the warning. It's useful.

Quoted 10 lines
Quoted 2 lines

Roger, please at least make it look like a macro. Say, name it DEVICE_MODEL_XS_PATH or something.

I'm not sure I agree. I think if we can make it a function-like macro, then it is fine to give it a function-like name. (Note that many libc functions might be macros; getc is traditionally a #define.)

Obviously it can't be function-like in that you must always pass it a literal, but violations of that constraint will be detected by the compiler.

I've pushed the series from Roger to staging because it fixes clang compilation. I don't have strong opinion on what the name of macro should look like so feel free to send a patch to change that.

Wei.

Quoted 2 lines

Ian.

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

#38 lore raw

PATCH v2 11/14 libxl: add explicit casts from yajl_gen_status to yajl_status

In reply to Roger Pau Monne

Or else clang complains with:

implicit conversion from enumeration type 'yajl_gen_status' to different enumeration type 'yajl_status' [-Werror,-Wenum-conversion]

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_json.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
tools/libxl/libxl_json.c +18 -11
index 3b695dd..6bb0695 100644
@@ -617,42 +617,48 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
     int idx = 0;
     yajl_status rc;
 
+#define CONVERT_YAJL_GEN_TO_STATUS(gen) \
+    ((gen) == yajl_gen_status_ok ? yajl_status_ok : yajl_status_error);
+
     switch (obj->type) {
     case JSON_NULL:
-        return yajl_gen_null(hand);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_null(hand));
     case JSON_BOOL:
-        return yajl_gen_bool(hand, obj->u.b);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_bool(hand, obj->u.b));
     case JSON_INTEGER:
-        return yajl_gen_integer(hand, obj->u.i);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_integer(hand, obj->u.i));
     case JSON_DOUBLE:
-        return yajl_gen_double(hand, obj->u.d);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_double(hand, obj->u.d));
     case JSON_NUMBER:
-        return yajl_gen_number(hand, obj->u.string, strlen(obj->u.string));
+        return CONVERT_YAJL_GEN_TO_STATUS(
+                  yajl_gen_number(hand, obj->u.string, strlen(obj->u.string)));
     case JSON_STRING:
-        return libxl__yajl_gen_asciiz(hand, obj->u.string);
+        return CONVERT_YAJL_GEN_TO_STATUS(
+                        libxl__yajl_gen_asciiz(hand, obj->u.string));
     case JSON_MAP: {
         libxl__json_map_node *node = NULL;
 
-        rc = yajl_gen_map_open(hand);
+        rc = CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_map_open(hand));
         if (rc != yajl_status_ok)
             return rc;
         for (idx = 0; idx < obj->u.map->count; idx++) {
             if (flexarray_get(obj->u.map, idx, (void**)&node) != 0)
                 break;
 
-            rc = libxl__yajl_gen_asciiz(hand, node->map_key);
+            rc = CONVERT_YAJL_GEN_TO_STATUS(
+                            libxl__yajl_gen_asciiz(hand, node->map_key));
             if (rc != yajl_status_ok)
                 return rc;
             rc = libxl__json_object_to_yajl_gen(gc, hand, node->obj);
             if (rc != yajl_status_ok)
                 return rc;
         }
-        return yajl_gen_map_close(hand);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_map_close(hand));
     }
     case JSON_ARRAY: {
         libxl__json_object *node = NULL;
 
-        rc = yajl_gen_array_open(hand);
+        rc = CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_array_open(hand));
         if (rc != yajl_status_ok)
             return rc;
         for (idx = 0; idx < obj->u.array->count; idx++) {
@@ -662,13 +668,14 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
             if (rc != yajl_status_ok)
                 return rc;
         }
-        return yajl_gen_array_close(hand);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_array_close(hand));
     }
     case JSON_ANY:
         /* JSON_ANY is not a valid value for obj->type. */
         ;
     }
     abort();
+#undef CONVERT_YAJL_GEN_TO_STATUS
 }
 
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 11/14
#39 lore raw

Re: [PATCH v2 for-4.7 11/14] libxl: add explicit casts from yajl_gen_status to yajl_status

Quoted 6 lines · Roger Pau Monne

Or else clang complains with:

implicit conversion from enumeration type 'yajl_gen_status' to different enumeration type 'yajl_status' [-Werror,-Wenum-conversion]

Quoted 12 lines

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_json.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
tools/libxl/libxl_json.c +0 -0
index 3b695dd..6bb0695 100644

tools/libxl/libxl_json.c yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc, · line 622

Quoted 6 lines
tools/libxl/libxl_json.c +3 -0
@@ -617,42 +617,48 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
     int idx = 0;
     yajl_status rc;
 
+#define CONVERT_YAJL_GEN_TO_STATUS(gen) \
+    ((gen) == yajl_gen_status_ok ? yajl_status_ok : yajl_status_error);
+

Extraneous ";" at the end.

I can fix that up while committing.

Wei.

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

#40 lore raw

PATCH v2 12/14 libxl: fix passing the type argument to xc_psr_*

In reply to Roger Pau Monne

The xc_psr_* functions expect the type to be xc_psr_cat_type instead of libxl_psr_cbm_type, so do the conversion.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_psr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/libxl/libxl_psr.c +5 -2
index 3d0dc61..40f2d5f 100644
@@ -298,6 +298,7 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
                           uint64_t cbm)
 {
     GC_INIT(ctx);
+    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
     int rc;
     int socketid, nr_sockets;
 
@@ -310,7 +311,8 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
     libxl_for_each_set_bit(socketid, *target_map) {
         if (socketid >= nr_sockets)
             break;
-        if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid, cbm)) {
+        if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+                                       socketid, cbm)) {
             libxl__psr_cat_log_err_msg(gc, errno);
             rc = ERROR_FAIL;
         }
@@ -328,7 +330,8 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
     GC_INIT(ctx);
     int rc = 0;
 
-    if (xc_psr_cat_get_domain_data(ctx->xch, domid, type, target, cbm_r)) {
+    if (xc_psr_cat_get_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+                                   target, cbm_r)) {
         libxl__psr_cat_log_err_msg(gc, errno);
         rc = ERROR_FAIL;
     }
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 12/14
#41 lore raw

Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*

Quoted 4 lines · Roger Pau Monne

The xc_psr_* functions expect the type to be xc_psr_cat_type instead of libxl_psr_cbm_type, so do the conversion.

Quoted 42 lines

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_psr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/libxl/libxl_psr.c +5 -2
index 3d0dc61..40f2d5f 100644
@@ -298,6 +298,7 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
                           uint64_t cbm)
 {
     GC_INIT(ctx);
+    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
     int rc;
     int socketid, nr_sockets;
 
@@ -310,7 +311,8 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
     libxl_for_each_set_bit(socketid, *target_map) {
         if (socketid >= nr_sockets)
             break;
-        if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid, cbm)) {
+        if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+                                       socketid, cbm)) {
             libxl__psr_cat_log_err_msg(gc, errno);
             rc = ERROR_FAIL;
         }
@@ -328,7 +330,8 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
     GC_INIT(ctx);
     int rc = 0;
 
-    if (xc_psr_cat_get_domain_data(ctx->xch, domid, type, target, cbm_r)) {
+    if (xc_psr_cat_get_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+                                   target, cbm_r)) {
         libxl__psr_cat_log_err_msg(gc, errno);
         rc = ERROR_FAIL;
     }
Signature · 1 line
2.6.4 (Apple Git-63)

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

Nacked-by NAK
#42 lore raw

Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*

Wei Liu writes ("Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*"):

Quoted 7 lines · Roger Pau Monne
Quoted 4 lines

The xc_psr_* functions expect the type to be xc_psr_cat_type instead of libxl_psr_cbm_type, so do the conversion.

Quoted 1 line
Quoted 1 line

- if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid,

cbm)) {

Quoted 1 line
Quoted 1 line

+ if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_typ

e)type,

Quoted 1 line
Quoted 1 line

+ socketid, cbm)) {

I'm very much against introducing casts which are not absolutely necessary. Casts are a big hammer which can suppress important warnings (such as conversions between integers and pointers).

This anomaly with the same enum defined in two places with two names is pretty poor. But if we are to perpetuate it, as perhaps we must, then rather than casting at each conversion point, we should introduce an inline function which contains the cast. That way each call site remains more typesafe.

Thanks,
Ian.

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

#43 lore raw

Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*

Quoted 21 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*"):

Quoted 7 lines · Roger Pau Monne
Quoted 4 lines

The xc_psr_* functions expect the type to be xc_psr_cat_type instead of libxl_psr_cbm_type, so do the conversion.

Quoted 1 line
Quoted 1 line

- if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid,

cbm)) {

Quoted 1 line
Quoted 1 line

+ if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_typ

e)type,

Quoted 1 line
Quoted 1 line

+ socketid, cbm)) {

I'm very much against introducing casts which are not absolutely necessary. Casts are a big hammer which can suppress important warnings (such as conversions between integers and pointers).

Quoted 6 lines

This anomaly with the same enum defined in two places with two names is pretty poor. But if we are to perpetuate it, as perhaps we must, then rather than casting at each conversion point, we should introduce an inline function which contains the cast. That way each call site remains more typesafe.

The two enums aren't going away any time soon.

Does the following diff meet your requirement?

---8<---

tools/libxl/libxl_psr.c +14 -3
index 40f2d5f..7a34c04 100644
@@ -293,12 +293,18 @@ out:
     return rc;
 }
 
+static inline xc_psr_cat_type libxl_psr_cbm_type_to_libxc_psr_cat_type(
+    libxl_psr_cbm_type type)
+{
+    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
+    return (xc_psr_cat_type)type;
+}
+
 int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
                           libxl_psr_cbm_type type, libxl_bitmap *target_map,
                           uint64_t cbm)
 {
     GC_INIT(ctx);
-    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
     int rc;
     int socketid, nr_sockets;
 
@@ -309,9 +315,13 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
     }
 
     libxl_for_each_set_bit(socketid, *target_map) {
+        xc_psr_cat_type xc_type;
+
         if (socketid >= nr_sockets)
             break;
-        if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+
+        xc_type = libxl_psr_cbm_type_to_libxc_psr_cat_type(type);
+        if (xc_psr_cat_set_domain_data(ctx->xch, domid, xc_type,
                                        socketid, cbm)) {
             libxl__psr_cat_log_err_msg(gc, errno);
             rc = ERROR_FAIL;
@@ -329,8 +339,9 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
 {
     GC_INIT(ctx);
     int rc = 0;
+    xc_psr_cat_type xc_type = libxl_psr_cbm_type_to_libxc_psr_cat_type(type);
 
-    if (xc_psr_cat_get_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+    if (xc_psr_cat_get_domain_data(ctx->xch, domid, xc_type,
                                    target, cbm_r)) {
         libxl__psr_cat_log_err_msg(gc, errno);
         rc = ERROR_FAIL;

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

#44 lore raw

Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*

Quoted 29 lines · Wei Liu
Quoted 21 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*"):

Quoted 7 lines · Roger Pau Monne
Quoted 4 lines

The xc_psr_* functions expect the type to be xc_psr_cat_type instead of libxl_psr_cbm_type, so do the conversion.

Quoted 1 line
Quoted 1 line

- if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid,

cbm)) {

Quoted 1 line
Quoted 1 line

+ if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_typ

e)type,

Quoted 1 line
Quoted 1 line

+ socketid, cbm)) {

I'm very much against introducing casts which are not absolutely necessary. Casts are a big hammer which can suppress important warnings (such as conversions between integers and pointers).

Quoted 6 lines

This anomaly with the same enum defined in two places with two names is pretty poor. But if we are to perpetuate it, as perhaps we must, then rather than casting at each conversion point, we should introduce an inline function which contains the cast. That way each call site remains more typesafe.

Quoted 3 lines

The two enums aren't going away any time soon.

Does the following diff meet your requirement?

Hello,

Thanks for doing this.

tools/libxl/libxl_psr.c out: · line 296

Quoted 10 lines

---8<---

tools/libxl/libxl_psr.c +1 -0
index 40f2d5f..7a34c04 100644
@@ -293,12 +293,18 @@ out:
     return rc;
 }
 
+static inline xc_psr_cat_type libxl_psr_cbm_type_to_libxc_psr_cat_type(

^ extra _ needed.

tools/libxl/libxl_psr.c out: · line 300

Quoted 4 lines
tools/libxl/libxl_psr.c +4 -0
+    libxl_psr_cbm_type type)
+{
+    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
+    return (xc_psr_cat_type)type;

In order to prevent using a cast, we could use a union:

union {
    libxl_psr_cbm_type libxl_psr;
    xc_psr_cat_type xc_psr;
} u;

u.libxl_psr = type;
return u.xc_psr;

Quoted 27 lines
tools/libxl/libxl_psr.c +7 -2
+}
+
 int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
                           libxl_psr_cbm_type type, libxl_bitmap *target_map,
                           uint64_t cbm)
 {
     GC_INIT(ctx);
-    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
     int rc;
     int socketid, nr_sockets;
 
@@ -309,9 +315,13 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
     }
 
     libxl_for_each_set_bit(socketid, *target_map) {
+        xc_psr_cat_type xc_type;
+
         if (socketid >= nr_sockets)
             break;
-        if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+
+        xc_type = libxl_psr_cbm_type_to_libxc_psr_cat_type(type);
+        if (xc_psr_cat_set_domain_data(ctx->xch, domid, xc_type,
                                        socketid, cbm)) {
             libxl__psr_cat_log_err_msg(gc, errno);
             rc = ERROR_FAIL;

tools/libxl/libxl_psr.c int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid, · line 347

Quoted 10 lines
tools/libxl/libxl_psr.c +2 -1
@@ -329,8 +339,9 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
 {
     GC_INIT(ctx);
     int rc = 0;
+    xc_psr_cat_type xc_type = libxl_psr_cbm_type_to_libxc_psr_cat_type(type);
 
-    if (xc_psr_cat_get_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+    if (xc_psr_cat_get_domain_data(ctx->xch, domid, xc_type,
                                    target, cbm_r)) {
         libxl__psr_cat_log_err_msg(gc, errno);
         rc = ERROR_FAIL;

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

Acked-by
#45 lore raw

Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_* [and 1 more messages]

In reply to Wei Liu

Wei Liu writes ("Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*"):

Quoted 5 lines · Ian Jackson
Quoted 4 lines

I'm very much against introducing casts which are not absolutely necessary. Casts are a big hammer which can suppress important warnings (such as conversions between integers and pointers).

Quoted 7 lines
Quoted 5 lines

This anomaly with the same enum defined in two places with two names is pretty poor. But if we are to perpetuate it, as perhaps we must, then rather than casting at each conversion point, we should introduce an inline function which contains the cast. That way each call site remains more typesafe.

The two enums aren't going away any time soon.

Sadly, I think you're right.

Quoted 1 line

Does the following diff meet your requirement?

Yes, that is exactly the kind of thing I was thinking of. It makes the cast non-routine by putting it in a dedicated function whose authors/readers know to check it's right.

(with a suitable commit message)

Roger Pau Monne writes ("Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*"):

Quoted 6 lines · Wei Liu

tools/libxl/libxl_psr.c out: · line 300

Quoted 2 lines
tools/libxl/libxl_psr.c +2 -0
+    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
+    return (xc_psr_cat_type)type;

In order to prevent using a cast, we could use a union:

Quoted 7 lines
union {
    libxl_psr_cbm_type libxl_psr;
    xc_psr_cat_type xc_psr;
} u;

u.libxl_psr = type;
return u.xc_psr;

No, not really.

Firstly, although we compile with -fno-strict-aliasing, this is a bad example in these days of hostile optimisers: without -fno-strict-aliasing, the compiler is allowed to assume that the loads and stores are to different variables, even though the contrary is evident.

Secondly, it's clumsy.

Thirdly, this kind of union aliasing is normally used for representation (structure) punning.

Thanks,
Ian.

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

#46 lore raw

Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_* [and 1 more messages]

Quoted 18 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH v2 for-4.7 12/14] libxl: fix passing the type argument to xc_psr_*"):

Quoted 5 lines · Ian Jackson
Quoted 4 lines

I'm very much against introducing casts which are not absolutely necessary. Casts are a big hammer which can suppress important warnings (such as conversions between integers and pointers).

Quoted 7 lines
Quoted 5 lines

This anomaly with the same enum defined in two places with two names is pretty poor. But if we are to perpetuate it, as perhaps we must, then rather than casting at each conversion point, we should introduce an inline function which contains the cast. That way each call site remains more typesafe.

The two enums aren't going away any time soon.

Sadly, I think you're right.

Quoted 1 line

Does the following diff meet your requirement?

Quoted 7 lines

Yes, that is exactly the kind of thing I was thinking of. It makes the cast non-routine by putting it in a dedicated function whose authors/readers know to check it's right.

(with a suitable commit message)

Thanks. I will submit a proper patch with your ack.

Wei.

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

#47 lore raw

PATCH v2 13/14 oxenstored: fix error when shifting negative value

In reply to Roger Pau Monne

By explicitly casting it to unsigned.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/ocaml/xenstored/systemd_stubs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/ocaml/xenstored/systemd_stubs.c +2 -2
index 1bd5dea..a78a72b 100644
@@ -124,7 +124,7 @@ CAMLprim value ocaml_sd_listen_fds(value connect_to)
 	CAMLparam1(connect_to);
 	CAMLlocal1(sock_ret);
 
-	sock_ret = Val_int(-1);
+	sock_ret = Val_int(-1U);
 
 	CAMLreturn(sock_ret);
 }
@@ -144,7 +144,7 @@ CAMLprim value ocaml_sd_notify_ready(value ignore)
 	CAMLparam1(ignore);
 	CAMLlocal1(ret);
 
-	ret = Val_int(-1);
+	ret = Val_int(-1U);
 
 	CAMLreturn(ret);
 }
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#49 lore raw

Re: [PATCH v2 for-4.7 13/14] oxenstored: fix error when shifting negative value

Quoted 1 line · Wei Liu

The title is a bit too cryptic to me. Where do that shift happen?

Ocaml stores integers shifted left by one, and with the bottom bit set.

Values with the bottom bit clear are pointers into the GC'd heap. Values with the bottom bit set are integers, and need to be shifted by 1 bit to have calculations performed.

Underlying patch Reviewed-by: Andrew Cooper <[email protected]>

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

#50 lore raw

Re: [PATCH v2 for-4.7 13/14] oxenstored: fix error when shifting negative value

Quoted 9 lines · Andrew Cooper
Quoted 1 line · Wei Liu

The title is a bit too cryptic to me. Where do that shift happen?

Ocaml stores integers shifted left by one, and with the bottom bit set.

Values with the bottom bit clear are pointers into the GC'd heap. Values with the bottom bit set are integers, and need to be shifted by 1 bit to have calculations performed.

This is better.

Roger, can you add the above paragraphs to commit message? Thanks.

Wei.

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

#51 lore raw

Re: [PATCH v2 for-4.7 13/14] oxenstored: fix error when shifting negative value

Quoted 5 lines · Wei Liu
Quoted 4 lines · Andrew Cooper
Quoted 1 line · Wei Liu

The title is a bit too cryptic to me. Where do that shift happen?

Ocaml stores integers shifted left by one, and with the bottom bit set.

Quoted 7 lines
Quoted 4 lines

Values with the bottom bit clear are pointers into the GC'd heap. Values with the bottom bit set are integers, and need to be shifted by 1 bit to have calculations performed.

This is better.

Roger, can you add the above paragraphs to commit message? Thanks.

P.S. this is why Ocaml integers are 31 or 63 bits wide, and cause all kinds of "fun" issues when interfacing with C which makes use of all bits available in an integer.

~Andrew

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

#52 lore raw

PATCH v2 14/14 tools/python: corrently use LDFLAGS and CFLAGS

In reply to Roger Pau Monne

It is incorrect to add the LDFLAGS to the CFLAGS, and some compilers will error out if linker flags are passed when creating object files. Fix this by properly passing CFLAGS and LDFLAGS, instead of putting everything in CFLAGS.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/python/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tools/python/Makefile +5 -3
index 2363537..da08f46 100644
@@ -4,7 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 .PHONY: all
 all: build
 
-PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)
+PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
+PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS)
 
 .PHONY: build
 build:
@@ -14,8 +15,9 @@ build:
 install:
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py install \
-		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
+	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
+		setup.py install $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)"  \
+		--force
 
 	$(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Reviewed-by on v2 14/14
#53 lore raw

Re: [PATCH v2 for-4.7 14/14] tools/python: corrently use LDFLAGS and CFLAGS

Quoted 7 lines · Roger Pau Monne

It is incorrect to add the LDFLAGS to the CFLAGS, and some compilers will error out if linker flags are passed when creating object files. Fix this by properly passing CFLAGS and LDFLAGS, instead of putting everything in CFLAGS.

---

Signature · 1 line
Doug Goldstein

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

Acked-by on v2 14/14
#54 lore raw

Re: [PATCH v2 for-4.7 14/14] tools/python: corrently use LDFLAGS and CFLAGS

In reply to Roger Pau Monne
Quoted 6 lines · Roger Pau Monne

It is incorrect to add the LDFLAGS to the CFLAGS, and some compilers will error out if linker flags are passed when creating object files. Fix this by properly passing CFLAGS and LDFLAGS, instead of putting everything in CFLAGS.

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

#55 lore raw
In reply to Roger Pau Monne
Quoted 7 lines · Roger Pau Monne

Hello,

This is a set of bug fixes for compiling both the hypervisor and the toolstack with clang. I've only tested it with clang 3.8.0 from base FreeBSD, so I'm not sure if it's going to work with _all_ clang versions, but should be better than nothing.

Quoted 8 lines

AFAICT, most of the issues that clang found on the toolstack are actual bugs, so it's worth trying to fix them before the release.

Patches 1-4 are for the hypervisor, while patches 5-14 are for the toolstack.

Thanks, Roger.

I went through the series. Most patches are trivial, so I'm inclined to take this series in 4.7.

There are a few patches that require updating. You can either resend the whole series with all tags folded in or just update those patches that require updating. Do whatever most convenient for you.

Wei.

Quoted 5 lines

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

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

#56 lore raw
Quoted 17 lines · Wei Liu
Quoted 7 lines · Roger Pau Monne

Hello,

This is a set of bug fixes for compiling both the hypervisor and the toolstack with clang. I've only tested it with clang 3.8.0 from base FreeBSD, so I'm not sure if it's going to work with _all_ clang versions, but should be better than nothing.

Quoted 8 lines

AFAICT, most of the issues that clang found on the toolstack are actual bugs, so it's worth trying to fix them before the release.

Patches 1-4 are for the hypervisor, while patches 5-14 are for the toolstack.

Thanks, Roger.

Quoted 9 lines

I went through the series. Most patches are trivial, so I'm inclined to take this series in 4.7.

There are a few patches that require updating. You can either resend the whole series with all tags folded in or just update those patches that require updating. Do whatever most convenient for you.

Wei.

FWIW, a lot of these are individual patches and don't build on each other. If some end up being controversial we can push the ones that have a broad consensus.

Signature · 1 line
Doug Goldstein

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

#57 lore raw
Quoted 25 lines · Doug Goldstein
Quoted 24 lines · Wei Liu
Quoted 7 lines · Roger Pau Monne

Hello,

This is a set of bug fixes for compiling both the hypervisor and the toolstack with clang. I've only tested it with clang 3.8.0 from base FreeBSD, so I'm not sure if it's going to work with _all_ clang versions, but should be better than nothing.

Quoted 8 lines

AFAICT, most of the issues that clang found on the toolstack are actual bugs, so it's worth trying to fix them before the release.

Patches 1-4 are for the hypervisor, while patches 5-14 are for the toolstack.

Thanks, Roger.

I went through the series. Most patches are trivial, so I'm inclined to take this series in 4.7.

There are a few patches that require updating. You can either resend the whole series with all tags folded in or just update those patches that require updating. Do whatever most convenient for you.

Quoted 7 lines
Quoted 2 lines

Wei.

FWIW, a lot of these are individual patches and don't build on each other. If some end up being controversial we can push the ones that have a broad consensus.

Right. I will see about pushing some of them today.

Wei.

Quoted 11 lines
Signature · 10 lines
Doug Goldstein





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

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