* Alano Song ([email protected]) wrote:
> 
> 
> 
> At 2026-05-28 23:24:56, "Philippe Mathieu-Daudé" <[email protected]> wrote:
> >Hi,
> >
> >On 24/5/26 14:41, [email protected] wrote:
> >> When booting an i386 guest, the `info tlb` command
> >> may walk the entire page table hierarchy and emit
> >> an enormous amount of output (as many as 800+ million
> >> entries under my test).
> >> It will take dozens of minutes to print all the info,
> >> because each monitor print function will holds 'mon_lock'.
> >> This effectively hangs the qemu monitor, and even leading
> >> to program exit due to timeout.
> >> 
> >> So it may be better to show only the first 32 entries
> >> and the last entry by default.
> >> 
> >> And if full output is required, the user can redirect
> >> the output to a file by specifying a file name, e.g.:
> >> `info tlb xxx.txt`.
> >> 
> >> Signed-off-by: Alano Song <[email protected]>
> >> ---
> >>   hmp-commands-info.hx  |  10 +-
> >>   target/i386/monitor.c | 230 ++++++++++++++++++++++++++++++++++--------
> >>   2 files changed, 195 insertions(+), 45 deletions(-)
> >> 
> >> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> >> index 82134eb6c2..33b4604d11 100644
> >> --- a/hmp-commands-info.hx
> >> +++ b/hmp-commands-info.hx
> >> @@ -188,17 +188,19 @@ ERST
> >>   
> >>       {
> >>           .name       = "tlb",
> >> -        .args_type  = "",
> >> -        .params     = "",
> >> -        .help       = "show virtual to physical memory mappings",
> >> +        .args_type  = "file:s?",
> >> +        .params     = "[file]",
> >> +        .help       = "show virtual to physical memory mappings 
> >> (optionally save to file)",
> >>           .cmd        = hmp_info_tlb,
> >>           .arch_bitmask = QEMU_ARCH_I386 | QEMU_ARCH_SH4 | QEMU_ARCH_SPARC 
> >> \
> >>                           | QEMU_ARCH_PPC | QEMU_ARCH_XTENSA | 
> >> QEMU_ARCH_M68K,
> >>       },
> >>   
> >>   SRST
> >> -  ``info tlb``
> >> +  ``info tlb`` [*file*]
> >>       Show virtual to physical memory mappings.
> >> +    If *file* is specified, the output is saved to the given file
> >> +    instead of being printed to the monitor.
> >>   ERST
> >
> >What about passing count or range by argument instead, keeping the
> 
> >default behavior?
> 
> 
> Hi, Philippe:
> 
> 
> Your suggestion is good,
> I can add several options,
> so that users can control the output range and count.
> 
> 
> And just as I described earlier, we should modify the default behavior:
> only print the first 32 entries and the last entry.
> so that users can know the range while avoiding
> the output of all the entries (there are too many).

A comment in the help warning that they'll get a lot of output would
be good as well.

Dave

> 
> Alano.
> 
> 
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

Reply via email to