public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, Gerd Hoffmann <kraxel@redhat.com>,
	Glauber de Oliveira Costa <gcosta@redhat.com>
Subject: Re: KVM: x86: silence preempt warning on kvm_write_guest_time
Date: Thu, 26 Feb 2009 11:57:00 +0200	[thread overview]
Message-ID: <49A6676C.1000606@redhat.com> (raw)
In-Reply-To: <20090224182800.GA7653@amt.cnet>

Marcelo Tosatti wrote:
> Glauber, Gerd,
>
> See comments on
> http://sourceforge.net/tracker2/?func=detail&aid=2627272&group_id=180599&atid=893831
> regarding the "version" variable. Looks fishy.
>
> From: Matt T. Yourst <yourst@users.sourceforge.net>
>
> This issue just appeared in kvm-84 when running on 2.6.28.7 (x86-64)
> with PREEMPT enabled.
>
> We're getting syslog warnings like this many (but not all) times qemu
> tells KVM to run the VCPU:
>
> BUG: using smp_processor_id() in preemptible [00000000] code:
> qemu-system-x86/28938
> caller is kvm_arch_vcpu_ioctl_run+0x5d1/0xc70 [kvm]
> Pid: 28938, comm: qemu-system-x86 2.6.28.7-mtyrel-64bit
> Call Trace:
> debug_smp_processor_id+0xf7/0x100
> kvm_arch_vcpu_ioctl_run+0x5d1/0xc70 [kvm]
> ? __wake_up+0x4e/0x70
> ? wake_futex+0x27/0x40
> kvm_vcpu_ioctl+0x2e9/0x5a0 [kvm]
> enqueue_hrtimer+0x8a/0x110
> _spin_unlock_irqrestore+0x27/0x50
> vfs_ioctl+0x31/0xa0
> do_vfs_ioctl+0x74/0x480
> sys_futex+0xb4/0x140
> sys_ioctl+0x99/0xa0
> system_call_fastpath+0x16/0x1b
>
> As it turns out, the call trace is messed up due to gcc's inlining, but
> I isolated the problem anyway: kvm_write_guest_time() is being used in a
> non-thread-safe manner on preemptable kernels.
>
> Basically kvm_write_guest_time()'s body needs to be surrounded by
> preempt_disable() and preempt_enable(), since the kernel won't let us
> query any per-CPU data (indirectly using smp_processor_id()) without
> preemption disabled. The attached patch fixes this issue by disabling
> preemption inside kvm_write_guest_time().
>
> [marcelo: surround only __get_cpu_var calls since the warning
> is harmless]
>
>   

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


      parent reply	other threads:[~2009-02-26  9:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-24 18:28 KVM: x86: silence preempt warning on kvm_write_guest_time Marcelo Tosatti
2009-02-25 10:40 ` Gerd Hoffmann
2009-02-26  9:57 ` Avi Kivity [this message]

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=49A6676C.1000606@redhat.com \
    --to=avi@redhat.com \
    --cc=gcosta@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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