9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Nick Owens <mischief@offblast.org>
To: 9front@9front.org
Subject: Re: [9front] qemu clock/timer issue
Date: Sat, 5 Feb 2022 10:14:07 -0800	[thread overview]
Message-ID: <CAH_zEu5n1mNXiz=ymKU-_zPwM67qgZXb=ow8Ujm8D+x0igzHAQ@mail.gmail.com> (raw)
In-Reply-To: <CAGw6cBvo+bA9BCOdXtM8O6vezod1szmVgKj0g-YnNYagf5++hw@mail.gmail.com>

kvm emulates a local APIC timer which the 9front kernel uses. the
timer period is clamped to a minimum period, and my understanding is
that the purpose is to protect the host from CPU consumption by
guests, but i don't have a citation for that. 9front requests a timer
period shorter than what the default minimum is and kvm warns about
it. it maybe needs more investigation as to whether we really need
such short timers.

in the meantime, you can lower the timer period minimum with

echo "options kvm min_timer_period_us=10" >> /etc/modprobe.d/kvm.conf

which is 10000ns. it won't kill all of the warnings since sometimes
the timer period is slightly shorter, but it will help with the dmesg
spam.

On Sat, Feb 5, 2022 at 7:30 AM Michael Forney <mforney@mforney.org> wrote:
>
> I was recently running 9front in a VM on linux (qemu, with
> -enable-kvm), and noticed several weird timing/clock issues. The date
> command gives wildly varying results +- 1 minute:
>
> cpu% date
> Fri Feb  4 17:39:23 PST 2022
> cpu% date
> Fri Feb  4 17:39:12 PST 2022
> cpu% date
> Fri Feb  4 17:40:19 PST 2022
> cpu% date
> Fri Feb  4 17:39:18 PST 2022
>
> `sleep 1` exits pretty much instantly, stats moves through the entire
> width in a second or two, and clicking in scrollbars starts repeating
> immediately.
>
> I notice the following messages in my dmesg:
> kvm: vcpu 3: requested 38141 ns lapic timer period limited to 200000 ns
> kvm: vcpu 1: requested 9449 ns lapic timer period limited to 200000 ns
> kvm: vcpu 2: requested 51204 ns lapic timer period limited to 200000 ns
> kvm: vcpu 0: requested 74421 ns lapic timer period limited to 200000 ns
>
> I don't remember this problem last time I ran 9front in qemu (around a
> year ago), so I looked through commit history and found one commit
> that seemed like it might be related:
> http://git.9front.org/plan9front/plan9front/a05bab362f66ddd6fa65f2e7cda9eaaa0217ec08/commit.html
>
> To check, I tried setting *nohpet=1 in my plan9.ini, which *seems* to
> have solved the problem, though I still see those same messages in
> dmesg on the linux host (but now the requested lapic timer period is
> always around 100000 ns or greater).
>
> Anyone know what's going on here?

  parent reply	other threads:[~2022-02-05 18:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05  2:04 Michael Forney
2022-02-05 17:04 ` hiro
2022-02-05 18:14 ` Nick Owens [this message]
2022-02-18  3:25   ` Michael Forney
2022-02-21 22:35     ` cinap_lenrek
2024-04-16  5:40       ` Douglas Guptill
2024-04-16 13:32         ` Jacob Moody
2024-04-16 17:07           ` Douglas Guptill
2024-04-16 17:34             ` Jacob Moody
2024-04-16 18:46           ` Michael Forney
2024-04-16 18:56             ` Jacob Moody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH_zEu5n1mNXiz=ymKU-_zPwM67qgZXb=ow8Ujm8D+x0igzHAQ@mail.gmail.com' \
    --to=mischief@offblast.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).