From patchwork Fri Nov 16 02:05:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 1752571 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2DFE140E02 for ; Fri, 16 Nov 2012 02:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751231Ab2KPCJR (ORCPT ); Thu, 15 Nov 2012 21:09:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:10831 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751200Ab2KPCJL (ORCPT ); Thu, 15 Nov 2012 21:09:11 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAG28lAd021563 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Nov 2012 21:08:47 -0500 Received: from amt.cnet (vpn1-5-40.gru2.redhat.com [10.97.5.40]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qAG28iEn032597; Thu, 15 Nov 2012 21:08:45 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id B715C68A099; Fri, 16 Nov 2012 00:05:49 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.5/8.14.5/Submit) id qAG25h76018482; Fri, 16 Nov 2012 00:05:43 -0200 Date: Fri, 16 Nov 2012 00:05:42 -0200 From: Marcelo Tosatti To: Glauber Costa Cc: kvm@vger.kernel.org, johnstul@us.ibm.com, jeremy@goop.org, zamsden@gmail.com, gleb@redhat.com, avi@redhat.com, pbonzini@redhat.com Subject: [patch 07/18] x86: pvclock: add note about rdtsc barriers (v2) Message-ID: <20121116020542.GA16948@amt.cnet> References: <20121115000823.285102321@redhat.com> <20121115000944.264435009@redhat.com> <50A4E06E.9020008@parallels.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <50A4E06E.9020008@parallels.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org As noted by Gleb, not advertising SSE2 support implies no RDTSC barriers. Signed-off-by: Marcelo Tosatti --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: vsyscall/arch/x86/include/asm/pvclock.h =================================================================== --- vsyscall.orig/arch/x86/include/asm/pvclock.h +++ vsyscall/arch/x86/include/asm/pvclock.h @@ -74,6 +74,12 @@ unsigned __pvclock_read_cycles(const str u8 ret_flags; version = src->version; + /* Note: emulated platforms which do not advertise SSE2 support + * result in kvmclock not using the necessary RDTSC barriers. + * Without barriers, it is possible that RDTSC instruction reads from + * the time stamp counter outside rdtsc_barrier protected section + * below, resulting in violation of monotonicity. + */ rdtsc_barrier(); offset = pvclock_get_nsec_offset(src); ret = src->system_time + offset;