summary refs log tree commit diff stats
path: root/results/scraper/launchpad/1994002
blob: d1bace98385c9b9f422297c0da0641bcae9083c7 (plain) (blame)
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
[SRU] migration was active, but no RAM info was set

While live-migrating many instances concurrently, libvirt sometimes return internal error: migration was active, but no RAM info was set:
~~~
2022-03-30 06:08:37.197 7 WARNING nova.virt.libvirt.driver [req-5c3296cf-88ee-4af6-ae6a-ddba99935e23 - - - - -] [instance: af339c99-1182-4489-b15c-21e52f50f724] Error monitoring migration: internal error: migration was active, but no RAM info was set: libvirt.libvirtError: internal error: migration was active, but no RAM info was set
~~~

From upstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=2074205

[Impact]

 * Effects of this bug are mostly observed in large scale clusters with a lot of live migration activity.
 * Has second order effects for consumers of migration monitor such as libvirt and openstack.

[Test Case]
Steps to Reproduce:
1. live evacuate a compute
2. live migration of one or more instances fails with the above error

N.B Due to the nature of this bug it is difficult consistently reproduce.

[Where problems could occur]
 * In the event of a regression the migration monitor may report an inconsistent state.



The attachment "lp1994002-qemu-ussuri.debdiff" seems to be a debdiff.  The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff.  If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

If you need something from upstream QEMU, please use the new bug tracker here: https://gitlab.com/qemu-project/qemu/-/issues







Hi Brett,

Thanks for the debdiffs!

I just reviewed them, and there are changes that should be made.

I could do those myself, but that wouldn't be an opportunity to
learn/practice some details for SRUs for you, so I'll add notes.

*However*, if you're too busy and can't do that, do let me know.

cheers,
Mauricio

...

qemu.git

$ git describe --contains 552de79bfdd5e9e53847eb3c6d6e4cd898a4370e
v7.1.0-rc0~136^2

ubuntu archive:

$ rmadison -a source qemu
...
 qemu | 1:2.11+dfsg-1ubuntu7    | bionic          | source
 qemu | 1:2.11+dfsg-1ubuntu7.40 | bionic-security | source
 qemu | 1:2.11+dfsg-1ubuntu7.40 | bionic-updates  | source
 qemu | 1:4.2-3ubuntu6          | focal           | source
 qemu | 1:4.2-3ubuntu6.23       | focal-security  | source
 qemu | 1:4.2-3ubuntu6.23       | focal-updates   | source
 qemu | 1:6.2+dfsg-2ubuntu6     | jammy           | source
 qemu | 1:6.2+dfsg-2ubuntu6.2   | jammy-security  | source
 qemu | 1:6.2+dfsg-2ubuntu6.5   | jammy-updates   | source
 qemu | 1:7.0+dfsg-7ubuntu2     | kinetic         | source
 qemu | 1:7.0+dfsg-7ubuntu2     | lunar           | source

0) Development release

The development release (lunar) still doesn't have the patch.
That is required for SRU / stable releases.

We'll need a debdiff for lunar, slightly different than kinetic
(release name and greater version string for the upgrade path).

I just checked w/ Christian and we shouldn't wait on qemu 7.1
merge from Debian (sid), which would include the patch, since
the merge from Debian should happen in January to get qemu 7.2.


1) Oldest LTS in standard support

Would Bionic benefit from this fix on the long run as well,
just before it goes into expanded/out of standard- support?

Apparently, some deployments/clouds still use Bionic on kvm
compute nodes.

If so, the backport targets qmp_query_migrate()/same file,
per commit 65ace0604551 ("migration: add postcopy total blocktime into query-migrate").


2) Debdiffs:

- version strings: the 'lp*' version suffix is fine for
test builds, but for official packages usually (see [1]):
just increment '.1' on stable releases, and '1' on dev.

example:
kinetic (sru): 1:7.0+dfsg-7ubuntu2 -> ubuntu2.1
luanr (devel): 1:7.0+dfsg-7ubuntu2 -> ubuntu3

- changelog: mostly good! (d/p/file.patch; LP: #number?; releases).

The LP bug number 1982284 refers to another/openstack bug,
but the Ubuntu SRUs are coming through this bug, apparently.

Since this is the bug where Ubuntu Archive/Cloud Archive
have packages/series on, to be closed when SRUs land in
-proposed and -updates (and UCA), we should change:
1) the LP bug number in the changelog 
2) and patch file names
3) also, it's a good idea to link to other LP bug
in the SRU template '[Other Info]' section.

(you could also just move the SRU template/packages/
series/tracks to the other LP bug, I guess. Up to you.)

- quilt patch: add DEP3 headers [2] (Origin:/Bug-Ubuntu:)

- quilt series: missing 'ubuntu/' dir on k/j (not on f)

- duplications: jammy has duplicated messages, and focal
has that plus duplicated changelog entries? -- for HA? x)

[1] https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Update_the_packaging
[2] https://dep-team.pages.debian.net/deps/dep3/

Brett, per our email conversation, please ignore this:
> - quilt series: missing 'ubuntu/' dir on k/j (not on f)

I missed that focal uses `d/p/ubuntu/` too (it just wasn't present in `d/p/series` context lines in the debdiff, for CVEs).
Sorry for the confusion, and thanks for checking!


Hi Mauricio,

Thanks for your review.
I've made the changes you've requested.
Looking forward to your feedback.










Thanks, Brett!

Very minor nitpicks left (changelog entry/release for lunar,
and URL for Origin:), I can handle those.

For Lunar/devel release, I'll send a MR for Christian to
review/upload (my upload rights are for stable releases).

This includes a fix to FTBFS per a package change in the
last 24 hours :) happy to catch it now!

It's currently (re)build-testing on all supported archs.
If all goes well now, I'll send the MR for Lunar, and
once it lands, we'll proceed w/ SRUs.

...

I also played with GDB for a synthetic reproducer.
It seems to be possible, but needs a little more study
on the monitor path.  We can sync on that later!


All archs finished building successfully on ppa:mfo/lp1994002v2.

Just sent the MR for Lunar. If/once it lands, I can do the SRUs.

https://code.launchpad.net/~mfo/ubuntu/+source/qemu/+git/qemu/+merge/434118

For documentation purposes,

The qemu package in lunar-proposed has its migration blocked to lunar(-release)
because of autopkgtests failures (sbuild), which have been analyzed/understood.

We're waiting on the autopkgtests queue to run sbuild w/ triggers on qemu _and_
sbuild from lunar-proposed, which should address the error w/ sbuild/unshare
(lack of adduser command in the sbuild chroot, as apt no longer deps on that).

Once that runs, we'll check if any other errors happen, and address those.

cheers,
Mauricio

The sbuild autopkgtest failure on the 'unshare' test
is indeed fixed w/ sbuild in lunar-proposed; however,
now the test 'unshare-qemuwrapper' timed out.

