enable fsx-linux.c running on VxWorks user space and add measurement of execution time
PATCH 1/1 enable fsx-linux.c running on VxWorks user space and add measurement of execution time
Hello,
I come from Wind River. We and our customers used fsx-linux for file system testing on VxWorks user space and total execution time also received more attention in the testing. So I upstream the change of VxWorks compatibility parts on this patch, wish to enlarge the test support of fsx-linux.
There is a point need to explain, because current VxWorks doesn't support CLOCK_MONOTONIC_RAW , CLOCK_MONOTONIC is still used by VxWorks when calling clock_gettime. When CLOCK_MONOTONIC_RAW is support by VxWorks in the future, this part will be removed.
Test log:
[fsx-linux]$ PATH=$PATH:$PWD ./fsx-linux -N 20000 /tmp/test/test.ini
truncating to largest ever: 0x13e76
truncating to largest ever: 0x2e52c
truncating to largest ever: 0x3c2c2
truncating to largest ever: 0x3f15f
truncating to largest ever: 0x3fcb9
truncating to largest ever: 0x3fe96
truncating to largest ever: 0x3ff9d
All operations completed A-OK!
Elapsed Test Time 1.366451681
--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 44 ++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-)
testcases/kernel/fs/fsx-linux/fsx-linux.c +40 -4
@@ -39,8 +39,10 @@#include <sys/types.h> #include <sys/stat.h> -#if defined(_UWIN) || defined(__linux__) +#if defined(_UWIN) || defined(__linux__) || defined(__VXWORKS__) +#if !defined(__VXWORKS__)#include <sys/param.h> +#endif #include <limits.h> #include <time.h> #include <string.h>
@@ -849,7 +851,12 @@ void domapwrite(unsigned offset, unsigned size)gettimeofday (&t,NULL );prt (" %lu.%06lu memcpy done\n" , t.tv_sec, t.tv_usec); } -if (msync (p, map_size,0 ) !=0 ) { +#ifdef MS_SYNC +if (msync (p, map_size,MS_SYNC ) !=0 ) +#else + if (msync(p, map_size, 0) != 0) +#endif + {prterr ("domapwrite: msync" );report_failure (203 ); }
@@ -1115,11 +1122,16 @@ int main(int argc, char **argv)int i, style, ch;char *endp;int dirpath =0 ; - +struct timespec time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ; +#if defined(__VXWORKS__) + page_size = (int )sysconf (_SC_PAGESIZE); +#else page_size =getpagesize (); +#endif page_mask = page_size -1 ;setvbuf (stdout,NULL , _IOLBF,0 );/* line buffered stdout */
@@ -1267,9 +1279,12 @@ int main(int argc, char **argv)signal (SIGUSR1 , cleanup);signal (SIGUSR2 , cleanup); +#if defined(__VXWORKS__) +srand (seed); +#else initstate (seed, state,256 );setstate (state); - +#endif open_test_files (argv, argc);strncat (goodfile, dirpath ?basename (fname) : fname,256 );
@@ -1336,12 +1351,33 @@ int main(int argc, char **argv) }else check_trunc_hack (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_start); +#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_start); +#endif +while (numops ==-1 || numops--)test ();close_test_files (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_end); +#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_end); +#endif +prt ("All operations completed A-OK!\n" ); +if (time_end.tv_nsec < time_start.tv_nsec) { + time_end.tv_nsec +=1000000000 ; + time_end.tv_sec -=1 ; + } + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_nsec = time_end.tv_nsec - time_start.tv_nsec; +prt ("Elapsed Test Time %lu.%09lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_nsec); +if (tf_buf)free (tf_buf);
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 9 lines
I come from Wind River. We and our customers used fsx-linux for file system testing on VxWorks user space and total execution time also received more attention in the testing. So I upstream the change of VxWorks compatibility parts on this patch, wish to enlarge the test support of fsx-linux. There is a point need to explain, because current VxWorks doesn't support
CLOCK_MONOTONIC_RAW,CLOCK_MONOTONICis still used by VxWorks when callingclock_gettime. WhenCLOCK_MONOTONIC_RAWis support by VxWorks in the future, this part will be removed.
Actually Andrea started to clean up and rewrite the test so that it uses LTP API and he will send a patch soon, can you please send a new patch once that rewrite is finished?
A few comments below.
Quoted 22 lines
Signed-off-by [email protected]--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 44 ++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-)testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1@@ -39,8 +39,10 @@#include <sys/types.h> #include <sys/stat.h> -#if defined(_UWIN) || defined(__linux__) +#if defined(_UWIN) || defined(__linux__) || defined(__VXWORKS__) +#if !defined(__VXWORKS__)#include <sys/param.h> +#endif #include <limits.h> #include <time.h> #include <string.h>
testcases/kernel/fs/fsx-linux/fsx-linux.c void domapwrite(unsigned offset, unsigned size) · line 858
Quoted 9 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +5
-1@@ -849,7 +851,12 @@ void domapwrite(unsigned offset, unsigned size)gettimeofday (&t,NULL );prt (" %lu.%06lu memcpy done\n" , t.tv_sec, t.tv_usec); } -if (msync (p, map_size,0 ) !=0 ) { +#ifdef MS_SYNC +if (msync (p, map_size,MS_SYNC ) !=0 ) +#else + if (msync(p, map_size, 0) != 0) +#endif
It would be better to define MS_SYNC to 0 on VXWORKS instead.
Quoted 6 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +1
-0+ {prterr ("domapwrite: msync" );report_failure (203 ); }@@ -1115,11 +1122,16 @@ int main(int argc, char **argv)int i, style, ch;
testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1131
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1char *endp;int dirpath =0 ; - +struct timespec time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ; +#if defined(__VXWORKS__) + page_size = (int )sysconf (_SC_PAGESIZE);
We can just use sysconf() everywhere instead.
Quoted 21 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +6
-1+#else page_size =getpagesize (); +#endif page_mask = page_size -1 ;setvbuf (stdout,NULL , _IOLBF,0 );/* line buffered stdout */ @@ -1267,9 +1279,12 @@ int main(int argc, char **argv)signal (SIGUSR1 , cleanup);signal (SIGUSR2 , cleanup); +#if defined(__VXWORKS__) +srand (seed); +#else initstate (seed, state,256 );setstate (state); - +#endif open_test_files (argv, argc);strncat (goodfile, dirpath ?basename (fname) : fname,256 );
testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1358
Quoted 8 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +5
-0@@ -1336,12 +1351,33 @@ int main(int argc, char **argv) }else check_trunc_hack (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_start); +#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_start); +#endif
And here it would be cleaner to define the clock to use instead of ifdefing each clock_gettime call. I.e.:
#if defined(__VXWORKS__)
# define CLOCK_ID CLOCK_MONOTONIC #else # define CLOCK_ID CLOCK_MONOTONIC_RAW #endif
Quoted 8 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-0while (numops ==-1 || numops--)test ();close_test_files (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_end); +#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_end);
testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1377
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +8
-0+#endif +prt ("All operations completed A-OK!\n" ); +if (time_end.tv_nsec < time_start.tv_nsec) { + time_end.tv_nsec +=1000000000 ; + time_end.tv_sec -=1 ; + } + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_nsec = time_end.tv_nsec - time_start.tv_nsec;
LTP has functions for operations with timespec, here you should use tst_timespec_diff()
Quoted 12 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-0+prt ("Elapsed Test Time %lu.%09lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_nsec); +if (tf_buf)free (tf_buf);Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Quoted 10 lines · Cyril Hrubis
Hi!
Quoted 9 lines
I come from Wind River. We and our customers used fsx-linux for file system testing on VxWorks user space and total execution time also received more attention in the testing. So I upstream the change of VxWorks compatibility parts on this patch, wish to enlarge the test support of fsx-linux. There is a point need to explain, because current VxWorks doesn't support
CLOCK_MONOTONIC_RAW,CLOCK_MONOTONICis still used by VxWorks when callingclock_gettime. WhenCLOCK_MONOTONIC_RAWis support by VxWorks in the future, this part will be removed.
Quoted 3 lines
Actually Andrea started to clean up and rewrite the test so that it uses LTP API and he will send a patch soon, can you please send a new patch once that rewrite is finished?
My 2 cents: I would go the other way around, since I'm busy with different things and it won't be available that soon.
Quoted 118 lines
A few comments below.
Quoted 22 lines
Signed-off-by [email protected]--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 44 ++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-)testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1@@ -39,8 +39,10 @@#include <sys/types.h> #include <sys/stat.h> -#if defined(_UWIN) || defined(__linux__) +#if defined(_UWIN) || defined(__linux__) || defined(__VXWORKS__) +#if !defined(__VXWORKS__)#include <sys/param.h> +#endif #include <limits.h> #include <time.h> #include <string.h> testcases/kernel/fs/fsx-linux/fsx-linux.c void domapwrite(unsigned offset, unsigned size) · line 858
Quoted 9 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +5
-1@@ -849,7 +851,12 @@ void domapwrite(unsigned offset, unsigned size)gettimeofday (&t,NULL );prt (" %lu.%06lu memcpy done\n" , t.tv_sec, t.tv_usec); } -if (msync (p, map_size,0 ) !=0 ) { +#ifdef MS_SYNC +if (msync (p, map_size,MS_SYNC ) !=0 ) +#else + if (msync(p, map_size, 0) != 0) +#endif It would be better to define
MS_SYNCto 0 on VXWORKS instead.Quoted 6 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +1
-0+ {prterr ("domapwrite: msync" );report_failure (203 ); }@@ -1115,11 +1122,16 @@ int main(int argc, char **argv)int i, style, ch;testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1131
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1char *endp;int dirpath =0 ; - +struct timespec time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ; +#if defined(__VXWORKS__) + page_size = (int )sysconf (_SC_PAGESIZE);We can just use
sysconf()everywhere instead.Quoted 21 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +6
-1+#else page_size =getpagesize (); +#endif page_mask = page_size -1 ;setvbuf (stdout,NULL , _IOLBF,0 );/* line buffered stdout */ @@ -1267,9 +1279,12 @@ int main(int argc, char **argv)signal (SIGUSR1 , cleanup);signal (SIGUSR2 , cleanup); +#if defined(__VXWORKS__) +srand (seed); +#else initstate (seed, state,256 );setstate (state); - +#endif open_test_files (argv, argc);strncat (goodfile, dirpath ?basename (fname) : fname,256 );testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1358
Quoted 8 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +5
-0@@ -1336,12 +1351,33 @@ int main(int argc, char **argv) }else check_trunc_hack (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_start); +#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_start); +#endif And here it would be cleaner to define the clock to use instead of ifdefing each
clock_gettimecall. I.e.:#if
defined(__VXWORKS__)# define CLOCK_ID CLOCK_MONOTONIC #else # define CLOCK_ID CLOCK_MONOTONIC_RAW #endifQuoted 8 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-0while (numops ==-1 || numops--)test ();close_test_files (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_end); +#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_end);testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1377
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +8
-0+#endif +prt ("All operations completed A-OK!\n" ); +if (time_end.tv_nsec < time_start.tv_nsec) { + time_end.tv_nsec +=1000000000 ; + time_end.tv_sec -=1 ; + } + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_nsec = time_end.tv_nsec - time_start.tv_nsec;LTP has functions for operations with timespec, here you should use
tst_timespec_diff()Quoted 6 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-0+prt ("Elapsed Test Time %lu.%09lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_nsec); +if (tf_buf)free (tf_buf);
Quoted 6 lines
Quoted 6 lines
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
The whole CLOCK_MONOTONIC_RAW problem is mostly related with test logging messages, which is something we will get rid in the fsx-linux rewrite.
Regards,
Andrea Cervesato
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hello,
Quoted 14 lines
Hi,
Quoted 7 lines · Cyril Hrubis
Hi!
Quoted 6 lines
I come from Wind River. We and our customers used fsx-linux for file system testing on VxWorks user space and total execution time also received more attention in the testing. So I upstream the change of VxWorks compatibility parts on this patch, wish to enlarge the test support of fsx-linux. There is a point need to explain, because current VxWorks doesn't support
CLOCK_MONOTONIC_RAW,
CLOCK_MONOTONICQuoted 3 lines
Quoted 3 lines
is still used by VxWorks when calling
clock_gettime. WhenCLOCK_MONOTONIC_RAWis support by VxWorks in the future, this part will be removed.
Quoted 6 lines
Quoted 3 lines
Actually Andrea started to clean up and rewrite the test so that it uses LTP API and he will send a patch soon, can you please send a new patch once that rewrite is finished?
My 2 cents: I would go the other way around, since I'm busy with different things and it won't be available that soon.
Thank you, I could wait for fsx-linux rewrite then send a new patch. Do you have a schedule for fsx-linux rewrite?
Quoted 131 lines
Quoted 100 lines
A few comments below.
Quoted 23 lines
Signed-off-by [email protected]--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 44 ++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-)testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1@@ -39,8 +39,10 @@#include <sys/types.h> #include <sys/stat.h> -#if defined(_UWIN) || defined(__linux__) +#if defined(_UWIN) || defined(__linux__) || defined(__VXWORKS__) #if +!defined(__VXWORKS__)#include <sys/param.h> +#endif #include <limits.h> #include <time.h> #include <string.h> testcases/kernel/fs/fsx-linux/fsx-linux.c void domapwrite(unsigned offset, unsigned size) · line 857
Quoted 8 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1@@ -849,7 +851,12 @@ void domapwrite(unsigned offset, unsigned size)gettimeofday (&t,NULL );prt (" %lu.%06lu memcpy done\n" , t.tv_sec, t.tv_usec); } -if (msync (p, map_size,0 ) !=0 ) { +#ifdef MS_SYNC + if (msync(p, map_size, MS_SYNC) != 0) #else + if (msync(p, map_size, 0) != 0) +#endif It would be better to define
MS_SYNCto 0 on VXWORKS instead.Quoted 6 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +1
-0+ {prterr ("domapwrite: msync" );report_failure (203 ); }@@ -1115,11 +1122,16 @@ int main(int argc, char **argv)int i, style, ch;testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1131
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1char *endp;int dirpath =0 ; - +struct timespec time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ; +#if defined(__VXWORKS__) + page_size = (int )sysconf (_SC_PAGESIZE);We can just use
sysconf()everywhere instead.Quoted 17 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +6
-1+#else page_size =getpagesize (); +#endif page_mask = page_size -1 ;setvbuf (stdout,NULL , _IOLBF,0 );/* line buffered stdout */ @@ -1267,9 +1279,12 @@ int main(int argc, char **argv)signal (SIGUSR1 , cleanup);signal (SIGUSR2 , cleanup); +#if defined(__VXWORKS__) +srand (seed); +#else initstate (seed, state,256 );setstate (state); - +#endif testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv)
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1open_test_files (argv, argc); strncat(goodfile, dirpath ? basename(fname) : fname, 256); @@ -1336,12 +1351,33 @@ int main(int argc, char **argv) }else check_trunc_hack (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_start);#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_start);#endif And here it would be cleaner to define the clock to use instead of ifdefing each
clock_gettimecall. I.e.:#if
defined(__VXWORKS__)# define CLOCK_ID CLOCK_MONOTONIC #else # define CLOCK_ID CLOCK_MONOTONIC_RAW #endifQuoted 10 lines
while (numops == -1 || numops--) test(); close_test_files();testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-0+#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_end);#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_end);#endif +prt ("All operations completed A-OK!\n" );Quoted 21 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1377
Quoted 6 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +6
-0+if (time_end.tv_nsec < time_start.tv_nsec) { + time_end.tv_nsec +=1000000000 ; + time_end.tv_sec -=1 ; + } + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_nsec = time_end.tv_nsec - time_start.tv_nsec;LTP has functions for operations with timespec, here you should use
tst_timespec_diff()Quoted 12 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1+prt ("Elapsed Test Time %lu.%09lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_nsec); +if (tf_buf)free (tf_buf); --2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltpThe whole
CLOCK_MONOTONIC_RAWproblem is mostly related with test logging messages, which is something we will get rid in the fsx-linux rewrite.Regards,
Andrea Cervesato--
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Quoted 15 lines · Xin
Hello,
Quoted 14 lines
Hi,
Quoted 7 lines · Cyril Hrubis
Hi!
Quoted 6 lines
I come from Wind River. We and our customers used fsx-linux for file system testing on VxWorks user space and total execution time also received more attention in the testing. So I upstream the change of VxWorks compatibility parts on this patch, wish to enlarge the test support of fsx-linux. There is a point need to explain, because current VxWorks doesn't support
CLOCK_MONOTONIC_RAW,
CLOCK_MONOTONICQuoted 3 lines
Quoted 3 lines
is still used by VxWorks when calling
clock_gettime. WhenCLOCK_MONOTONIC_RAWis support by VxWorks in the future, this part will be removed.
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Actually Andrea started to clean up and rewrite the test so that it uses LTP API and he will send a patch soon, can you please send a new patch once that rewrite is finished?
My 2 cents: I would go the other way around, since I'm busy with different things and it won't be available that soon.
Thank you, I could wait for fsx-linux rewrite then send a new patch. Do you have a schedule for fsx-linux rewrite?
I can't give a schedule at the moment, because I'm busy with other things. It might take a few months, considering review process as well.
Quoted 123 lines
Quoted 123 lines
Quoted 99 lines
A few comments below.
Quoted 23 lines
Signed-off-by [email protected]--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 44 ++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-)testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1@@ -39,8 +39,10 @@#include <sys/types.h> #include <sys/stat.h> -#if defined(_UWIN) || defined(__linux__) +#if defined(_UWIN) || defined(__linux__) || defined(__VXWORKS__) #if +!defined(__VXWORKS__)#include <sys/param.h> +#endif #include <limits.h> #include <time.h> #include <string.h> testcases/kernel/fs/fsx-linux/fsx-linux.c void domapwrite(unsigned offset, unsigned size) · line 857
Quoted 8 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1@@ -849,7 +851,12 @@ void domapwrite(unsigned offset, unsigned size)gettimeofday (&t,NULL );prt (" %lu.%06lu memcpy done\n" , t.tv_sec, t.tv_usec); } -if (msync (p, map_size,0 ) !=0 ) { +#ifdef MS_SYNC + if (msync(p, map_size, MS_SYNC) != 0) #else + if (msync(p, map_size, 0) != 0) +#endif It would be better to define
MS_SYNCto 0 on VXWORKS instead.Quoted 6 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +1
-0+ {prterr ("domapwrite: msync" );report_failure (203 ); }@@ -1115,11 +1122,16 @@ int main(int argc, char **argv)int i, style, ch;testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1131
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1char *endp;int dirpath =0 ; - +struct timespec time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ; +#if defined(__VXWORKS__) + page_size = (int )sysconf (_SC_PAGESIZE);We can just use
sysconf()everywhere instead.Quoted 17 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +6
-1+#else page_size =getpagesize (); +#endif page_mask = page_size -1 ;setvbuf (stdout,NULL , _IOLBF,0 );/* line buffered stdout */ @@ -1267,9 +1279,12 @@ int main(int argc, char **argv)signal (SIGUSR1 , cleanup);signal (SIGUSR2 , cleanup); +#if defined(__VXWORKS__) +srand (seed); +#else initstate (seed, state,256 );setstate (state); - +#endif testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv)
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1open_test_files (argv, argc); strncat(goodfile, dirpath ? basename(fname) : fname, 256); @@ -1336,12 +1351,33 @@ int main(int argc, char **argv) }else check_trunc_hack (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_start);#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_start);#endif And here it would be cleaner to define the clock to use instead of ifdefing each
clock_gettimecall. I.e.:#if
defined(__VXWORKS__)# define CLOCK_ID CLOCK_MONOTONIC #else # define CLOCK_ID CLOCK_MONOTONIC_RAW #endifQuoted 10 lines
while (numops == -1 || numops--) test(); close_test_files();testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-0+#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_end);#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_end);#endif +prt ("All operations completed A-OK!\n" );Quoted 21 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1377
Quoted 6 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +6
-0+if (time_end.tv_nsec < time_start.tv_nsec) { + time_end.tv_nsec +=1000000000 ; + time_end.tv_sec -=1 ; + } + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_nsec = time_end.tv_nsec - time_start.tv_nsec;LTP has functions for operations with timespec, here you should use
tst_timespec_diff()Quoted 12 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1+prt ("Elapsed Test Time %lu.%09lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_nsec); +if (tf_buf)free (tf_buf); --2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltpThe whole
CLOCK_MONOTONIC_RAWproblem is mostly related with test logging messages, which is something we will get rid in the fsx-linux rewrite.
Quoted 6 lines
Quoted 6 lines
Regards,
Andrea Cervesato--
Mailing list info: https://lists.linux.it/listinfo/ltp
Regards,
Andrea Cervesato
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 12 lines
Hi!
Quoted 6 lines
I come from Wind River. We and our customers used fsx-linux for file system testing on VxWorks user space and total execution time also received more attention in the testing. So I upstream the change of VxWorks compatibility parts on this patch, wish to enlarge the test support of fsx-linux. There is a point need to explain, because current VxWorks doesn't support
CLOCK_MONOTONIC_RAW,
CLOCK_MONOTONICQuoted 3 lines
is still used by VxWorks when calling
clock_gettime. WhenCLOCK_MONOTONIC_RAWis support by VxWorks in the future, this part will be removed.
Quoted 5 lines
Actually Andrea started to clean up and rewrite the test so that it uses LTP API and he will send a patch soon, can you please send a new patch once that rewrite is finished?
A few comments below.
Thanks for your review. One question abort msync part in below.
Quoted 27 lines
Quoted 27 lines
Signed-off-by [email protected]--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 44 ++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-)testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1@@ -39,8 +39,10 @@#include <sys/types.h> #include <sys/stat.h> -#if defined(_UWIN) || defined(__linux__) +#if defined(_UWIN) || defined(__linux__) || defined(__VXWORKS__) #if +!defined(__VXWORKS__)#include <sys/param.h> +#endif #include <limits.h> #include <time.h> #include <string.h> @@ -849,7 +851,12 @@ void domapwrite(unsigned offset, unsigned size)gettimeofday (&t,NULL );prt (" %lu.%06lu memcpy done\n" , t.tv_sec, t.tv_usec);
Quoted 8 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c void domapwrite(unsigned offset, unsigned size) · line 858
Quoted 6 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1} -if (msync (p, map_size,0 ) !=0 ) { +#ifdef MS_SYNC + if (msync(p, map_size, MS_SYNC) != 0) #else + if (msync(p, map_size, 0) != 0) +#endif It would be better to define
MS_SYNCto 0 on VXWORKS instead.
Because only MS_ASYNC, MS_SYNC and MS_INVALIDATE are defined for flag argument of msync in POSIX. Is it right to set 0 directly in the case? Flag set 0 will be identified EINVAL in VxWorks.
Quoted 93 lines
Quoted 7 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +1
-0+ {prterr ("domapwrite: msync" );report_failure (203 ); }@@ -1115,11 +1122,16 @@ int main(int argc, char **argv)int i, style, ch;testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1131
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1char *endp;int dirpath =0 ; - +struct timespec time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ; +#if defined(__VXWORKS__) + page_size = (int )sysconf (_SC_PAGESIZE);We can just use
sysconf()everywhere instead.Quoted 17 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +6
-1+#else page_size =getpagesize (); +#endif page_mask = page_size -1 ;setvbuf (stdout,NULL , _IOLBF,0 );/* line buffered stdout */ @@ -1267,9 +1279,12 @@ int main(int argc, char **argv)signal (SIGUSR1 , cleanup);signal (SIGUSR2 , cleanup); +#if defined(__VXWORKS__) +srand (seed); +#else initstate (seed, state,256 );setstate (state); - +#endif testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv)
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1open_test_files (argv, argc); strncat(goodfile, dirpath ? basename(fname) : fname, 256); @@ -1336,12 +1351,33 @@ int main(int argc, char **argv) }else check_trunc_hack (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_start);#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_start);#endif And here it would be cleaner to define the clock to use instead of ifdefing each
clock_gettimecall. I.e.:#if
defined(__VXWORKS__)# define CLOCK_ID CLOCK_MONOTONIC #else # define CLOCK_ID CLOCK_MONOTONIC_RAW #endifQuoted 6 lines
while (numops == -1 || numops--) test(); close_test_files();testcases/kernel/fs/fsx-linux/fsx-linux.c +2
-0+#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_end);#else testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1377
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +8
-0+clock_gettime (CLOCK_MONOTONIC_RAW , &time_end);#endif +prt ("All operations completed A-OK!\n" ); +if (time_end.tv_nsec < time_start.tv_nsec) { + time_end.tv_nsec +=1000000000 ; + time_end.tv_sec -=1 ; + } + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_nsec = time_end.tv_nsec - time_start.tv_nsec;LTP has functions for operations with timespec, here you should use
tst_timespec_diff()Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +3
-1+prt ("Elapsed Test Time %lu.%09lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_nsec); +if (tf_buf)free (tf_buf); --2.34.1
Quoted 2 lines
--
Mailing list info: https://lists.linux.it/listinfo/ltp--
Cyril Hrubis
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp