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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 30 Sep 2010 22:28:19 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	LKML <linux-kernel@...r.kernel.org>, linux-arch@...r.kernel.org,
	Linus Torvalds <torvalds@...l.org>,
	Andrew Morton <akpm@...ux-foundation.org>, x86@...nel.org,
	Peter Zijlstra <peterz@...radead.org>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Paul Mundt <lethal@...ux-sh.org>,
	Russell King <linux@....linux.org.uk>,
	David Woodhouse <dwmw2@...radead.org>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Grant Likely <grant.likely@...retlab.ca>,
	"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [patch 14/47] genirq: Implement a sane sparse_irq allocator

On 09/30/2010 04:15 PM, Thomas Gleixner wrote:
......
> ---
>  include/linux/irq.h  |   25 +++++
>  kernel/irq/irqdesc.c |  226 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 243 insertions(+), 8 deletions(-)
> 
> Index: linux-2.6-tip/include/linux/irq.h
> ===================================================================
> --- linux-2.6-tip.orig/include/linux/irq.h
> +++ linux-2.6-tip/include/linux/irq.h
> @@ -276,6 +276,31 @@ static inline struct irq_desc *move_irq_
>  
>  extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
>  
> +int irq_alloc_descs(unsigned int irq, unsigned int from, unsigned int cnt, int node);
> +
> +static inline int irq_alloc_desc(int node)
> +{
> +	return irq_alloc_descs(0, 0, 1, node);
> +}
> +
> +static inline int
> +irq_alloc_desc_at(unsigned int at, int node)
> +{
> +	return irq_alloc_descs(at, 0, 1, node);

need to change to 

	return irq_alloc_descs(at, at, 1, node);

> +}
> +
...

> Index: linux-2.6-tip/kernel/irq/irqdesc.c
> ===================================================================
> --- linux-2.6-tip.orig/kernel/irq/irqdesc.c
> +++ linux-2.6-tip/kernel/irq/irqdesc.c
...

> +/**
> + * irq_alloc_descs - allocate and initialize a range of irq descriptors
> + * @irq:	Allocate for specific irq number if irq > 0
> + * @from:	Start the search from this irq number
> + * @cnt:	Number of consecutive irqs to allocate.
> + * @node:	Preferred node on which the irq descriptor should be allocated
> + *
> + * Returns the first irq number or error code
> + */
> +int __ref
> +irq_alloc_descs(unsigned int irq, unsigned int from, unsigned int cnt, int node)
> +{
> +	unsigned long flags;
> +	int start, ret;
> +
> +	if (!cnt)
> +		return -EINVAL;
> +
> +	raw_spin_lock_irqsave(&sparse_irq_lock, flags);
> +
or add
	if (irq)
		from = irq;
here.

> +	start = bitmap_find_next_zero_area(allocated_irqs, nr_irqs, from, cnt, 0);
> +	ret = -EEXIST;
> +	if (irq && start != irq)
> +		goto err;
> +
> +	ret = -ENOMEM;
> +	if (start >= nr_irqs)
> +		goto err;
> +
> +	bitmap_set(allocated_irqs, start, cnt);
> +	raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
> +	return alloc_descs(start, cnt, node);
> +
> +err:
> +	raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
> +	return ret;
> +}

Yinghai
--
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