autopkgtest [23:36:43]: @@@@@@@@@@@@@@@@@@@@ summary
build-procenv        PASS
unshare-qemuwrapper  FAIL timed out
unshare              PASS

It timed out on the 'guestfish' command, so I enabled
`export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1` there,
and run autopkgtests against its build in a PPA [1].

Then it finished successfully w/out timing out! x)

autopkgtest [16:17:39]: @@@@@@@@@@@@@@@@@@@@ summary
build-procenv        PASS
unshare-qemuwrapper  PASS
unshare              PASS

Not a very useful result, but it did show that an
step in guestfish took ~25 minutes; 30 mins total:

autopkgtest [15:22:52]: test unshare-qemuwrapper: [-----------------------
...
+ export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
+ guestfish <...>
...
libguestfs: trace: tar_in "/tmp/.../ubuntu-lunar-host.tar" "/"
...
tar -C /sysroot/ -xf - 2> /tmp/tarSfYHJX
...
guestfsd: => tar_in (0x45) took 1489.08 secs
...
autopkgtest [15:52:27]: test unshare-qemuwrapper: -----------------------]
unshare-qemuwrapper  PASS

So, well, it might have been due to load in the
autopkgtest infrastructure at the time tests ran,
so just triggered retries on sbuild and sbuild+qemu.

Hopefully they will pass and unblock proposed migration
for both sbuild & qemu.

[1] https://autopkgtest.ubuntu.com/results/autopkgtest-lunar-mfo-build/lunar/amd64/s/sbuild/20221215_161801_a2772@/log.gz



The sbuild autopkgtests need a fix for lunar-proposed;
reported bug 2000015 w/ analysis and debdiff attached.

This bug was fixed in the package qemu - 1:7.0+dfsg-7ubuntu3

---------------
qemu (1:7.0+dfsg-7ubuntu3) lunar; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/ebpf-replace-deprecated-bpf_program__set_socket_filt.patch:
    Fix FTBFS with libbpf 1.0.1-2.

 -- Mauricio Faria de Oliveira <email address hidden>  Wed, 30 Nov 2022 12:17:51 -0300

These are the steps for a synthetic reproducer with GDB and QEMU.

It's sufficient to validate the change on QEMU and move forward with SRUs.
(We can add libvirt for reaching the error message too, but it's a plus.)

I'll check/coordinate on the QEMU uploads next week.

cheers,
Mauricio

...


Original code.

The race condition is, one thread can read 's->state' as SETUP (line 1078/1083/1086),
and another thread changes it to ACTIVE _before_ this thread assigns (the different)
's->state' to 'info->status' (line 1123), which will NOT have RAM info expected for
the ACTIVE status (line 1087/1096).

	1056 static void fill_source_migration_info(MigrationInfo *info)
	1057 {
	1058     MigrationState *s = migrate_get_current();
	...
	1078     switch (s->state) {
	...
	1083     case MIGRATION_STATUS_SETUP:
	...
	1086         break;
	1087     case MIGRATION_STATUS_ACTIVE:
	...
	1096         populate_ram_info(info, s);
	...
	1123     info->status = s->state;
	1124 }

We'll break on this function that changes migration states.

	void migrate_set_state(int *state, int old_state, int new_state)


Terminal 1)

QEMU process for incoming migration (ie, destination)

qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444

Terminal 2)

QEMU process for outgoing migration (ie, source)
with QEMU monitor on port 3333,
with GDB in non-stop threads mode
(and debuginfod for debug symbols),


gdb \
  -ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off' \
  -iex 'set debuginfod enabled on' -iex 'set debuginfod urls "https://debuginfod.ubuntu.com"' \
  qemu-system-x86_64

Set breakpoints on the functions above
(and line number of the 'break' statement under 'case MIGRATION_STATUS_SETUP'):

b migrate_set_state
b migration/migration.c:1086

run -nodefaults -nographic -S -monitor tcp:0:3333,server,wait=off
...

Terminal 3)

Connect to QEMU monitor with netcat,
and start the the migration:

nc 127.0.0.1 3333
...
(qemu) migrate -d tcp:127.0.0.1:4444


Terminal 2)

GDB breaks on change from migration status NONE to SETUP. 

Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566f8628, old_state=0, new_state=1) at ../../migration/migration.c:1746

(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE

(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP

Just continue.

(gdb) c

GDB breaks on change from migration status SETUP to ACTIVE. 

Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566f8628, old_state=1, new_state=4) at ../../migration/migration.c:1746

(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP

(gdb) p (MigrationStatus) 4
$3 = MIGRATION_STATUS_ACTIVE

Let's explore the race condition.


Terminal 2)

Check the migration information:

(qemu) info migrate


Terminal 3)

GDB breaks on the migration information function.

The status is now observed as SETUP (not yet ACTIVE),
and is not yet propagated to the migration information
to be returned to the monitor.

Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_migration_info (info=0x555556d65c70) at ../../migration/migration.c:1086

(gdb) p (MigrationStatus) s.state
$4 = MIGRATION_STATUS_SETUP

(gdb) p info.status
$5 = MIGRATION_STATUS_NONE


Now, allow the other thread to continue and change status to ACTIVE.

(gdb) info threads
  Id   Target Id                                          Frame
* 1    Thread 0x7ffff6c21e80 (LWP 995) "qemu-system-x86"  fill_source_migration_info (info=0x555556d65c70) at ../../migration/migration.c:1123
  2    Thread 0x7ffff65ff640 (LWP 998) "qemu-system-x86"  (running)
  3    Thread 0x7ffff5d7c640 (LWP 999) "qemu-system-x86"  (running)
  5    Thread 0x7ffff49ff640 (LWP 1002) "qemu-system-x86" migrate_set_state (state=0x5555566f8628, old_state=1, new_state=4) at ../../migration/migration.c:1746

(gdb) thread 5
[Switching to thread 5 (Thread 0x7ffff49ff640 (LWP 1002))]
#0  migrate_set_state (state=0x5555566f8628, old_state=1, new_state=4) at ../../migration/migration.c:1746
1746    in ../../migration/migration.c

(gdb) continue &
Continuing.

The first thread now observes the ACTIVE status.

(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7ffff6c21e80 (LWP 995) "qemu-system-x86"  fill_source_migration_info (info=0x555556d65c70) at ../../migration/migration.c:1123
  2    Thread 0x7ffff65ff640 (LWP 998) "qemu-system-x86"  (running)
  3    Thread 0x7ffff5d7c640 (LWP 999) "qemu-system-x86"  (running)
* 5    Thread 0x7ffff49ff640 (LWP 1002) "qemu-system-x86" (running)
(gdb)

(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff6c21e80 (LWP 995))]
#0  fill_source_migration_info (info=0x555556d65c70) at ../../migration/migration.c:1123
1123    in ../../migration/migration.c

(gdb) p (MigrationStatus) s.state
$7 = MIGRATION_STATUS_ACTIVE


