kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Owen Hofmann <osh@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	KVM General <kvm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Sasha Levin <sasha.levin@oracle.com>
Subject: Re: [PATCH v2] KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR
Date: Tue, 26 May 2015 09:22:40 -0400	[thread overview]
Message-ID: <20150526092240.4a74fa67@redhat.com> (raw)
In-Reply-To: <20150523200629.GA18207@amt.cnet>

On Sat, 23 May 2015 17:06:29 -0300
Marcelo Tosatti <mtosatti@redhat.com> wrote:

> Initialize kvmclock base, on kvmclock system MSR write time, 
> so that the guest sees kvmclock counting from zero.
> 
> This matches baremetal behaviour when kvmclock in guest
> sets sched clock stable.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Tested-by: Luiz Capitulino <lcapitulino@redhat.com>

> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index cc2c759..ea40d24 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2188,6 +2188,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  					&vcpu->requests);
>  
>  			ka->boot_vcpu_runs_old_kvmclock = tmp;
> +
> +			ka->kvmclock_offset = -get_kernel_ns();
>  		}
>  
>  		vcpu->arch.time = data;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


      reply	other threads:[~2015-05-26 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 21:40 KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR Owen Hofmann
2015-05-23 20:06 ` [PATCH v2] " Marcelo Tosatti
2015-05-26 13:22   ` Luiz Capitulino [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=20150526092240.4a74fa67@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=osh@google.com \
    --cc=pbonzini@redhat.com \
    --cc=sasha.levin@oracle.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;
as well as URLs for NNTP newsgroup(s).