From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: [PATCH] x86: kvmclock: Do not setup kvmclock vsyscall in the absence of that clock Date: Sat, 23 Feb 2013 17:05:29 +0100 Message-ID: <5128E8C9.1050000@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2ILFFCOSGFQHBKFQDFRDI" Cc: kvm To: Marcelo Tosatti , Gleb Natapov Return-path: Received: from mout.web.de ([212.227.15.3]:62824 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758763Ab3BWQFh (ORCPT ); Sat, 23 Feb 2013 11:05:37 -0500 Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2ILFFCOSGFQHBKFQDFRDI Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable From: Jan Kiszka This fixes boot lockups with "no-kvmclock", when the host is not exposing this particular feature (QEMU: -cpu ...,-kvmclock) or when the kvmclock initialization failed for whatever reason. Signed-off-by: Jan Kiszka --- Should go to 3.8 as well, I presume. arch/x86/kernel/kvmclock.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 5bedbdd..b730efa 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -160,8 +160,12 @@ int kvm_register_clock(char *txt) { int cpu =3D smp_processor_id(); int low, high, ret; - struct pvclock_vcpu_time_info *src =3D &hv_clock[cpu].pvti; + struct pvclock_vcpu_time_info *src; + + if (!hv_clock) + return 0; =20 + src =3D &hv_clock[cpu].pvti; low =3D (int)__pa(src) | 1; high =3D ((u64)__pa(src) >> 32); ret =3D native_write_msr_safe(msr_kvm_system_time, low, high); @@ -276,6 +280,9 @@ int __init kvm_setup_vsyscall_timeinfo(void) struct pvclock_vcpu_time_info *vcpu_time; unsigned int size; =20 + if (!hv_clock) + return 0; + size =3D PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);= =20 preempt_disable(); --=20 1.7.3.4 ------enig2ILFFCOSGFQHBKFQDFRDI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlEo6MoACgkQitSsb3rl5xRFQwCfdOZ6a3S5Qou2syFYAYij7XkJ wAEAoKxqtgQzjy5cw/lNacZ4UkIc1NR6 =uP7Q -----END PGP SIGNATURE----- ------enig2ILFFCOSGFQHBKFQDFRDI--