Done, the next statement in the code assigns the ACTIVE
status to the migration information, but it did NOT add
any RAM statistics (as it executed for the SETUP status).

Just continue, and check the resulting migration info:

(gdb) c


Terminal 2)
... info migrate
...
Migration status: active
total time: 0 ms
(qemu)

Migration status is active, without any RAM statistics.


...
...
...

Note that, normally, without exploring the race condition,
the status is 'active' and there _is_ memory statistics:

[just a summary from gdb/monitor steps]

...
(qemu) migrate -d tcp:127.0.0.1:4444

...
Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566f8628, old_state=0, new_state=1) at ../../migration/migration.c:1746
(gdb) c
Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566f8628, old_state=1, new_state=4) at ../../migration/migration.c:1746
(gdb) thread 5
(gdb) c
Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566f8628, old_state=4, new_state=8) at ../../migration/migration.c:1746

(qemu) info migrate
...
Migration status: active
total time: 41387 ms
expected downtime: 300 ms
setup: 22590 ms
transferred ram: 485 kbytes
throughput: 0.18 mbps
remaining ram: 0 kbytes
total ram: 131592 kbytes
duplicate: 32849 pages
skipped: 0 pages
normal: 49 pages
normal bytes: 196 kbytes
dirty sync count: 3
page size: 4 kbytes
multifd bytes: 0 kbytes
pages-per-second: 1453
(qemu)

(gdb) c
...


Uploaded to k/j/f/b.

Hello Brett, or anyone else affected,

Accepted qemu into kinetic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:7.0+dfsg-7ubuntu2.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package.  See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.  Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-kinetic to verification-done-kinetic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-kinetic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

All autopkgtests for the newly accepted qemu (1:7.0+dfsg-7ubuntu2.2) for kinetic have finished running.
The following regressions have been reported in tests triggered by the package:

sbuild/0.83.1ubuntu1 (amd64)
ubuntu-image/2.2+22.04ubuntu3 (ppc64el)
dropbear/2022.82-4 (armhf)


Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/kinetic/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!


Autopkgtests regressions cleared for kinetic.

Verification done on kinetic-proposed.

The migration status during the race condition is
not 'active' (which is expected to have RAM info, but didn't)
but 'setup' (which is not, thus no issues).

(qemu) info migrate

-updates:
...
Migration status: active
total time: 0 ms

-proposed:
...
Migration status: setup
total time: 0 ms

Detailed steps:
==============

$ lxc launch ubuntu:kinetic qemu-k
$ lxc exec qemu-k -- su - ubuntu


Packages from -updates: FAIL
----------------------

$ sudo apt install --yes --no-install-recommends qemu-system-x86 gdb dpkg-dev

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:7.0+dfsg-7ubuntu2.1

...

Source: get line number for breakpoint.

$ sudo add-apt-repository -ys
$ apt source qemu

$ head -n1 qemu-*/debian/changelog
qemu (1:7.0+dfsg-7ubuntu2.1) kinetic-security; urgency=medium

$ vim qemu-*/migration/migration.c

1073 static void fill_source_migration_info(MigrationInfo *info)
1074 {
...
1100     case MIGRATION_STATUS_SETUP:
...
1103         break;
...

...

Terminal 1)

$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444

Terminal 2)

gdb \
  -ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off' \
  -iex 'set debuginfod enabled on' -iex 'set debuginfod urls https://debuginfod.ubuntu.com' \
  qemu-system-x86_64
  
(gdb) b migrate_set_state
...
Breakpoint 1 at 0x47ed10: migrate_set_state. (2 locations)
(gdb) b migration/migration.c:1103
...
Breakpoint 2 at 0x47dba0: file ../../migration/migration.c, line 1103.

(gdb) run -nodefaults -nographic -S -monitor tcp:0:3333,server,wait=off


Terminal 3)

nc 127.0.0.1 3333

(qemu) migrate -d tcp:127.0.0.1:4444

Terminal 2)

Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x555556779618, old_state=0, new_state=1) at ../../migration/migration.c:1763

(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP
(gdb) c

Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x555556779618, old_state=1, new_state=4) at ../../migration/migration.c:1763

(gdb) p (MigrationStatus) 1
$3 = MIGRATION_STATUS_SETUP
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_STATUS_ACTIVE

Terminal 3)

(qemu) info migrate

Terminal 2)

Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1103

(gdb) p (MigrationStatus) s.state
$6 = MIGRATION_STATUS_SETUP
(gdb) p info.status
$7 = MIGRATION_STATUS_NONE

(gdb) info threads
  Id   Target Id                                          Frame
* 1    Thread 0x7ffff6c32340 (LWP 2368) "qemu-system-x86" fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1103
  2    Thread 0x7ffff65ff6c0 (LWP 2369) "qemu-system-x86" (running)
  3    Thread 0x7ffff5d7c6c0 (LWP 2370) "qemu-system-x86" (running)
  5    Thread 0x7ffff49ff6c0 (LWP 2373) "qemu-system-x86" migrate_set_state (state=0x555556779618, old_state=1, new_state=4) at ../../migration/migration.c:1763

(gdb) thread 5
(gdb) continue &

(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7ffff6c32340 (LWP 2368) "qemu-system-x86" fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1103
  2    Thread 0x7ffff65ff6c0 (LWP 2369) "qemu-system-x86" (running)
  3    Thread 0x7ffff5d7c6c0 (LWP 2370) "qemu-system-x86" (running)
* 5    Thread 0x7ffff49ff6c0 (LWP 2373) "qemu-system-x86" (running)

(gdb) thread 1

(gdb) p (MigrationStatus) s.state
$8 = MIGRATION_STATUS_ACTIVE
(gdb) c

Terminal 3)

...
Migration status: active
total time: 0 ms
(qemu)

Migration status is active, without any RAM statistics.

(qemu) quit
(gdb) quit

Terminal 1)

Ctrl-C

...


Packages from -proposed: PASS
-----------------------

$ sudo add-apt-repository -yp proposed
$ sudo add-apt-repository -ys # didn't work for proposed
$ echo 'deb-src http://archive.ubuntu.com/ubuntu kinetic-proposed main' | sudo tee -a /etc/apt/sources.list

$ sudo apt install --yes --no-install-recommends qemu-system-x86

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:7.0+dfsg-7ubuntu2.2

$ rm -rf qemu-*
a$ apt source qemu

$ head -n1 qemu-*/debian/changelog
qemu (1:7.0+dfsg-7ubuntu2.2) kinetic; urgency=medium

$ vim qemu-*/migration/migration.c

1073 static void fill_source_migration_info(MigrationInfo *info)
1074 {
...
1076     int state = qatomic_read(&s->state);
...
1101     case MIGRATION_STATUS_SETUP:
...
1104         break;


Terminal 1)

$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444

Terminal 2)

