Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754169AbbGFPff (ORCPT ); Mon, 6 Jul 2015 11:35:35 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:34487 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbbGFPf2 (ORCPT ); Mon, 6 Jul 2015 11:35:28 -0400 Message-ID: <559AA02A.6060703@linaro.org> Date: Mon, 06 Jul 2015 17:35:06 +0200 From: Eric Auger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Paolo Bonzini , 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 CC: linux-kernel@vger.kernel.org, patches@linaro.org Subject: Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control 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> In-Reply-To: <559A7425.4050506@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1927 Lines: 65 Hi Paolo, On 07/06/2015 02:27 PM, Paolo Bonzini wrote: > > > On 06/07/2015 14:11, 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 Eric > >> +static void connect(struct irq_bypass_producer *prod, >> + struct irq_bypass_consumer *cons) >> +{ >> + if (prod->stop) >> + prod->stop(prod); >> + if (cons->stop) >> + cons->stop(cons); >> + if (prod->add_consumer) >> + prod->add_consumer(prod, cons); >> + if (cons->add_producer) >> + cons->add_producer(cons, prod); >> + if (cons->resume) >> + cons->resume(cons); >> + if (prod->resume) >> + prod->resume(prod); >> +} >> + >> +/* lock must be hold when calling disconnect */ >> +static void disconnect(struct irq_bypass_producer *prod, >> + struct irq_bypass_consumer *cons) >> +{ >> + if (prod->stop) >> + prod->stop(prod); >> + if (cons->stop) >> + cons->stop(cons); >> + if (cons->del_producer) >> + cons->del_producer(cons, prod); >> + if (prod->del_consumer) >> + prod->del_consumer(prod, cons); >> + if (cons->resume) >> + cons->resume(cons); >> + if (prod->resume) >> + prod->resume(prod); >> +} >> + -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/