Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753723AbdLDJJD (ORCPT ); Mon, 4 Dec 2017 04:09:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54740 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752860AbdLDJI7 (ORCPT ); Mon, 4 Dec 2017 04:08:59 -0500 From: Vitaly Kuznetsov To: Paolo Bonzini Cc: Stephen Hemminger , Stephen Hemminger , kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW0=?= =?utf-8?B?w6HFmQ==?= , Haiyang Zhang , x86@kernel.org, linux-kernel@vger.kernel.org, Ingo Molnar , Andy Lutomirski , "H. Peter Anvin" , devel@linuxdriverproject.org, Thomas Gleixner Subject: Re: [PATCH RFC 2/6] x86/hyper-v: add a function to read both TSC and TSC page value simulateneously References: <20171201131321.918-1-vkuznets@redhat.com> <20171201131321.918-3-vkuznets@redhat.com> <20171201092904.30d9831f@xeon-e3> <77674d0f-f4c6-ad47-1984-ea040e256501@redhat.com> Date: Mon, 04 Dec 2017 10:08:52 +0100 In-Reply-To: <77674d0f-f4c6-ad47-1984-ea040e256501@redhat.com> (Paolo Bonzini's message of "Fri, 1 Dec 2017 18:52:48 +0100") Message-ID: <87o9neoo63.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 04 Dec 2017 09:08:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 658 Lines: 22 Paolo Bonzini writes: > On 01/12/2017 18:29, Stephen Hemminger wrote: >>> +static inline u64 hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg, >>> + u64 *cur_tsc) >>> +{ >>> + *cur_tsc = rdtsc(); >>> + >>> + return cur_tsc; >> Why do return and setting by reference. Looks like an ugly API. > > This is the fallback implementation for !CONFIG_HYPERV_TSCPAGE, which > explains why it's ugly, but why is it needed at all (or it could just > BUG())? > It is not needed indeed, the intention was just to avoid '#if IS_ENABLED(CONFIG_HYPERV)' in kvm code. I can replace it with BUG() or return U64_MAX; -- Vitaly