fio: fix s390 timing for older machines/binutils
Older gcc/binutils or one with very low default march will refuse to use stckf.
On top of that machines older than a z196 don not even have the store clock
fast facility.
To fix all of those issues, check for the facilities in configure step and make
the usage of stckf and a matching march dependent to it.
Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/arch/arch-s390.h b/arch/arch-s390.h
index 56cb230..169282b 100644
--- a/arch/arch-s390.h
+++ b/arch/arch-s390.h
@@ -22,15 +22,19 @@
#define read_barrier() asm volatile("bcr 15,0" : : : "memory")
#define write_barrier() asm volatile("bcr 15,0" : : : "memory")
-/*
- * Fio needs monotonic (never lower), but not strict monotonic (never the same)
- * so store clock fast is enough
- */
static inline unsigned long long get_cpu_clock(void)
{
unsigned long long clk;
+#ifdef CONFIG_S390_Z196_FACILITIES
+ /*
+ * Fio needs monotonic (never lower), but not strict monotonic (never
+ * the same) so store clock fast is enough.
+ */
__asm__ __volatile__("stckf %0" : "=Q" (clk) : : "cc");
+#else
+ __asm__ __volatile__("stck %0" : "=Q" (clk) : : "cc");
+#endif
return clk>>12;
}