Skip to contentSkip to conversation

xen{trace/analyze}: fix build on FreeBSD

PATCH In review Roger Pau Monne 4 participants 18 messages Jun 19, 2015 – Jun 25, 2015

lore
Share & tools
lore
#0 lore raw

cover xen{trace/analyze}: fix build on FreeBSD

Fix the build of xentrace/xenalyze on FreeBSD, and possibly other libcs not having argp. Also fix the usage of fstat64 and O_LARGEFILE.

Roger.

#1 lore raw

PATCH 1/2 xen{trace/analyze}: don't use 64bit versions of libc functions

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
---
 tools/xentrace/mread.c    |  8 ++++----
 tools/xentrace/mread.h    |  6 +++---
 tools/xentrace/xenalyze.c | 28 ++++++++++++++--------------
 3 files changed, 21 insertions(+), 21 deletions(-)
tools/xentrace/mread.c +4 -4
index a63d16c..a22c4ea 100644
@@ -9,7 +9,7 @@
 
 mread_handle_t mread_init(int fd)
 {
-    struct stat64 s;
+    struct stat s;
     mread_handle_t h;
     
     h=malloc(sizeof(struct mread_ctrl));
@@ -24,13 +24,13 @@ mread_handle_t mread_init(int fd)
 
     h->fd = fd;
 
-    fstat64(fd, &s);
+    fstat(fd, &s);
     h->file_size = s.st_size;
 
     return h;
 }
 