$ gdb   -ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off'   -iex 'set debuginfod enabled on' -iex 'set debuginfod urls https://debuginfod.ubuntu.com'   qemu-system-x86_64

(gdb) b migrate_set_state
...
Breakpoint 1 at 0x47ed20: migrate_set_state. (2 locations)
(gdb) b migration/migration.c:1104
...
Breakpoint 2 at 0x47dbc3: file ../../migration/migration.c, line 1104.

Terminal 3)

$ nc 127.0.0.1 3333
(qemu) migrate -d tcp:127.0.0.1:4444

Terminal 2)

Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x555556779618, old_state=0, new_state=1) at ../../migration/migration.c:1764

(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP
(gdb) c

Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x555556779618, old_state=1, new_state=4) at ../../migration/migration.c:1764
1764    in ../../migration/migration.c
(gdb) p (MigrationStatus) 1
$3 = MIGRATION_STATUS_SETUP
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_STATUS_ACTIVE

(qemu) info migrate

Terminal 2)

Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1141

(gdb) p (MigrationStatus) s.state
$6 = MIGRATION_STATUS_SETUP
(gdb) p info.status
$7 = MIGRATION_STATUS_NONE

(gdb) info threads
  Id   Target Id                                          Frame
* 1    Thread 0x7ffff6c32340 (LWP 7562) "qemu-system-x86" fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1141
  2    Thread 0x7ffff65ff6c0 (LWP 7565) "qemu-system-x86" (running)
  3    Thread 0x7ffff5d7c6c0 (LWP 7566) "qemu-system-x86" (running)
  5    Thread 0x7fffa7dff6c0 (LWP 7569) "qemu-system-x86" migrate_set_state (state=0x555556779618, old_state=1, new_state=4) at ../../migration/migration.c:1764

(gdb) thread 5
(gdb) continue &

(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7ffff6c32340 (LWP 7562) "qemu-system-x86" fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1141
  2    Thread 0x7ffff65ff6c0 (LWP 7565) "qemu-system-x86" (running)
  3    Thread 0x7ffff5d7c6c0 (LWP 7566) "qemu-system-x86" (running)
* 5    Thread 0x7fffa7dff6c0 (LWP 7569) "qemu-system-x86" (running)

(gdb) thread 1
(gdb) p (MigrationStatus) s.state
$8 = MIGRATION_STATUS_ACTIVE

(gdb) c

Terminal 3)

Status is now still 'SETUP' (which is not expected to have RAM statistics), not 'ACTIVE' (which is, and caused the issue).

...
Migration status: setup
total time: 0 ms


This bug was fixed in the package qemu - 1:7.0+dfsg-7ubuntu2.2

---------------
qemu (1:7.0+dfsg-7ubuntu2.2) kinetic; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
    to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)

 -- Mauricio Faria de Oliveira <email address hidden>  Thu, 02 Mar 2023 17:29:05 -0300

The verification of the Stable Release Update for qemu has completed successfully and the package is now being released to -updates.  Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report.  In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Hello Brett, or anyone else affected,

Accepted qemu into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:6.2+dfsg-2ubuntu6.7 in a few hours, and then in the -proposed repository.

Please help us by testing this new package.  See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.  Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Hello Brett, or anyone else affected,

Accepted qemu into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:4.2-3ubuntu6.25 in a few hours, and then in the -proposed repository.

Please help us by testing this new package.  See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.  Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Hello Brett, or anyone else affected,

Accepted qemu into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:2.11+dfsg-1ubuntu7.42 in a few hours, and then in the -proposed repository.

Please help us by testing this new package.  See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.  Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

All autopkgtests for the newly accepted qemu (1:6.2+dfsg-2ubuntu6.7) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

initramfs-tools/0.140ubuntu13.1 (amd64)
ubuntu-image/2.2+22.04ubuntu3 (amd64, arm64, ppc64el)


Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!


All autopkgtests for the newly accepted qemu (1:4.2-3ubuntu6.25) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

livecd-rootfs/2.664.46 (amd64)


Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!


All autopkgtests for the newly accepted qemu (1:2.11+dfsg-1ubuntu7.42) for bionic have finished running.
The following regressions have been reported in tests triggered by the package:

systemd/237-3ubuntu10.57 (i386)


Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/bionic/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!


autopkgtests regressions cleared; unrelated to these changes.

Verification done on jammy-proposed.

Followed the instructions as per: https://bugs.launchpad.net/cloud-archive/+bug/1994002/comments/26

With the exception that I had to install the debug symbols package as per https://wiki.ubuntu.com/Debug%20Symbol%20Packages for -proposed.

jammy-updates -- Fail:
ubuntu@qemu-j:~$ nc 127.0.0.1 3333
QEMU 6.2.0 monitor - type 'help' for more information
(qemu) migrate -d tcp:127.0.0.1:4444
migrate -d tcp:127.0.0.1:4444

(qemu)
(qemu) info migrate
info migrate

globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
clear-bitmap-shift: 18
Migration status: active
total time: 0 ms
(qemu)
(qemu) quit
quit

jammy-proposed - Pass:
ubuntu@qemu-j2:~$ nc 127.0.0.1 3333
QEMU 6.2.0 monitor - type 'help' for more information
(qemu) migrate -d tcp:127.0.0.1:4444
migrate -d tcp:127.0.0.1:4444
(qemu) info migrate
info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
clear-bitmap-shift: 18
Migration status: setup
total time: 0 ms
(qemu)

Full gdb session output: https://pastebin.ubuntu.com/p/mkhQzCXKdk/

Verification done for focal-proposed.

focal-updates: FAIL (status: active)

	(qemu) info migrate
	...
	Migration status: active
	total time: 0 milliseconds

focal-proposed: PASS (status: setup)

	(qemu) info migrate
	...
	Migration status: setup
	total time: 0 milliseconds

Details:
=======

$ lsb_release -cs
focal

focal-updates: FAIL
-------------

$ curl http://ddebs.ubuntu.com/dbgsym-release-key.asc | sudo apt-key add -
$ sudo add-apt-repository -y 'deb http://ddebs.ubuntu.com/ubuntu focal-updates main'

$ sudo apt install --yes qemu-system-x86 qemu-system-x86-dbgsym

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:4.2-3ubuntu6.24

$ dpkg -s qemu-system-x86-dbgsym | grep Version:
Version: 1:4.2-3ubuntu6.24

...

$ sudo add-apt-repository -ys 'deb http://archive.ubuntu.com/ubuntu focal-updates main'

$ apt source qemu
$ head -n1 qemu-*/debian/changelog
qemu (1:4.2-3ubuntu6.24) focal-security; urgency=medium

$ vim qemu-*/migration/migration.c

 915 static void fill_source_migration_info(MigrationInfo *info)
...
 925     case MIGRATION_STATUS_SETUP:
 926         info->has_status = true;
 927         info->has_total_time = false;
 928         break;

...

T1)

$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444

T2)

