1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
graphic: 0.940
debug: 0.926
user-level: 0.908
virtual: 0.898
peripherals: 0.896
arm: 0.894
risc-v: 0.891
VMM: 0.891
semantic: 0.881
permissions: 0.881
mistranslation: 0.881
PID: 0.879
assembly: 0.870
TCG: 0.861
ppc: 0.857
performance: 0.857
KVM: 0.857
socket: 0.856
kernel: 0.853
architecture: 0.852
register: 0.847
vnc: 0.843
boot: 0.839
x86: 0.837
hypervisor: 0.831
device: 0.829
network: 0.824
files: 0.803
i386: 0.735
qmp-version of memsave makes a zero filled dump
calling the memsave function through hmp and qmp makes a different results. it happened because hmp_memsave calls synchronization of cpu, but qmp_marshal_input_memsave does not. so virDomainMemoryPeek (libvirt api) does not work correctly
1) hmp:
void hmp_memsave(Monitor *mon, const QDict *qdict)
{
uint32_t size = qdict_get_int(qdict, "size");
const char *filename = qdict_get_str(qdict, "filename");
uint64_t addr = qdict_get_int(qdict, "val");
Error *errp = NULL;
qmp_memsave(addr, size, filename, true, <<<< monitor_get_cpu_index() >>>, &errp);
hmp_handle_error(mon, &errp);
}
int monitor_get_cpu_index(void)
{
CPUState *cpu = ENV_GET_CPU(<<< mon_get_cpu >>>());
return cpu->cpu_index;
}
static CPUArchState *mon_get_cpu(void)
{
if (!cur_mon->mon_cpu) {
monitor_set_cpu(0);
}
<<< cpu_synchronize_state(cur_mon->mon_cpu); >>>
return cur_mon->mon_cpu->env_ptr;
}
2) qmp
int qmp_marshal_input_memsave(Monitor *mon, const QDict *qdict, QObject **ret)
{
Error *local_err = NULL;
Error **errp = &local_err;
QDict *args = (QDict *)qdict;
QmpInputVisitor *mi;
QapiDeallocVisitor *md;
Visitor *v;
int64_t val;
int64_t size;
char * filename = NULL;
bool has_cpu_index = false;
int64_t cpu_index;
mi = qmp_input_visitor_new_strict(QOBJECT(args));
v = qmp_input_get_visitor(mi);
visit_type_int(v, &val, "val", errp);
visit_type_int(v, &size, "size", errp);
visit_type_str(v, &filename, "filename", errp);
visit_start_optional(v, &has_cpu_index, "cpu-index", errp);
if (has_cpu_index) {
visit_type_int(v, &cpu_index, "cpu-index", errp);
}
visit_end_optional(v, errp);
qmp_input_visitor_cleanup(mi);
if (error_is_set(errp)) {
goto out;
}
<<< qmp_memsave(val, size, filename, has_cpu_index, cpu_index, errp); >>>
out:
md = qapi_dealloc_visitor_new();
v = qapi_dealloc_get_visitor(md);
visit_type_int(v, &val, "val", NULL);
visit_type_int(v, &size, "size", NULL);
visit_type_str(v, &filename, "filename", NULL);
visit_start_optional(v, &has_cpu_index, "cpu-index", NULL);
if (has_cpu_index) {
visit_type_int(v, &cpu_index, "cpu-index", NULL);
}
visit_end_optional(v, NULL);
qapi_dealloc_visitor_cleanup(md);
if (local_err) {
qerror_report_err(local_err);
error_free(local_err);
return -1;
}
return 0;
}
how to reproduce:
1) run qemu as it makes a libvirtd
./qemu-system-x86_64 -name gentoo -machine pc-i440fx-1.7,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 135b3e47-43ca-bc68-e23b-354a2f62a023 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=./gentoo.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot menu=off,strict=on -kernel ./bzImage -append root="/dev/vda2 vga=38f" -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=./gentoo.img,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=./install-amd64-minimal-20140320.iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=2 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -vnc 127.0.0.1:0 -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -vnc 127.0.0.1:2 -monitor stdio
2) attach to qemu through qmp-shell (taken from qemu sources)
python ./qmp-shell ./gentoo.monitor
3) make some commands in sequence
(qmp-shell) memsave memsave val=-2130706432 size=100 filename=./test01
(stdio monitor) memsave 0xffffffff81000000 100 ./test02
(qmp-shell) memsave memsave val=-2130706432 size=100 filename=./test03
result:
test01 - zero filled
test02 - right
test03 - right
Looking through old bug tickets... can you still reproduce this issue with the latest version of QEMU? Or could we close this ticket nowadays?
[Expired for QEMU because there has been no activity for 60 days.]
|