From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755390AbbFTVvG (ORCPT ); Sat, 20 Jun 2015 17:51:06 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55439 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752327AbbFTVu4 (ORCPT ); Sat, 20 Jun 2015 17:50:56 -0400 Date: Sat, 20 Jun 2015 23:50:46 +0200 From: Borislav Petkov To: Paolo Bonzini Cc: Andy Lutomirski , x86@kernel.org, Peter Zijlstra , John Stultz , linux-kernel@vger.kernel.org, Len Brown , Huang Rui , Denys Vlasenko , kvm@vger.kernel.org, Ralf Baechle , Radim Krcmar , Marcelo Tosatti Subject: Re: [PATCH v3 17/18] x86/kvm/tsc: Drop extra barrier and use rdtsc_ordered in kvmclock Message-ID: <20150620215046.GB30725@pd.tnic> References: <678981cc4761fb38a793c217c9cac42503cf3719.1434501121.git.luto@kernel.org> <558125FC.7010007@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <558125FC.7010007@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 17, 2015 at 09:47:08AM +0200, Paolo Bonzini wrote: > On 17/06/2015 02:36, Andy Lutomirski wrote: > > __pvclock_read_cycles had an unnecessary barrier. Get rid of that > > barrier and clean up the code by just using rdtsc_ordered(). > > > > Cc: Paolo Bonzini > > Cc: Radim Krcmar > > Cc: Marcelo Tosatti > > Cc: kvm@vger.kernel.org > > Signed-off-by: Andy Lutomirski > > --- > > > > I'm hoping to get an ack for this to go in through -tip. (Arguably > > I'm the maintainer of this code given how it's used, but I should > > still ask for an ack.) > > > > arch/x86/include/asm/pvclock.h | 21 ++++++++++++--------- > > 1 file changed, 12 insertions(+), 9 deletions(-) > > Can you send a URL to the rest of the series? I've never even seen v1 > or v2 so I have no idea of what this is about. > > > diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h > > index 6084bce345fc..cf2329ca4812 100644 > > --- a/arch/x86/include/asm/pvclock.h > > +++ b/arch/x86/include/asm/pvclock.h > > @@ -62,7 +62,18 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift) > > static __always_inline > > u64 pvclock_get_nsec_offset(const struct pvclock_vcpu_time_info *src) > > { > > - u64 delta = rdtsc() - src->tsc_timestamp; > > + /* > > + * Note: emulated platforms which do not advertise SSE2 support > > + * break rdtsc_ordered, resulting in kvmclock not using the > > + * necessary RDTSC barriers. Without barriers, it is possible > > + * that RDTSC instruction is executed before prior loads, > > + * resulting in violation of monotonicity. > > + * > > + * On an SMP guest without SSE2, it's unclear how anything is > > + * supposed to work correctly, though -- memory fences > > + * (e.g. smp_mb) are important for more than just timing. > > + */ > > On an SMP guest without SSE2, memory fences are obtained with e.g. "lock > addb $0, (%esp)". Yeah, I killed that comment when applying. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Subject: Re: [PATCH v3 17/18] x86/kvm/tsc: Drop extra barrier and use rdtsc_ordered in kvmclock Date: Sat, 20 Jun 2015 23:50:46 +0200 Message-ID: <20150620215046.GB30725@pd.tnic> References: <678981cc4761fb38a793c217c9cac42503cf3719.1434501121.git.luto@kernel.org> <558125FC.7010007@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Andy Lutomirski , x86@kernel.org, Peter Zijlstra , John Stultz , linux-kernel@vger.kernel.org, Len Brown , Huang Rui , Denys Vlasenko , kvm@vger.kernel.org, Ralf Baechle , Radim Krcmar , Marcelo Tosatti To: Paolo Bonzini Return-path: Received: from cantor2.suse.de ([195.135.220.15]:55439 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752327AbbFTVu4 (ORCPT ); Sat, 20 Jun 2015 17:50:56 -0400 Content-Disposition: inline In-Reply-To: <558125FC.7010007@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jun 17, 2015 at 09:47:08AM +0200, Paolo Bonzini wrote: > On 17/06/2015 02:36, Andy Lutomirski wrote: > > __pvclock_read_cycles had an unnecessary barrier. Get rid of that > > barrier and clean up the code by just using rdtsc_ordered(). > > > > Cc: Paolo Bonzini > > Cc: Radim Krcmar > > Cc: Marcelo Tosatti > > Cc: kvm@vger.kernel.org > > Signed-off-by: Andy Lutomirski > > --- > > > > I'm hoping to get an ack for this to go in through -tip. (Arguably > > I'm the maintainer of this code given how it's used, but I should > > still ask for an ack.) > > > > arch/x86/include/asm/pvclock.h | 21 ++++++++++++--------- > > 1 file changed, 12 insertions(+), 9 deletions(-) > > Can you send a URL to the rest of the series? I've never even seen v1 > or v2 so I have no idea of what this is about. > > > diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h > > index 6084bce345fc..cf2329ca4812 100644 > > --- a/arch/x86/include/asm/pvclock.h > > +++ b/arch/x86/include/asm/pvclock.h > > @@ -62,7 +62,18 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift) > > static __always_inline > > u64 pvclock_get_nsec_offset(const struct pvclock_vcpu_time_info *src) > > { > > - u64 delta = rdtsc() - src->tsc_timestamp; > > + /* > > + * Note: emulated platforms which do not advertise SSE2 support > > + * break rdtsc_ordered, resulting in kvmclock not using the > > + * necessary RDTSC barriers. Without barriers, it is possible > > + * that RDTSC instruction is executed before prior loads, > > + * resulting in violation of monotonicity. > > + * > > + * On an SMP guest without SSE2, it's unclear how anything is > > + * supposed to work correctly, though -- memory fences > > + * (e.g. smp_mb) are important for more than just timing. > > + */ > > On an SMP guest without SSE2, memory fences are obtained with e.g. "lock > addb $0, (%esp)". Yeah, I killed that comment when applying. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line "unsubscribe kvm" in