From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH 2/5] VIRT: Support runtime irq_bypass consumer Date: Wed, 16 Dec 2015 12:48:56 -0700 Message-ID: <1450295336.2674.49.camel@redhat.com> References: <1449166972-8894-1-git-send-email-yunhong.jiang@linux.intel.com> <1449166972-8894-3-git-send-email-yunhong.jiang@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Yunhong Jiang , pbonzini@redhat.com Return-path: In-Reply-To: <1449166972-8894-3-git-send-email-yunhong.jiang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Thu, 2015-12-03 at 10:22 -0800, Yunhong Jiang wrote: > Extend the irq_bypass manager to support runtime consumers. A runtime > irq_bypass consumer can handle interrupt when an interrupt triggered.= A > runtime consumer has it's handle_irq() function set and passing a > irq_context for the irq handling. >=20 > A producer keep a link for the runtime consumers, so that it can invo= ke > each consumer's handle_irq() when irq invoked. >=20 > Currently the irq_bypass manager has several code path assuming there= is > only one consumer/producer pair for each token. For example, when > register the producer, it exits the loop after finding one match > consumer.=C2=A0=C2=A0This is updated to support both static consumer = (like for > Posted Interrupt consumer) and runtime consumer. >=20 > Signed-off-by: Yunhong Jiang > --- > =C2=A0include/linux/irqbypass.h |=C2=A0=C2=A08 +++++ > =C2=A0virt/lib/irqbypass.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| 82 ++= +++++++++++++++++++++++++++++++++------------ > =C2=A02 files changed, 69 insertions(+), 21 deletions(-) >=20 > diff --git a/include/linux/irqbypass.h b/include/linux/irqbypass.h > index 1551b5b2f4c2..d5bec0c7be3a 100644 > --- a/include/linux/irqbypass.h > +++ b/include/linux/irqbypass.h > @@ -12,6 +12,7 @@ > =C2=A0#define IRQBYPASS_H > =C2=A0 > =C2=A0#include=20 > +#include=20 > =C2=A0 > =C2=A0struct irq_bypass_consumer; > =C2=A0 > @@ -47,6 +48,9 @@ struct irq_bypass_consumer; > =C2=A0 */ > =C2=A0struct irq_bypass_producer { > =C2=A0 struct list_head node; > + /* Update side is synchronized by the lock on irqbypass.c */ > + struct srcu_struct srcu; > + struct list_head consumers; > =C2=A0 void *token; > =C2=A0 int irq; > =C2=A0 int (*add_consumer)(struct irq_bypass_producer *, Documentation? > @@ -61,6 +65,7 @@ struct irq_bypass_producer { > =C2=A0 * struct irq_bypass_consumer - IRQ bypass consumer definition > =C2=A0 * @node: IRQ bypass manager private list management > =C2=A0 * @token: opaque token to match between producer and consumer > + * @sibling: consumers with same token list management > =C2=A0 * @add_producer: Connect the IRQ consumer to an IRQ producer > =C2=A0 * @del_producer: Disconnect the IRQ consumer from an IRQ produ= cer > =C2=A0 * @stop: Perform any quiesce operations necessary prior to add= /del (optional) What about @handle_irq and @irq_context? > @@ -73,6 +78,7 @@ struct irq_bypass_producer { > =C2=A0 */ > =C2=A0struct irq_bypass_consumer { > =C2=A0 struct list_head node; > + struct list_head sibling; > =C2=A0 void *token; > =C2=A0 int (*add_producer)(struct irq_bypass_consumer *, > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0struct irq_bypass_producer *); > @@ -80,6 +86,8 @@ struct irq_bypass_consumer { > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct irq_bypass_producer *); > =C2=A0 void (*stop)(struct irq_bypass_consumer *); > =C2=A0 void (*start)(struct irq_bypass_consumer *); > + int (*handle_irq)(void *arg); If we called this with a pointer to the consumer, like the other functions, the consumer could embed arg (irq_context) into their own structure, or in this case, do a container_of and avoid storing the irqfd pointer entirely. > + void *irq_context; > =C2=A0}; > =C2=A0 > =C2=A0int irq_bypass_register_producer(struct irq_bypass_producer *);