gdb \
  -ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off' \
  qemu-system-x86_64
  
(gdb) b migrate_set_state
Breakpoint 1 at 0x6d3aa0: migrate_set_state. (2 locations)

(gdb) b migration/migration.c:928
Breakpoint 2 at 0x6d317b: file ./migration/migration.c, line 928.

(gdb) run -nodefaults -nographic -S -monitor tcp:0:3333,server,wait=off

T3)

nc 127.0.0.1 3333

(qemu) migrate -d tcp:127.0.0.1:4444

T2)

Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566949d8, old_state=0, new_state=1) at ./migration/migration.c:1463
1463    ./migration/migration.c: No such file or directory.
(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP
(gdb) c

Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566949d8, old_state=1, new_state=4) at ./migration/migration.c:1463
1463    in ./migration/migration.c
(gdb) p (MigrationStatus) 1
$3 = MIGRATION_STATUS_SETUP
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_STATUS_ACTIVE
(gdb)

T3)

(qemu) info migrate

T2)

Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_migration_info (info=0x555556850590) at ./migration/migration.c:928
928     in ./migration/migration.c

(gdb) p (MigrationStatus) s.state
$6 = MIGRATION_STATUS_SETUP
(gdb) p info.status
$7 = MIGRATION_STATUS_NONE

(gdb) info threads
  Id   Target Id                                          Frame
* 1    Thread 0x7ffff5ee55c0 (LWP 5066) "qemu-system-x86" fill_source_migration_info (info=0x555556850590) at ./migration/migration.c:928
  2    Thread 0x7ffff5ee1700 (LWP 5070) "qemu-system-x86" (running)
  3    Thread 0x7ffff565f700 (LWP 5071) "qemu-system-x86" (running)
  5    Thread 0x7fffedfff700 (LWP 5075) "qemu-system-x86" migrate_set_state (state=0x5555566949d8, old_state=1, new_state=4) at ./migration/migration.c:1463
(gdb) thread 5
[Switching to thread 5 (Thread 0x7fffedfff700 (LWP 5075))]
#0  migrate_set_state (state=0x5555566949d8, old_state=1, new_state=4) at ./migration/migration.c:1463
1463    in ./migration/migration.c

(gdb) continue &
Continuing.
(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7ffff5ee55c0 (LWP 5066) "qemu-system-x86" fill_source_migration_info (info=0x555556850590) at ./migration/migration.c:928
  2    Thread 0x7ffff5ee1700 (LWP 5070) "qemu-system-x86" (running)
  3    Thread 0x7ffff565f700 (LWP 5071) "qemu-system-x86" (running)
* 5    Thread 0x7fffedfff700 (LWP 5075) "qemu-system-x86" (running)

(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff5ee55c0 (LWP 5066))]
#0  fill_source_migration_info (info=0x555556850590) at ./migration/migration.c:928
928     in ./migration/migration.c
(gdb) p (MigrationStatus) s.state
$8 = MIGRATION_STATUS_ACTIVE
(gdb) c

T3)

(qemu) info migrate
info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
clear-bitmap-shift: 18
Migration status: active
total time: 0 milliseconds
(qemu)

Migration status is active, without any RAM statistics.

(qemu) quit
(gdb) quit

Terminal 1)

Ctrl-C




focal-proposed: PASS
--------------


$ sudo add-apt-repository -ys 'deb http://archive.ubuntu.com/ubuntu focal-proposed main'
$ sudo add-apt-repository -y 'deb http://ddebs.ubuntu.com/ubuntu focal-proposed main'

$ sudo apt install --yes qemu-system-x86 qemu-system-x86-dbgsym


$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:4.2-3ubuntu6.25

$ dpkg -s qemu-system-x86-dbgsym | grep Version:
Version: 1:4.2-3ubuntu6.25

...

$ apt source qemu

$ head -n1 qemu-*/debian/changelog
qemu (1:4.2-3ubuntu6.25) focal; urgency=medium

$ vim qemu-*/migration/migration.c

 915 static void fill_source_migration_info(MigrationInfo *info)
...
 926     case MIGRATION_STATUS_SETUP:
 927         info->has_status = true;
 928         info->has_total_time = false;
 929         break;

...




T1)

$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444

T2)

gdb \
  -ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off' \
  qemu-system-x86_64
  
(gdb) b migrate_set_state
Breakpoint 1 at 0x6d3b80: migrate_set_state. (2 locations)
(gdb) b migration/migration.c:928
Breakpoint 2 at 0x6d32ad: file ./migration/migration.c, line 928.

(gdb) run -nodefaults -nographic -S -monitor tcp:0:3333,server,wait=off

T3)

nc 127.0.0.1 3333

(qemu) migrate -d tcp:127.0.0.1:4444

T2)

Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566949d8, old_state=0, new_state=1) at ./migration/migration.c:1464
1464    ./migration/migration.c: No such file or directory.
(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP
(gdb) c
Continuing.
[New Thread 0x7fffedfff700 (LWP 6990)]
[New Thread 0x7fffed7fe700 (LWP 6991)]
[Thread 0x7fffedfff700 (LWP 6990) exited]

Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566949d8, old_state=1, new_state=4) at ./migration/migration.c:1464
1464    in ./migration/migration.c
(gdb) p (MigrationStatus) 1
$3 = MIGRATION_STATUS_SETUP
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_STATUS_ACTIVE
(gdb)

T3)

(qemu) info migrate

T2)

Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_migration_info (info=0x555556850590) at ./migration/migration.c:928
928     in ./migration/migration.c

(gdb) p (MigrationStatus) s.state
$6 = MIGRATION_STATUS_SETUP
(gdb) p info.status
$7 = MIGRATION_STATUS_NONE

(gdb) info threads
  Id   Target Id                                          Frame
* 1    Thread 0x7ffff5ee55c0 (LWP 6983) "qemu-system-x86" fill_source_migration_info (info=0x555556850590) at ./migration/migration.c:928
  2    Thread 0x7ffff5ee1700 (LWP 6987) "qemu-system-x86" (running)
  3    Thread 0x7ffff565f700 (LWP 6988) "qemu-system-x86" (running)
  5    Thread 0x7fffed7fe700 (LWP 6991) "qemu-system-x86" migrate_set_state (state=0x5555566949d8, old_state=1, new_state=4) at ./migration/migration.c:1464
(gdb) thread 5
[Switching to thread 5 (Thread 0x7fffed7fe700 (LWP 6991))]
#0  migrate_set_state (state=0x5555566949d8, old_state=1, new_state=4) at ./migration/migration.c:1464
1464    in ./migration/migration.c

(gdb) continue &
Continuing.

