linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	jan.kiszka@siemens.com, Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] kvm: deliver msix interrupts from irq handler
Date: Thu, 19 Jan 2012 18:39:17 +0200	[thread overview]
Message-ID: <20120119163917.GB18770@redhat.com> (raw)
In-Reply-To: <20120119155748.GA6340@redhat.com>

On Thu, Jan 19, 2012 at 05:57:48PM +0200, Michael S. Tsirkin wrote:
> On Thu, Jan 19, 2012 at 05:02:17PM +0200, Gleb Natapov wrote:
> > On Thu, Jan 19, 2012 at 03:49:57PM +0200, Michael S. Tsirkin wrote:
> > > > > +	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) {
> > > > > +			if (ei->type == KVM_IRQ_ROUTING_MSI)
> > > > > +				ret = kvm_set_msi(e, kvm, irq_source_id, level,
> > > > > +						  host_irq);
> > > > > +			else
> > > > > +				ret = -EWOULDBLOCK;
> > > > > +			break;
> > > > > +		}
> > > > > +	rcu_read_unlock_bh();
> > > > > +	return ret;
> > > > > +}
> > > > > +
> > > > Share implementation with kvm_set_irq().
> > > 
> > > I considered this. There are several reasons not to do it:
> > > - Amount of common code is very small
> > Why? Just pass msi_only flag to kvm_set_irq() and skip an entry if flag is
> > set and entry type is not msi.
> > 
> > > - As it's separate, it's more obvious that it can't block (kvm_set_irq can block)
> > >   We can even tag kvm_set_irq with might_sleep.
> > They can still be two separate function calling common one.
> 
> No, the common code is the surrounding foreach loop,
> the internal if branch is different.
> 
I do not see any complication whatsoever. The reuse it trivial.

--
			Gleb.

  reply	other threads:[~2012-01-19 16:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 18:10 [PATCH RFC] kvm: deliver msix interrupts from irq handler Michael S. Tsirkin
2012-01-19  7:21 ` Gleb Natapov
2012-01-19 13:49   ` Michael S. Tsirkin
2012-01-19 15:02     ` Gleb Natapov
2012-01-19 15:57       ` Michael S. Tsirkin
2012-01-19 16:39         ` Gleb Natapov [this message]
2012-01-19 12:04 ` Jan Kiszka
2012-01-19 14:30   ` Michael S. Tsirkin

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=20120119163917.GB18770@redhat.com \
    --to=gleb@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).