xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxl: fix compilation on ARM
@ 2016-04-02  0:36 Wei Liu
  2016-04-04 10:46 ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Liu @ 2016-04-02  0:36 UTC (permalink / raw)
  To: Xen-devel; +Cc: Ian Jackson, Changlong Xie, Wei Liu, Wen Congyang

COLO introduced a few callbacks. The original implementation used
unsigned long for a type which in fact should be xen_pfn_t. That broke
libxl compilation on ARM, because xen_pfn_t is not a synonym for
unsigned long on ARM platform.

Fixing this requires modifying the perl script. Specifically now we need
to include xenctrl.h in helper header file so that we can use xen_pfn_t
there.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Changlong Xie <xiecl.fnst@cn.fujitsu.com>

Compile test only. Please review carefully.
---
 tools/libxl/libxl_create.c         |  4 ++--
 tools/libxl/libxl_save_msgs_gen.pl | 17 +++++++++++++----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 6882ff8..4b02de9 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1109,8 +1109,8 @@ static void domcreate_bootloader_done(libxl__egc *egc,
     domcreate_stream_done(egc, &dcs->srs, rc);
 }
 
-void libxl__srm_callout_callback_restore_results(unsigned long store_mfn,
-          unsigned long console_mfn, void *user)
+void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
+          xen_pfn_t console_mfn, void *user)
 {
     libxl__save_helper_state *shs = user;
     libxl__domain_create_state *dcs = shs->caller_state;
diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl
index c2243f2..25728aa 100755
--- a/tools/libxl/libxl_save_msgs_gen.pl
+++ b/tools/libxl/libxl_save_msgs_gen.pl
@@ -29,8 +29,8 @@ our @msgs = (
     [  6, 'srcxA',  "wait_checkpoint", [] ],
     [  7, 'scxA',   "switch_qemu_logdirty",  [qw(int domid
                                               unsigned enable)] ],
-    [  8, 'rcx',    "restore_results",       ['unsigned long', 'store_gfn',
-                                              'unsigned long', 'console_gfn'] ],
+    [  8, 'rcx',    "restore_results",       ['xen_pfn_t', 'store_gfn',
+                                              'xen_pfn_t', 'console_gfn'] ],
     [  9, 'srW',    "complete",              [qw(int retval
                                                  int errnoval)] ],
 );
@@ -41,6 +41,7 @@ our %cbs;
 our %func;
 our %func_ah;
 our @outfuncs;
+our %out_incls;
 our %out_decls;
 our %out_body;
 our %msgnum_used;
@@ -71,10 +72,14 @@ END_BOTH
 END_CALLOUT
 
 #include "_libxl_save_msgs_${ah}.h"
-#include <xenctrl.h>
 #include <xenguest.h>
 
 END_HELPER
+
+    $out_incls{$ah} .= $ah eq 'helper' ? <<END : "";
+#include <xenctrl.h>
+
+END
 }
 
 die $want_ah unless defined $out_body{$want_ah};