(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7ffff5ee55c0 (LWP 6983) "qemu-system-x86" fill_source_migration_info (info=0x555556850590) at ./migration/migration.c:928
  2    Thread 0x7ffff5ee1700 (LWP 6987) "qemu-system-x86" (running)
  3    Thread 0x7ffff565f700 (LWP 6988) "qemu-system-x86" (running)
* 5    Thread 0x7fffed7fe700 (LWP 6991) "qemu-system-x86" (running)
(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff5ee55c0 (LWP 6983))]
#0  fill_source_migration_info (info=0x555556850590) at ./migration/migration.c:928
928     in ./migration/migration.c
(gdb) p (MigrationStatus) s.state
$8 = MIGRATION_STATUS_ACTIVE
(gdb) c

T3)

(qemu) info migrate
info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
clear-bitmap-shift: 18
Migration status: setup
total time: 0 milliseconds

Status is now still 'SETUP' (which is not expected to have RAM statistics), not 'ACTIVE' (which is, and caused the issue).

(qemu) quit
(gdb) quit

Terminal 1)

Ctrl-C

Verification done for bionic-proposed.

bionic-updates: FAIL (status: active)

	(qemu) info migrate
	info migrate
	globals: store-global-state=1, only_migratable=0, send-configuration=1, send-section-footer=1
	capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off postcopy-ram: off x-colo: off release-ram: off block: off return-path: off pause-before-switchover: off x-multifd: off
	Migration status: active
	total time: 0 milliseconds

bionic-proposed: PASS (status: setup)

	(qemu) info migrate
	info migrate
	globals: store-global-state=1, only_migratable=0, send-configuration=1, send-section-footer=1
	capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off postcopy-ram: off x-colo: off release-ram: off block: off return-path: off pause-before-switchover: off x-multifd: off
	Migration status: setup
	total time: 0 milliseconds

Details:
=======

$ lsb_release -cs
bionic

bionic-updates: FAIL
--------------

$ curl http://ddebs.ubuntu.com/dbgsym-release-key.asc | sudo apt-key add -
OK
$ sudo add-apt-repository -y 'deb http://ddebs.ubuntu.com/ubuntu bionic-updates main'

$ sudo apt install --yes qemu-system-x86 qemu-system-x86-dbgsym

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:2.11+dfsg-1ubuntu7.41

$ dpkg -s qemu-system-x86-dbgsym | grep Version:
Version: 1:2.11+dfsg-1ubuntu7.41

...

$ sudo add-apt-repository -ys 'deb http://archive.ubuntu.com/ubuntu bionic-updates main'
$ apt source qemu
$ head -n1 qemu-*/debian/changelog
qemu (1:2.11+dfsg-1ubuntu7.41) bionic-security; urgency=medium

$ vim qemu-*/migration/migration.c
 594 MigrationInfo *qmp_query_migrate(Error **errp)
 ...
 603     case MIGRATION_STATUS_SETUP:
 604         info->has_status = true;
 605         info->has_total_time = false;
 606         break;
...

T1)

$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444

T2)

(gdb) b migrate_set_state
Breakpoint 1 at 0x58dd60: file ./migration/migration.c, line 1025.

(gdb) b migration/migration.c:603
Breakpoint 2 at 0x58d670: file ./migration/migration.c, line 603.

# Using 603 vs 606 as the code didn't break on 606 for some reason.

(gdb) run -nodefaults -nographic -S -monitor tcp:0:3333,server,wait=off

T3)

$ nc 127.0.0.1 3333

(qemu) migrate -d tcp:127.0.0.1:4444

T2)

Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566ac6f0, old_state=0, new_state=1) at ./migration/migration.c:1025
1025    ./migration/migration.c: No such file or directory.
(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP
(gdb) c
Continuing.
[New Thread 0x7fffcf9ff700 (LWP 4909)]
[New Thread 0x7fffcf1fe700 (LWP 4910)]
[Thread 0x7fffcf9ff700 (LWP 4909) exited]

Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566ac6f0, old_state=1, new_state=4) at ./migration/migration.c:1025
1025    in ./migration/migration.c
(gdb) p (MigrationStatus) 1
$3 = MIGRATION_STATUS_SETUP
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_STATUS_ACTIVE

T3)

(qemu) info migrate

T2)

Thread 1 "qemu-system-x86" hit Breakpoint 2, qmp_query_migrate (errp=errp@entry=0x0) at ./migration/migration.c:604
604     in ./migration/migration.c
(gdb) p (MigrationStatus) s.state
value has been optimized out
(gdb) p info.status
$1 = MIGRATION_STATUS_NONE

(gdb) info threads
  Id   Target Id         Frame
* 1    Thread 0x7ffff7fc1cc0 (LWP 4916) "qemu-system-x86" qmp_query_migrate (errp=errp@entry=0x0) at ./migration/migration.c:604
  2    Thread 0x7fffdf7ff700 (LWP 4920) "qemu-system-x86" (running)
  3    Thread 0x7fffdcffe700 (LWP 4921) "qemu-system-x86" (running)
  5    Thread 0x7fffcf9ff700 (LWP 4924) "qemu-system-x86" migrate_set_state (state=0x5555566ac6f0, old_state=1, new_state=4) at ./migration/migration.c:1025

(gdb) thread 5
[Switching to thread 5 (Thread 0x7fffcf9ff700 (LWP 4924))]
#0  migrate_set_state (state=0x5555566ac6f0, old_state=1, new_state=4) at ./migration/migration.c:1025
1025    in ./migration/migration.c
(gdb) continue &
Continuing.

(gdb) info threads
  Id   Target Id         Frame
  1    Thread 0x7ffff7fc1cc0 (LWP 4916) "qemu-system-x86" qmp_query_migrate (errp=errp@entry=0x0) at ./migration/migration.c:604
  2    Thread 0x7fffdf7ff700 (LWP 4920) "qemu-system-x86" (running)
  3    Thread 0x7fffdcffe700 (LWP 4921) "qemu-system-x86" (running)
* 5    Thread 0x7fffcf9ff700 (LWP 4924) "qemu-system-x86" (running)

(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff7fc1cc0 (LWP 4916))]
#0  qmp_query_migrate (errp=errp@entry=0x0) at ./migration/migration.c:604
604     in ./migration/migration.c
(gdb) p (MigrationStatus) s.state
value has been optimized out
(gdb) c

T3)

(qemu) info migrate
info migrate
globals: store-global-state=1, only_migratable=0, send-configuration=1, send-section-footer=1
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off postcopy-ram: off x-colo: off release-ram: off block: off return-path: off pause-before-switchover: off x-multifd: off
Migration status: active
total time: 0 milliseconds

Migration status is active, without any RAM statistics.



bionic-proposed: PASS
---------------

$ sudo add-apt-repository -ys 'deb http://archive.ubuntu.com/ubuntu bionic-proposed main'
$ sudo add-apt-repository -y 'deb http://ddebs.ubuntu.com/ubuntu bionic-proposed main'

$ sudo apt install --yes qemu-system-x86 qemu-system-x86-dbgsym

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:2.11+dfsg-1ubuntu7.42

