The following changes since commit ab9461eaea21e861cc777aae2420db8f486ed1e2: values.h is obsolete: use float.h and DBL_MIN/MAX instead. (2013-02-02 15:45:23 +0100) are available in the git repository at: git://git.kernel.dk/fio.git master Bruce Cran (3): Default to CS_GTOD if CONFIG_CLOCK_GETTIME isn't defined. Remove duplicated Windows configure options. Update the Windows section of the README file. Jens Axboe (2): Fix failure to exit IO loop on some IO sizes gettime: fixup AMD constant TSC detection README | 34 +++++++++++++--------------------- arch/arch-x86-common.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- backend.c | 15 +++++++++++++-- configure | 4 +--- gettime.c | 8 -------- os/os.h | 4 ++++ 6 files changed, 77 insertions(+), 36 deletions(-) --- Diff of recent changes: diff --git a/README b/README index 97f1a28..4c7b542 100644 --- a/README +++ b/README @@ -109,29 +109,21 @@ based distros, it's typically called libaio-devel. Windows ------- -On Windows MinGW (http://www.mingw.org/) is required in order to -build fio. To create an MSI installer package install WiX 3.6 from -http://wix.sourceforge.net/releases/ and run dobuild.cmd from the +On Windows Cygwin (http://www.cygwin.com/) is required in order to +build fio. To create an MSI installer package install WiX 3.7 from +http://wixtoolset.org and run dobuild.cmd from the os/windows directory. -How to compile FIO on Windows 64 bits - - 1. Install Cygwin - search for MinGW and install all MinGW packages. - 2. Download x86_64-w64-mingw32-gcc-4.7.2-release-win64_rubenvb.7z (http://sourceforge.net/projects/mingw-w64/files) - Select Toolchains targeting Win64 -> - Personal Builds -> rubenv -> gcc-4.7-release - 3. Unzip the directory mingw64 to c:\ (c:\mingw64) - 4. Add to PATH - c:\mingw64\bin - 5. Copy c:\mingw64\bin\mingw32-make to c:\mingw64\bin\make.exe - 6. Download pthreads-20100604.zip (http://sourceforge.net/projects/mingw-w64/files) - Select External binary packages (Win64 hosted) -> pthreads - 7. Unzip pthreads-20100604.zip - 8. Unzip pthreads-w64.zip - 9. Copy pthreadGC2-w64.dll to c:\mingw64\bin -10. Copy c:\mingw64\bin\pthreadGC2-w64.dll to c:\mingw64\bin\pthreadGC2.dll -11. Open Cygwin Terminal -12. Go to fio directory (source files) -13. make clean -14. ./configure -15. make +How to compile FIO on 64-bit Windows: + + 1. Install Cygwin (http://www.cygwin.com/setup.exe). Install 'make' and all + packages starting with 'mingw64-i686' and 'mingw64-x86_64'. + 2. Download ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release/dll/x64/pthreadGC2.dll + and copy to the fio source directory. + 3. Open the Cygwin Terminal. + 4. Go to the fio directory (source files). + 5. Run 'make clean'. + 6. Run 'make'. Command line diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h index d533d22..78fd40c 100644 --- a/arch/arch-x86-common.h +++ b/arch/arch-x86-common.h @@ -1,6 +1,8 @@ #ifndef FIO_ARCH_X86_COMMON #define FIO_ARCH_X86_COMMON +#include <string.h> + static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { @@ -10,9 +12,20 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, : "memory"); } +static inline void cpuid(unsigned int op, + unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) +{ + *eax = op; + *ecx = 0; + do_cpuid(eax, ebx, ecx, edx); +} + #define ARCH_HAVE_INIT + extern int tsc_reliable; -static inline int arch_init(char *envp[]) + +static inline int arch_init_intel(unsigned int level) { unsigned int eax, ebx, ecx = 0, edx; @@ -29,7 +42,38 @@ static inline int arch_init(char *envp[]) */ eax = 0x80000007; do_cpuid(&eax, &ebx, &ecx, &edx); - tsc_reliable = edx & (1U << 8); + return edx & (1U << 8); +} + +static inline int arch_init_amd(unsigned int level) +{ + unsigned int eax, ebx, ecx, edx; + + cpuid(0x80000000, &eax, &ebx, &ecx, &edx); + if (eax < 0x80000007) + return 0; + + cpuid(0x80000007, &eax, &ebx, &ecx, &edx); + if (edx & (1 << 8)) + return 1; + + return 0; +} + +static inline int arch_init(char *envp[]) +{ + unsigned int level; + char str[12]; + + cpuid(0, &level, (unsigned int *) &str[0], + (unsigned int *) &str[8], + (unsigned int *) &str[4]); + + if (!strcmp(str, "GenuineIntel")) + tsc_reliable = arch_init_intel(level); + else if (!strcmp(str, "AuthenticAMD")) + tsc_reliable = arch_init_amd(level); + return 0; } diff --git a/backend.c b/backend.c index 218ae25..6461fff 100644 --- a/backend.c +++ b/backend.c @@ -813,7 +813,7 @@ sync_done: i = td->cur_depth; if (i) { - ret = io_u_queued_complete(td, i, NULL); + ret = io_u_queued_complete(td, i, bytes_done); if (td->o.fill_device && td->error == ENOSPC) td->error = 0; } @@ -1017,8 +1017,19 @@ static int keep_running(struct thread_data *td) return 1; } - if (ddir_rw_sum(td->io_bytes) < td->o.size) + if (ddir_rw_sum(td->io_bytes) < td->o.size) { + uint64_t diff; + + /* + * If the difference is less than the minimum IO size, we + * are done. + */ + diff = td->o.size - ddir_rw_sum(td->io_bytes); + if (diff < td->o.rw_min_bs) + return 0; + return 1; + } return 0; } diff --git a/configure b/configure index d332c5e..078dab8 100755 --- a/configure +++ b/configure @@ -187,9 +187,6 @@ CYGWIN*) fi output_sym "CONFIG_LITTLE_ENDIAN" output_sym "CONFIG_64BIT_LLP64" - output_sym "CONFIG_CLOCK_GETTIME" - output_sym "CONFIG_CLOCK_MONOTONIC" - output_sym "CONFIG_GETTIMEOFDAY" output_sym "CONFIG_FADVISE" output_sym "CONFIG_SOCKLEN_T" output_sym "CONFIG_POSIX_FALLOCATE" @@ -198,6 +195,7 @@ CYGWIN*) output_sym "CONFIG_RUSAGE_THREAD" output_sym "CONFIG_WINDOWSAIO" output_sym "CONFIG_FDATASYNC" + output_sym "CONFIG_CLOCK_MONOTONIC" output_sym "CONFIG_GETTIMEOFDAY" output_sym "CONFIG_CLOCK_GETTIME" output_sym "CONFIG_SCHED_IDLE" diff --git a/gettime.c b/gettime.c index 5c0e445..cc9dcb7 100644 --- a/gettime.c +++ b/gettime.c @@ -342,14 +342,6 @@ void fio_clock_init(void) log_err("fio: can't create TLS key\n"); #endif - /* - * Probably an AMD issue, will need to investigate. Until that - * is done, disable the CPU clock. - */ -#if FIO_OS == os_solaris - tsc_reliable = 0; -#endif - fio_clock_source_inited = fio_clock_source; calibrate_cpu_clock(); diff --git a/os/os.h b/os/os.h index ef9f91f..ce33160 100644 --- a/os/os.h +++ b/os/os.h @@ -125,7 +125,11 @@ typedef unsigned long os_cpu_mask_t; #endif #ifndef FIO_PREFERRED_CLOCK_SOURCE +#ifdef CONFIG_CLOCK_GETTIME #define FIO_PREFERRED_CLOCK_SOURCE CS_CGETTIME +#else +#define FIO_PREFERRED_CLOCK_SOURCE CS_GTOD +#endif #endif #ifndef FIO_MAX_JOBS -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html