Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752352AbcD3RsM (ORCPT ); Sat, 30 Apr 2016 13:48:12 -0400 Received: from mail-oi0-f48.google.com ([209.85.218.48]:35918 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751225AbcD3RsL convert rfc822-to-8bit (ORCPT ); Sat, 30 Apr 2016 13:48:11 -0400 MIME-Version: 1.0 In-Reply-To: <20160430132420.GA4084@pd.tnic> References: <1461567194-2007-1-git-send-email-mnghuan@gmail.com> <20160430132420.GA4084@pd.tnic> From: Andy Lutomirski Date: Sat, 30 Apr 2016 10:47:49 -0700 Message-ID: Subject: Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables To: Borislav Petkov Cc: Minfei Huang , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andrew Lutomirski , Paolo Bonzini , Marcelo Tosatti , X86 ML , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1498 Lines: 50 On Sat, Apr 30, 2016 at 6:24 AM, Borislav Petkov wrote: > On Mon, Apr 25, 2016 at 02:53:14PM +0800, Minfei Huang wrote: >> The value of cycles and flags can be assigned directly without >> intermediate variables. >> >> Remove the useless variables. >> >> Signed-off-by: Minfei Huang >> --- >> arch/x86/include/asm/pvclock.h | 15 ++++----------- >> 1 file changed, 4 insertions(+), 11 deletions(-) >> >> diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h >> index fdcc040..fb95dac 100644 >> --- a/arch/x86/include/asm/pvclock.h >> +++ b/arch/x86/include/asm/pvclock.h >> @@ -80,19 +80,12 @@ static __always_inline >> unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src, >> cycle_t *cycles, u8 *flags) >> { >> - unsigned version; >> - cycle_t ret, offset; >> - u8 ret_flags; >> - >> - version = src->version; >> + cycle_t offset; >> >> offset = pvclock_get_nsec_offset(src); > > You could go a step further and get rid of that > pvclock_get_nsec_offset() simple wrapper too and move its meat into > __pvclock_read_cycles()... > Take a look at vread_pvclock. I decided that __pvclock_read_cycles was too ugly to use and was very slow and I just gave up and rewrote it. > -- > Regards/Gruss, > Boris. > > SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) > -- -- Andy Lutomirski AMA Capital Management, LLC