public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Andrea Arcangeli <andrea-l3A5Bk7waGM@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: external module sched_in event
Date: Sat, 22 Dec 2007 21:13:44 +0200	[thread overview]
Message-ID: <476D61E8.5000102@qumranet.com> (raw)
In-Reply-To: <20071220162353.GA3802-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>

Andrea Arcangeli wrote:

[snip]
> So in short with the below fix applied, after a write_tsc(0,0), the
> UP guest never return any error anymore. Previously it would return
> frequent errors because sched_in wasn't properly invoked by svm.c and
> it would crash at boot every single time after a write_tsc(0,0).
>
> The SMP guest of course still returns TSC errors but that's ok, the
> smp host also return TSC errors, that's ok, it's only the UP guest
> that is forbidden to have a not monotone TSC or the guest would crash
> like it happened to me.
>
> I'm unsure if special_reload_db7 is needed at all, but it certainly
> can't hurt so it's the only hack I left.
>   

It's needed, vmx (and IIRC svm) will clear out db7 so we must reload it.

In fairness we need also reload it if the host had it set; it shouldn't
be a hack but part of mainline.

> Finally I can enjoy KVM stability too ;). If you always compiled your
> host kernel with CONFIG_KVM=y on a recent kernels including the
> preempt-notifiers, you could never run into this. If you compile your
> host kernel with CONFIG_KVM=n please try to test this.
>   

Unfortunately, this fails badly on Intel i386:

> kvm: emulating preempt notifiers; do not benchmark on this machine
> loaded kvm module (kvm-56-127-g433be51)
> vmwrite error: reg c08 value d8 (err 3080)
>  [<f8baf9e2>] vmx_save_host_state+0x4f/0x162 [kvm_intel]
>  [<c0425803>] __cond_resched+0x25/0x3c
>  [<f91a22a4>] kvm_arch_vcpu_ioctl_run+0x16f/0x3a7 [kvm]
>  [<f919f244>] kvm_vcpu_ioctl+0xcb/0x28f [kvm]
>  [<c0421987>] enqueue_entity+0x2c0/0x2ea
>  [<c05a8340>] skb_dequeue+0x39/0x3f
>  [<c0604b6d>] unix_stream_recvmsg+0x3a2/0x4c3
>  [<c0425c82>] scheduler_tick+0x1a1/0x274
>  [<c0487329>] core_sys_select+0x21f/0x2fa
>  [<c043e9e6>] clockevents_program_event+0xb5/0xbc
>  [<c04c6853>] avc_has_perm+0x4e/0x58
>  [<c04c7174>] inode_has_perm+0x66/0x6e
>  [<c0430bed>] recalc_sigpending+0xb/0x1d
>  [<c043231d>] dequeue_signal+0xa9/0x12a
>  [<c043cb95>] getnstimeofday+0x30/0xbf
>  [<c04c7205>] file_has_perm+0x89/0x91
>  [<f919f179>] kvm_vcpu_ioctl+0x0/0x28f [kvm]
>  [<c04861b9>] do_ioctl+0x21/0xa0
>  [<c048646f>] vfs_ioctl+0x237/0x249
>  [<c04864cd>] sys_ioctl+0x4c/0x67
>  [<c0404f26>] sysenter_past_esp+0x5f/0x85
>  =======================

vmwrite error means the vmcs pointer was not loaded, probably because
the sched_in event did not fire after a vcpu migration.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  parent reply	other threads:[~2007-12-22 19:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 16:23 external module sched_in event Andrea Arcangeli
     [not found] ` <20071220162353.GA3802-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2007-12-22 19:13   ` Avi Kivity [this message]
     [not found]     ` <476D61E8.5000102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-23 16:49       ` Andrea Arcangeli
     [not found]         ` <20071223164932.GA8483-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2007-12-23 17:37           ` Avi Kivity
     [not found]             ` <476E9CE4.2060705-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-24 16:26               ` Andrea Arcangeli
     [not found]                 ` <20071224162639.GH8483-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2007-12-25  9:00                   ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2007-12-21 17:40 Andrea Arcangeli
     [not found] ` <20071221174048.GB1292-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2007-12-21 17:52   ` Izik Eidus
     [not found]     ` <476BFD74.2040509-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-21 18:22       ` Andrea Arcangeli
2007-12-22 20:24       ` Avi Kivity

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=476D61E8.5000102@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=andrea-l3A5Bk7waGM@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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