From: Marcelo Tosatti <marcelo@kvack.org>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm-devel@lists.sourceforge.net, chrisw@sous-sol.org,
Glauber de Oliveira Costa <gcosta@redhat.com>
Subject: Re: [PATCH 1/2] kvmclock - the host part.
Date: Mon, 18 Feb 2008 11:06:54 -0300 [thread overview]
Message-ID: <20080218140654.GA10446@dmt> (raw)
In-Reply-To: <47B2CB46.1090804@qumranet.com>
On Wed, Feb 13, 2008 at 12:49:42PM +0200, Avi Kivity wrote:
> Glauber de Oliveira Costa wrote:
> > This is the host part of kvm clocksource implementation. As it does
> > not include clockevents, it is a fairly simple implementation. We
> > only have to register a per-vcpu area, and start writting to it periodically.
> >
> > The area is binary compatible with xen, as we use the same shadow_info structure.
> >
> >
>
> > +static void kvm_write_wall_clock(struct kvm_vcpu *v, gpa_t wall_clock)
> > +{
> > + int version = 1;
> > + struct kvm_wall_clock wc;
> > + unsigned long flags;
> > + struct timespec wc_ts;
> > +
> > + local_irq_save(flags);
> > + kvm_get_msr(v, MSR_IA32_TIME_STAMP_COUNTER,
> > + &v->arch.hv_clock.tsc_timestamp);
> >
>
> Why is this needed? IIRC the wall clock is not tied to any vcpu.
>
> If we can remove this, the argument to the function should be kvm, not
> kvm_vcpu. We can remove the irq games as well.
>
> > + wc_ts = current_kernel_time();
> > + local_irq_restore(flags);
> > +
> > + down_write(¤t->mm->mmap_sem);
> > + kvm_write_guest(v->kvm, wall_clock, &version, sizeof(version));
> > + up_write(¤t->mm->mmap_sem);
> >
>
> Why down_write? accidentally or on purpose?
>
> For mutual exclusion, I suggest taking kvm->lock instead (for the entire
> function).
You need slots_lock in read-mode for kvm_write_guest(). kvm->lock does
not protect against memslot changes and the dirty bitmap.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-02-18 14:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-11 18:07 [PATCH 0/2] kvm clock - merge last comments Glauber de Oliveira Costa
2008-02-11 18:07 ` [PATCH 1/2] kvmclock - the host part Glauber de Oliveira Costa
2008-02-11 18:07 ` [PATCH 2/2] kvmclock implementation, the guest part Glauber de Oliveira Costa
2008-02-13 10:49 ` [PATCH 1/2] kvmclock - the host part Avi Kivity
2008-02-13 21:45 ` Glauber Costa
2008-02-14 9:21 ` Avi Kivity
2008-02-18 14:06 ` Marcelo Tosatti [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-01-16 16:31 [PATCH 0/2] kvm clock - xen compatible by accident Glauber de Oliveira Costa
[not found] ` <1200501067774-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-16 16:31 ` [PATCH 1/2] kvmclock - the host part Glauber de Oliveira Costa
[not found] ` <12005010761561-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-16 19:00 ` Anthony Liguori
[not found] ` <478E544C.4020603-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2008-01-17 0:18 ` Glauber de Oliveira Costa
2008-01-17 7:59 ` Gerd Hoffmann
2008-01-20 15:37 ` Avi Kivity
2008-01-20 15:38 ` 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=20080218140654.GA10446@dmt \
--to=marcelo@kvack.org \
--cc=avi@qumranet.com \
--cc=chrisw@sous-sol.org \
--cc=gcosta@redhat.com \
--cc=kvm-devel@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.