Commit 36b3fe3
committed
virtio-fs: signal exit_evt when guest reports an exit code
When a virtual machine (VM) passes its final exit status via the `KRUN_EXIT_CODE_IOCTL` function on the virtio-fs root filesystem, the host records it in the shared `exit_code` AtomicI32, but does not signal it to the VMM's `EventFd`.
The VMM only stops when `exit_evt` becomes readable, so the VM's reported exit status itself does not wake up the `EventManager` and terminate the VM.
This is a common bug in virtio-fs/VMM exit interactions, not a code path specific to any particular architecture (but the reset path on x86-64 i8042 is configured as a VMM exit event, masking the problem). User-visible symptoms depend on the architecture/platform:
- On platforms without an equivalent rollback mechanism, or where the VM continues to perform reboot/shutdown processing after reporting the exit code, it may continue running even after reporting completion.
We observed the latter scenario on LoongArch, where the virtual machine could continue to restart/shut down, eventually leading to a soft lock rather than the VMM exiting immediately.
Signed-off-by: Zewei Yang <yangzewei@loongson.cn>1 parent 788cf91 commit 36b3fe3
3 files changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| |||
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| 191 | + | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
173 | 177 | | |
174 | 178 | | |
175 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
176 | 186 | | |
177 | 187 | | |
178 | 188 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1885 | 1885 | | |
1886 | 1886 | | |
1887 | 1887 | | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
1888 | 1893 | | |
1889 | 1894 | | |
1890 | 1895 | | |
1891 | 1896 | | |
1892 | 1897 | | |
| 1898 | + | |
1893 | 1899 | | |
1894 | 1900 | | |
1895 | 1901 | | |
| |||
0 commit comments