lkml.org 
[lkml]   [2012]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 -tip 1/5] x86, MSI: Support multiple MSIs in presense of IRQ remapping
On Tue, Oct 02, 2012 at 06:55:18AM +0200, Ingo Molnar wrote:

Thanks for the review, Ingo.

> > @@ -584,8 +586,12 @@ int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
> > #define irq_alloc_desc_from(from, node) \
> > irq_alloc_descs(-1, from, 1, node)
> >
> > +#define irq_alloc_descs_from(from, cnt, node) \
> > + irq_alloc_descs(-1, from, cnt, node)
> > +
>
> Please use inlines instead of macros. Might transform the one
> above it as well in the process.

You mean here do not introduce irq_alloc_descs_from, but rather use
irq_alloc_descs() directly?

> > +int irq_can_alloc_irqs(unsigned int from, unsigned int cnt)
> > +{
> > + unsigned int start;
> > + int ret = 0;
> > +
> > + if (!cnt)
> > + return -EINVAL;
> > +
> > + mutex_lock(&sparse_irq_lock);
> > + start = bitmap_find_next_zero_area(allocated_irqs, IRQ_BITMAP_BITS,
> > + from, cnt, 0);
> > + mutex_unlock(&sparse_irq_lock);
> > + if (start + cnt > nr_irqs)
> > + ret = irq_can_expand_nr_irqs(start + cnt);
> > + return ret;
>
> How is this supposed to work wrt. races?

It is not supposed. Just a quick check if there are enough bits before an
attempt to allocate memory in __create_irqs(). Otherwise __create_irqs()
might allocate irq_cfg's, then realize there are no bits, then deallocate
and fail.

But strictly speaking, irq_can_alloc_irqs() is unnecessary.

--
Regards,
Alexander Gordeev
agordeev@redhat.com


\
 
 \ /
  Last update: 2012-10-02 13:41    [W:0.065 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site