$ dpkg -s qemu-system-x86-dbgsym | grep Version:
Version: 1:2.11+dfsg-1ubuntu7.42

$ rm -rf qemu*
$ apt source qemu

$ head -n1 qemu-*/debian/changelog
qemu (1:2.11+dfsg-1ubuntu7.42) bionic; urgency=medium

$ vim qemu-*/migration/migration.c
 594 MigrationInfo *qmp_query_migrate(Error **errp)
...
 604     case MIGRATION_STATUS_SETUP:
 605         info->has_status = true;
 606         info->has_total_time = false;
 607         break;


T1)

$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444

T2)

gdb \
  -ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off' \
  qemu-system-x86_64

(gdb) b migrate_set_state
Breakpoint 1 at 0x58de30: file ./migration/migration.c, line 1026.

(gdb) b migration/migration.c:604
Breakpoint 2 at 0x58d748: file ./migration/migration.c, line 604.

(gdb) run -nodefaults -nographic -S -monitor tcp:0:3333,server,wait=off


T3)

nc 127.0.0.1 3333

(qemu) migrate -d tcp:127.0.0.1:4444

T2)

Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566ac6f0, old_state=0, new_state=1) at ./migration/migration.c:1026
1026    ./migration/migration.c: No such file or directory.
(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP
(gdb) c
Continuing.
[New Thread 0x7fffcf9ff700 (LWP 6525)]
[New Thread 0x7fffcf1fe700 (LWP 6526)]
[Thread 0x7fffcf9ff700 (LWP 6525) exited]

Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566ac6f0, old_state=1, new_state=4) at ./migration/migration.c:1026
1026    in ./migration/migration.c
(gdb) p (MigrationStatus) 1
$3 = MIGRATION_STATUS_SETUP
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_STATUS_ACTIVE

T3)

(qemu) info migrate

T2)

Thread 1 "qemu-system-x86" hit Breakpoint 2, qmp_query_migrate (errp=errp@entry=0x0) at ./migration/migration.c:605
605     in ./migration/migration.c
(gdb) p (MigrationStatus) s.state
value has been optimized out
(gdb) p info.status
$5 = MIGRATION_STATUS_NONE

(gdb) info threads
  Id   Target Id         Frame
* 1    Thread 0x7ffff7fc1cc0 (LWP 6518) "qemu-system-x86" qmp_query_migrate (errp=errp@entry=0x0) at ./migration/migration.c:605
  2    Thread 0x7fffdf7ff700 (LWP 6522) "qemu-system-x86" (running)
  3    Thread 0x7fffdcffe700 (LWP 6523) "qemu-system-x86" (running)
  5    Thread 0x7fffcf1fe700 (LWP 6526) "qemu-system-x86" migrate_set_state (state=0x5555566ac6f0, old_state=1, new_state=4) at ./migration/migration.c:1026
(gdb) thread 5
[Switching to thread 5 (Thread 0x7fffcf1fe700 (LWP 6526))]
#0  migrate_set_state (state=0x5555566ac6f0, old_state=1, new_state=4) at ./migration/migration.c:1026
1026    in ./migration/migration.c
(gdb) continue &
Continuing.
(gdb) info threads
  Id   Target Id         Frame
  1    Thread 0x7ffff7fc1cc0 (LWP 6518) "qemu-system-x86" qmp_query_migrate (errp=errp@entry=0x0) at ./migration/migration.c:605
  2    Thread 0x7fffdf7ff700 (LWP 6522) "qemu-system-x86" (running)
  3    Thread 0x7fffdcffe700 (LWP 6523) "qemu-system-x86" (running)
* 5    Thread 0x7fffcf1fe700 (LWP 6526) "qemu-system-x86" (running)

(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff7fc1cc0 (LWP 6518))]
#0  qmp_query_migrate (errp=errp@entry=0x0) at ./migration/migration.c:605
605     in ./migration/migration.c
(gdb) p (MigrationStatus) s.state
value has been optimized out

(gdb) c

T3)

(qemu) info migrate
info migrate
globals: store-global-state=1, only_migratable=0, send-configuration=1, send-section-footer=1
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off postcopy-ram: off x-colo: off release-ram: off block: off return-path: off pause-before-switchover: off x-multifd: off
Migration status: setup
total time: 0 milliseconds

Status is now still 'SETUP' (which is not expected to have RAM statistics), not 'ACTIVE' (which is, and caused the issue).

(qemu) quit
(gdb) quit

Terminal 1)

Ctrl-C


I verified the test results and am satisfied that they show the executed planned test case, and that the results are correct.

The package built correctly in all architectures and Ubuntu releases it was meant for.

There are no DEP8 regressions at the moment.

There is no SRU freeze ongoing at the moment.

There is no halted phasing on the previous update.


This bug was fixed in the package qemu - 1:6.2+dfsg-2ubuntu6.7

---------------
qemu (1:6.2+dfsg-2ubuntu6.7) jammy; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
    to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)
  * d/rules: move "Disable LTO on non-amd64" before buildflags.mk on Jammy.

  [ Michal Maloszewski ]
  * d/rules: Disable LTO on non-amd 64 architectures to prevent QEMU
    coroutines from failing (LP: #1921664)

 -- Mauricio Faria de Oliveira <email address hidden>  Mon, 06 Mar 2023 17:00:46 -0300

This bug was fixed in the package qemu - 1:4.2-3ubuntu6.25

---------------
qemu (1:4.2-3ubuntu6.25) focal; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
    to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)

 -- Mauricio Faria de Oliveira <email address hidden>  Thu, 02 Mar 2023 18:07:21 -0300

This bug was fixed in the package qemu - 1:2.11+dfsg-1ubuntu7.42

---------------
qemu (1:2.11+dfsg-1ubuntu7.42) bionic; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
    to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)

 -- Mauricio Faria de Oliveira <email address hidden>  Thu, 02 Mar 2023 18:26:12 -0300

Marking the UCA tasks as Invalid, as apparently not needed; please revert otherwise.

Hello Brett, or anyone else affected,

Accepted qemu into ussuri-proposed. The package will build now and be available in the Ubuntu Cloud Archive in a few hours, and then in the -proposed repository.

Please help us by testing this new package. To enable the -proposed repository:

  sudo add-apt-repository cloud-archive:ussuri-proposed
  sudo apt-get update

Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-ussuri-needed to verification-ussuri-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-ussuri-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Verification done on ussuri-proposed.
Steps explained in previous comments.

The migration status with the synthetic reproducer in GDB
is now still 'SETUP' (which is not expected to have RAM statistics),
instead of 'ACTIVE' (which is, and caused the issue):

(qemu) info migrate
...
Migration status: setup

...

$ lsb_release -cs
bionic

$ apt policy qemu-system-x86
qemu-system-x86:
  Installed: 1:4.2-3ubuntu6.27~cloud0
  Candidate: 1:4.2-3ubuntu6.27~cloud0
  Version table:
 *** 1:4.2-3ubuntu6.27~cloud0 500
        500 http://ubuntu-cloud.archive.canonical.com/ubuntu bionic-proposed/ussuri/main amd64 Packages
        100 /var/lib/dpkg/status
