From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756442AbbGFP5P (ORCPT ); Mon, 6 Jul 2015 11:57:15 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:36394 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756420AbbGFP5L (ORCPT ); Mon, 6 Jul 2015 11:57:11 -0400 Subject: Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control To: Eric Auger , eric.auger@st.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, alex.williamson@redhat.com, avi.kivity@gmail.com, mtosatti@redhat.com, feng.wu@intel.com, joro@8bytes.org, b.reynal@virtualopensystems.com References: <1436184692-20927-1-git-send-email-eric.auger@linaro.org> <1436184692-20927-4-git-send-email-eric.auger@linaro.org> <559A7425.4050506@redhat.com> <559AA02A.6060703@linaro.org> Cc: linux-kernel@vger.kernel.org, patches@linaro.org From: Paolo Bonzini X-Enigmail-Draft-Status: N1110 Message-ID: <559AA552.3010400@redhat.com> Date: Mon, 6 Jul 2015 17:57:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <559AA02A.6060703@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/07/2015 17:35, Eric Auger wrote: >>> diff --git a/kernel/irq/bypass.c b/kernel/irq/bypass.c >>> >> index 5d0f92b..efadbe5 100644 >>> >> --- a/kernel/irq/bypass.c >>> >> +++ b/kernel/irq/bypass.c >>> >> @@ -19,6 +19,42 @@ static LIST_HEAD(producers); >>> >> static LIST_HEAD(consumers); >>> >> static DEFINE_MUTEX(lock); >>> >> >>> >> +/* lock must be hold when calling connect */ >> > >> > If a lock must be held while callbacks are called, you have to document >> > that producers and consumers must _not_ call back into the IRQ bypass >> > manager. (If they have to, you have to document explicitly "This >> > function can be called from producer and consumer callbacks" whenever >> > relevant). > OK Thanks Also, please document on functions that take the irq bypass mutex that they can sleep. In fact irq_bypass_{,un}register_{producer,consumer} need kerneldoc comments. The good thing is that this helps a bit forming a lock hierarchy across the subsystems, for example irq bypass mutex outside vfio_platform_irq spinlock, because you cannot have a spinlock inside the mutex. I think that all of your six callbacks are fine. Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 From: pbonzini@redhat.com (Paolo Bonzini) Date: Mon, 6 Jul 2015 17:57:06 +0200 Subject: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control In-Reply-To: <559AA02A.6060703@linaro.org> References: <1436184692-20927-1-git-send-email-eric.auger@linaro.org> <1436184692-20927-4-git-send-email-eric.auger@linaro.org> <559A7425.4050506@redhat.com> <559AA02A.6060703@linaro.org> Message-ID: <559AA552.3010400@redhat.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 06/07/2015 17:35, Eric Auger wrote: >>> diff --git a/kernel/irq/bypass.c b/kernel/irq/bypass.c >>> >> index 5d0f92b..efadbe5 100644 >>> >> --- a/kernel/irq/bypass.c >>> >> +++ b/kernel/irq/bypass.c >>> >> @@ -19,6 +19,42 @@ static LIST_HEAD(producers); >>> >> static LIST_HEAD(consumers); >>> >> static DEFINE_MUTEX(lock); >>> >> >>> >> +/* lock must be hold when calling connect */ >> > >> > If a lock must be held while callbacks are called, you have to document >> > that producers and consumers must _not_ call back into the IRQ bypass >> > manager. (If they have to, you have to document explicitly "This >> > function can be called from producer and consumer callbacks" whenever >> > relevant). > OK Thanks Also, please document on functions that take the irq bypass mutex that they can sleep. In fact irq_bypass_{,un}register_{producer,consumer} need kerneldoc comments. The good thing is that this helps a bit forming a lock hierarchy across the subsystems, for example irq bypass mutex outside vfio_platform_irq spinlock, because you cannot have a spinlock inside the mutex. I think that all of your six callbacks are fine. Paolo