All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory Haskins <gregory.haskins@gmail.com>
To: Gregory Haskins <ghaskins@novell.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	alacrityvm-devel@lists.sourceforge.net
Subject: Re: [KVM PATCH v2 1/2] KVM: export lockless GSI attribute
Date: Thu, 22 Oct 2009 22:43:21 -0400	[thread overview]
Message-ID: <4AE11849.9070807@gmail.com> (raw)
In-Reply-To: <20091023023845.3891.36857.stgit@dev.haskins.net>

[-- Attachment #1: Type: text/plain, Size: 3233 bytes --]

Gregory Haskins wrote:
> Certain GSI's support lockless injecton, but we have no way to detect
> which ones at the GSI level.  Knowledge of this attribute will be
> useful later in the series so that we can optimize irqfd injection
> paths for cases where we know the code will not sleep.  Therefore,
> we provide an API to query a specific GSI.
> 
> Signed-off-by: Gregory Haskins <ghaskins@novell.com>
> ---
> 
>  include/linux/kvm_host.h |    2 ++
>  virt/kvm/irq_comm.c      |   19 +++++++++++++++++++
>  2 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index bd5a616..93393a4 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -119,6 +119,7 @@ struct kvm_memory_slot {
>  struct kvm_kernel_irq_routing_entry {
>  	u32 gsi;
>  	u32 type;
> +	bool lockless;
>  	int (*set)(struct kvm_kernel_irq_routing_entry *e,
>  		   struct kvm *kvm, int irq_source_id, int level);
>  	union {
> @@ -417,6 +418,7 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
>  				   unsigned long *deliver_bitmask);
>  #endif
>  int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level);
> +int kvm_irq_check_lockless(struct kvm *kvm, u32 irq);
>  void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
>  void kvm_register_irq_ack_notifier(struct kvm *kvm,
>  				   struct kvm_irq_ack_notifier *kian);
> diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
> index 00c68d2..04f0134 100644
> --- a/virt/kvm/irq_comm.c
> +++ b/virt/kvm/irq_comm.c
> @@ -174,6 +174,23 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level)
>  	return ret;
>  }
>  
> +int kvm_irq_check_lockless(struct kvm *kvm, u32 irq)
> +{
> +	struct kvm_kernel_irq_routing_entry *e;
> +	struct kvm_irq_routing_table *irq_rt;
> +	struct hlist_node *n;
> +	int ret = -ENOENT;
> +
> +	rcu_read_lock();
> +	irq_rt = rcu_dereference(kvm->irq_routing);
> +	if (irq < irq_rt->nr_rt_entries)
> +		hlist_for_each_entry(e, n, &irq_rt->map[irq], link)
> +			ret = e->lockless ? 1 : 0;

Sigh...  just noticed this as it hits the list.  I should probably break
out of the loop here.

> +	rcu_read_unlock();
> +
> +	return ret;
> +}
> +
>  void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
>  {
>  	struct kvm_irq_ack_notifier *kian;
> @@ -314,6 +331,7 @@ static int setup_routing_entry(struct kvm_irq_routing_table *rt,
>  
>  	e->gsi = ue->gsi;
>  	e->type = ue->type;
> +	e->lockless = false;
>  	switch (ue->type) {
>  	case KVM_IRQ_ROUTING_IRQCHIP:
>  		delta = 0;
> @@ -342,6 +360,7 @@ static int setup_routing_entry(struct kvm_irq_routing_table *rt,
>  		e->msi.address_lo = ue->u.msi.address_lo;
>  		e->msi.address_hi = ue->u.msi.address_hi;
>  		e->msi.data = ue->u.msi.data;
> +		e->lockless = true;
>  		break;
>  	default:
>  		goto out;
> 
> --
> 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/



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 267 bytes --]

  reply	other threads:[~2009-10-23  2:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23  2:38 [KVM PATCH v2 0/2] irqfd enhancements Gregory Haskins
2009-10-23  2:38 ` [KVM PATCH v2 1/2] KVM: export lockless GSI attribute Gregory Haskins
2009-10-23  2:43   ` Gregory Haskins [this message]
2009-10-25 14:30   ` Avi Kivity
2009-10-26 13:25     ` [Alacrityvm-devel] " Gregory Haskins
2009-10-26 15:38       ` Gregory Haskins
2009-10-28 10:04         ` Avi Kivity
2009-10-28 13:19           ` Gregory Haskins
2009-10-28 13:27             ` Avi Kivity
2009-10-28 13:30               ` Gregory Haskins
2009-10-23  2:38 ` [KVM PATCH v2 2/2] KVM: Directly inject interrupts if they support lockless operation Gregory Haskins

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=4AE11849.9070807@gmail.com \
    --to=gregory.haskins@gmail.com \
    --cc=alacrityvm-devel@lists.sourceforge.net \
    --cc=ghaskins@novell.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.