...

$ file $(which qemu-system-x86_64) | grep -o 'BuildID.*,'
BuildID[sha1]=82a4159294ae653e770be24bbcfbb35703e60005,

(Corey provided the .ddeb packages which is not yet exposed/published in PPAs/archive.)

$ dpkg-deb -c qemu-system-x86-dbgsym_4.2-3ubuntu6.27~cloud0_amd64.ddeb | fgrep .debug
-rw-r--r-- root/root  21271712 2023-10-26 14:08 ./usr/lib/debug/.build-id/48/bd78ceee4a669d37efd9ac8d851947205de4f7.debug
-rw-r--r-- root/root  21321832 2023-10-26 14:08 ./usr/lib/debug/.build-id/82/a4159294ae653e770be24bbcfbb35703e60005.debug

$ sudo apt install ./qemu-system-x86-dbgsym_4.2-3ubuntu6.27~cloud0_amd64.ddeb

$ apt source qemu

$ head -n1 qemu-4.2/debian/changelog
qemu (1:4.2-3ubuntu6.27~cloud0) bionic-ussuri; urgency=medium

 915 static void fill_source_migration_info(MigrationInfo *info)
...
 926     case MIGRATION_STATUS_SETUP:
 927         info->has_status = true;
 928         info->has_total_time = false;
 929         break;

Terminal 1)

$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444

Terminal 2)

$ gdb \
  -ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off' \
  qemu-system-x86_64
...
Reading symbols from qemu-system-x86_64...Reading symbols from /usr/lib/debug/.build-id/82/a4159294ae653e770be24bbcfbb35703e60005.debug...done.
done.

(gdb) b migrate_set_state
Breakpoint 1 at 0x6ba8c0: file ./migration/migration.c, line 1464.

(gdb) b migration/migration.c:928
Breakpoint 2 at 0x6b9fb3: file ./migration/migration.c, line 928.

(gdb) run -nodefaults -nographic -S -monitor tcp:0:3333,server,wait=off
...

Terminal 3)

$ nc 127.0.0.1 3333
QEMU 4.2.1 monitor - type 'help' for more information
(qemu) migrate -d tcp:127.0.0.1:4444

Terminal 2)

Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566a11d8, old_state=0, new_state=1) at ./migration/migration.c:1464
1464    ./migration/migration.c: No such file or directory.

(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE

(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP

(gdb) c
Continuing.
...

Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x5555566a11d8, old_state=1, new_state=4) at ./migration/migration.c:1464
1464    in ./migration/migration.c

(gdb) p (MigrationStatus) 1
$3 = MIGRATION_STATUS_SETUP

(gdb) p (MigrationStatus) 4
$4 = MIGRATION_STATUS_ACTIVE

(gdb)

Terminal 3)

(qemu) info migrate

Terminal 2)

Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_migration_info (info=0x5555572d29b0) at ./migration/migration.c:928
928     in ./migration/migration.c

(gdb) info threads
  Id   Target Id         Frame
* 1    Thread 0x7ffff7fcdcc0 (LWP 1477) "qemu-system-x86" fill_source_migration_info (info=0x5555572d29b0) at ./migration/migration.c:928
  2    Thread 0x7fffe61ff700 (LWP 1481) "qemu-system-x86" (running)
  3    Thread 0x7fffe59fe700 (LWP 1482) "qemu-system-x86" (running)
  5    Thread 0x7fffdd7fe700 (LWP 1485) "qemu-system-x86" migrate_set_state (state=0x5555566a11d8, old_state=1, new_state=4) at ./migration/migration.c:1464
  
(gdb) thread 5
[Switching to thread 5 (Thread 0x7fffdd7fe700 (LWP 1485))]
#0  migrate_set_state (state=0x5555566a11d8, old_state=1, new_state=4) at ./migration/migration.c:1464
1464    in ./migration/migration.c

(gdb) continue &
Continuing.

(gdb) info threads
  Id   Target Id         Frame
  1    Thread 0x7ffff7fcdcc0 (LWP 1477) "qemu-system-x86" fill_source_migration_info (info=0x5555572d29b0) at ./migration/migration.c:928
  2    Thread 0x7fffe61ff700 (LWP 1481) "qemu-system-x86" (running)
  3    Thread 0x7fffe59fe700 (LWP 1482) "qemu-system-x86" (running)
* 5    Thread 0x7fffdd7fe700 (LWP 1485) "qemu-system-x86" (running)

(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff7fcdcc0 (LWP 1477))]
#0  fill_source_migration_info (info=0x5555572d29b0) at ./migration/migration.c:928
928     in ./migration/migration.c

(gdb) c
Continuing.

Terminal 3)

(qemu) info migrate
info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
clear-bitmap-shift: 18
Migration status: setup
total time: 0 milliseconds

Status is now still 'SETUP' (which is not expected to have RAM statistics), not 'ACTIVE' (which is, and caused the issue).

The verification of the Stable Release Update for qemu has completed successfully and the package has now been released to -updates. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.


This bug was fixed in the package qemu - 1:4.2-3ubuntu6.27~cloud0
---------------

 qemu (1:4.2-3ubuntu6.27~cloud0) bionic-ussuri; urgency=medium
 .
   * New update for the Ubuntu Cloud Archive.
 .
 qemu (1:4.2-3ubuntu6.27) focal-security; urgency=medium
 .
   * SECURITY UPDATE: user-after-free issue
     - debian/patches/CVE-2022-1050.patch: Protect against buggy or
       malicious guest driver
     - CVE-2022-1050
   * SECURITY UPDATE: Out-of-bounds read
     - debian/patches/CVE-2022-4144-*.patch: Have qxl_log_command Return
       early if no log_cmd handler; Document qxl_phys2virt(); Pass requested
       buffer size to qxl_phys2virt(); Avoid buffer overrun in qxl_phys2virt;
       Assert memory slot fits in preallocated MemoryRegion
     - CVE-2022-4144
   * SECURITY UPDATE: reentrancy problem
     - debian/patches/CVE-2023-0330.patch: Fix reentrancy issues in the LSI
       controller
     - CVE-2023-0330
 .
 qemu (1:4.2-3ubuntu6.26) focal; urgency=medium
 .
   * d/p/u/lp-1999885-s390x-tod-kvm-don-t-save-restore-the-TOD-in-PV-guest.patch:
     avoid timer issues in s390x secure execution guests (LP: #1999885)
 .
 qemu (1:4.2-3ubuntu6.25) focal; urgency=medium
 .
   [ Brett Milford ]
   * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
     error 'migration was active, but no RAM info was set' (LP: #1994002)
 .
   [ Mauricio Faria de Oliveira ]
   * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
     to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)