Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754242AbcJZKWb (ORCPT ); Wed, 26 Oct 2016 06:22:31 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39377 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752721AbcJZKVO (ORCPT ); Wed, 26 Oct 2016 06:21:14 -0400 Date: Wed, 26 Oct 2016 12:18:33 +0200 (CEST) From: Thomas Gleixner To: Alexey Makhalov cc: corbet@lwn.net, akataria@vmware.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, monitor-list@vmware.com, pv-drivers@vmware.com, time-lords@vmware.com Subject: Re: [PATCH 3/3] x86/vmware: Add paravirt sched clock In-Reply-To: <20161026052640.77585-1-amakhalov@vmware.com> Message-ID: References: <20161026052038.77042-1-amakhalov@vmware.com> <20161026052640.77585-1-amakhalov@vmware.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1614 Lines: 56 On Tue, 25 Oct 2016, Alexey Makhalov wrote: > no-vmw-sched-clock kernel parameter is added to switch back to the > native_sched_clock() implementation. You are not switching back. The parameter is used to disable the paravirt sched clock. > #ifdef CONFIG_PARAVIRT > +static struct cyc2ns_data vmware_cyc2ns __ro_after_init; > + > +static int vmw_sched_clock __initdata = 1; > +static __init int setup_vmw_sched_clock(char *s) Please stop glueing a variable to a function w/o a new line between them. It's just stopping the reading flow. > +{ > + vmw_sched_clock = 0; > + return 0; > +} > +early_param("no-vmw-sched-clock", setup_vmw_sched_clock); > + > +static unsigned long long vmware_sched_clock(void) > +{ > + unsigned long long ns; > + > + ns = mul_u64_u32_shr(rdtsc(), vmware_cyc2ns.cyc2ns_mul, > + vmware_cyc2ns.cyc2ns_shift); > + ns -= vmware_cyc2ns.cyc2ns_offset; > + return ns; > +} > + > static void __init vmware_paravirt_ops_setup(void) > { > pv_info.name = "VMware"; > pv_cpu_ops.io_delay = paravirt_nop; > + > + if (vmware_tsc_khz && vmw_sched_clock) { > + unsigned long long tsc_now = rdtsc(); > + > + clocks_calc_mult_shift(&vmware_cyc2ns.cyc2ns_mul, > + &vmware_cyc2ns.cyc2ns_shift, > + vmware_tsc_khz, > + NSEC_PER_MSEC, 0); > + vmware_cyc2ns.cyc2ns_offset = > + mul_u64_u32_shr(tsc_now, vmware_cyc2ns.cyc2ns_mul, > + vmware_cyc2ns.cyc2ns_shift); > + > + pv_time_ops.sched_clock = vmware_sched_clock; > + pr_info("vmware: using sched offset of %llu ns\n", Please use pr_fmt instead of adding the prefix to every print. Thanks, tglx