@@ -141,7 +146,7 @@ static void bytes_put(unsigned char *const buf, int *len,
 
 END
 
-foreach my $simpletype (qw(int uint16_t uint32_t unsigned), 'unsigned long') {
+foreach my $simpletype (qw(int uint16_t uint32_t unsigned), 'unsigned long', 'xen_pfn_t') {
     my $typeid = typeid($simpletype);
     $out_body{'callout'} .= <<END;
 static int ${typeid}_get(const unsigned char **msg,
@@ -363,6 +368,10 @@ END_ALWAYS
 
 print "/* AUTOGENERATED by $0 DO NOT EDIT */\n\n" or die $!;
 
+if ($ch eq 'h') {
+    print $out_incls{$want_ah} or die $!;
+}
+
 foreach my $sr (qw(save restore)) {
     f_more("${enumcallbacks}_${sr}",
            "    return cbflags;\n");
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] libxl: fix compilation on ARM
  2016-04-02  0:36 [PATCH] libxl: fix compilation on ARM Wei Liu
@ 2016-04-04 10:46 ` Ian Jackson
  2016-04-04 10:48   ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2016-04-04 10:46 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Changlong Xie, Wen Congyang

Wei Liu writes ("[PATCH] libxl: fix compilation on ARM"):
> COLO introduced a few callbacks. The original implementation used
> unsigned long for a type which in fact should be xen_pfn_t. That broke
> libxl compilation on ARM, because xen_pfn_t is not a synonym for
> unsigned long on ARM platform.
> 
> Fixing this requires modifying the perl script. Specifically now we need
> to include xenctrl.h in helper header file so that we can use xen_pfn_t
> there.
> 
> Reported-by: Olaf Hering <olaf@aepfle.de>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Following discussion on irc, here is a v2:

* AFAICT all that's needed is to change the ordering of the headers
  before END_HELPER.  _libxl_save_msgs_helper.h isn't a "proper"
  header: it has no multiple inclusion protection, either.  It's for
  use in only the two places.  (_libxl_save_msgs_helper.c and
  libxl_save_helper.c - both of which already have xenctrl.h) I think
  I prefer to perhpas-duplicate some #include lines to adding a new
  facility to the Perl script (which I would like to keep no more
  complex than necessary).

* Better patch title.

Thanks,
Ian.

From ca9654206863224cbf2cc998d8f6a2bd6c1511b3 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ian.jackson@eu.citrix.com>
Date: Mon, 4 Apr 2016 11:41:19 +0100
Subject: [PATCH] libxl: ARM build: fix type of
 libxl__srm_callout_callback_restore_results

COLO introduced a few callbacks. The original implementation used
unsigned long for a type which in fact should be xen_pfn_t. That broke
libxl compilation on ARM, because xen_pfn_t is not a synonym for
unsigned long on ARM platform.

Fixing this requires modifying the perl script. Specifically now we need
to include xenctrl.h in helper header file so that we can use xen_pfn_t
there.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_create.c         |    4 ++--
 tools/libxl/libxl_save_msgs_gen.pl |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 6882ff8..4b02de9 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1109,8 +1109,8 @@ static void domcreate_bootloader_done(libxl__egc *egc,
     domcreate_stream_done(egc, &dcs->srs, rc);
 }
 
-void libxl__srm_callout_callback_restore_results(unsigned long store_mfn,
-          unsigned long console_mfn, void *user)
+void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
+          xen_pfn_t console_mfn, void *user)
 {
     libxl__save_helper_state *shs = user;
     libxl__domain_create_state *dcs = shs->caller_state;
diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl
index c2243f2..3ae7373 100755
--- a/tools/libxl/libxl_save_msgs_gen.pl
+++ b/tools/libxl/libxl_save_msgs_gen.pl
@@ -29,8 +29,8 @@ our @msgs = (
     [  6, 'srcxA',  "wait_checkpoint", [] ],
     [  7, 'scxA',   "switch_qemu_logdirty",  [qw(int domid
                                               unsigned enable)] ],
-    [  8, 'rcx',    "restore_results",       ['unsigned long', 'store_gfn',
-                                              'unsigned long', 'console_gfn'] ],
+    [  8, 'rcx',    "restore_results",       ['xen_pfn_t', 'store_gfn',
+                                              'xen_pfn_t', 'console_gfn'] ],
     [  9, 'srW',    "complete",              [qw(int retval
                                                  int errnoval)] ],
 );
@@ -70,9 +70,9 @@ END_BOTH
 
 END_CALLOUT
 
-#include "_libxl_save_msgs_${ah}.h"
 #include <xenctrl.h>
 #include <xenguest.h>
+#include "_libxl_save_msgs_${ah}.h"
 
 END_HELPER
 }
@@ -141,7 +141,7 @@ static void bytes_put(unsigned char *const buf, int *len,
 
 END
 
-foreach my $simpletype (qw(int uint16_t uint32_t unsigned), 'unsigned long') {
+foreach my $simpletype (qw(int uint16_t uint32_t unsigned), 'unsigned long', 'xen_pfn_t') {
     my $typeid = typeid($simpletype);
     $out_body{'callout'} .= <<END;
 static int ${typeid}_get(const unsigned char **msg,
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] libxl: fix compilation on ARM
  2016-04-04 10:46 ` Ian Jackson
@ 2016-04-04 10:48   ` Ian Jackson
  2016-04-04 10:51     ` Wei Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2016-04-04 10:48 UTC (permalink / raw)
  To: Wei Liu, Xen-devel, Wen Congyang, Changlong Xie

Ian Jackson writes ("Re: [PATCH] libxl: fix compilation on ARM"):
> Following discussion on irc, here is a v2:

I forgot to update the commit message.

Ian.

From 4cbc583020642d6c333d07e297c52594bb88b542 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ian.jackson@eu.citrix.com>
Date: Mon, 4 Apr 2016 11:41:19 +0100
Subject: [PATCH] libxl: ARM build: fix type of libxl__srm_callout_callback_restore_results

COLO introduced a few callbacks. The original implementation used
unsigned long for a type which in fact should be xen_pfn_t. That broke
libxl compilation on ARM, because xen_pfn_t is not a synonym for
unsigned long on ARM platform.

Fixing this requires modifying the perl script: specifically now we
need to include xenctrl.h before _libxl_save_msgs_*.h, rather than
afterwards, so that we can use xen_pfn_t there.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_create.c         |    4 ++--
 tools/libxl/libxl_save_msgs_gen.pl |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 6882ff8..4b02de9 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1109,8 +1109,8 @@ static void domcreate_bootloader_done(libxl__egc *egc,
     domcreate_stream_done(egc, &dcs->srs, rc);
 }
 
-void libxl__srm_callout_callback_restore_results(unsigned long store_mfn,
-          unsigned long console_mfn, void *user)
+void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
+          xen_pfn_t console_mfn, void *user)
 {
     libxl__save_helper_state *shs = user;
     libxl__domain_create_state *dcs = shs->caller_state;
diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl
index c2243f2..3ae7373 100755
--- a/tools/libxl/libxl_save_msgs_gen.pl
+++ b/tools/libxl/libxl_save_msgs_gen.pl
@@ -29,8 +29,8 @@ our @msgs = (
     [  6, 'srcxA',  "wait_checkpoint", [] ],
     [  7, 'scxA',   "switch_qemu_logdirty",  [qw(int domid
                                               unsigned enable)] ],
-    [  8, 'rcx',    "restore_results",       ['unsigned long', 'store_gfn',
-                                              'unsigned long', 'console_gfn'] ],
+    [  8, 'rcx',    "restore_results",       ['xen_pfn_t', 'store_gfn',
+                                              'xen_pfn_t', 'console_gfn'] ],
     [  9, 'srW',    "complete",              [qw(int retval
                                                  int errnoval)] ],
 );
@@ -70,9 +70,9 @@ END_BOTH
 
 END_CALLOUT
 
-#include "_libxl_save_msgs_${ah}.h"
 #include <xenctrl.h>
 #include <xenguest.h>
+#include "_libxl_save_msgs_${ah}.h"
 
 END_HELPER
 }
@@ -141,7 +141,7 @@ static void bytes_put(unsigned char *const buf, int *len,
 
 END
 
-foreach my $simpletype (qw(int uint16_t uint32_t unsigned), 'unsigned long') {
+foreach my $simpletype (qw(int uint16_t uint32_t unsigned), 'unsigned long', 'xen_pfn_t') {
     my $typeid = typeid($simpletype);
     $out_body{'callout'} .= <<END;
 static int ${typeid}_get(const unsigned char **msg,
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] libxl: fix compilation on ARM
  2016-04-04 10:51     ` Wei Liu
@ 2016-04-04 10:51       ` Ian Jackson
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2016-04-04 10:51 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Changlong Xie, Wen Congyang

Wei Liu writes ("Re: [PATCH] libxl: fix compilation on ARM"):
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Thanks, pushed.  Hopefully this will unblock the smoke test.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libxl: fix compilation on ARM
  2016-04-04 10:48   ` Ian Jackson
@ 2016-04-04 10:51     ` Wei Liu
  2016-04-04 10:51       ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Liu @ 2016-04-04 10:51 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Xen-devel, Changlong Xie, Wei Liu, Wen Congyang

On Mon, Apr 04, 2016 at 11:48:59AM +0100, Ian Jackson wrote:
> Ian Jackson writes ("Re: [PATCH] libxl: fix compilation on ARM"):
> > Following discussion on irc, here is a v2:
> 
> I forgot to update the commit message.
> 
> Ian.
> 
> From 4cbc583020642d6c333d07e297c52594bb88b542 Mon Sep 17 00:00:00 2001
> From: Ian Jackson <ian.jackson@eu.citrix.com>
> Date: Mon, 4 Apr 2016 11:41:19 +0100
> Subject: [PATCH] libxl: ARM build: fix type of libxl__srm_callout_callback_restore_results
> 
> COLO introduced a few callbacks. The original implementation used
> unsigned long for a type which in fact should be xen_pfn_t. That broke
> libxl compilation on ARM, because xen_pfn_t is not a synonym for
> unsigned long on ARM platform.
> 
> Fixing this requires modifying the perl script: specifically now we
> need to include xenctrl.h before _libxl_save_msgs_*.h, rather than
> afterwards, so that we can use xen_pfn_t there.
> 
> Reported-by: Olaf Hering <olaf@aepfle.de>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  tools/libxl/libxl_create.c         |    4 ++--
>  tools/libxl/libxl_save_msgs_gen.pl |    8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index 6882ff8..4b02de9 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -1109,8 +1109,8 @@ static void domcreate_bootloader_done(libxl__egc *egc,
>      domcreate_stream_done(egc, &dcs->srs, rc);
>  }
>  
> -void libxl__srm_callout_callback_restore_results(unsigned long store_mfn,
> -          unsigned long console_mfn, void *user)
> +void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
> +          xen_pfn_t console_mfn, void *user)
>  {
>      libxl__save_helper_state *shs = user;
>      libxl__domain_create_state *dcs = shs->caller_state;
> diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl
> index c2243f2..3ae7373 100755
> --- a/tools/libxl/libxl_save_msgs_gen.pl
> +++ b/tools/libxl/libxl_save_msgs_gen.pl
> @@ -29,8 +29,8 @@ our @msgs = (
>      [  6, 'srcxA',  "wait_checkpoint", [] ],
>      [  7, 'scxA',   "switch_qemu_logdirty",  [qw(int domid
>                                                unsigned enable)] ],
> -    [  8, 'rcx',    "restore_results",       ['unsigned long', 'store_gfn',
> -                                              'unsigned long', 'console_gfn'] ],
> +    [  8, 'rcx',    "restore_results",       ['xen_pfn_t', 'store_gfn',
> +                                              'xen_pfn_t', 'console_gfn'] ],
>      [  9, 'srW',    "complete",              [qw(int retval
>                                                   int errnoval)] ],
>  );
> @@ -70,9 +70,9 @@ END_BOTH
>  
>  END_CALLOUT
>  
> -#include "_libxl_save_msgs_${ah}.h"
>  #include <xenctrl.h>
>  #include <xenguest.h>
> +#include "_libxl_save_msgs_${ah}.h"
>  
>  END_HELPER
>  }
> @@ -141,7 +141,7 @@ static void bytes_put(unsigned char *const buf, int *len,
>  
>  END
>  
> -foreach my $simpletype (qw(int uint16_t uint32_t unsigned), 'unsigned long') {
> +foreach my $simpletype (qw(int uint16_t uint32_t unsigned), 'unsigned long', 'xen_pfn_t') {
>      my $typeid = typeid($simpletype);
>      $out_body{'callout'} .= <<END;
>  static int ${typeid}_get(const unsigned char **msg,
> -- 
> 1.7.10.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-04 10:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-02  0:36 [PATCH] libxl: fix compilation on ARM Wei Liu
2016-04-04 10:46 ` Ian Jackson
2016-04-04 10:48   ` Ian Jackson
2016-04-04 10:51     ` Wei Liu
2016-04-04 10:51       ` Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).