qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

iotests/qcow2.py: Split feature fields into bits

Print the feature fields as a set of bits so that filtering is easier.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-id: 20191107163708.833192-4-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>

+99 -89
+18 -18
tests/qemu-iotests/031.out
··· 18 18 refcount_table_clusters 1 19 19 nb_snapshots 0 20 20 snapshot_offset 0x0 21 - incompatible_features 0x0 22 - compatible_features 0x0 23 - autoclear_features 0x0 21 + incompatible_features [] 22 + compatible_features [] 23 + autoclear_features [] 24 24 refcount_order 4 25 25 header_length 72 26 26 ··· 46 46 refcount_table_clusters 1 47 47 nb_snapshots 0 48 48 snapshot_offset 0x0 49 - incompatible_features 0x0 50 - compatible_features 0x0 51 - autoclear_features 0x0 49 + incompatible_features [] 50 + compatible_features [] 51 + autoclear_features [] 52 52 refcount_order 4 53 53 header_length 72 54 54 ··· 74 74 refcount_table_clusters 1 75 75 nb_snapshots 0 76 76 snapshot_offset 0x0 77 - incompatible_features 0x0 78 - compatible_features 0x0 79 - autoclear_features 0x0 77 + incompatible_features [] 78 + compatible_features [] 79 + autoclear_features [] 80 80 refcount_order 4 81 81 header_length 72 82 82 ··· 109 109 refcount_table_clusters 1 110 110 nb_snapshots 0 111 111 snapshot_offset 0x0 112 - incompatible_features 0x0 113 - compatible_features 0x0 114 - autoclear_features 0x0 112 + incompatible_features [] 113 + compatible_features [] 114 + autoclear_features [] 115 115 refcount_order 4 116 116 header_length 104 117 117 ··· 142 142 refcount_table_clusters 1 143 143 nb_snapshots 0 144 144 snapshot_offset 0x0 145 - incompatible_features 0x0 146 - compatible_features 0x0 147 - autoclear_features 0x0 145 + incompatible_features [] 146 + compatible_features [] 147 + autoclear_features [] 148 148 refcount_order 4 149 149 header_length 104 150 150 ··· 175 175 refcount_table_clusters 1 176 176 nb_snapshots 0 177 177 snapshot_offset 0x0 178 - incompatible_features 0x0 179 - compatible_features 0x0 180 - autoclear_features 0x0 178 + incompatible_features [] 179 + compatible_features [] 180 + autoclear_features [] 181 181 refcount_order 4 182 182 header_length 104 183 183
+9 -9
tests/qemu-iotests/036.out
··· 16 16 refcount_table_clusters 1 17 17 nb_snapshots 0 18 18 snapshot_offset 0x0 19 - incompatible_features 0x8000000000000000 20 - compatible_features 0x0 21 - autoclear_features 0x0 19 + incompatible_features [63] 20 + compatible_features [] 21 + autoclear_features [] 22 22 refcount_order 4 23 23 header_length 104 24 24 ··· 50 50 refcount_table_clusters 1 51 51 nb_snapshots 0 52 52 snapshot_offset 0x0 53 - incompatible_features 0x0 54 - compatible_features 0x0 55 - autoclear_features 0x8000000000000000 53 + incompatible_features [] 54 + compatible_features [] 55 + autoclear_features [63] 56 56 refcount_order 4 57 57 header_length 104 58 58 ··· 78 78 refcount_table_clusters 1 79 79 nb_snapshots 0 80 80 snapshot_offset 0x0 81 - incompatible_features 0x0 82 - compatible_features 0x0 83 - autoclear_features 0x0 81 + incompatible_features [] 82 + compatible_features [] 83 + autoclear_features [] 84 84 refcount_order 4 85 85 header_length 104 86 86
+11 -11
tests/qemu-iotests/039.out
··· 4 4 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 5 5 wrote 512/512 bytes at offset 0 6 6 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 7 - incompatible_features 0x0 7 + incompatible_features [] 8 8 No errors were found on the image. 9 9 10 10 == Creating a dirty image file == ··· 12 12 wrote 512/512 bytes at offset 0 13 13 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 14 14 ./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) 15 - incompatible_features 0x1 15 + incompatible_features [0] 16 16 ERROR cluster 5 refcount=0 reference=1 17 17 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0 18 18 ··· 22 22 == Read-only access must still work == 23 23 read 512/512 bytes at offset 0 24 24 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 25 - incompatible_features 0x1 25 + incompatible_features [0] 26 26 27 27 == Repairing the image file must succeed == 28 28 ERROR cluster 5 refcount=0 reference=1 ··· 36 36 37 37 Double checking the fixed image now... 38 38 No errors were found on the image. 39 - incompatible_features 0x0 39 + incompatible_features [] 40 40 41 41 == Data should still be accessible after repair == 42 42 read 512/512 bytes at offset 0 ··· 47 47 wrote 512/512 bytes at offset 0 48 48 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 49 49 ./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) 50 - incompatible_features 0x1 50 + incompatible_features [0] 51 51 ERROR cluster 5 refcount=0 reference=1 52 52 Rebuilding refcount structure 53 53 Repairing cluster 1 refcount=1 reference=0 54 54 Repairing cluster 2 refcount=1 reference=0 55 55 wrote 512/512 bytes at offset 0 56 56 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 57 - incompatible_features 0x0 57 + incompatible_features [] 58 58 59 59 == Creating an image file with lazy_refcounts=off == 60 60 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 61 61 wrote 512/512 bytes at offset 0 62 62 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 63 63 ./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) 64 - incompatible_features 0x0 64 + incompatible_features [] 65 65 No errors were found on the image. 66 66 67 67 == Committing to a backing file with lazy_refcounts=on == ··· 70 70 wrote 512/512 bytes at offset 0 71 71 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 72 72 Image committed. 73 - incompatible_features 0x0 74 - incompatible_features 0x0 73 + incompatible_features [] 74 + incompatible_features [] 75 75 No errors were found on the image. 76 76 No errors were found on the image. 77 77 ··· 80 80 wrote 512/512 bytes at offset 0 81 81 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 82 82 ./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) 83 - incompatible_features 0x1 83 + incompatible_features [0] 84 84 ERROR cluster 5 refcount=0 reference=1 85 85 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0 86 86 ··· 90 90 wrote 512/512 bytes at offset 0 91 91 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 92 92 ./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) 93 - incompatible_features 0x0 93 + incompatible_features [] 94 94 No errors were found on the image. 95 95 *** done
+10 -10
tests/qemu-iotests/060.out
··· 7 7 8 8 1 errors were found on the image. 9 9 Data may be corrupted, or further writes to the image may corrupt it. 10 - incompatible_features 0x0 10 + incompatible_features [] 11 11 qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with active L1 table); further corruption events will be suppressed 12 12 write failed: Input/output error 13 - incompatible_features 0x2 13 + incompatible_features [1] 14 14 image: TEST_DIR/t.IMGFMT 15 15 file format: IMGFMT 16 16 virtual size: 64 MiB (67108864 bytes) ··· 33 33 34 34 2 errors were found on the image. 35 35 Data may be corrupted, or further writes to the image may corrupt it. 36 - incompatible_features 0x0 36 + incompatible_features [] 37 37 qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with refcount block); further corruption events will be suppressed 38 38 write failed: Input/output error 39 - incompatible_features 0x2 39 + incompatible_features [1] 40 40 ERROR refcount block 0 refcount=2 41 41 ERROR cluster 2 refcount=1 reference=2 42 42 Rebuilding refcount structure ··· 49 49 50 50 Double checking the fixed image now... 51 51 No errors were found on the image. 52 - incompatible_features 0x0 52 + incompatible_features [] 53 53 wrote 512/512 bytes at offset 0 54 54 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 55 - incompatible_features 0x0 55 + incompatible_features [] 56 56 57 57 === Testing cluster data reference into inactive L2 table === 58 58 ··· 69 69 70 70 1 leaked clusters were found on the image. 71 71 This means waste of disk space, but no harm to data. 72 - incompatible_features 0x0 72 + incompatible_features [] 73 73 qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with inactive L2 table); further corruption events will be suppressed 74 74 write failed: Input/output error 75 - incompatible_features 0x2 75 + incompatible_features [1] 76 76 ERROR cluster 4 refcount=1 reference=2 77 77 Leaked cluster 9 refcount=1 reference=0 78 78 Repairing cluster 4 refcount=1 reference=2 ··· 85 85 86 86 Double checking the fixed image now... 87 87 No errors were found on the image. 88 - incompatible_features 0x0 88 + incompatible_features [] 89 89 wrote 512/512 bytes at offset 0 90 90 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 91 - incompatible_features 0x0 91 + incompatible_features [] 92 92 read 512/512 bytes at offset 0 93 93 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 94 94 No errors were found on the image.
+36 -36
tests/qemu-iotests/061.out
··· 18 18 refcount_table_clusters 1 19 19 nb_snapshots 0 20 20 snapshot_offset 0x0 21 - incompatible_features 0x0 22 - compatible_features 0x1 23 - autoclear_features 0x0 21 + incompatible_features [] 22 + compatible_features [0] 23 + autoclear_features [] 24 24 refcount_order 4 25 25 header_length 104 26 26 ··· 42 42 refcount_table_clusters 1 43 43 nb_snapshots 0 44 44 snapshot_offset 0x0 45 - incompatible_features 0x0 46 - compatible_features 0x0 47 - autoclear_features 0x0 45 + incompatible_features [] 46 + compatible_features [] 47 + autoclear_features [] 48 48 refcount_order 4 49 49 header_length 72 50 50 ··· 76 76 refcount_table_clusters 1 77 77 nb_snapshots 0 78 78 snapshot_offset 0x0 79 - incompatible_features 0x0 80 - compatible_features 0x1 81 - autoclear_features 0x0 79 + incompatible_features [] 80 + compatible_features [0] 81 + autoclear_features [] 82 82 refcount_order 4 83 83 header_length 104 84 84 ··· 100 100 refcount_table_clusters 1 101 101 nb_snapshots 0 102 102 snapshot_offset 0x0 103 - incompatible_features 0x0 104 - compatible_features 0x0 105 - autoclear_features 0x0 103 + incompatible_features [] 104 + compatible_features [] 105 + autoclear_features [] 106 106 refcount_order 4 107 107 header_length 72 108 108 ··· 132 132 refcount_table_clusters 1 133 133 nb_snapshots 0 134 134 snapshot_offset 0x0 135 - incompatible_features 0x1 136 - compatible_features 0x1 137 - autoclear_features 0x0 135 + incompatible_features [0] 136 + compatible_features [0] 137 + autoclear_features [] 138 138 refcount_order 4 139 139 header_length 104 140 140 ··· 161 161 refcount_table_clusters 1 162 162 nb_snapshots 0 163 163 snapshot_offset 0x0 164 - incompatible_features 0x0 165 - compatible_features 0x0 166 - autoclear_features 0x0 164 + incompatible_features [] 165 + compatible_features [] 166 + autoclear_features [] 167 167 refcount_order 4 168 168 header_length 72 169 169 ··· 187 187 refcount_table_clusters 1 188 188 nb_snapshots 0 189 189 snapshot_offset 0x0 190 - incompatible_features 0x0 191 - compatible_features 0x40000000000 192 - autoclear_features 0x40000000000 190 + incompatible_features [] 191 + compatible_features [42] 192 + autoclear_features [42] 193 193 refcount_order 4 194 194 header_length 104 195 195 ··· 211 211 refcount_table_clusters 1 212 212 nb_snapshots 0 213 213 snapshot_offset 0x0 214 - incompatible_features 0x0 215 - compatible_features 0x0 216 - autoclear_features 0x0 214 + incompatible_features [] 215 + compatible_features [] 216 + autoclear_features [] 217 217 refcount_order 4 218 218 header_length 72 219 219 ··· 237 237 refcount_table_clusters 1 238 238 nb_snapshots 0 239 239 snapshot_offset 0x0 240 - incompatible_features 0x0 241 - compatible_features 0x0 242 - autoclear_features 0x0 240 + incompatible_features [] 241 + compatible_features [] 242 + autoclear_features [] 243 243 refcount_order 4 244 244 header_length 72 245 245 ··· 256 256 refcount_table_clusters 1 257 257 nb_snapshots 0 258 258 snapshot_offset 0x0 259 - incompatible_features 0x0 260 - compatible_features 0x1 261 - autoclear_features 0x0 259 + incompatible_features [] 260 + compatible_features [0] 261 + autoclear_features [] 262 262 refcount_order 4 263 263 header_length 104 264 264 ··· 290 290 refcount_table_clusters 1 291 291 nb_snapshots 0 292 292 snapshot_offset 0x0 293 - incompatible_features 0x1 294 - compatible_features 0x1 295 - autoclear_features 0x0 293 + incompatible_features [0] 294 + compatible_features [0] 295 + autoclear_features [] 296 296 refcount_order 4 297 297 header_length 104 298 298 ··· 319 319 refcount_table_clusters 1 320 320 nb_snapshots 0 321 321 snapshot_offset 0x0 322 - incompatible_features 0x0 323 - compatible_features 0x0 324 - autoclear_features 0x0 322 + incompatible_features [] 323 + compatible_features [] 324 + autoclear_features [] 325 325 refcount_order 4 326 326 header_length 104 327 327
+1 -1
tests/qemu-iotests/137.out
··· 36 36 wrote 512/512 bytes at offset 0 37 37 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 38 38 ./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) 39 - incompatible_features 0x0 39 + incompatible_features [] 40 40 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 41 41 wrote 65536/65536 bytes at offset 0 42 42 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+14 -4
tests/qemu-iotests/qcow2.py
··· 42 42 [ uint64_t, '%#x', 'snapshot_offset' ], 43 43 44 44 # Version 3 header fields 45 - [ uint64_t, '%#x', 'incompatible_features' ], 46 - [ uint64_t, '%#x', 'compatible_features' ], 47 - [ uint64_t, '%#x', 'autoclear_features' ], 45 + [ uint64_t, 'mask', 'incompatible_features' ], 46 + [ uint64_t, 'mask', 'compatible_features' ], 47 + [ uint64_t, 'mask', 'autoclear_features' ], 48 48 [ uint32_t, '%d', 'refcount_order' ], 49 49 [ uint32_t, '%d', 'header_length' ], 50 50 ]; ··· 130 130 131 131 def dump(self): 132 132 for f in QcowHeader.fields: 133 - print("%-25s" % f[2], f[1] % self.__dict__[f[2]]) 133 + value = self.__dict__[f[2]] 134 + if f[1] == 'mask': 135 + bits = [] 136 + for bit in range(64): 137 + if value & (1 << bit): 138 + bits.append(bit) 139 + value_str = str(bits) 140 + else: 141 + value_str = f[1] % value 142 + 143 + print("%-25s" % f[2], value_str) 134 144 print("") 135 145 136 146 def dump_extensions(self):