Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Nov 2022 14:06:47 -0500
From:      Mark Johnston <markj@freebsd.org>
To:        "Bjoern A. Zeeb" <bz@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Can we "pause" in loader and ddb>?
Message-ID:  <Y3vMRxjj0GZsc29R@nuc>
In-Reply-To: <oso1756-4q74-7850-4s5r-7sq5qr0sp18@mnoonqbm.arg>
References:  <oso1756-4q74-7850-4s5r-7sq5qr0sp18@mnoonqbm.arg>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 21, 2022 at 06:42:44PM +0000, Bjoern A. Zeeb wrote:
> Hi,
> 
> having a VM sitting (a) in loader prompt or (b) in ddb> makes the fans
> go loud on a test-laptop which makes one wonder if we can avoid that.
> Note -- I assume also on real HW though that's less likely observered
> here.
> 
> For example I am sitting in a 4 vCPU bhyve current in ddb> and two
> threads are at 100% on the base system.  Do we need to heat up the
> planet doing that or are there alternatives?  I haven't looke dta the
> code in ages and I assume we need to poll in these situations on the
> console and for interactivity often enough?  Can we "pause"?   And why
> would two [v]CPUs be at 100% and not just one as I would expect all but
> one to be stopped?

When DDB is active, one CPU is going to be spinning in cncheckc()
waiting for input, and the others will be in cpustop_handler().  For the
latter, there is an option to use MWAIT/MONITOR to pause the CPU instead
of calling pause in a loop, but bhyve hides the MWAIT/MONITOR CPU
capability from guests (I'm not sure exactly why), so they just execute
"pause" in a loop, which won't help the apparent CPU usage.

Note that when the kernel panics, cpustop_handler() will execute "hlt",
which should result in a vmexit if you started bhyve with -H, and you'll
see only one vCPU thread consuming 100% when sitting at the DDB prompt.
But when you enter DDB without a panic, we need some mechanism to resume
the stopped CPUs when exiting DDB.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Y3vMRxjj0GZsc29R>