lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121002110630.GA2258@dhcp-26-207.brq.redhat.com>
Date:	Tue, 2 Oct 2012 13:06:30 +0200
From:	Alexander Gordeev <agordeev@...hat.com>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Suresh Siddha <suresh.b.siddha@...el.com>,
	Yinghai Lu <yinghai@...nel.org>,
	Jeff Garzik <jgarzik@...ox.com>,
	Matthew Wilcox <willy@...ux.intel.com>, x86@...nel.org,
	linux-pci@...r.kernel.org, linux-ide@...r.kernel.org
Subject: Re: [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@...hat.com
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