All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Wu, Feng" <feng.wu@intel.com>
To: "Wu, Feng" <feng.wu@intel.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>
Cc: "iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"eric.auger@linaro.org" <eric.auger@linaro.org>,
	"Wu, Feng" <feng.wu@intel.com>
Subject: RE: [PATCH v9 04/18] KVM: create kvm_irqfd.h
Date: Fri, 18 Sep 2015 15:35:30 +0000	[thread overview]
Message-ID: <E959C4978C3B6342920538CF579893F00271D0FA@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1442586596-5920-5-git-send-email-feng.wu@intel.com>

Signed-off-by: Feng Wu <feng.wu@intel.com>

> -----Original Message-----
> From: iommu-bounces@lists.linux-foundation.org
> [mailto:iommu-bounces@lists.linux-foundation.org] On Behalf Of Feng Wu
> Sent: Friday, September 18, 2015 10:30 PM
> To: pbonzini@redhat.com; alex.williamson@redhat.com; joro@8bytes.org;
> mtosatti@redhat.com
> Cc: iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org;
> kvm@vger.kernel.org; eric.auger@linaro.org
> Subject: [PATCH v9 04/18] KVM: create kvm_irqfd.h
> 
> From: Eric Auger <eric.auger@linaro.org>
> 
> Move _irqfd_resampler and _irqfd struct declarations in a new
> public header: kvm_irqfd.h. They are respectively renamed into
> kvm_kernel_irqfd_resampler and kvm_kernel_irqfd. Those datatypes
> will be used by architecture specific code, in the context of
> IRQ bypass manager integration.
> 
> Signed-off-by: Eric Auger <eric.auger@linaro.org>
> ---
>  include/linux/kvm_irqfd.h | 69 ++++++++++++++++++++++++++++++++++
>  virt/kvm/eventfd.c        | 95 ++++++++++++-----------------------------------
>  2 files changed, 92 insertions(+), 72 deletions(-)
>  create mode 100644 include/linux/kvm_irqfd.h
> 
> diff --git a/include/linux/kvm_irqfd.h b/include/linux/kvm_irqfd.h
> new file mode 100644
> index 0000000..f926b39
> --- /dev/null
> +++ b/include/linux/kvm_irqfd.h
> @@ -0,0 +1,69 @@
> +/*
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * irqfd: Allows an fd to be used to inject an interrupt to the guest
> + * Credit goes to Avi Kivity for the original idea.
> + */
> +
> +#ifndef __LINUX_KVM_IRQFD_H
> +#define __LINUX_KVM_IRQFD_H
> +
> +#include <linux/kvm_host.h>
> +#include <linux/poll.h>
> +
> +/*
> + * Resampling irqfds are a special variety of irqfds used to emulate
> + * level triggered interrupts.  The interrupt is asserted on eventfd
> + * trigger.  On acknowledgment through the irq ack notifier, the
> + * interrupt is de-asserted and userspace is notified through the
> + * resamplefd.  All resamplers on the same gsi are de-asserted
> + * together, so we don't need to track the state of each individual
> + * user.  We can also therefore share the same irq source ID.
> + */
> +struct kvm_kernel_irqfd_resampler {
> +	struct kvm *kvm;
> +	/*
> +	 * List of resampling struct _irqfd objects sharing this gsi.
> +	 * RCU list modified under kvm->irqfds.resampler_lock
> +	 */
> +	struct list_head list;
> +	struct kvm_irq_ack_notifier notifier;
> +	/*
> +	 * Entry in list of kvm->irqfd.resampler_list.  Use for sharing
> +	 * resamplers among irqfds on the same gsi.
> +	 * Accessed and modified under kvm->irqfds.resampler_lock
> +	 */
> +	struct list_head link;
> +};
> +
> +struct kvm_kernel_irqfd {
> +	/* Used for MSI fast-path */
> +	struct kvm *kvm;
> +	wait_queue_t wait;
> +	/* Update side is protected by irqfds.lock */
> +	struct kvm_kernel_irq_routing_entry irq_entry;
> +	seqcount_t irq_entry_sc;
> +	/* Used for level IRQ fast-path */
> +	int gsi;
> +	struct work_struct inject;
> +	/* The resampler used by this irqfd (resampler-only) */
> +	struct kvm_kernel_irqfd_resampler *resampler;
> +	/* Eventfd notified on resample (resampler-only) */
> +	struct eventfd_ctx *resamplefd;
> +	/* Entry in list of irqfds for a resampler (resampler-only) */
> +	struct list_head resampler_link;
> +	/* Used for setup/shutdown */
> +	struct eventfd_ctx *eventfd;
> +	struct list_head list;
> +	poll_table pt;
> +	struct work_struct shutdown;
> +};
> +
> +#endif /* __LINUX_KVM_IRQFD_H */
> diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> index 9ff4193..647ffb8 100644
> --- a/virt/kvm/eventfd.c
> +++ b/virt/kvm/eventfd.c
> @@ -23,6 +23,7 @@
> 
>  #include <linux/kvm_host.h>
>  #include <linux/kvm.h>
> +#include <linux/kvm_irqfd.h>
>  #include <linux/workqueue.h>
>  #include <linux/syscalls.h>
>  #include <linux/wait.h>
> @@ -39,68 +40,14 @@
>  #include <kvm/iodev.h>
> 
>  #ifdef CONFIG_HAVE_KVM_IRQFD
> -/*
> - * --------------------------------------------------------------------
> - * irqfd: Allows an fd to be used to inject an interrupt to the guest
> - *
> - * Credit goes to Avi Kivity for the original idea.
> - * --------------------------------------------------------------------
> - */
> -
> -/*
> - * Resampling irqfds are a special variety of irqfds used to emulate
> - * level triggered interrupts.  The interrupt is asserted on eventfd
> - * trigger.  On acknowledgement through the irq ack notifier, the
> - * interrupt is de-asserted and userspace is notified through the
> - * resamplefd.  All resamplers on the same gsi are de-asserted
> - * together, so we don't need to track the state of each individual
> - * user.  We can also therefore share the same irq source ID.
> - */
> -struct _irqfd_resampler {
> -	struct kvm *kvm;
> -	/*
> -	 * List of resampling struct _irqfd objects sharing this gsi.
> -	 * RCU list modified under kvm->irqfds.resampler_lock
> -	 */
> -	struct list_head list;
> -	struct kvm_irq_ack_notifier notifier;
> -	/*
> -	 * Entry in list of kvm->irqfd.resampler_list.  Use for sharing
> -	 * resamplers among irqfds on the same gsi.
> -	 * Accessed and modified under kvm->irqfds.resampler_lock
> -	 */
> -	struct list_head link;
> -};
> -
> -struct _irqfd {
> -	/* Used for MSI fast-path */
> -	struct kvm *kvm;
> -	wait_queue_t wait;
> -	/* Update side is protected by irqfds.lock */
> -	struct kvm_kernel_irq_routing_entry irq_entry;
> -	seqcount_t irq_entry_sc;
> -	/* Used for level IRQ fast-path */
> -	int gsi;
> -	struct work_struct inject;
> -	/* The resampler used by this irqfd (resampler-only) */
> -	struct _irqfd_resampler *resampler;
> -	/* Eventfd notified on resample (resampler-only) */
> -	struct eventfd_ctx *resamplefd;
> -	/* Entry in list of irqfds for a resampler (resampler-only) */
> -	struct list_head resampler_link;
> -	/* Used for setup/shutdown */
> -	struct eventfd_ctx *eventfd;
> -	struct list_head list;
> -	poll_table pt;
> -	struct work_struct shutdown;
> -};
> 
>  static struct workqueue_struct *irqfd_cleanup_wq;
> 
>  static void
>  irqfd_inject(struct work_struct *work)
>  {
> -	struct _irqfd *irqfd = container_of(work, struct _irqfd, inject);
> +	struct kvm_kernel_irqfd *irqfd =
> +		container_of(work, struct kvm_kernel_irqfd, inject);
>  	struct kvm *kvm = irqfd->kvm;
> 
>  	if (!irqfd->resampler) {
> @@ -121,12 +68,13 @@ irqfd_inject(struct work_struct *work)
>  static void
>  irqfd_resampler_ack(struct kvm_irq_ack_notifier *kian)
>  {
> -	struct _irqfd_resampler *resampler;
> +	struct kvm_kernel_irqfd_resampler *resampler;
>  	struct kvm *kvm;
> -	struct _irqfd *irqfd;
> +	struct kvm_kernel_irqfd *irqfd;
>  	int idx;
> 
> -	resampler = container_of(kian, struct _irqfd_resampler, notifier);
> +	resampler = container_of(kian,
> +			struct kvm_kernel_irqfd_resampler, notifier);
>  	kvm = resampler->kvm;
> 
>  	kvm_set_irq(kvm, KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID,
> @@ -141,9 +89,9 @@ irqfd_resampler_ack(struct kvm_irq_ack_notifier *kian)
>  }
> 
>  static void
> -irqfd_resampler_shutdown(struct _irqfd *irqfd)
> +irqfd_resampler_shutdown(struct kvm_kernel_irqfd *irqfd)
>  {
> -	struct _irqfd_resampler *resampler = irqfd->resampler;
> +	struct kvm_kernel_irqfd_resampler *resampler = irqfd->resampler;
>  	struct kvm *kvm = resampler->kvm;
> 
>  	mutex_lock(&kvm->irqfds.resampler_lock);
> @@ -168,7 +116,8 @@ irqfd_resampler_shutdown(struct _irqfd *irqfd)
>  static void
>  irqfd_shutdown(struct work_struct *work)
>  {
> -	struct _irqfd *irqfd = container_of(work, struct _irqfd, shutdown);
> +	struct kvm_kernel_irqfd *irqfd =
> +		container_of(work, struct kvm_kernel_irqfd, shutdown);
>  	u64 cnt;
> 
>  	/*
> @@ -198,7 +147,7 @@ irqfd_shutdown(struct work_struct *work)
> 
>  /* assumes kvm->irqfds.lock is held */
>  static bool
> -irqfd_is_active(struct _irqfd *irqfd)
> +irqfd_is_active(struct kvm_kernel_irqfd *irqfd)
>  {
>  	return list_empty(&irqfd->list) ? false : true;
>  }
> @@ -209,7 +158,7 @@ irqfd_is_active(struct _irqfd *irqfd)
>   * assumes kvm->irqfds.lock is held
>   */
>  static void
> -irqfd_deactivate(struct _irqfd *irqfd)
> +irqfd_deactivate(struct kvm_kernel_irqfd *irqfd)
>  {
>  	BUG_ON(!irqfd_is_active(irqfd));
> 
> @@ -224,7 +173,8 @@ irqfd_deactivate(struct _irqfd *irqfd)
>  static int
>  irqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key)
>  {
> -	struct _irqfd *irqfd = container_of(wait, struct _irqfd, wait);
> +	struct kvm_kernel_irqfd *irqfd =
> +		container_of(wait, struct kvm_kernel_irqfd, wait);
>  	unsigned long flags = (unsigned long)key;
>  	struct kvm_kernel_irq_routing_entry irq;
>  	struct kvm *kvm = irqfd->kvm;
> @@ -274,12 +224,13 @@ static void
>  irqfd_ptable_queue_proc(struct file *file, wait_queue_head_t *wqh,
>  			poll_table *pt)
>  {
> -	struct _irqfd *irqfd = container_of(pt, struct _irqfd, pt);
> +	struct kvm_kernel_irqfd *irqfd =
> +		container_of(pt, struct kvm_kernel_irqfd, pt);
>  	add_wait_queue(wqh, &irqfd->wait);
>  }
> 
>  /* Must be called under irqfds.lock */
> -static void irqfd_update(struct kvm *kvm, struct _irqfd *irqfd)
> +static void irqfd_update(struct kvm *kvm, struct kvm_kernel_irqfd *irqfd)
>  {
>  	struct kvm_kernel_irq_routing_entry *e;
>  	struct kvm_kernel_irq_routing_entry entries[KVM_NR_IRQCHIPS];
> @@ -304,7 +255,7 @@ static void irqfd_update(struct kvm *kvm, struct _irqfd
> *irqfd)
>  static int
>  kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
>  {
> -	struct _irqfd *irqfd, *tmp;
> +	struct kvm_kernel_irqfd *irqfd, *tmp;
>  	struct fd f;
>  	struct eventfd_ctx *eventfd = NULL, *resamplefd = NULL;
>  	int ret;
> @@ -340,7 +291,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd
> *args)
>  	irqfd->eventfd = eventfd;
> 
>  	if (args->flags & KVM_IRQFD_FLAG_RESAMPLE) {
> -		struct _irqfd_resampler *resampler;
> +		struct kvm_kernel_irqfd_resampler *resampler;
> 
>  		resamplefd = eventfd_ctx_fdget(args->resamplefd);
>  		if (IS_ERR(resamplefd)) {
> @@ -525,7 +476,7 @@ kvm_eventfd_init(struct kvm *kvm)
>  static int
>  kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args)
>  {
> -	struct _irqfd *irqfd, *tmp;
> +	struct kvm_kernel_irqfd *irqfd, *tmp;
>  	struct eventfd_ctx *eventfd;
> 
>  	eventfd = eventfd_ctx_fdget(args->fd);
> @@ -581,7 +532,7 @@ kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
>  void
>  kvm_irqfd_release(struct kvm *kvm)
>  {
> -	struct _irqfd *irqfd, *tmp;
> +	struct kvm_kernel_irqfd *irqfd, *tmp;
> 
>  	spin_lock_irq(&kvm->irqfds.lock);
> 
> @@ -604,7 +555,7 @@ kvm_irqfd_release(struct kvm *kvm)
>   */
>  void kvm_irq_routing_update(struct kvm *kvm)
>  {
> -	struct _irqfd *irqfd;
> +	struct kvm_kernel_irqfd *irqfd;
> 
>  	spin_lock_irq(&kvm->irqfds.lock);
> 
> --
> 2.1.0
> 
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: "Wu, Feng" <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "Wu, Feng" <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
	<pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
	<alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org"
	<joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>,
	"mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
	<mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: RE: [PATCH v9 04/18] KVM: create kvm_irqfd.h
Date: Fri, 18 Sep 2015 15:35:30 +0000	[thread overview]
Message-ID: <E959C4978C3B6342920538CF579893F00271D0FA@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1442586596-5920-5-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> -----Original Message-----
> From: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> [mailto:iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org] On Behalf Of Feng Wu
> Sent: Friday, September 18, 2015 10:30 PM
> To: pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org;
> mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
> Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
> kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
> Subject: [PATCH v9 04/18] KVM: create kvm_irqfd.h
> 
> From: Eric Auger <eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> 
> Move _irqfd_resampler and _irqfd struct declarations in a new
> public header: kvm_irqfd.h. They are respectively renamed into
> kvm_kernel_irqfd_resampler and kvm_kernel_irqfd. Those datatypes
> will be used by architecture specific code, in the context of
> IRQ bypass manager integration.
> 
> Signed-off-by: Eric Auger <eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  include/linux/kvm_irqfd.h | 69 ++++++++++++++++++++++++++++++++++
>  virt/kvm/eventfd.c        | 95 ++++++++++++-----------------------------------
>  2 files changed, 92 insertions(+), 72 deletions(-)
>  create mode 100644 include/linux/kvm_irqfd.h
> 
> diff --git a/include/linux/kvm_irqfd.h b/include/linux/kvm_irqfd.h
> new file mode 100644
> index 0000000..f926b39
> --- /dev/null
> +++ b/include/linux/kvm_irqfd.h
> @@ -0,0 +1,69 @@
> +/*
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * irqfd: Allows an fd to be used to inject an interrupt to the guest
> + * Credit goes to Avi Kivity for the original idea.
> + */
> +
> +#ifndef __LINUX_KVM_IRQFD_H
> +#define __LINUX_KVM_IRQFD_H
> +
> +#include <linux/kvm_host.h>
> +#include <linux/poll.h>
> +
> +/*
> + * Resampling irqfds are a special variety of irqfds used to emulate
> + * level triggered interrupts.  The interrupt is asserted on eventfd
> + * trigger.  On acknowledgment through the irq ack notifier, the
> + * interrupt is de-asserted and userspace is notified through the
> + * resamplefd.  All resamplers on the same gsi are de-asserted
> + * together, so we don't need to track the state of each individual
> + * user.  We can also therefore share the same irq source ID.
> + */
> +struct kvm_kernel_irqfd_resampler {
> +	struct kvm *kvm;
> +	/*
> +	 * List of resampling struct _irqfd objects sharing this gsi.
> +	 * RCU list modified under kvm->irqfds.resampler_lock
> +	 */
> +	struct list_head list;
> +	struct kvm_irq_ack_notifier notifier;
> +	/*
> +	 * Entry in list of kvm->irqfd.resampler_list.  Use for sharing
> +	 * resamplers among irqfds on the same gsi.
> +	 * Accessed and modified under kvm->irqfds.resampler_lock
> +	 */
> +	struct list_head link;
> +};
> +
> +struct kvm_kernel_irqfd {
> +	/* Used for MSI fast-path */
> +	struct kvm *kvm;
> +	wait_queue_t wait;
> +	/* Update side is protected by irqfds.lock */
> +	struct kvm_kernel_irq_routing_entry irq_entry;
> +	seqcount_t irq_entry_sc;
> +	/* Used for level IRQ fast-path */
> +	int gsi;
> +	struct work_struct inject;
> +	/* The resampler used by this irqfd (resampler-only) */
> +	struct kvm_kernel_irqfd_resampler *resampler;
> +	/* Eventfd notified on resample (resampler-only) */
> +	struct eventfd_ctx *resamplefd;
> +	/* Entry in list of irqfds for a resampler (resampler-only) */
> +	struct list_head resampler_link;
> +	/* Used for setup/shutdown */
> +	struct eventfd_ctx *eventfd;
> +	struct list_head list;
> +	poll_table pt;
> +	struct work_struct shutdown;
> +};
> +
> +#endif /* __LINUX_KVM_IRQFD_H */
> diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> index 9ff4193..647ffb8 100644
> --- a/virt/kvm/eventfd.c
> +++ b/virt/kvm/eventfd.c
> @@ -23,6 +23,7 @@
> 
>  #include <linux/kvm_host.h>
>  #include <linux/kvm.h>
> +#include <linux/kvm_irqfd.h>
>  #include <linux/workqueue.h>
>  #include <linux/syscalls.h>
>  #include <linux/wait.h>
> @@ -39,68 +40,14 @@
>  #include <kvm/iodev.h>
> 
>  #ifdef CONFIG_HAVE_KVM_IRQFD
> -/*
> - * --------------------------------------------------------------------
> - * irqfd: Allows an fd to be used to inject an interrupt to the guest
> - *
> - * Credit goes to Avi Kivity for the original idea.
> - * --------------------------------------------------------------------
> - */
> -
> -/*
> - * Resampling irqfds are a special variety of irqfds used to emulate
> - * level triggered interrupts.  The interrupt is asserted on eventfd
> - * trigger.  On acknowledgement through the irq ack notifier, the
> - * interrupt is de-asserted and userspace is notified through the
> - * resamplefd.  All resamplers on the same gsi are de-asserted
> - * together, so we don't need to track the state of each individual
> - * user.  We can also therefore share the same irq source ID.
> - */
> -struct _irqfd_resampler {
> -	struct kvm *kvm;
> -	/*
> -	 * List of resampling struct _irqfd objects sharing this gsi.
> -	 * RCU list modified under kvm->irqfds.resampler_lock
> -	 */
> -	struct list_head list;
> -	struct kvm_irq_ack_notifier notifier;
> -	/*
> -	 * Entry in list of kvm->irqfd.resampler_list.  Use for sharing
> -	 * resamplers among irqfds on the same gsi.
> -	 * Accessed and modified under kvm->irqfds.resampler_lock
> -	 */
> -	struct list_head link;
> -};
> -
> -struct _irqfd {
> -	/* Used for MSI fast-path */
> -	struct kvm *kvm;
> -	wait_queue_t wait;
> -	/* Update side is protected by irqfds.lock */
> -	struct kvm_kernel_irq_routing_entry irq_entry;
> -	seqcount_t irq_entry_sc;
> -	/* Used for level IRQ fast-path */
> -	int gsi;
> -	struct work_struct inject;
> -	/* The resampler used by this irqfd (resampler-only) */
> -	struct _irqfd_resampler *resampler;
> -	/* Eventfd notified on resample (resampler-only) */
> -	struct eventfd_ctx *resamplefd;
> -	/* Entry in list of irqfds for a resampler (resampler-only) */
> -	struct list_head resampler_link;
> -	/* Used for setup/shutdown */
> -	struct eventfd_ctx *eventfd;
> -	struct list_head list;
> -	poll_table pt;
> -	struct work_struct shutdown;
> -};
> 
>  static struct workqueue_struct *irqfd_cleanup_wq;
> 
>  static void
>  irqfd_inject(struct work_struct *work)
>  {
> -	struct _irqfd *irqfd = container_of(work, struct _irqfd, inject);
> +	struct kvm_kernel_irqfd *irqfd =
> +		container_of(work, struct kvm_kernel_irqfd, inject);
>  	struct kvm *kvm = irqfd->kvm;
> 
>  	if (!irqfd->resampler) {
> @@ -121,12 +68,13 @@ irqfd_inject(struct work_struct *work)
>  static void
>  irqfd_resampler_ack(struct kvm_irq_ack_notifier *kian)
>  {
> -	struct _irqfd_resampler *resampler;
> +	struct kvm_kernel_irqfd_resampler *resampler;
>  	struct kvm *kvm;
> -	struct _irqfd *irqfd;
> +	struct kvm_kernel_irqfd *irqfd;
>  	int idx;
> 
> -	resampler = container_of(kian, struct _irqfd_resampler, notifier);
> +	resampler = container_of(kian,
> +			struct kvm_kernel_irqfd_resampler, notifier);
>  	kvm = resampler->kvm;
> 
>  	kvm_set_irq(kvm, KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID,
> @@ -141,9 +89,9 @@ irqfd_resampler_ack(struct kvm_irq_ack_notifier *kian)
>  }
> 
>  static void
> -irqfd_resampler_shutdown(struct _irqfd *irqfd)
> +irqfd_resampler_shutdown(struct kvm_kernel_irqfd *irqfd)
>  {
> -	struct _irqfd_resampler *resampler = irqfd->resampler;
> +	struct kvm_kernel_irqfd_resampler *resampler = irqfd->resampler;
>  	struct kvm *kvm = resampler->kvm;
> 
>  	mutex_lock(&kvm->irqfds.resampler_lock);
> @@ -168,7 +116,8 @@ irqfd_resampler_shutdown(struct _irqfd *irqfd)
>  static void
>  irqfd_shutdown(struct work_struct *work)
>  {
> -	struct _irqfd *irqfd = container_of(work, struct _irqfd, shutdown);
> +	struct kvm_kernel_irqfd *irqfd =
> +		container_of(work, struct kvm_kernel_irqfd, shutdown);
>  	u64 cnt;
> 
>  	/*
> @@ -198,7 +147,7 @@ irqfd_shutdown(struct work_struct *work)
> 
>  /* assumes kvm->irqfds.lock is held */
>  static bool
> -irqfd_is_active(struct _irqfd *irqfd)
> +irqfd_is_active(struct kvm_kernel_irqfd *irqfd)
>  {
>  	return list_empty(&irqfd->list) ? false : true;
>  }
> @@ -209,7 +158,7 @@ irqfd_is_active(struct _irqfd *irqfd)
>   * assumes kvm->irqfds.lock is held
>   */
>  static void
> -irqfd_deactivate(struct _irqfd *irqfd)
> +irqfd_deactivate(struct kvm_kernel_irqfd *irqfd)
>  {
>  	BUG_ON(!irqfd_is_active(irqfd));
> 
> @@ -224,7 +173,8 @@ irqfd_deactivate(struct _irqfd *irqfd)
>  static int
>  irqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key)
>  {
> -	struct _irqfd *irqfd = container_of(wait, struct _irqfd, wait);
> +	struct kvm_kernel_irqfd *irqfd =
> +		container_of(wait, struct kvm_kernel_irqfd, wait);
>  	unsigned long flags = (unsigned long)key;
>  	struct kvm_kernel_irq_routing_entry irq;
>  	struct kvm *kvm = irqfd->kvm;
> @@ -274,12 +224,13 @@ static void
>  irqfd_ptable_queue_proc(struct file *file, wait_queue_head_t *wqh,
>  			poll_table *pt)
>  {
> -	struct _irqfd *irqfd = container_of(pt, struct _irqfd, pt);
> +	struct kvm_kernel_irqfd *irqfd =
> +		container_of(pt, struct kvm_kernel_irqfd, pt);
>  	add_wait_queue(wqh, &irqfd->wait);
>  }
> 
>  /* Must be called under irqfds.lock */
> -static void irqfd_update(struct kvm *kvm, struct _irqfd *irqfd)
> +static void irqfd_update(struct kvm *kvm, struct kvm_kernel_irqfd *irqfd)
>  {
>  	struct kvm_kernel_irq_routing_entry *e;
>  	struct kvm_kernel_irq_routing_entry entries[KVM_NR_IRQCHIPS];
> @@ -304,7 +255,7 @@ static void irqfd_update(struct kvm *kvm, struct _irqfd
> *irqfd)
>  static int
>  kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
>  {
> -	struct _irqfd *irqfd, *tmp;
> +	struct kvm_kernel_irqfd *irqfd, *tmp;
>  	struct fd f;
>  	struct eventfd_ctx *eventfd = NULL, *resamplefd = NULL;
>  	int ret;
> @@ -340,7 +291,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd
> *args)
>  	irqfd->eventfd = eventfd;
> 
>  	if (args->flags & KVM_IRQFD_FLAG_RESAMPLE) {
> -		struct _irqfd_resampler *resampler;
> +		struct kvm_kernel_irqfd_resampler *resampler;
> 
>  		resamplefd = eventfd_ctx_fdget(args->resamplefd);
>  		if (IS_ERR(resamplefd)) {
> @@ -525,7 +476,7 @@ kvm_eventfd_init(struct kvm *kvm)
>  static int
>  kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args)
>  {
> -	struct _irqfd *irqfd, *tmp;
> +	struct kvm_kernel_irqfd *irqfd, *tmp;
>  	struct eventfd_ctx *eventfd;
> 
>  	eventfd = eventfd_ctx_fdget(args->fd);
> @@ -581,7 +532,7 @@ kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
>  void
>  kvm_irqfd_release(struct kvm *kvm)
>  {
> -	struct _irqfd *irqfd, *tmp;
> +	struct kvm_kernel_irqfd *irqfd, *tmp;
> 
>  	spin_lock_irq(&kvm->irqfds.lock);
> 
> @@ -604,7 +555,7 @@ kvm_irqfd_release(struct kvm *kvm)
>   */
>  void kvm_irq_routing_update(struct kvm *kvm)
>  {
> -	struct _irqfd *irqfd;
> +	struct kvm_kernel_irqfd *irqfd;
> 
>  	spin_lock_irq(&kvm->irqfds.lock);
> 
> --
> 2.1.0
> 
> _______________________________________________
> iommu mailing list
> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2015-09-18 15:35 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18 14:29 [PATCH v9 00/18] Add VT-d Posted-Interrupts support - including prerequisite series Feng Wu
2015-09-18 14:29 ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 01/18] virt: IRQ bypass manager Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 15:34   ` Wu, Feng
2015-09-18 15:34     ` Wu, Feng
2015-09-18 14:29 ` [PATCH v9 02/18] KVM: x86: select IRQ_BYPASS_MANAGER Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 03/18] KVM: arm/arm64: " Feng Wu
2015-09-21 19:32   ` Eric Auger
2015-09-18 14:29 ` [PATCH v9 04/18] KVM: create kvm_irqfd.h Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 15:35   ` Wu, Feng [this message]
2015-09-18 15:35     ` Wu, Feng
2015-09-18 14:29 ` [PATCH v9 05/18] KVM: introduce kvm_arch functions for IRQ bypass Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 06/18] KVM: eventfd: add irq bypass consumer management Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 07/18] KVM: Extend struct pi_desc for VT-d Posted-Interrupts Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 08/18] KVM: Add some helper functions for Posted-Interrupts Feng Wu
2015-09-18 14:29 ` [PATCH v9 09/18] KVM: Define a new interface kvm_intr_is_single_vcpu() Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 10/18] KVM: Make struct kvm_irq_routing_table accessible Feng Wu
2015-09-18 14:29 ` [PATCH v9 11/18] KVM: make kvm_set_msi_irq() public Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 12/18] vfio: Register/unregister irq_bypass_producer Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 17:19   ` Alex Williamson
2015-09-18 17:19     ` Alex Williamson
2015-09-21  8:56   ` Wu, Feng
2015-09-21  8:56     ` Wu, Feng
2015-09-21  9:32     ` Paolo Bonzini
2015-09-21  9:32       ` Paolo Bonzini
2015-09-21 11:35       ` Wu, Feng
2015-09-21 11:35         ` Wu, Feng
2015-09-21 12:06         ` Paolo Bonzini
2015-09-21 12:06           ` Paolo Bonzini
2015-09-21 12:08           ` Wu, Feng
2015-09-21 12:08             ` Wu, Feng
2015-09-21 12:53       ` Wu, Feng
2015-09-21 12:53         ` Wu, Feng
2015-09-21 13:02         ` Paolo Bonzini
2015-09-21 19:46           ` Eric Auger
2015-09-21 19:46             ` Eric Auger
2016-04-26 20:08   ` Alex Williamson
2016-04-26 20:08     ` Alex Williamson
2016-04-27  1:32     ` Wu, Feng
2016-04-27  1:32       ` Wu, Feng
2016-04-28 16:40       ` Alex Williamson
2016-04-28 16:40         ` Alex Williamson
2016-04-28 15:35     ` Eric Auger
2016-04-28 15:35       ` Eric Auger
2015-09-18 14:29 ` [PATCH v9 13/18] KVM: x86: Update IRTE for posted-interrupts Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 14/18] KVM: Implement IRQ bypass consumer callbacks for x86 Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 15/18] KVM: Add an arch specific hooks in 'struct kvm_kernel_irqfd' Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 16/18] KVM: Update Posted-Interrupts Descriptor when vCPU is preempted Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 14:29 ` [PATCH v9 17/18] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-18 16:06   ` Paolo Bonzini
2015-09-18 16:06     ` Paolo Bonzini
2015-09-19  7:11     ` Wu, Feng
2015-09-19  7:11       ` Wu, Feng
2015-09-21  2:16     ` Wu, Feng
2015-09-21  5:32       ` Paolo Bonzini
2015-09-21  5:32         ` Paolo Bonzini
2015-09-21  5:45         ` Wu, Feng
2015-09-21  5:45           ` Wu, Feng
2015-10-14 23:41   ` David Matlack
2015-10-15  1:33     ` Wu, Feng
2015-10-15  1:33       ` Wu, Feng
2015-10-15 17:39       ` David Matlack
2015-10-15 18:13         ` Paolo Bonzini
2015-10-15 18:13           ` Paolo Bonzini
2015-10-16  1:45           ` Wu, Feng
2015-10-16  1:45             ` Wu, Feng
2015-09-18 14:29 ` [PATCH v9 18/18] iommu/vt-d: Add a command line parameter for VT-d posted-interrupts Feng Wu
2015-09-18 14:29   ` Feng Wu
2015-09-21 13:46   ` Joerg Roedel
2015-09-21 13:46     ` Joerg Roedel
2015-09-18 14:58 ` [PATCH v9 00/18] Add VT-d Posted-Interrupts support - including prerequisite series Paolo Bonzini
2015-09-18 14:58   ` Paolo Bonzini
2015-09-18 15:08   ` Wu, Feng
2015-09-18 15:08     ` Wu, Feng
2015-09-18 15:21     ` Paolo Bonzini
2015-09-18 15:21       ` Paolo Bonzini
2015-09-18 15:38       ` Wu, Feng
2015-09-18 17:57   ` Alex Williamson
2015-09-18 17:57     ` Alex Williamson
2015-09-25  1:49 ` Wu, Feng
2015-09-25  1:49   ` Wu, Feng
2015-09-25 11:14   ` Paolo Bonzini
2015-09-25 11:14     ` Paolo Bonzini
2015-09-28 10:14     ` Wu, Feng
2015-09-28 10:14       ` Wu, Feng
2015-09-28 10:18       ` Paolo Bonzini
2015-09-28 10:18         ` Paolo Bonzini
2015-09-28 10:22         ` Wu, Feng
2015-09-28 10:22           ` Wu, Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E959C4978C3B6342920538CF579893F00271D0FA@SHSMSX104.ccr.corp.intel.com \
    --to=feng.wu@intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=eric.auger@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.