-ssize_t mread64(mread_handle_t h, void *rec, ssize_t len, loff_t offset)
+ssize_t mread64(mread_handle_t h, void *rec, ssize_t len, off_t offset)
 {
     /* Idea: have a "cache" of N mmaped regions.  If the offset is
      * in one of the regions, just copy it.  If not, evict one of the
@@ -45,7 +45,7 @@ ssize_t mread64(mread_handle_t h, void *rec, ssize_t len, loff_t offset)
      */
     char * b=NULL;
     int bind=-1;
-    loff_t boffset=0;
+    off_t boffset=0;
     ssize_t bsize;
 
 #define dprintf(x...)
tools/xentrace/mread.h +3 -3
index 8df41a8..443814f 100644
@@ -5,14 +5,14 @@
 #define MREAD_BUF_MASK (~(MREAD_BUF_SIZE-1))
 typedef struct mread_ctrl {
     int fd;
-    loff_t file_size;
+    off_t file_size;
     struct mread_buffer {
         char * buffer;
-        loff_t start_offset;
+        off_t start_offset;
         int accessed;
     } map[MREAD_MAPS];
     int clock, last;
 } *mread_handle_t;
 
 mread_handle_t mread_init(int fd);
-ssize_t mread64(mread_handle_t h, void *dst, ssize_t len, loff_t offset);
+ssize_t mread64(mread_handle_t h, void *dst, ssize_t len, off_t offset);
tools/xentrace/xenalyze.c +14 -14
index a8e73eb..dc89ffe 100644
@@ -70,9 +70,9 @@ struct {
     char * symbol_file;
     char * trace_file;
     int output_defined;
-    loff_t file_size;
+    off_t file_size;
     struct {
-        loff_t update_offset;
+        off_t update_offset;
         int pipe[2];
         FILE* out;
         int pid;
@@ -1853,8 +1853,8 @@ struct pcpu_info {
 
     /* Information related to scanning thru the file */
     tsc_t first_tsc, last_tsc, order_tsc;
-    loff_t file_offset;
-    loff_t next_cpu_change_offset;
+    off_t file_offset;
+    off_t next_cpu_change_offset;
     struct record_info ri;
     int last_cpu_change_pid;
     int power_state;
@@ -1898,7 +1898,7 @@ void __fill_in_record_info(struct pcpu_info *p);
 
 struct {
     int max_active_pcpu;
-    loff_t last_epoch_offset;
+    off_t last_epoch_offset;
     int early_eof;
     int lost_cpus;
     tsc_t now;
@@ -1937,7 +1937,7 @@ char * pcpu_string(int pcpu);
 void pcpu_string_draw(struct pcpu_info *p);
 void process_generic(struct record_info *ri);
 void dump_generic(FILE *f, struct record_info *ri);
-ssize_t __read_record(struct trace_record *rec, loff_t offset);
+ssize_t __read_record(struct trace_record *rec, off_t offset);
 void error(enum error_level l, struct record_info *ri);
 void update_io_address(struct io_address ** list, unsigned int pa, int dir,
                        tsc_t arc_cycles, unsigned int va);
@@ -8512,7 +8512,7 @@ void activate_early_eof(void) {
     }
 }
 
-loff_t scan_for_new_pcpu(loff_t offset) {
+off_t scan_for_new_pcpu(off_t offset) {
     ssize_t r;
     struct trace_record rec;
     struct cpu_change_data *cd;
@@ -9051,7 +9051,7 @@ void progress_init(void) {
 
 }
 
-void progress_update(loff_t offset) {
+void progress_update(off_t offset) {
     long long p;
 
     p = ( offset * 100 ) / G.file_size;
@@ -9089,7 +9089,7 @@ void progress_finish(void) {
     }
 }
 
-ssize_t __read_record(struct trace_record *rec, loff_t offset)
+ssize_t __read_record(struct trace_record *rec, off_t offset)
 {
     ssize_t r, rsize;
 
@@ -9172,7 +9172,7 @@ void __fill_in_record_info(struct pcpu_info *p)
 }
 
 ssize_t read_record(struct pcpu_info * p) {
-    loff_t * offset;
+    off_t * offset;
     struct record_info *ri;
 
     offset = &p->file_offset;
@@ -9489,7 +9489,7 @@ void report_pcpu(void) {
 
 void init_pcpus(void) {
     int i=0;
-    loff_t offset = 0;
+    off_t offset = 0;
 
     for(i=0; i<MAX_CPUS; i++)
     {
@@ -10358,12 +10358,12 @@ int main(int argc, char *argv[]) {
     if (G.trace_file == NULL)
         exit(1);
 
-    if ( (G.fd = open(G.trace_file, O_RDONLY|O_LARGEFILE)) < 0) {
+    if ( (G.fd = open(G.trace_file, O_RDONLY)) < 0) {
         perror("open");
         error(ERR_SYSTEM, NULL);
     } else {
-        struct stat64 s;
-        fstat64(G.fd, &s);
+        struct stat s;
+        fstat(G.fd, &s);
         G.file_size = s.st_size;
     }
 
Signature · 7 lines
1.9.5 (Apple Git-50.3)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xen{trace/analyze}: don't use 64bit versions of libc functions

Quoted 11 lines · Roger Pau Monne

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
#3 lore raw

Re: [PATCH 1/2] xen{trace/analyze}: don't use 64bit versions of libc functions

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

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Just so I understand -- are you saying that configure at the tools directory level will notice that Linux can handle 64-bit file operations and use them automatically?

-George

Quoted 170 lines
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
---
 tools/xentrace/mread.c    |  8 ++++----
 tools/xentrace/mread.h    |  6 +++---
 tools/xentrace/xenalyze.c | 28 ++++++++++++++--------------
 3 files changed, 21 insertions(+), 21 deletions(-)
tools/xentrace/mread.c +4 -4
index a63d16c..a22c4ea 100644
@@ -9,7 +9,7 @@
 
 mread_handle_t mread_init(int fd)
 {
-    struct stat64 s;
+    struct stat s;
     mread_handle_t h;
 
     h=malloc(sizeof(struct mread_ctrl));
@@ -24,13 +24,13 @@ mread_handle_t mread_init(int fd)
 
     h->fd = fd;
 
-    fstat64(fd, &s);
+    fstat(fd, &s);
     h->file_size = s.st_size;
 
     return h;
 }
 
-ssize_t mread64(mread_handle_t h, void *rec, ssize_t len, loff_t offset)
+ssize_t mread64(mread_handle_t h, void *rec, ssize_t len, off_t offset)
 {
     /* Idea: have a "cache" of N mmaped regions.  If the offset is
      * in one of the regions, just copy it.  If not, evict one of the
@@ -45,7 +45,7 @@ ssize_t mread64(mread_handle_t h, void *rec, ssize_t len, loff_t offset)
      */
     char * b=NULL;
     int bind=-1;
-    loff_t boffset=0;
+    off_t boffset=0;
     ssize_t bsize;
 
 #define dprintf(x...)
tools/xentrace/mread.h +3 -3
index 8df41a8..443814f 100644
@@ -5,14 +5,14 @@
 #define MREAD_BUF_MASK (~(MREAD_BUF_SIZE-1))
 typedef struct mread_ctrl {
     int fd;
-    loff_t file_size;
+    off_t file_size;
     struct mread_buffer {
         char * buffer;
-        loff_t start_offset;
+        off_t start_offset;
         int accessed;
     } map[MREAD_MAPS];
     int clock, last;
 } *mread_handle_t;
 
 mread_handle_t mread_init(int fd);
-ssize_t mread64(mread_handle_t h, void *dst, ssize_t len, loff_t offset);
+ssize_t mread64(mread_handle_t h, void *dst, ssize_t len, off_t offset);
tools/xentrace/xenalyze.c +12 -12
index a8e73eb..dc89ffe 100644
@@ -70,9 +70,9 @@ struct {
     char * symbol_file;
     char * trace_file;
     int output_defined;
-    loff_t file_size;
+    off_t file_size;
     struct {
-        loff_t update_offset;
+        off_t update_offset;
         int pipe[2];
         FILE* out;
         int pid;
@@ -1853,8 +1853,8 @@ struct pcpu_info {
 
     /* Information related to scanning thru the file */
     tsc_t first_tsc, last_tsc, order_tsc;
-    loff_t file_offset;
-    loff_t next_cpu_change_offset;
+    off_t file_offset;
+    off_t next_cpu_change_offset;
     struct record_info ri;
     int last_cpu_change_pid;
     int power_state;
@@ -1898,7 +1898,7 @@ void __fill_in_record_info(struct pcpu_info *p);
 
 struct {
     int max_active_pcpu;
-    loff_t last_epoch_offset;
+    off_t last_epoch_offset;
     int early_eof;
     int lost_cpus;
     tsc_t now;
@@ -1937,7 +1937,7 @@ char * pcpu_string(int pcpu);
 void pcpu_string_draw(struct pcpu_info *p);
 void process_generic(struct record_info *ri);
 void dump_generic(FILE *f, struct record_info *ri);
-ssize_t __read_record(struct trace_record *rec, loff_t offset);
+ssize_t __read_record(struct trace_record *rec, off_t offset);
 void error(enum error_level l, struct record_info *ri);
 void update_io_address(struct io_address ** list, unsigned int pa, int dir,
                        tsc_t arc_cycles, unsigned int va);
@@ -8512,7 +8512,7 @@ void activate_early_eof(void) {
     }
 }
 
-loff_t scan_for_new_pcpu(loff_t offset) {
+off_t scan_for_new_pcpu(off_t offset) {
     ssize_t r;
     struct trace_record rec;
     struct cpu_change_data *cd;
@@ -9051,7 +9051,7 @@ void progress_init(void) {
 
 }
 
-void progress_update(loff_t offset) {
+void progress_update(off_t offset) {
     long long p;
 
     p = ( offset * 100 ) / G.file_size;
@@ -9089,7 +9089,7 @@ void progress_finish(void) {
     }
 }
 
-ssize_t __read_record(struct trace_record *rec, loff_t offset)
+ssize_t __read_record(struct trace_record *rec, off_t offset)
 {
     ssize_t r, rsize;
 
@@ -9172,7 +9172,7 @@ void __fill_in_record_info(struct pcpu_info *p)
 }
 
 ssize_t read_record(struct pcpu_info * p) {
-    loff_t * offset;
+    off_t * offset;
     struct record_info *ri;
 
     offset = &p->file_offset;
@@ -9489,7 +9489,7 @@ void report_pcpu(void) {
 
 void init_pcpus(void) {
     int i=0;
-    loff_t offset = 0;
+    off_t offset = 0;
 
     for(i=0; i<MAX_CPUS; i++)
     {
@@ -10358,12 +10358,12 @@ int main(int argc, char *argv[]) {
     if (G.trace_file == NULL)
         exit(1);
 
-    if ( (G.fd = open(G.trace_file, O_RDONLY|O_LARGEFILE)) < 0) {
+    if ( (G.fd = open(G.trace_file, O_RDONLY)) < 0) {

tools/xentrace/xenalyze.c int main(int argc, char *argv[]) { · line 10369

Quoted 10 lines
tools/xentrace/xenalyze.c +2 -2
         perror("open");
         error(ERR_SYSTEM, NULL);
     } else {
-        struct stat64 s;
-        fstat64(G.fd, &s);
+        struct stat s;
+        fstat(G.fd, &s);
         G.file_size = s.st_size;
     }
 

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

#4 lore raw

Re: [PATCH 1/2] xen{trace/analyze}: don't use 64bit versions of libc functions

El 22/06/15 a les 11.08, George Dunlap ha escrit:

Quoted 9 lines · Roger Pau Monne
Quoted 4 lines

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Just so I understand -- are you saying that configure at the tools directory level will notice that Linux can handle 64-bit file operations and use them automatically?

Yes, according to the man page [1]:

"Over time, increases in the size of the stat structure have led to three successive versions of stat(): sys_stat() (slot __NR_oldstat), sys_newstat() (slot __NR_stat), and sys_stat64() (new in kernel 2.4; slot __NR_stat64). The glibc stat() wrapper function hides these details from applications, invoking the most recent version of the system call provided by the kernel, and repacking the returned information if required for old binaries. Similar remarks apply for fstat() and lstat()."

Roger.

[1] http://linux.die.net/man/2/fstat64

Acked-by
#5 lore raw

Re: [PATCH 1/2] xen{trace/analyze}: don't use 64bit versions of libc functions

Quoted 13 lines · Roger Pau Monné

El 22/06/15 a les 11.08, George Dunlap ha escrit:

Quoted 9 lines · Roger Pau Monne
Quoted 4 lines

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Just so I understand -- are you saying that configure at the tools directory level will notice that Linux can handle 64-bit file operations and use them automatically?

Yes, according to the man page [1]:

Quoted 7 lines

"Over time, increases in the size of the stat structure have led to three successive versions of stat(): sys_stat() (slot __NR_oldstat), sys_newstat() (slot __NR_stat), and sys_stat64() (new in kernel 2.4; slot __NR_stat64). The glibc stat() wrapper function hides these details from applications, invoking the most recent version of the system call provided by the kernel, and repacking the returned information if required for old binaries. Similar remarks apply for fstat() and lstat()."

OK, if you can confirm that you've actually tested this on a file larger than 4GiB, then:

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

#6 lore raw

Re: [PATCH 1/2] xen{trace/analyze}: don't use 64bit versions of libc functions

El 22/06/15 a les 12.09, George Dunlap ha escrit:

Quoted 22 lines · Roger Pau Monné
Quoted 13 lines

El 22/06/15 a les 11.08, George Dunlap ha escrit:

Quoted 9 lines · Roger Pau Monne
Quoted 4 lines

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Just so I understand -- are you saying that configure at the tools directory level will notice that Linux can handle 64-bit file operations and use them automatically?

Yes, according to the man page [1]:

Quoted 7 lines

"Over time, increases in the size of the stat structure have led to three successive versions of stat(): sys_stat() (slot __NR_oldstat), sys_newstat() (slot __NR_stat), and sys_stat64() (new in kernel 2.4; slot __NR_stat64). The glibc stat() wrapper function hides these details from applications, invoking the most recent version of the system call provided by the kernel, and repacking the returned information if required for old binaries. Similar remarks apply for fstat() and lstat()."

Quoted 2 lines

OK, if you can confirm that you've actually tested this on a file larger than 4GiB, then:

No, I have only build tested it since I was trying to unbreak the build. I don't think I will have time to test this until tomorrow, sorry for the delay.

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

#7 lore raw

Re: [PATCH 1/2] xen{trace/analyze}: don't use 64bit versions of libc functions

El 22/06/15 a les 16.48, Roger Pau Monné ha escrit:

Quoted 23 lines

El 22/06/15 a les 12.09, George Dunlap ha escrit:

Quoted 22 lines · Roger Pau Monné
Quoted 20 lines

El 22/06/15 a les 11.08, George Dunlap ha escrit:

Quoted 9 lines · Roger Pau Monne
Quoted 4 lines

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Just so I understand -- are you saying that configure at the tools directory level will notice that Linux can handle 64-bit file operations and use them automatically?

Yes, according to the man page [1]:

"Over time, increases in the size of the stat structure have led to three successive versions of stat(): sys_stat() (slot __NR_oldstat), sys_newstat() (slot __NR_stat), and sys_stat64() (new in kernel 2.4; slot __NR_stat64). The glibc stat() wrapper function hides these details from applications, invoking the most recent version of the system call provided by the kernel, and repacking the returned information if required for old binaries. Similar remarks apply for fstat() and lstat()."

Quoted 6 lines
Quoted 2 lines

OK, if you can confirm that you've actually tested this on a file larger than 4GiB, then:

No, I have only build tested it since I was trying to unbreak the build. I don't think I will have time to test this until tomorrow, sorry for the delay.

I've now tested this with a ~5GB file and it seems to work fine, I haven't seen any error and the output looks reasonable. This was on a 64bit Dom0, if someone has a 32bit Dom0 it would be good to test it there also.

Roger.

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

#8 lore raw

Re: [PATCH 1/2] xen{trace/analyze}: don't use 64bit versions of libc functions

El 24/06/15 a les 13.11, Roger Pau Monné ha escrit:

Quoted 27 lines

El 22/06/15 a les 16.48, Roger Pau Monné ha escrit:

Quoted 26 lines

El 22/06/15 a les 12.09, George Dunlap ha escrit:

Quoted 24 lines · Roger Pau Monné
Quoted 13 lines

El 22/06/15 a les 11.08, George Dunlap ha escrit:

Quoted 9 lines · Roger Pau Monne
Quoted 4 lines

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Just so I understand -- are you saying that configure at the tools directory level will notice that Linux can handle 64-bit file operations and use them automatically?

Yes, according to the man page [1]:

Quoted 7 lines

"Over time, increases in the size of the stat structure have led to three successive versions of stat(): sys_stat() (slot __NR_oldstat), sys_newstat() (slot __NR_stat), and sys_stat64() (new in kernel 2.4; slot __NR_stat64). The glibc stat() wrapper function hides these details from applications, invoking the most recent version of the system call provided by the kernel, and repacking the returned information if required for old binaries. Similar remarks apply for fstat() and lstat()."

OK, if you can confirm that you've actually tested this on a file larger than 4GiB, then:

Quoted 8 lines
Quoted 3 lines

No, I have only build tested it since I was trying to unbreak the build. I don't think I will have time to test this until tomorrow, sorry for the delay.

I've now tested this with a ~5GB file and it seems to work fine, I haven't seen any error and the output looks reasonable. This was on a 64bit Dom0, if someone has a 32bit Dom0 it would be good to test it there also.

I've also tested on a 32bit Dom0, with and without the patches in this series and I always end up getting the same strange output from xenalyze:

# xenalyze trace.file
No output defined, using summary.
Using VMX hardware-assisted virtualization.
scan_for_new_pcpu: Activating pcpu 0 at offset 0
Creating vcpu 0 for dom 32768
scan_for_new_pcpu: Activating pcpu 1 at offset 10376
Creating vcpu 1 for dom 32768
scan_for_new_pcpu: Activating pcpu 4 at offset 10848
Creating vcpu 4 for dom 32768
scan_for_new_pcpu: Activating pcpu 6 at offset 11176
Creating vcpu 6 for dom 32768
init_pcpus: through first trace write, done for now.
Creating domain 0
Creating vcpu 0 for dom 0
Using first_tsc for d0v0 (8109 cycles)
Creating domain 32767
Creating vcpu 1 for dom 32767
Creating vcpu 1 for dom 0
Creating vcpu 2 for dom 0
Creating vcpu 4 for dom 32767
Using first_tsc for d32767v4 (9407 cycles)
Creating vcpu 6 for dom 32767
Using first_tsc for d32767v6 (8755 cycles)
process_cpu_change: Activating pcpu 5 at offset 16664
Creating vcpu 5 for dom 32768
scan_for_new_pcpu: Activating pcpu 7 at offset 17812
Creating vcpu 7 for dom 32768
Creating vcpu 3 for dom 0
Using first_tsc for d0v3 (3369172 cycles)
Creating vcpu 0 for dom 32767
Creating vcpu 6 for dom 0
Creating vcpu 5 for dom 32767
Using first_tsc for d32767v5 (7868 cycles)
Creating vcpu 7 for dom 0
Creating vcpu 7 for dom 32767
Using first_tsc for d32767v7 (7693 cycles)
process_cpu_change: Activating pcpu 2 at offset 61284
Creating vcpu 2 for dom 32768
process_cpu_change: Activating pcpu 3 at offset 62128
Creating vcpu 3 for dom 32768
Creating vcpu 5 for dom 0
Creating vcpu 3 for dom 32767
Using first_tsc for d32767v3 (24609 cycles)
Creating vcpu 4 for dom 0
Creating vcpu 2 for dom 32767
Using first_tsc for d32767v2 (2575 cycles)
WARNING: Unexpected vcpu data type for d0v0 on proc 1! Expected 1 got 2.
Not processing
]   84007(8:4:7) 0 [ ]
WARNING: Unexpected vcpu data type for d0v0 on proc 1! Expected 1 got 2.
Not processing
]   84006(8:4:6) 0 [ ]
WARNING: Unexpected vcpu data type for d0v2 on proc 6! Expected 1 got 2.
Not processing
]   84008(8:4:8) 0 [ ]
WARNING: Unexpected vcpu data type for d0v2 on proc 6! Expected 1 got 2.
Not processing
]   84008(8:4:8) 0 [ ]
WARNING: Unexpected vcpu data type for d0v3 on proc 0! Expected 1 got 2.
Not processing
]   84006(8:4:6) 0 [ ]
Creating domain 90
Creating vcpu 0 for dom 90
Creating domain 89
Creating vcpu 0 for dom 89
Unknown hvm event: 84011
h->exit_reason 7b > exit_reason_max 38!
]   81002(8:1:2) 2 [ 7b 100d9e ]

And that's all. Since this seems to not be related to this fixes I think they should be applied.

Roger.

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

#9 lore raw

Re: [PATCH 1/2] xen{trace/analyze}: don't use 64bit versions of libc functions

Quoted 109 lines · Roger Pau Monné

El 24/06/15 a les 13.11, Roger Pau Monné ha escrit:

Quoted 27 lines

El 22/06/15 a les 16.48, Roger Pau Monné ha escrit:

Quoted 26 lines

El 22/06/15 a les 12.09, George Dunlap ha escrit:

Quoted 24 lines · Roger Pau Monné
Quoted 13 lines

El 22/06/15 a les 11.08, George Dunlap ha escrit:

Quoted 9 lines · Roger Pau Monne
Quoted 4 lines

This is not needed, neither encouraged. Configure already checks _FILE_OFFSET_BITS and appends it when needed, so that the right functions are used. Also remove the usage of loff_t and O_LARGEFILE for the same reason.

Just so I understand -- are you saying that configure at the tools directory level will notice that Linux can handle 64-bit file operations and use them automatically?

Yes, according to the man page [1]:

Quoted 7 lines

"Over time, increases in the size of the stat structure have led to three successive versions of stat(): sys_stat() (slot __NR_oldstat), sys_newstat() (slot __NR_stat), and sys_stat64() (new in kernel 2.4; slot __NR_stat64). The glibc stat() wrapper function hides these details from applications, invoking the most recent version of the system call provided by the kernel, and repacking the returned information if required for old binaries. Similar remarks apply for fstat() and lstat()."

OK, if you can confirm that you've actually tested this on a file larger than 4GiB, then:

Quoted 8 lines
Quoted 3 lines

No, I have only build tested it since I was trying to unbreak the build. I don't think I will have time to test this until tomorrow, sorry for the delay.

I've now tested this with a ~5GB file and it seems to work fine, I haven't seen any error and the output looks reasonable. This was on a 64bit Dom0, if someone has a 32bit Dom0 it would be good to test it there also.

I've also tested on a 32bit Dom0, with and without the patches in this series and I always end up getting the same strange output from xenalyze:

# xenalyze trace.file
No output defined, using summary.
Using VMX hardware-assisted virtualization.
scan_for_new_pcpu: Activating pcpu 0 at offset 0
Creating vcpu 0 for dom 32768
scan_for_new_pcpu: Activating pcpu 1 at offset 10376
Creating vcpu 1 for dom 32768
scan_for_new_pcpu: Activating pcpu 4 at offset 10848
Creating vcpu 4 for dom 32768
scan_for_new_pcpu: Activating pcpu 6 at offset 11176
Creating vcpu 6 for dom 32768
init_pcpus: through first trace write, done for now.
Creating domain 0
Creating vcpu 0 for dom 0
Using first_tsc for d0v0 (8109 cycles)
Creating domain 32767
Creating vcpu 1 for dom 32767
Creating vcpu 1 for dom 0
Creating vcpu 2 for dom 0
Creating vcpu 4 for dom 32767
Using first_tsc for d32767v4 (9407 cycles)
Creating vcpu 6 for dom 32767
Using first_tsc for d32767v6 (8755 cycles)
process_cpu_change: Activating pcpu 5 at offset 16664
Creating vcpu 5 for dom 32768
scan_for_new_pcpu: Activating pcpu 7 at offset 17812
Creating vcpu 7 for dom 32768
Creating vcpu 3 for dom 0
Using first_tsc for d0v3 (3369172 cycles)
Creating vcpu 0 for dom 32767
Creating vcpu 6 for dom 0
Creating vcpu 5 for dom 32767
Using first_tsc for d32767v5 (7868 cycles)
Creating vcpu 7 for dom 0
Creating vcpu 7 for dom 32767
Using first_tsc for d32767v7 (7693 cycles)
process_cpu_change: Activating pcpu 2 at offset 61284
Creating vcpu 2 for dom 32768
process_cpu_change: Activating pcpu 3 at offset 62128
Creating vcpu 3 for dom 32768
Creating vcpu 5 for dom 0
Creating vcpu 3 for dom 32767
Using first_tsc for d32767v3 (24609 cycles)
Creating vcpu 4 for dom 0
Creating vcpu 2 for dom 32767
Using first_tsc for d32767v2 (2575 cycles)
WARNING: Unexpected vcpu data type for d0v0 on proc 1! Expected 1 got 2.
Not processing
]   84007(8:4:7) 0 [ ]
WARNING: Unexpected vcpu data type for d0v0 on proc 1! Expected 1 got 2.
Not processing
]   84006(8:4:6) 0 [ ]
WARNING: Unexpected vcpu data type for d0v2 on proc 6! Expected 1 got 2.
Not processing
]   84008(8:4:8) 0 [ ]
WARNING: Unexpected vcpu data type for d0v2 on proc 6! Expected 1 got 2.
Not processing
]   84008(8:4:8) 0 [ ]
WARNING: Unexpected vcpu data type for d0v3 on proc 0! Expected 1 got 2.
Not processing
]   84006(8:4:6) 0 [ ]
Creating domain 90
Creating vcpu 0 for dom 90
Creating domain 89
Creating vcpu 0 for dom 89
Unknown hvm event: 84011
h->exit_reason 7b > exit_reason_max 38!
]   81002(8:1:2) 2 [ 7b 100d9e ]
Quoted 2 lines

And that's all. Since this seems to not be related to this fixes I think they should be applied.

+1.

(Ack is already there.)

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

#10 lore raw

PATCH 2/2 configure: check for argp

In reply to Roger Pau Monne

argp is only present in the GNU C library, so add a specific check for it in configure. Also check if -largp is needed for linking against it.

Please run autoconf after applying.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
---
 config/Tools.mk.in      | 1 +
 tools/configure.ac      | 4 ++++
 tools/xentrace/Makefile | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index aef9ed6..9bd5f6c 100644
@@ -78,5 +78,6 @@ CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
 TINFO_LIBS          := @TINFO_LIBS@
+ARGP_LDFLAGS        := @argp_ldflags@
 
 FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
tools/configure.ac +4 -0
index 1a06ddf..5eb4799 100644
@@ -356,6 +356,10 @@ AC_CHECK_LIB([yajl], [yajl_alloc], [],
 AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
 AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
 AC_SUBST(libiconv)
+AC_CHECK_HEADER([argp.h], [
+AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"])
+], [AC_MSG_ERROR([Could not find argp])])
+AC_SUBST(argp_ldflags)
 
 # FDT is needed only on ARM
 case "$host_cpu" in
tools/xentrace/Makefile +1 -1
index 7d874a3..2f57bda 100644
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 
 CFLAGS += $(CFLAGS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenctrl)
+LDLIBS += $(LDLIBS_libxenctrl) $(ARGP_LDFLAGS)
 
 BIN-$(CONFIG_X86) = xenalyze
 BIN      = $(BIN-y)
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

Re: [PATCH 2/2] configure: check for argp

Quoted 11 lines · Roger Pau Monne

argp is only present in the GNU C library, so add a specific check for it in configure. Also check if -largp is needed for linking against it.

Please run autoconf after applying.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
Quoted 47 lines
---
 config/Tools.mk.in      | 1 +
 tools/configure.ac      | 4 ++++
 tools/xentrace/Makefile | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index aef9ed6..9bd5f6c 100644
@@ -78,5 +78,6 @@ CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
 TINFO_LIBS          := @TINFO_LIBS@
+ARGP_LDFLAGS        := @argp_ldflags@
 
 FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
tools/configure.ac +4 -0
index 1a06ddf..5eb4799 100644
@@ -356,6 +356,10 @@ AC_CHECK_LIB([yajl], [yajl_alloc], [],
 AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
 AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
 AC_SUBST(libiconv)
+AC_CHECK_HEADER([argp.h], [
+AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"])
+], [AC_MSG_ERROR([Could not find argp])])
+AC_SUBST(argp_ldflags)
 
 # FDT is needed only on ARM
 case "$host_cpu" in
tools/xentrace/Makefile +1 -1
index 7d874a3..2f57bda 100644
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 
 CFLAGS += $(CFLAGS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenctrl)
+LDLIBS += $(LDLIBS_libxenctrl) $(ARGP_LDFLAGS)
 
 BIN-$(CONFIG_X86) = xenalyze
 BIN      = $(BIN-y)
Signature · 1 line
1.9.5 (Apple Git-50.3)
#12 lore raw

Re: [PATCH 2/2] configure: check for argp

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

argp is only present in the GNU C library, so add a specific check for it in configure. Also check if -largp is needed for linking against it.

Please run autoconf after applying.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
---
 config/Tools.mk.in      | 1 +
 tools/configure.ac      | 4 ++++
 tools/xentrace/Makefile | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index aef9ed6..9bd5f6c 100644
@@ -78,5 +78,6 @@ CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
 TINFO_LIBS          := @TINFO_LIBS@
+ARGP_LDFLAGS        := @argp_ldflags@
 
 FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
tools/configure.ac +0 -0
index 1a06ddf..5eb4799 100644

tools/configure.ac AC_CHECK_LIB([yajl], [yajl_alloc], [], · line 362

Quoted 7 lines
tools/configure.ac +4 -0
@@ -356,6 +356,10 @@ AC_CHECK_LIB([yajl], [yajl_alloc], [],
 AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
 AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
 AC_SUBST(libiconv)
+AC_CHECK_HEADER([argp.h], [
+AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"])
+], [AC_MSG_ERROR([Could not find argp])])
+AC_SUBST(argp_ldflags)

Sorry if my config-fu isn't very good: Is this basically requiring the user to have argp available at configure time? Does this make it more difficult to build on BSDs? Or is it just a matter of adding one more library to the already long list of dependencies?

-George

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

#13 lore raw

Re: [PATCH 2/2] configure: check for argp

Quoted 38 lines · George Dunlap
Quoted 37 lines · Roger Pau Monne

argp is only present in the GNU C library, so add a specific check for it in configure. Also check if -largp is needed for linking against it.

Please run autoconf after applying.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
---
 config/Tools.mk.in      | 1 +
 tools/configure.ac      | 4 ++++
 tools/xentrace/Makefile | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index aef9ed6..9bd5f6c 100644
@@ -78,5 +78,6 @@ CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
 TINFO_LIBS          := @TINFO_LIBS@
+ARGP_LDFLAGS        := @argp_ldflags@
 
 FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
tools/configure.ac +1 -0
index 1a06ddf..5eb4799 100644
@@ -356,6 +356,10 @@ AC_CHECK_LIB([yajl], [yajl_alloc], [],
 AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
 AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
 AC_SUBST(libiconv)
+AC_CHECK_HEADER([argp.h], [
Quoted 8 lines

tools/configure.ac AC_CHECK_LIB([yajl], [yajl_alloc], [], · line 362

Quoted 3 lines
tools/configure.ac +3 -0
+AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"])
+], [AC_MSG_ERROR([Could not find argp])])
+AC_SUBST(argp_ldflags)

Sorry if my config-fu isn't very good: Is this basically requiring the user to have argp available at configure time? Does this make it more difficult to build on BSDs? Or is it just a matter of adding one more library to the already long list of dependencies?

This is just to make that dependency explicit. This is a step towards the right direction. It's not going to make it easier or harder to build on BSDs.

Wei.

Quoted 2 lines

-George

#14 lore raw

Re: [PATCH 2/2] configure: check for argp

Quoted 48 lines · Wei Liu
Quoted 38 lines · George Dunlap
Quoted 37 lines · Roger Pau Monne

argp is only present in the GNU C library, so add a specific check for it in configure. Also check if -largp is needed for linking against it.

Please run autoconf after applying.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
---
 config/Tools.mk.in      | 1 +
 tools/configure.ac      | 4 ++++
 tools/xentrace/Makefile | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index aef9ed6..9bd5f6c 100644
@@ -78,5 +78,6 @@ CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
 TINFO_LIBS          := @TINFO_LIBS@
+ARGP_LDFLAGS        := @argp_ldflags@
 
 FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
tools/configure.ac +1 -0
index 1a06ddf..5eb4799 100644
@@ -356,6 +356,10 @@ AC_CHECK_LIB([yajl], [yajl_alloc], [],
 AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
 AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
 AC_SUBST(libiconv)
+AC_CHECK_HEADER([argp.h], [
Quoted 8 lines

tools/configure.ac AC_CHECK_LIB([yajl], [yajl_alloc], [], · line 362

Quoted 3 lines
tools/configure.ac +3 -0
+AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"])
+], [AC_MSG_ERROR([Could not find argp])])
+AC_SUBST(argp_ldflags)

Sorry if my config-fu isn't very good: Is this basically requiring the user to have argp available at configure time? Does this make it more difficult to build on BSDs? Or is it just a matter of adding one more library to the already long list of dependencies?

Quoted 3 lines

This is just to make that dependency explicit. This is a step towards the right direction. It's not going to make it easier or harder to build on BSDs.

Well the reason I was asking is that if it would be a big hassle for someone building on BSDs to install the argp library, then a better option might to just not build xenalyze.

On the other hand, if it's no more difficult than installing libyajl (or any of the other dozen dependencies), then adding a dependency is fine.
And naturally in that case making the dependency explicit is the right
thing to do.

-George

#15 lore raw

Re: [PATCH 2/2] configure: check for argp

Quoted 53 lines · George Dunlap
Quoted 48 lines · Wei Liu
Quoted 38 lines · George Dunlap
Quoted 37 lines · Roger Pau Monne

argp is only present in the GNU C library, so add a specific check for it in configure. Also check if -largp is needed for linking against it.

Please run autoconf after applying.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
---
 config/Tools.mk.in      | 1 +
 tools/configure.ac      | 4 ++++
 tools/xentrace/Makefile | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index aef9ed6..9bd5f6c 100644
@@ -78,5 +78,6 @@ CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
 TINFO_LIBS          := @TINFO_LIBS@
+ARGP_LDFLAGS        := @argp_ldflags@
 
 FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
tools/configure.ac +1 -0
index 1a06ddf..5eb4799 100644
@@ -356,6 +356,10 @@ AC_CHECK_LIB([yajl], [yajl_alloc], [],
 AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
 AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
 AC_SUBST(libiconv)
+AC_CHECK_HEADER([argp.h], [
Quoted 8 lines

tools/configure.ac AC_CHECK_LIB([yajl], [yajl_alloc], [], · line 362

Quoted 3 lines
tools/configure.ac +3 -0
+AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"])
+], [AC_MSG_ERROR([Could not find argp])])
+AC_SUBST(argp_ldflags)

Sorry if my config-fu isn't very good: Is this basically requiring the user to have argp available at configure time? Does this make it more difficult to build on BSDs? Or is it just a matter of adding one more library to the already long list of dependencies?

Quoted 3 lines

This is just to make that dependency explicit. This is a step towards the right direction. It's not going to make it easier or harder to build on BSDs.

Quoted 9 lines

Well the reason I was asking is that if it would be a big hassle for someone building on BSDs to install the argp library, then a better option might to just not build xenalyze.

On the other hand, if it's no more difficult than installing libyajl (or any of the other dozen dependencies), then adding a dependency is fine.
And naturally in that case making the dependency explicit is the right
thing to do.

Yes, package argp exist in FreeBSD and NetBSD.

Wei.

Quoted 2 lines

-George

Acked-by
#16 lore raw

Re: [PATCH 2/2] configure: check for argp

Quoted 58 lines · Wei Liu
Quoted 57 lines · George Dunlap
Quoted 48 lines · Wei Liu
Quoted 38 lines · George Dunlap
Quoted 37 lines · Roger Pau Monne

argp is only present in the GNU C library, so add a specific check for it in configure. Also check if -largp is needed for linking against it.

Please run autoconf after applying.

Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Olaf Hering <[email protected]>
---
 config/Tools.mk.in      | 1 +
 tools/configure.ac      | 4 ++++
 tools/xentrace/Makefile | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index aef9ed6..9bd5f6c 100644
@@ -78,5 +78,6 @@ CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
 TINFO_LIBS          := @TINFO_LIBS@
+ARGP_LDFLAGS        := @argp_ldflags@
 
 FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
tools/configure.ac +1 -0
index 1a06ddf..5eb4799 100644
@@ -356,6 +356,10 @@ AC_CHECK_LIB([yajl], [yajl_alloc], [],
 AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
 AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
 AC_SUBST(libiconv)
+AC_CHECK_HEADER([argp.h], [
Quoted 8 lines

tools/configure.ac AC_CHECK_LIB([yajl], [yajl_alloc], [], · line 362

Quoted 3 lines
tools/configure.ac +3 -0
+AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"])
+], [AC_MSG_ERROR([Could not find argp])])
+AC_SUBST(argp_ldflags)

Sorry if my config-fu isn't very good: Is this basically requiring the user to have argp available at configure time? Does this make it more difficult to build on BSDs? Or is it just a matter of adding one more library to the already long list of dependencies?

Quoted 3 lines

This is just to make that dependency explicit. This is a step towards the right direction. It's not going to make it easier or harder to build on BSDs.

Well the reason I was asking is that if it would be a big hassle for someone building on BSDs to install the argp library, then a better option might to just not build xenalyze.

Quoted 7 lines
Quoted 5 lines

On the other hand, if it's no more difficult than installing libyajl (or any of the other dozen dependencies), then adding a dependency is fine.
And naturally in that case making the dependency explicit is the right
thing to do.

Yes, package argp exist in FreeBSD and NetBSD.

In which case:

#17 lore raw
In reply to Roger Pau Monne
Quoted 2 lines · Roger Pau Monne

Fix the build of xentrace/xenalyze on FreeBSD, and possibly other libcs not having argp. Also fix the usage of fstat64 and O_LARGEFILE.

Both applied, thanks.