From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932614AbcEKOYp (ORCPT ); Wed, 11 May 2016 10:24:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39554 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932240AbcEKOYn (ORCPT ); Wed, 11 May 2016 10:24:43 -0400 Subject: Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables To: Andy Lutomirski , Borislav Petkov References: <1461567194-2007-1-git-send-email-mnghuan@gmail.com> <20160430132420.GA4084@pd.tnic> <20160430191734.GB4084@pd.tnic> Cc: Thomas Gleixner , Ingo Molnar , X86 ML , Minfei Huang , Marcelo Tosatti , "linux-kernel@vger.kernel.org" , "H. Peter Anvin" From: Paolo Bonzini Message-ID: <573340A5.1090209@redhat.com> Date: Wed, 11 May 2016 16:24:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 11 May 2016 14:24:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/04/2016 23:57, Andy Lutomirski wrote: >> > Should we kill __pvclock_read_cycles in favor of vread_pvclock? It looks >> > doable at a quick scan... >> > > The in-kernel version might have to be a bit different because it > needs to handle the !stable case. If !stable, it should just use the > current CPU's copy which means that, realistically, it should just > get_cpu and use the local copy unconditionally. Other than that, it > could look a lot like the vread_pvclock variant. > > But I agree, the current thing is incomprehensible. It also lacks smp_rmb()s. One is more or less implicit in rdtsc, but you need one to separate __pvclock_read_cycles's reads of src->foo from pvclock_read_flags's read of src->version. Minfei, would you like to take a look? Paolo