From patchwork Thu Feb 21 14:56:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 2171731 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 51798DF215 for ; Thu, 21 Feb 2013 14:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753777Ab3BUO4n (ORCPT ); Thu, 21 Feb 2013 09:56:43 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:58053 "EHLO e06smtp10.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753756Ab3BUO4m (ORCPT ); Thu, 21 Feb 2013 09:56:42 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 21 Feb 2013 14:55:43 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 21 Feb 2013 14:55:41 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id DBC6117D8058; Thu, 21 Feb 2013 14:57:07 +0000 (GMT) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r1LEuSpS29556810; Thu, 21 Feb 2013 14:56:28 GMT Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r1LDr2pa022028; Thu, 21 Feb 2013 08:53:02 -0500 Received: from gondolin (dyn-9-152-224-122.boeblingen.de.ibm.com [9.152.224.122]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r1LDr10u022005; Thu, 21 Feb 2013 08:53:01 -0500 Date: Thu, 21 Feb 2013 15:56:35 +0100 From: Cornelia Huck To: "Michael S. Tsirkin" Cc: linux-s390 , qemu-devel , KVM Subject: Re: [RFC PATCH 1/3] KVM: s390: Move out initialization code. Message-ID: <20130221155635.33de37b6@gondolin> In-Reply-To: <20130221141834.GB24738@redhat.com> References: <1361452380-50398-1-git-send-email-cornelia.huck@de.ibm.com> <1361452380-50398-2-git-send-email-cornelia.huck@de.ibm.com> <20130221134355.GA24738@redhat.com> <20130221150732.1580dbd4@gondolin> <20130221141834.GB24738@redhat.com> Organization: IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz =?UTF-8?B?R2VzY2jDpGZ0c2bDvGhydW5nOg==?= Dirk Wittkopp Sitz der Gesellschaft: =?UTF-8?B?QsO2Ymxpbmdlbg==?= Registergericht: Amtsgericht Stuttgart, HRB 243294 Mime-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13022114-4966-0000-0000-000004F6F04C Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, 21 Feb 2013 16:18:34 +0200 "Michael S. Tsirkin" wrote: > On Thu, Feb 21, 2013 at 03:07:32PM +0100, Cornelia Huck wrote: > > On Thu, 21 Feb 2013 15:43:55 +0200 > > "Michael S. Tsirkin" wrote: > > > > > On Thu, Feb 21, 2013 at 02:12:58PM +0100, Cornelia Huck wrote: > > > > kvm-s390's module initialization code needs to live in a separate > > > > module (kvm-s390.ko) if we want to include eventfd (which has its > > > > own module init func). > > > > > > > > Signed-off-by: Cornelia Huck > > > > > > I don't get this explanation. > > > What's the problem this solves? > > > Could you clarify please? > > > > On s390, we currently build a single 'kvm' module, with a module_init > > function. eventfd has its own module_init function, and we can't have > > two of them in the same module. I just moved our specific module > > initialization into a new 'kvm_s390' module. > > > You mean this? > > virt/kvm/eventfd.c:static int __init irqfd_module_init(void) > virt/kvm/eventfd.c:module_init(irqfd_module_init); > > I see. Won't it be easier to just call irqfd_module_init > from kvm_init? > It does make it clearer what happens, and eliminates the need for a new module on s390. I'll do that in the next round: --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d7965fb..55a6de1 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -423,6 +423,19 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); int __must_check vcpu_load(struct kvm_vcpu *vcpu); void vcpu_put(struct kvm_vcpu *vcpu); +#ifdef __KVM_HAVE_IOAPIC +int kvm_irqfd_init(void); +void kvm_irqfd_exit(void); +#else +static inline int kvm_irqfd_init(void) +{ + return 0; +} + +static inline void kvm_irqfd_exit(void) +{ +} +#endif int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, struct module *module); void kvm_exit(void); diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 63fe454..c631c4b 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -544,7 +544,7 @@ void kvm_irq_routing_update(struct kvm *kvm, * aggregated from all vm* instances. We need our own isolated single-thread * queue to prevent deadlock against flushing the normal work-queue. */ -static int __init irqfd_module_init(void) +int kvm_irqfd_init(void) { irqfd_cleanup_wq = create_singlethread_workqueue("kvm-irqfd-cleanup"); if (!irqfd_cleanup_wq) @@ -553,13 +553,10 @@ static int __init irqfd_module_init(void) return 0; } -static void __exit irqfd_module_exit(void) +void kvm_irqfd_exit(void) { destroy_workqueue(irqfd_cleanup_wq); } - -module_init(irqfd_module_init); -module_exit(irqfd_module_exit); #endif /* diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index adc68fe..7c188a3 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2920,6 +2920,9 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, int r; int cpu; + r = kvm_irqfd_init(); + if (r) + goto out_irqfd; r = kvm_arch_init(opaque); if (r) goto out_fail; @@ -3000,6 +3003,8 @@ out_free_0a: out_free_0: kvm_arch_exit(); out_fail: + kvm_irqfd_exit(); +out_irqfd: return r; } EXPORT_SYMBOL_GPL(kvm_init); @@ -3016,6 +3021,7 @@ void kvm_exit(void) on_each_cpu(hardware_disable_nolock, NULL, 1); kvm_arch_hardware_unsetup(); kvm_arch_exit(); + kvm_irqfd_exit(); free_cpumask_var(cpus_hardware_enabled); } EXPORT_SYMBOL_GPL(kvm_exit);