All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Makhalov via Virtualization <virtualization@lists.linux-foundation.org>
To: x86@kernel.org
Cc: Juergen Gross <jgross@suse.com>,
	Alexey Makhalov <amakhalov@vmware.com>,
	Jonathan Corbet <corbet@lwn.net>,
	"VMware, Inc." <pv-drivers@vmware.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	virtualization@lists.linux-foundation.org,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 2/5] x86/vmware: Remove vmware_sched_clock_setup()
Date: Wed, 12 Feb 2020 20:03:09 +0000	[thread overview]
Message-ID: <20200212200312.2033-3-amakhalov@vmware.com> (raw)
In-Reply-To: <20200212200312.2033-1-amakhalov@vmware.com>

Move cyc2ns setup logic to separate function.
This separation will allow to use cyc2ns mult/shift pair
not only for the sched_clock but also for other clocks
such as steal_clock.

Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 arch/x86/kernel/cpu/vmware.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index d280560fd75e..efb22fa76ba4 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -122,7 +122,7 @@ static unsigned long long notrace vmware_sched_clock(void)
 	return ns;
 }
 
-static void __init vmware_sched_clock_setup(void)
+static void __init vmware_cyc2ns_setup(void)
 {
 	struct cyc2ns_data *d = &vmware_cyc2ns;
 	unsigned long long tsc_now = rdtsc();
@@ -132,8 +132,7 @@ static void __init vmware_sched_clock_setup(void)
 	d->cyc2ns_offset = mul_u64_u32_shr(tsc_now, d->cyc2ns_mul,
 					   d->cyc2ns_shift);
 
-	pv_ops.time.sched_clock = vmware_sched_clock;
-	pr_info("using sched offset of %llu ns\n", d->cyc2ns_offset);
+	pr_info("using clock offset of %llu ns\n", d->cyc2ns_offset);
 }
 
 static void __init vmware_paravirt_ops_setup(void)
@@ -141,8 +140,14 @@ static void __init vmware_paravirt_ops_setup(void)
 	pv_info.name = "VMware hypervisor";
 	pv_ops.cpu.io_delay = paravirt_nop;
 
-	if (vmware_tsc_khz && vmw_sched_clock)
-		vmware_sched_clock_setup();
+	if (vmware_tsc_khz == 0)
+		return;
+
+	vmware_cyc2ns_setup();
+
+	if (vmw_sched_clock)
+		pv_ops.time.sched_clock = vmware_sched_clock;
+
 }
 #else
 #define vmware_paravirt_ops_setup() do {} while (0)
-- 
2.14.2

  parent reply	other threads:[~2020-02-12 20:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 20:03 [PATCH 0/5] x86/vmware: Steal time accounting support Alexey Makhalov via Virtualization
2020-02-12 20:03 ` [PATCH 1/5] x86/vmware: Make vmware_select_hypercall() __init Alexey Makhalov via Virtualization
2020-02-12 20:03 ` Alexey Makhalov via Virtualization [this message]
2020-02-12 20:03 ` [PATCH 3/5] x86/vmware: Steal time clock for VMware guest Alexey Makhalov via Virtualization
2020-02-12 20:03 ` [PATCH 4/5] x86/vmware: Enable steal time accounting Alexey Makhalov via Virtualization
2020-02-12 20:03 ` [PATCH 5/5] x86/vmware: Use bool type for vmw_sched_clock Alexey Makhalov via Virtualization
2020-03-12 19:05 ` [PATCH 0/5] x86/vmware: Steal time accounting support Thomas Gleixner
2020-03-13 13:17 ` Borislav Petkov
2020-03-23 19:57 ` [PATCH v2 " Alexey Makhalov via Virtualization
2020-03-23 19:57   ` [PATCH v2 1/5] x86/vmware: Make vmware_select_hypercall() __init Alexey Makhalov via Virtualization
2020-03-24 14:23     ` [tip: x86/vmware] " tip-bot2 for Alexey Makhalov
2020-03-23 19:57   ` [PATCH v2 2/5] x86/vmware: Remove vmware_sched_clock_setup() Alexey Makhalov via Virtualization
2020-03-24 14:23     ` [tip: x86/vmware] " tip-bot2 for Alexey Makhalov
2020-03-23 19:57   ` [PATCH v2 3/5] x86/vmware: Steal time clock for VMware guest Alexey Makhalov via Virtualization
2020-03-24 14:23     ` [tip: x86/vmware] x86/vmware: Add steal time clock support for VMware guests tip-bot2 for Alexey Makhalov
2020-03-23 19:57   ` [PATCH v2 4/5] x86/vmware: Enable steal time accounting Alexey Makhalov via Virtualization
2020-03-24 14:23     ` [tip: x86/vmware] " tip-bot2 for Alexey Makhalov
2020-03-23 19:57   ` [PATCH v2 5/5] x86/vmware: Use bool type for vmw_sched_clock Alexey Makhalov via Virtualization
2020-03-24 14:23     ` [tip: x86/vmware] " tip-bot2 for Alexey Makhalov
2020-03-20 20:34 [PATCH 0/5] x86/vmware: Steal time accounting support Alexey Makhalov
2020-03-20 20:34 ` [PATCH 2/5] x86/vmware: Remove vmware_sched_clock_setup() Alexey Makhalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200212200312.2033-3-amakhalov@vmware.com \
    --to=virtualization@lists.linux-foundation.org \
    --cc=amakhalov@vmware.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jpoimboe@redhat.com \
    --cc=mchehab+samsung@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=pv-drivers@vmware.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.