From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitaly Kuznetsov Subject: Re: [PATCH RFC 2/6] x86/hyper-v: add a function to read both TSC and TSC page value simulateneously Date: Mon, 04 Dec 2017 10:08:52 +0100 Message-ID: <87o9neoo63.fsf@vitty.brq.redhat.com> References: <20171201131321.918-1-vkuznets@redhat.com> <20171201131321.918-3-vkuznets@redhat.com> <20171201092904.30d9831f@xeon-e3> <77674d0f-f4c6-ad47-1984-ea040e256501@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: 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 To: Paolo Bonzini Return-path: In-Reply-To: <77674d0f-f4c6-ad47-1984-ea040e256501@redhat.com> (Paolo Bonzini's message of "Fri, 1 Dec 2017 18:52:48 +0100") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" List-Id: kvm.vger.kernel.org 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