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: 222306 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D04242C0092 for ; Fri, 22 Feb 2013 01:56:59 +1100 (EST) Received: from localhost ([::1]:57797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8XZx-0003i7-B4 for incoming@patchwork.ozlabs.org; Thu, 21 Feb 2013 09:56:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8XZj-0003hD-Sc for qemu-devel@nongnu.org; Thu, 21 Feb 2013 09:56:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8XZh-0000Ad-M2 for qemu-devel@nongnu.org; Thu, 21 Feb 2013 09:56:43 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:56339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8XZh-0000AF-Cx for qemu-devel@nongnu.org; Thu, 21 Feb 2013 09:56:41 -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:42 -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:40 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9820717D8059 for ; 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 b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r1LEuSLQ32506048 for ; 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 r1LDr2pW022028 for ; 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" 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-000004F6F04A X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.106 Cc: linux-s390 , qemu-devel , KVM Subject: Re: [Qemu-devel] [RFC PATCH 1/3] KVM: s390: Move out initialization code. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.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: 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);