From patchwork Tue Jul 7 11:18:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Feng" X-Patchwork-Id: 6732191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 389B39F319 for ; Tue, 7 Jul 2015 11:20:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C11E20693 for ; Tue, 7 Jul 2015 11:20:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5C8D220657 for ; Tue, 7 Jul 2015 11:20:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCQtd-0005kW-Un; Tue, 07 Jul 2015 11:18:41 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCQtb-0005ca-Dr for linux-arm-kernel@lists.infradead.org; Tue, 07 Jul 2015 11:18:39 +0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 07 Jul 2015 04:18:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,422,1432623600"; d="scan'208";a="601525032" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by orsmga003.jf.intel.com with ESMTP; 07 Jul 2015 04:18:16 -0700 Received: from kmsmsx154.gar.corp.intel.com (172.21.73.14) by PGSMSX106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 7 Jul 2015 19:18:13 +0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 7 Jul 2015 19:18:13 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.129]) by shsmsx102.ccr.corp.intel.com ([169.254.2.165]) with mapi id 14.03.0224.002; Tue, 7 Jul 2015 19:18:11 +0800 From: "Wu, Feng" To: Paolo Bonzini , 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" , "joro@8bytes.org" , "b.reynal@virtualopensystems.com" Subject: RE: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control Thread-Topic: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control Thread-Index: AQHQuKRCWVo917B5sUaLTdnapZiqPZ3P2deg//96t4CAAIZfYA== Date: Tue, 7 Jul 2015 11:18:09 +0000 Message-ID: References: <1436184692-20927-1-git-send-email-eric.auger@linaro.org> <1436184692-20927-4-git-send-email-eric.auger@linaro.org> <559BB167.1030603@redhat.com> <559BB463.6090406@redhat.com> In-Reply-To: <559BB463.6090406@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150707_041839_491412_32A79099 X-CRM114-Status: GOOD ( 10.51 ) X-Spam-Score: -7.6 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Wu, Feng" , "linux-kernel@vger.kernel.org" , "patches@linaro.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > -----Original Message----- > From: Paolo Bonzini [mailto:pbonzini@redhat.com] > Sent: Tuesday, July 07, 2015 7:14 PM > To: Wu, Feng; 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; > 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 > > > > On 07/07/2015 13:13, Wu, Feng wrote: > >> > You can use container_of to add it to your own struct, e.g. > >> > > >> > struct irq_bypass_consumer cons; > >> > struct irq_bypass_producer *prod; > > Do you mean this: > > > > struct kvm_kernel_irqfd { > > > > ...... > > > > struct irq_bypass_consumer cons; > > struct irq_bypass_producer *prod; > > }; > > Yes. Then I still need assign prod and de-assign prod in irq_bypass_register_consumer/irq_bypass_unregister_consumer, Right? Would you please share why this is better. My original though is as below: Thanks, Feng > > Paolo diff --git a/include/linux/irqbypass.h b/include/linux/irqbypass.h index 8f62235..11930c1 100644 --- a/include/linux/irqbypass.h +++ b/include/linux/irqbypass.h @@ -20,6 +20,7 @@ struct irq_bypass_producer { struct irq_bypass_consumer { struct list_head node; void *token; + struct irq_bypass_producer *producer; void (*stop)(struct irq_bypass_consumer *); void (*resume)(struct irq_bypass_consumer *); void (*add_producer)(struct irq_bypass_consumer *, diff --git a/kernel/irq/bypass.c b/kernel/irq/bypass.c index efadbe5..be2da25 100644 --- a/kernel/irq/bypass.c +++ b/kernel/irq/bypass.c @@ -122,6 +122,7 @@ int irq_bypass_register_consumer(struct irq_bypass_consumer *consumer) list_for_each_entry(producer, &producers, node) { if (producer->token == consumer->token) { + consumer->producer = producer; connect(producer, consumer); break; } @@ -140,6 +141,7 @@ void irq_bypass_unregister_consumer(struct irq_bypass_consumer *consumer) list_for_each_entry(producer, &producers, node) { if (producer->token == consumer->token) { + consumer->producer = NULL; disconnect(producer, consumer); break; }