1*774ad6b5SPeter Xu==============
2*774ad6b5SPeter XuBest practices
3*774ad6b5SPeter Xu==============
4*774ad6b5SPeter Xu
5*774ad6b5SPeter XuDebugging
6*774ad6b5SPeter Xu=========
7*774ad6b5SPeter Xu
8*774ad6b5SPeter XuThe migration stream can be analyzed thanks to ``scripts/analyze-migration.py``.
9*774ad6b5SPeter Xu
10*774ad6b5SPeter XuExample usage:
11*774ad6b5SPeter Xu
12*774ad6b5SPeter Xu.. code-block:: shell
13*774ad6b5SPeter Xu
14*774ad6b5SPeter Xu  $ qemu-system-x86_64 -display none -monitor stdio
15*774ad6b5SPeter Xu  (qemu) migrate "exec:cat > mig"
16*774ad6b5SPeter Xu  (qemu) q
17*774ad6b5SPeter Xu  $ ./scripts/analyze-migration.py -f mig
18*774ad6b5SPeter Xu  {
19*774ad6b5SPeter Xu    "ram (3)": {
20*774ad6b5SPeter Xu        "section sizes": {
21*774ad6b5SPeter Xu            "pc.ram": "0x0000000008000000",
22*774ad6b5SPeter Xu  ...
23*774ad6b5SPeter Xu
24*774ad6b5SPeter XuSee also ``analyze-migration.py -h`` help for more options.
25*774ad6b5SPeter Xu
26*774ad6b5SPeter XuFirmware
27*774ad6b5SPeter Xu========
28*774ad6b5SPeter Xu
29*774ad6b5SPeter XuMigration migrates the copies of RAM and ROM, and thus when running
30*774ad6b5SPeter Xuon the destination it includes the firmware from the source. Even after
31*774ad6b5SPeter Xuresetting a VM, the old firmware is used.  Only once QEMU has been restarted
32*774ad6b5SPeter Xuis the new firmware in use.
33*774ad6b5SPeter Xu
34*774ad6b5SPeter Xu- Changes in firmware size can cause changes in the required RAMBlock size
35*774ad6b5SPeter Xu  to hold the firmware and thus migration can fail.  In practice it's best
36*774ad6b5SPeter Xu  to pad firmware images to convenient powers of 2 with plenty of space
37*774ad6b5SPeter Xu  for growth.
38*774ad6b5SPeter Xu
39*774ad6b5SPeter Xu- Care should be taken with device emulation code so that newer
40*774ad6b5SPeter Xu  emulation code can work with older firmware to allow forward migration.
41*774ad6b5SPeter Xu
42*774ad6b5SPeter Xu- Care should be taken with newer firmware so that backward migration
43*774ad6b5SPeter Xu  to older systems with older device emulation code will work.
44*774ad6b5SPeter Xu
45*774ad6b5SPeter XuIn some cases it may be best to tie specific firmware versions to specific
46*774ad6b5SPeter Xuversioned machine types to cut down on the combinations that will need
47*774ad6b5SPeter Xusupport.  This is also useful when newer versions of firmware outgrow
48*774ad6b5SPeter Xuthe padding.
49