Re: [PATCH] bitops: remove "optimizations"

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <tglx@...>
Cc: <torvalds@...>, <harvey.harrison@...>, <mingo@...>, <akpm@...>, <linux-kernel@...>
Date: Tuesday, April 29, 2008 - 7:30 pm

From: David Miller <davem@davemloft.net>
Date: Tue, 29 Apr 2008 15:58:24 -0700 (PDT)


Ok, I think I see the problem.

The core issue is that (X << N) is undefined when N is >= the
word size, but that's exactly what the find_next_bit() inline
optimizations do.

This optimization code will trigger on 64-bit if NR_CPUS is set
to 64, and you actually have 64 cpus.  It should also occur
on 32-bit if NR_CPUS=32 and you have 32 cpus.

The bogus expansion occurs in lib/cpumask.c:__next_cpu()

After processing cpu 63, we'll use offset==64 and thus try
to make the undefined shift I described above, causing the
caller's cpumask iteration loop to run forever.

This code was really not tested very well at all.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] bitops: simplify generic bit finding functions, Harvey Harrison, (Sun Apr 27, 4:19 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Alexander van Heukelum, (Mon Apr 28, 10:32 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Sun Apr 27, 4:26 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Alexander van Heukelum, (Mon Apr 28, 10:58 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Thomas Gleixner, (Mon Apr 28, 10:04 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Mon Apr 28, 12:25 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Thomas Gleixner, (Mon Apr 28, 12:47 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Mon Apr 28, 12:54 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Thomas Gleixner, (Mon Apr 28, 3:26 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Mon Apr 28, 3:37 pm)
[PATCH] bitops: remove "optimizations", Thomas Gleixner, (Tue Apr 29, 6:01 am)
Re: [PATCH] bitops: remove "optimizations", David Miller, (Tue Apr 29, 6:03 am)
Re: [PATCH] bitops: remove "optimizations", David Miller, (Tue Apr 29, 8:34 am)
Re: [PATCH] bitops: remove "optimizations", Thomas Gleixner, (Tue Apr 29, 12:51 pm)
Re: [PATCH] bitops: remove "optimizations", David Miller, (Tue Apr 29, 6:58 pm)
Re: [PATCH] bitops: remove "optimizations", David Miller, (Tue Apr 29, 7:30 pm)
Re: [PATCH] bitops: remove "optimizations", Ingo Molnar, (Tue Apr 29, 10:20 am)
Re: [PATCH] bitops: remove "optimizations", David Miller, (Tue Apr 29, 6:31 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Alexander van Heukelum, (Mon Apr 28, 11:10 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Thomas Gleixner, (Mon Apr 28, 11:58 am)
Re: [PATCH] bitops: simplify generic bit finding functions, Harvey Harrison, (Sun Apr 27, 4:29 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Linus Torvalds, (Sun Apr 27, 4:38 pm)
Re: [PATCH] bitops: simplify generic bit finding functions, Harvey Harrison, (Sun Apr 27, 4:38 pm)