[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120119163917.GB18770@redhat.com>
Date: Thu, 19 Jan 2012 18:39:17 +0200
From: Gleb Natapov <gleb@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Alex Williamson <alex.williamson@...hat.com>,
jan.kiszka@...mens.com, Avi Kivity <avi@...hat.com>,
Marcelo Tosatti <mtosatti@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC] kvm: deliver msix interrupts from irq handler
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists