* [Qemu-devel] [PATCH 0/5] trace-mem fixes
@ 2018-05-22 22:26 Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 1/5] trace: fix misreporting of TCG access sizes for user-space Emilio G. Cota
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Emilio G. Cota @ 2018-05-22 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Stefan Hajnoczi, Paolo Bonzini
This series fixes a few issues that I found while testing
the tracing of guest memory accesses in TCG. Please review!
You can fetch these patches from:
https://github.com/cota/qemu/commits/trace-mem
Thanks,
Emilio
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 1/5] trace: fix misreporting of TCG access sizes for user-space
2018-05-22 22:26 [Qemu-devel] [PATCH 0/5] trace-mem fixes Emilio G. Cota
@ 2018-05-22 22:26 ` Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 2/5] trace: simplify trace_mem functions Emilio G. Cota
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Emilio G. Cota @ 2018-05-22 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Stefan Hajnoczi, Paolo Bonzini
trace_mem_build_info expects a size_shift for its first argument. Fix it.
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
include/exec/cpu_ldst_useronly_template.h | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/exec/cpu_ldst_useronly_template.h b/include/exec/cpu_ldst_useronly_template.h
index c168f31..e30e58e 100644
--- a/include/exec/cpu_ldst_useronly_template.h
+++ b/include/exec/cpu_ldst_useronly_template.h
@@ -33,20 +33,24 @@
#define SUFFIX q
#define USUFFIX q
#define DATA_TYPE uint64_t
+#define SHIFT 3
#elif DATA_SIZE == 4
#define SUFFIX l
#define USUFFIX l
#define DATA_TYPE uint32_t
+#define SHIFT 2
#elif DATA_SIZE == 2
#define SUFFIX w
#define USUFFIX uw
#define DATA_TYPE uint16_t
#define DATA_STYPE int16_t
+#define SHIFT 1
#elif DATA_SIZE == 1
#define SUFFIX b
#define USUFFIX ub
#define DATA_TYPE uint8_t
#define DATA_STYPE int8_t
+#define SHIFT 0
#else
#error unsupported data size
#endif
@@ -63,7 +67,7 @@ glue(glue(cpu_ld, USUFFIX), MEMSUFFIX)(CPUArchState *env, target_ulong ptr)
#if !defined(CODE_ACCESS)
trace_guest_mem_before_exec(
ENV_GET_CPU(env), ptr,
- trace_mem_build_info(DATA_SIZE, false, MO_TE, false));
+ trace_mem_build_info(SHIFT, false, MO_TE, false));
#endif
return glue(glue(ld, USUFFIX), _p)(g2h(ptr));
}
@@ -87,7 +91,7 @@ glue(glue(cpu_lds, SUFFIX), MEMSUFFIX)(CPUArchState *env, target_ulong ptr)
#if !defined(CODE_ACCESS)
trace_guest_mem_before_exec(
ENV_GET_CPU(env), ptr,
- trace_mem_build_info(DATA_SIZE, true, MO_TE, false));
+ trace_mem_build_info(SHIFT, true, MO_TE, false));
#endif
return glue(glue(lds, SUFFIX), _p)(g2h(ptr));
}
@@ -113,7 +117,7 @@ glue(glue(cpu_st, SUFFIX), MEMSUFFIX)(CPUArchState *env, target_ulong ptr,
#if !defined(CODE_ACCESS)
trace_guest_mem_before_exec(
ENV_GET_CPU(env), ptr,
- trace_mem_build_info(DATA_SIZE, false, MO_TE, true));
+ trace_mem_build_info(SHIFT, false, MO_TE, true));
#endif
glue(glue(st, SUFFIX), _p)(g2h(ptr), v);
}
@@ -136,3 +140,4 @@ glue(glue(glue(cpu_st, SUFFIX), MEMSUFFIX), _ra)(CPUArchState *env,
#undef SUFFIX
#undef USUFFIX
#undef DATA_SIZE
+#undef SHIFT
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 2/5] trace: simplify trace_mem functions
2018-05-22 22:26 [Qemu-devel] [PATCH 0/5] trace-mem fixes Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 1/5] trace: fix misreporting of TCG access sizes for user-space Emilio G. Cota
@ 2018-05-22 22:26 ` Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 3/5] trace: expand mem_info:size_shift to 3 bits Emilio G. Cota
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Emilio G. Cota @ 2018-05-22 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Stefan Hajnoczi, Paolo Bonzini
Add some defines for the mem_info bits, simplify
trace_mem_build_info, and also simplify trace_mem_get_info
by making it a wrapper around trace_mem_build_info.
This paves the way for increasing size_shift by one bit.
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
trace/mem-internal.h | 40 ++++++++++++++++++----------------------
trace/mem.h | 2 +-
2 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/trace/mem-internal.h b/trace/mem-internal.h
index ddda934..b684e27 100644
--- a/trace/mem-internal.h
+++ b/trace/mem-internal.h
@@ -10,37 +10,33 @@
#ifndef TRACE__MEM_INTERNAL_H
#define TRACE__MEM_INTERNAL_H
-static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store)
+#define TRACE_MEM_SZ_SHIFT_MASK 0x3 /* size shift mask */
+#define TRACE_MEM_SE (1ULL << 2) /* sign extended (y/n) */
+#define TRACE_MEM_BE (1ULL << 3) /* big endian (y/n) */
+#define TRACE_MEM_ST (1ULL << 4) /* store (y/n) */
+
+static inline uint8_t trace_mem_build_info(
+ int size_shift, bool sign_extend, TCGMemOp endianness, bool store)
{
- uint8_t res = op;
- bool be = (op & MO_BSWAP) == MO_BE;
+ uint8_t res;
- /* remove untraced fields */
- res &= (1ULL << 4) - 1;
- /* make endianness absolute */
- res &= ~MO_BSWAP;
- if (be) {
- res |= 1ULL << 3;
+ res = size_shift & TRACE_MEM_SZ_SHIFT_MASK;
+ if (sign_extend) {
+ res |= TRACE_MEM_SE;
+ }
+ if (endianness == MO_BE) {
+ res |= TRACE_MEM_BE;
}
- /* add fields */
if (store) {
- res |= 1ULL << 4;
+ res |= TRACE_MEM_ST;
}
-
return res;
}
-static inline uint8_t trace_mem_build_info(
- TCGMemOp size, bool sign_extend, TCGMemOp endianness, bool store)
+static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store)
{
- uint8_t res = 0;
- res |= size;
- res |= (sign_extend << 2);
- if (endianness == MO_BE) {
- res |= (1ULL << 3);
- }
- res |= (store << 4);
- return res;
+ return trace_mem_build_info(op & MO_SIZE, !!(op & MO_SIGN),
+ op & MO_BSWAP, store);
}
#endif /* TRACE__MEM_INTERNAL_H */
diff --git a/trace/mem.h b/trace/mem.h
index 9c88bcb..2b58196 100644
--- a/trace/mem.h
+++ b/trace/mem.h
@@ -25,7 +25,7 @@ static uint8_t trace_mem_get_info(TCGMemOp op, bool store);
*
* Return a value for the 'info' argument in guest memory access traces.
*/
-static uint8_t trace_mem_build_info(TCGMemOp size, bool sign_extend,
+static uint8_t trace_mem_build_info(int size_shift, bool sign_extend,
TCGMemOp endianness, bool store);
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 3/5] trace: expand mem_info:size_shift to 3 bits
2018-05-22 22:26 [Qemu-devel] [PATCH 0/5] trace-mem fixes Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 1/5] trace: fix misreporting of TCG access sizes for user-space Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 2/5] trace: simplify trace_mem functions Emilio G. Cota
@ 2018-05-22 22:26 ` Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 4/5] trace: add trace_mem_build_info_no_se_be/le Emilio G. Cota
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Emilio G. Cota @ 2018-05-22 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Stefan Hajnoczi, Paolo Bonzini
This will allow us to trace 16B-long memory accesses.
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
trace/mem-internal.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/trace/mem-internal.h b/trace/mem-internal.h
index b684e27..a9e408e 100644
--- a/trace/mem-internal.h
+++ b/trace/mem-internal.h
@@ -10,10 +10,10 @@
#ifndef TRACE__MEM_INTERNAL_H
#define TRACE__MEM_INTERNAL_H
-#define TRACE_MEM_SZ_SHIFT_MASK 0x3 /* size shift mask */
-#define TRACE_MEM_SE (1ULL << 2) /* sign extended (y/n) */
-#define TRACE_MEM_BE (1ULL << 3) /* big endian (y/n) */
-#define TRACE_MEM_ST (1ULL << 4) /* store (y/n) */
+#define TRACE_MEM_SZ_SHIFT_MASK 0x7 /* size shift mask */
+#define TRACE_MEM_SE (1ULL << 3) /* sign extended (y/n) */
+#define TRACE_MEM_BE (1ULL << 4) /* big endian (y/n) */
+#define TRACE_MEM_ST (1ULL << 5) /* store (y/n) */
static inline uint8_t trace_mem_build_info(
int size_shift, bool sign_extend, TCGMemOp endianness, bool store)
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 4/5] trace: add trace_mem_build_info_no_se_be/le
2018-05-22 22:26 [Qemu-devel] [PATCH 0/5] trace-mem fixes Emilio G. Cota
` (2 preceding siblings ...)
2018-05-22 22:26 ` [Qemu-devel] [PATCH 3/5] trace: expand mem_info:size_shift to 3 bits Emilio G. Cota
@ 2018-05-22 22:26 ` Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 5/5] trace: enable tracing of TCG atomics Emilio G. Cota
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Emilio G. Cota @ 2018-05-22 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Stefan Hajnoczi, Paolo Bonzini
These will be used by the following commit.
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
trace/mem-internal.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/trace/mem-internal.h b/trace/mem-internal.h
index a9e408e..f6efaf6 100644
--- a/trace/mem-internal.h
+++ b/trace/mem-internal.h
@@ -39,4 +39,16 @@ static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store)
op & MO_BSWAP, store);
}
+static inline
+uint8_t trace_mem_build_info_no_se_be(int size_shift, bool store)
+{
+ return trace_mem_build_info(size_shift, false, MO_BE, store);
+}
+
+static inline
+uint8_t trace_mem_build_info_no_se_le(int size_shift, bool store)
+{
+ return trace_mem_build_info(size_shift, false, MO_LE, store);
+}
+
#endif /* TRACE__MEM_INTERNAL_H */
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 5/5] trace: enable tracing of TCG atomics
2018-05-22 22:26 [Qemu-devel] [PATCH 0/5] trace-mem fixes Emilio G. Cota
` (3 preceding siblings ...)
2018-05-22 22:26 ` [Qemu-devel] [PATCH 4/5] trace: add trace_mem_build_info_no_se_be/le Emilio G. Cota
@ 2018-05-22 22:26 ` Emilio G. Cota
2018-05-25 15:20 ` [Qemu-devel] [PATCH 0/5] trace-mem fixes Stefan Hajnoczi
2018-06-07 8:44 ` Stefan Hajnoczi
6 siblings, 0 replies; 8+ messages in thread
From: Emilio G. Cota @ 2018-05-22 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Stefan Hajnoczi, Paolo Bonzini
We do not trace guest atomic accesses. Fix it.
Tested with a modified atomic_add-bench so that it executes
a deterministic number of instructions, i.e. fixed seeding,
no threading and fixed number of loop iterations instead
of running for a certain time.
Before:
- With parallel_cpus = false (no clone syscall so it is never set to true):
220070 memory accesses
- With parallel_cpus = true (hard-coded):
212105 memory accesses <-- we're not tracing the atomics!
After:
220070 memory accesses regardless of parallel_cpus.
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
accel/tcg/atomic_template.h | 87 +++++++++++++++++++++++++++++++++++++++++----
1 file changed, 81 insertions(+), 6 deletions(-)
diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h
index 3f41ef2..d751bcb 100644
--- a/accel/tcg/atomic_template.h
+++ b/accel/tcg/atomic_template.h
@@ -18,30 +18,37 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+#include "trace/mem.h"
+
#if DATA_SIZE == 16
# define SUFFIX o
# define DATA_TYPE Int128
# define BSWAP bswap128
+# define SHIFT 4
#elif DATA_SIZE == 8
# define SUFFIX q
# define DATA_TYPE uint64_t
# define SDATA_TYPE int64_t
# define BSWAP bswap64
+# define SHIFT 3
#elif DATA_SIZE == 4
# define SUFFIX l
# define DATA_TYPE uint32_t
# define SDATA_TYPE int32_t
# define BSWAP bswap32
+# define SHIFT 2
#elif DATA_SIZE == 2
# define SUFFIX w
# define DATA_TYPE uint16_t
# define SDATA_TYPE int16_t
# define BSWAP bswap16
+# define SHIFT 1
#elif DATA_SIZE == 1
# define SUFFIX b
# define DATA_TYPE uint8_t
# define SDATA_TYPE int8_t
# define BSWAP
+# define SHIFT 0
#else
# error unsupported data size
#endif
@@ -52,14 +59,37 @@
# define ABI_TYPE uint32_t
#endif
+#define ATOMIC_TRACE_RMW do { \
+ uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, false); \
+ \
+ trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info); \
+ trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, \
+ info | TRACE_MEM_ST); \
+ } while (0)
+
+#define ATOMIC_TRACE_LD do { \
+ uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, false); \
+ \
+ trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info); \
+ } while (0)
+
+# define ATOMIC_TRACE_ST do { \
+ uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, true); \
+ \
+ trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info); \
+ } while (0)
+
/* Define host-endian atomic operations. Note that END is used within
the ATOMIC_NAME macro, and redefined below. */
#if DATA_SIZE == 1
# define END
+# define MEND _be /* either le or be would be fine */
#elif defined(HOST_WORDS_BIGENDIAN)
# define END _be
+# define MEND _be
#else
# define END _le
+# define MEND _le
#endif
ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
@@ -67,7 +97,10 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
{
ATOMIC_MMU_DECLS;
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
- DATA_TYPE ret = atomic_cmpxchg__nocheck(haddr, cmpv, newv);
+ DATA_TYPE ret;
+
+ ATOMIC_TRACE_RMW;
+ ret = atomic_cmpxchg__nocheck(haddr, cmpv, newv);
ATOMIC_MMU_CLEANUP;
return ret;
}
@@ -77,6 +110,8 @@ ABI_TYPE ATOMIC_NAME(ld)(CPUArchState *env, target_ulong addr EXTRA_ARGS)
{
ATOMIC_MMU_DECLS;
DATA_TYPE val, *haddr = ATOMIC_MMU_LOOKUP;
+
+ ATOMIC_TRACE_LD;
__atomic_load(haddr, &val, __ATOMIC_RELAXED);
ATOMIC_MMU_CLEANUP;
return val;
@@ -87,6 +122,8 @@ void ATOMIC_NAME(st)(CPUArchState *env, target_ulong addr,
{
ATOMIC_MMU_DECLS;
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
+
+ ATOMIC_TRACE_ST;
__atomic_store(haddr, &val, __ATOMIC_RELAXED);
ATOMIC_MMU_CLEANUP;
}
@@ -96,7 +133,10 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr,
{
ATOMIC_MMU_DECLS;
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
- DATA_TYPE ret = atomic_xchg__nocheck(haddr, val);
+ DATA_TYPE ret;
+
+ ATOMIC_TRACE_RMW;
+ ret = atomic_xchg__nocheck(haddr, val);
ATOMIC_MMU_CLEANUP;
return ret;
}
@@ -107,7 +147,10 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
{ \
ATOMIC_MMU_DECLS; \
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \
- DATA_TYPE ret = atomic_##X(haddr, val); \
+ DATA_TYPE ret; \
+ \
+ ATOMIC_TRACE_RMW; \
+ ret = atomic_##X(haddr, val); \
ATOMIC_MMU_CLEANUP; \
return ret; \
}
@@ -126,6 +169,9 @@ GEN_ATOMIC_HELPER(xor_fetch)
/* These helpers are, as a whole, full barriers. Within the helper,
* the leading barrier is explicit and the trailing barrier is within
* cmpxchg primitive.
+ *
+ * Trace this load + RMW loop as a single RMW op. This way, regardless
+ * of CF_PARALLEL's value, we'll trace just a read and a write.
*/
#define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \
ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
@@ -134,6 +180,8 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
ATOMIC_MMU_DECLS; \
XDATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \
XDATA_TYPE cmp, old, new, val = xval; \
+ \
+ ATOMIC_TRACE_RMW; \
smp_mb(); \
cmp = atomic_read__nocheck(haddr); \
do { \
@@ -158,6 +206,7 @@ GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new)
#endif /* DATA SIZE >= 16 */
#undef END
+#undef MEND
#if DATA_SIZE > 1
@@ -165,8 +214,10 @@ GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new)
within the ATOMIC_NAME macro. */
#ifdef HOST_WORDS_BIGENDIAN
# define END _le
+# define MEND _le
#else
# define END _be
+# define MEND _be
#endif
ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
@@ -174,7 +225,10 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
{
ATOMIC_MMU_DECLS;
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
- DATA_TYPE ret = atomic_cmpxchg__nocheck(haddr, BSWAP(cmpv), BSWAP(newv));
+ DATA_TYPE ret;
+
+ ATOMIC_TRACE_RMW;
+ ret = atomic_cmpxchg__nocheck(haddr, BSWAP(cmpv), BSWAP(newv));
ATOMIC_MMU_CLEANUP;
return BSWAP(ret);
}
@@ -184,6 +238,8 @@ ABI_TYPE ATOMIC_NAME(ld)(CPUArchState *env, target_ulong addr EXTRA_ARGS)
{
ATOMIC_MMU_DECLS;
DATA_TYPE val, *haddr = ATOMIC_MMU_LOOKUP;
+
+ ATOMIC_TRACE_LD;
__atomic_load(haddr, &val, __ATOMIC_RELAXED);
ATOMIC_MMU_CLEANUP;
return BSWAP(val);
@@ -194,6 +250,8 @@ void ATOMIC_NAME(st)(CPUArchState *env, target_ulong addr,
{
ATOMIC_MMU_DECLS;
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
+
+ ATOMIC_TRACE_ST;
val = BSWAP(val);
__atomic_store(haddr, &val, __ATOMIC_RELAXED);
ATOMIC_MMU_CLEANUP;
@@ -204,7 +262,10 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr,
{
ATOMIC_MMU_DECLS;
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
- ABI_TYPE ret = atomic_xchg__nocheck(haddr, BSWAP(val));
+ ABI_TYPE ret;
+
+ ATOMIC_TRACE_RMW;
+ ret = atomic_xchg__nocheck(haddr, BSWAP(val));
ATOMIC_MMU_CLEANUP;
return BSWAP(ret);
}
@@ -215,7 +276,10 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
{ \
ATOMIC_MMU_DECLS; \
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \
- DATA_TYPE ret = atomic_##X(haddr, BSWAP(val)); \
+ DATA_TYPE ret; \
+ \
+ ATOMIC_TRACE_RMW; \
+ ret = atomic_##X(haddr, BSWAP(val)); \
ATOMIC_MMU_CLEANUP; \
return BSWAP(ret); \
}
@@ -232,6 +296,9 @@ GEN_ATOMIC_HELPER(xor_fetch)
/* These helpers are, as a whole, full barriers. Within the helper,
* the leading barrier is explicit and the trailing barrier is within
* cmpxchg primitive.
+ *
+ * Trace this load + RMW loop as a single RMW op. This way, regardless
+ * of CF_PARALLEL's value, we'll trace just a read and a write.
*/
#define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \
ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
@@ -240,6 +307,8 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
ATOMIC_MMU_DECLS; \
XDATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \
XDATA_TYPE ldo, ldn, old, new, val = xval; \
+ \
+ ATOMIC_TRACE_RMW; \
smp_mb(); \
ldn = atomic_read__nocheck(haddr); \
do { \
@@ -271,11 +340,17 @@ GEN_ATOMIC_HELPER_FN(add_fetch, ADD, DATA_TYPE, new)
#endif /* DATA_SIZE >= 16 */
#undef END
+#undef MEND
#endif /* DATA_SIZE > 1 */
+#undef ATOMIC_TRACE_ST
+#undef ATOMIC_TRACE_LD
+#undef ATOMIC_TRACE_RMW
+
#undef BSWAP
#undef ABI_TYPE
#undef DATA_TYPE
#undef SDATA_TYPE
#undef SUFFIX
#undef DATA_SIZE
+#undef SHIFT
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/5] trace-mem fixes
2018-05-22 22:26 [Qemu-devel] [PATCH 0/5] trace-mem fixes Emilio G. Cota
` (4 preceding siblings ...)
2018-05-22 22:26 ` [Qemu-devel] [PATCH 5/5] trace: enable tracing of TCG atomics Emilio G. Cota
@ 2018-05-25 15:20 ` Stefan Hajnoczi
2018-06-07 8:44 ` Stefan Hajnoczi
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2018-05-25 15:20 UTC (permalink / raw)
To: Emilio G. Cota
Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Lluís Vilanova
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
On Tue, May 22, 2018 at 06:26:47PM -0400, Emilio G. Cota wrote:
> This series fixes a few issues that I found while testing
> the tracing of guest memory accesses in TCG. Please review!
>
> You can fetch these patches from:
> https://github.com/cota/qemu/commits/trace-mem
I took a quick look and am happy.
CCing Lluís.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/5] trace-mem fixes
2018-05-22 22:26 [Qemu-devel] [PATCH 0/5] trace-mem fixes Emilio G. Cota
` (5 preceding siblings ...)
2018-05-25 15:20 ` [Qemu-devel] [PATCH 0/5] trace-mem fixes Stefan Hajnoczi
@ 2018-06-07 8:44 ` Stefan Hajnoczi
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2018-06-07 8:44 UTC (permalink / raw)
To: Emilio G. Cota
Cc: qemu-devel, Paolo Bonzini, Richard Henderson, Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
On Tue, May 22, 2018 at 06:26:47PM -0400, Emilio G. Cota wrote:
> This series fixes a few issues that I found while testing
> the tracing of guest memory accesses in TCG. Please review!
>
> You can fetch these patches from:
> https://github.com/cota/qemu/commits/trace-mem
Doesn't look like anyone else is going to review this.
Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-06-07 8:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-22 22:26 [Qemu-devel] [PATCH 0/5] trace-mem fixes Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 1/5] trace: fix misreporting of TCG access sizes for user-space Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 2/5] trace: simplify trace_mem functions Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 3/5] trace: expand mem_info:size_shift to 3 bits Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 4/5] trace: add trace_mem_build_info_no_se_be/le Emilio G. Cota
2018-05-22 22:26 ` [Qemu-devel] [PATCH 5/5] trace: enable tracing of TCG atomics Emilio G. Cota
2018-05-25 15:20 ` [Qemu-devel] [PATCH 0/5] trace-mem fixes Stefan Hajnoczi
2018-06-07 8:44 ` Stefan Hajnoczi
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).