public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	Gleb Natapov <gleb@redhat.com>
Subject: Re: [RFC][PATCH] qemu-kvm: Introduce writeback scope for cpu_synchronize_state
Date: Tue, 17 Nov 2009 10:37:43 +0200	[thread overview]
Message-ID: <4B0260D7.1060107@redhat.com> (raw)
In-Reply-To: <4B025B50.4070505@web.de>

On 11/17/2009 10:14 AM, Jan Kiszka wrote:
>
>
>> state that is updated outside the vcpu thread.  These are particularly
>> bad since we can't exclude them from updates without excluding other
>> state as well.
>>      
> We easily can, using the very same mechanism: No need to overwrite any
> of the kvm_vcpu_events during runtime, only on reset/vmload).
>    

That's because qemu has no need for this.  But kvm is more than just 
serving qemu, we try to be more general.  That said, I can't really see 
anyone wanting to arbitrarily inject an exception.

>> The whole issue is tricky.  I'm inclined to pretend we never meant any
>> vcpu state (outside lapic) to be asynchronous and declare the whole
>> thing a bug.  We could fix it by modeling external changes to state
>> (INIT, SIPI, NMI) as messages queued to the vcpu, to be processed in the
>> vcpu thread.  The queue would be drained before running the vcpu or
>> before reading state from userspace, so the message queue contents can
>> never be observed and never lost.
>>
>> Of course, we can't really implement this as a queue (SIGSTOP vcpu
>> thread ->  overflow), but a word is sufficient.  INIT writes the word,
>> everything else uses compare-and-swap or set_bit to raise events (e.g.
>> SIPI = do { oldq = vcpu->queue; newq = (oldq&  ~SIPI_MASK) | sipi_vector
>> | RUNNING; } while (!cas(&vcpu->queue, oldq, newq)))
>>
>>      
> I do not yet see why we need this complication, why the proposed model
> isn't enough.
>    

The current interface is subtly dangerous, you can't run set(get()) as 
you would expect.

(well you can't with the lapic or the tsc msr either...)

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


  reply	other threads:[~2009-11-17  8:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-16 17:00 [RFC][PATCH] qemu-kvm: Introduce writeback scope for cpu_synchronize_state Jan Kiszka
2009-11-16 18:20 ` Alexander Graf
2009-11-16 19:14 ` Avi Kivity
2009-11-16 21:22   ` Jan Kiszka
2009-11-17  8:05     ` Avi Kivity
2009-11-17  8:14       ` Jan Kiszka
2009-11-17  8:37         ` Avi Kivity [this message]
2009-11-17  9:16           ` Jan Kiszka
2009-11-17 12:37             ` Avi Kivity
2009-11-17 13:05               ` Jan Kiszka
2009-11-17 13:28                 ` Avi Kivity
2009-11-17 14:12                   ` Jan Kiszka
2009-11-17 14:25                     ` Avi Kivity
2009-11-17 16:50                       ` Jan Kiszka
2009-11-17 16:58                         ` Jan Kiszka
2009-11-18 13:48                           ` Avi Kivity
2009-11-17 16:59                         ` Avi Kivity
2009-11-18  9:50                           ` Jan Kiszka
2009-11-18 13:46                             ` 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=4B0260D7.1060107@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@web.de \
    --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