From patchwork Wed Oct 14 23:21:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 53896 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9ENMKU3030083 for ; Wed, 14 Oct 2009 23:22:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761453AbZJNXVq (ORCPT ); Wed, 14 Oct 2009 19:21:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758811AbZJNXVp (ORCPT ); Wed, 14 Oct 2009 19:21:45 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:56624 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbZJNXVo (ORCPT ); Wed, 14 Oct 2009 19:21:44 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e32.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9ENGALa028331; Wed, 14 Oct 2009 17:16:10 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n9ENL3YC240568; Wed, 14 Oct 2009 17:21:04 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n9ENL2Hg026099; Wed, 14 Oct 2009 17:21:03 -0600 Received: from tux1.beaverton.ibm.com (elm3a169.beaverton.ibm.com [9.47.66.169]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n9ENL1mS026037; Wed, 14 Oct 2009 17:21:02 -0600 Received: by tux1.beaverton.ibm.com (Postfix, from userid 501) id 0F1C413E76E; Wed, 14 Oct 2009 16:21:00 -0700 (PDT) Date: Wed, 14 Oct 2009 16:21:00 -0700 From: "Darrick J. Wong" To: Avi Kivity , Marcelo Tosatti Cc: linux-kernel , kvm@vger.kernel.org Subject: [PATCH] kvm: Prevent kvm_init from corrupting debugfs structures Message-ID: <20091014232100.GE26149@tux1.beaverton.ibm.com> Reply-To: djwong@us.ibm.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index b7c78a4..7495ce3 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2717,8 +2717,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size, int r; int cpu; - kvm_init_debug(); - r = kvm_arch_init(opaque); if (r) goto out_fail; @@ -2785,6 +2783,8 @@ int kvm_init(void *opaque, unsigned int vcpu_size, kvm_preempt_ops.sched_in = kvm_sched_in; kvm_preempt_ops.sched_out = kvm_sched_out; + kvm_init_debug(); + return 0; out_free: @@ -2807,7 +2807,6 @@ out_free_0: out: kvm_arch_exit(); out_fail: - kvm_exit_debug(); return r; } EXPORT_SYMBOL_GPL(kvm_init); @@ -2815,6 +2814,7 @@ EXPORT_SYMBOL_GPL(kvm_init); void kvm_exit(void) { tracepoint_synchronize_unregister(); + kvm_exit_debug(); misc_deregister(&kvm_dev); kmem_cache_destroy(kvm_vcpu_cache); sysdev_unregister(&kvm_sysdev); @@ -2824,7 +2824,6 @@ void kvm_exit(void) on_each_cpu(hardware_disable, NULL, 1); kvm_arch_hardware_unsetup(); kvm_arch_exit(); - kvm_exit_debug(); free_cpumask_var(cpus_hardware_enabled); __free_page(bad_page); }