From fa647905e6baae9510e7ddcd640961bad60ba14c Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Sat, 21 Nov 2020 21:35:06 +0000 Subject: [PATCH] qemu-options.hx: Fix minor issues in icount documentation The documentation for the icount documentation has some minor issues: * in a couple of places it says "sleep=on|off" when in the context of the sentence it means specifically "sleep=on" * the synopsis line for the documentation has drifted out of sync with the synopsis line in the DEF() macro (used for "-help" output) * the synopsis line in the DEF() macro is missing a "][" between the sleep= part and the rr= part * the synopsis line doesn't indicate that rrsnapshot is an optional part of the rr=mode,rrfile=filename subgrouping * we don't document that sleep=on can't be used with shift=auto or align=on * the rr option description had some minor grammar and formatting errors and was a bit terse * in commit f1f4b57e88ff in 2015 the documentation of the sleep= suboption got added between the two paragraphs defining general behaviour of the icount option. This meant that the second paragraph talking about the behaviour of "this option" reads as if it's talking about sleep=on, when it's really describing -icount as a whole. The paragraph is better moved back up to above the sleep= section. * the summary text displayed in "-help" output didn't mention the record-and-replay part Fix these errors. Fixes: https://bugs.launchpad.net/qemu/+bug/1774412 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20201121213506.15599-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- qemu-options.hx | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index e60ad42976..ae8872d1d6 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3958,30 +3958,34 @@ SRST ERST DEF("icount", HAS_ARG, QEMU_OPTION_icount, \ - "-icount [shift=N|auto][,align=on|off][,sleep=on|off,rr=record|replay,rrfile=,rrsnapshot=]\n" \ + "-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=[,rrsnapshot=]]\n" \ " enable virtual instruction counter with 2^N clock ticks per\n" \ " instruction, enable aligning the host and virtual clocks\n" \ - " or disable real time cpu sleeping\n", QEMU_ARCH_ALL) + " or disable real time cpu sleeping, and optionally enable\n" \ + " record-and-replay mode\n", QEMU_ARCH_ALL) SRST -``-icount [shift=N|auto][,rr=record|replay,rrfile=filename,rrsnapshot=snapshot]`` +``-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=filename[,rrsnapshot=snapshot]]`` Enable virtual instruction counter. The virtual cpu will execute one instruction every 2^N ns of virtual time. If ``auto`` is specified then the virtual cpu speed will be automatically adjusted to keep virtual time within a few seconds of real time. - When the virtual cpu is sleeping, the virtual time will advance at - default speed unless ``sleep=on|off`` is specified. With - ``sleep=on|off``, the virtual time will jump to the next timer - deadline instantly whenever the virtual cpu goes to sleep mode and - will not advance if no timer is enabled. This behavior give - deterministic execution times from the guest point of view. - Note that while this option can give deterministic behavior, it does not provide cycle accurate emulation. Modern CPUs contain superscalar out of order cores with complex cache hierarchies. The number of instructions executed often has little or no correlation with actual performance. + When the virtual cpu is sleeping, the virtual time will advance at + default speed unless ``sleep=on`` is specified. With + ``sleep=on``, the virtual time will jump to the next timer + deadline instantly whenever the virtual cpu goes to sleep mode and + will not advance if no timer is enabled. This behavior gives + deterministic execution times from the guest point of view. + The default if icount is enabled is ``sleep=off``. + ``sleep=on`` cannot be used together with either ``shift=auto`` + or ``align=on``. + ``align=on`` will activate the delay algorithm which will try to synchronise the host clock and the virtual clock. The goal is to have a guest running at the real frequency imposed by the shift @@ -3991,15 +3995,17 @@ SRST ``shift`` is ``auto``. Note: The sync algorithm will work for those shift values for which the guest clock runs ahead of the host clock. Typically this happens when the shift value is high (how high - depends on the host machine). + depends on the host machine). The default if icount is enabled + is ``align=off``. - When ``rr`` option is specified deterministic record/replay is - enabled. Replay log is written into filename file in record mode and - read from this file in replay mode. - - Option rrsnapshot is used to create new vm snapshot named snapshot - at the start of execution recording. In replay mode this option is - used to load the initial VM state. + When the ``rr`` option is specified deterministic record/replay is + enabled. The ``rrfile=`` option must also be provided to + specify the path to the replay log. In record mode data is written + to this file, and in replay mode it is read back. + If the ``rrsnapshot`` option is given then it specifies a VM snapshot + name. In record mode, a new VM snapshot with the given name is created + at the start of execution recording. In replay mode this option + specifies the snapshot name used to load the initial VM state. ERST DEF("watchdog", HAS_ARG, QEMU_OPTION_watchdog, \