From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752552AbcFILVX (ORCPT ); Thu, 9 Jun 2016 07:21:23 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37837 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751393AbcFILVV (ORCPT ); Thu, 9 Jun 2016 07:21:21 -0400 Subject: Re: [PATCH 3/3 V2] pvclock: Get rid of __pvclock_read_cycles in function pvclock_read_flags To: Borislav Petkov , Minfei Huang References: <1464329832-4638-3-git-send-email-mnghuan@gmail.com> <1464438463-8485-1-git-send-email-mnghuan@gmail.com> <20160608081739.GD26187@pd.tnic> Cc: luto@kernel.org, hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: <1ade9d3e-2064-c811-f718-371d91c7874c@redhat.com> Date: Thu, 9 Jun 2016 13:21:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160608081739.GD26187@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/06/2016 10:17, Borislav Petkov wrote: >> > - version = __pvclock_read_cycles(src, &ret, &flags); >> > + version = src->version; >> > + /* Make the latest version visible */ >> > + smp_rmb(); >> > + >> > + flags = src->flags; >> > /* Make sure that the version double-check is last. */ > What does that comment mean over the barrier? It should be over the > "while" line IMO. > >> > smp_rmb(); > Why the two barriers back-to-back? Can't have one at the end for all? > This is basically implementing a seqcount. It needs two barriers and, technically, they should be virt_rmb() -- it really doesn't matter of course because reads are never reordered on x86. Paolo