Age | Commit message (Collapse) | Author | Files | Lines |
|
The generation counters were removed from the idr code. Update idr.c
comments, now uses doc-book style API documentation.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Adds support for 'hh' (store number in char *) and 'll' (proper C99 for
long long) modifiers to sscanf().
|
|
Quite a few functions in lib/string.c are not exported. I ran into this
trying to use strnchr() in a module.
This patch
- exports every function defined in lib/string.c
- adds some missing __HAVE_ARCH_xxx defines for i386
- gets rid of the exports of functions from lib/string.c in arch/s390
(BTW, why is s390 exporting things NOVERS?)
Signed-off-by: Roland Dreier <roland@topspin.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
into kroah.com:/home/greg/linux/BK/driver-2.6
|
|
As pointed by Thomas Sailer, crc16.c module contains CRC16-CCITT (x^16 + x^12
+ x^5 + 1) implementation, not IBM CRC16 (x^16 + x^15 + x^2 + 1) one. Looks
like we need to rename it accordingly and this patchset does exactly this.
Signed-off-by: Andrey Panin <pazke@donpac.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
kset_find_obj should increment refcount of the found object so users of
the function can safely use returned object
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
gcc 3.5 is warning about unused static variables, add __attribute_unused__
to the 2 places to silence it.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
The radix tree functions __lookup and __lookup_tag uses (1 << shift) in
their index calculations. On 64 bit systems the shift can be bigger than
32. The shift of an integer by more than 32 bits evaluates to zero which
causes the lookup to fail.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Use NULL, not 0, where appropriate.
|
|
build
Well, one of these (fs/block_dev.c) is little non-trivial, but i felt
throwing that away would be a shame (and I did add comments ;-).
Also almost all of these have been submitted earlier through other
channels, but have not been picked up (the only controversial is again the
fs/block_dev.c patch, where Linus felt a better job would be done with
__ffs(), but I could not convince myself that is does the same thing as
original code).
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Currently we have 8 copies of CRC16 calculation table in different device
drivers, this patch creates common crc16.c module to replace them.
Signed-off-by: Andrey Panin <pazke@donpac.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
From: Paul Jackson <pj@sgi.com>
These bitmap improvements make it a suitable basis for fully supporting
cpumask_t and nodemask_t. Inline macros with compile-time checks enable
generating tight code on both small and large systems (large meaning cpumask_t
requires more than one unsigned long's worth of bits).
The existing bitmap_<op> macros in lib/bitmap.c are renamed to __bitmap_<op>,
and wrappers for each bitmap_<op> are exposed in include/linux/bitmap.h
This patch _includes_ Bill Irwins rewrite of the bitmap_shift operators to not
require a fixed length intermediate bitmap.
Improved comments list each available operator for easy browsing.
Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
From: Paul Jackson <pj@sgi.com>
Document the bitmap bit model and handling of unused bits.
Tighten up bitmap so it does not generate nonzero bits in the unused tail if
it is not given any on input.
Add intersects, subset, xor and andnot operators. Change bitmap_complement to
take two operands.
Add a couple of missing 'const' qualifiers on bitops test_bit and bitmap_equal
args.
Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
|
|
Lindent rwsem.c and rwsem-spinlock.c and fix a few things by hand. Also
added a couple of comments for the memory barriers. Added the __sched
annotation that was left out of rwsem-spinlock.c.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
A classic..
lib/string.c:165:19: warning: assignment expression in conditional
From: Mika Kukkonen <mika@osdl.org>
Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
|
|
I know it's simple_strtoul, but is it meant to be that simple? Fix up for
both simple_strtoul and simple_strtoull.
simple_strtoul(0x401b, NULL, 0) = 0x401b
simple_strtoul(0X401b, NULL, 0) = 0x0
simple_strtoul(0x401b, NULL, 16) = 0x0
simple_strtoul(0X401b, NULL, 16) = 0x0
simple_strtoull(0x401b, NULL, 0) = 0x401b
simple_strtoull(0X401b, NULL, 0) = 0x0
simple_strtoull(0x401b, NULL, 16) = 0x0
simple_strtoull(0X401b, NULL, 16) = 0x0
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
There were definately some problems in there. I've made some changes and
tested with a lot of bounds. I don't have a machine with enough memory to
fill it up (it would take ~16GB on a 64-bit machine), but I use the "above"
code to simulate a lot of situations.
The problems were:
* IDR_FULL was not the right value
* idr_get_new_above() was not defined in the headers or documented.
* idr_alloc() bug-ed if there was a race and not enough memory was
allocated. It should have returned NULL.
* id will overflow when you go past the end.
* There was a "(id >= (1 << (layers*IDR_BITS)))" comparison, but at
the top layer it would overflow the id and be zero.
* The allocation should return ENOSPC for an "above" value with
nothing above it, but it returned EAGAIN.
I have not tested on 64-bits (as I don't have a 64-bit machine).
I've included the files, a diff from the previous version, and my test
programs.
For the test programs, idr_test <size> will just attempt to allocate
<size> elements, check them, free them, and check them again.
idr_test2 <size> <incr> will allocate <size> element with <incr> between
them.
idr_test3 just tests some bounds and tries all values with just a few in
the idr.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
idr_get_new() currently returns an incrementing counter in the top 8 bits of
the counter. Which means that most users have to mask it off again, and we
only have a 24-bit range.
So remove that counter. Also:
- Remove the BITS_PER_INT define due to namespace collision risk.
- Make MAX_ID_SHIFT 31, so counters have a 0 to 2G-1 range.
- Why is MAX_ID_SHIFT using sizeof(int) and not sizeof(long)? If it's for
consistency across 32- and 64-bit machines, why not just make it "31"?
- Does this still hold true with the counter removed?
/* We can only use half the bits in the top level because there are
only four possible bits in the top level (5 bits * 4 levels = 25
bits, but you only use 24 bits in the id). */
If not, what needs to change?
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
* On a 32-bit architecture, the idr code will cease to work if you add
more than 2^20 entries. You will not be able to find many of the
entries. The problem is that the IDR code uses 5-bit chunks of the
number and the lower portion used by IDR is 24 bits, so you have one bit
that leaks over into the comparisons that should not be there. The
solution is to mask off that bit before doing IDR processing. This
actually causes the POSIX timer code to crash if you create that many
timers. I have included an idr_test.tar.gz file that demonstrates this
with and without the fix, in case you need more evidence :).
* When the IDR fills up, it returns -1. However, there was no way to
check for this condition. This patch adds the ability to check for the
idr being full and fixes all the users. It also fixes a problem in
fs/super.c where the idr code wasn't checking for -1.
* There was a race condition creating POSIX timers. The timer was added
to a task struct for another process then the data for the timer was
filled out. The other task could use/destroy time timer as soon as it is
in the task's queue and the lock is released. This moves settup up the
timer data to before the timer is enqueued or (for some data) into the
lock.
* Change things so that the caller doesn't need to run idr_full() to find
out the reason for an idr_get_new() failure.
Just return -ENOSPC if the tree was full, or -EAGAIN if the caller needs
to re-run idr_pre_get() and try again.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Stop downgrade_write() from under-adjusting the rwsem counter in optimised
rw-semaphores.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Many places do:
if (kmem_cache_create(...) == NULL)
panic(...);
We can consolidate all that by passing another flag to kmem_cache_create()
which says "panic if it doesn't work".
|
|
into kroah.com:/home/greg/linux/BK/driver-2.6
|
|
o The following patch cleans up sysfs_rename_dir(). It now checks the
return code of kobject_set_name() and propagates the error code to its
callers. Because of this there are changes in the following two APIs. Both
return int instead of void.
int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
int kobject_rename(struct kobject * kobj, char *new_name)
|
|
From: Alexey Dobriyan <adobriyan@mail.ru>
Fix various kernel-doc parameters.
|
|
Get a reference count on the the sleeper, so that
it can't possibly go away before we've sent it the
wakeup event.
Noted by Nick Piggin <nickpiggin@yahoo.com.au>
David Howells <dhowells@redhat.com>
|
|
Don't touch the wakee stack after marking it runnable.
|
|
into kernel.bkbits.net:/home/davem/net-2.6
|
|
|
|
|
|
Thanks to Dru <andru@treshna.com>, who provided an easy way to reproduce
the problem.
What we have in lib/rwsem.c:__rwsem_do_wake():
int woken, loop;
^^^
and several lines below:
loop = woken;
woken *= RWSEM_ACTIVE_BIAS-RWSEM_WAITING_BIAS;
woken -= RWSEM_ACTIVE_BIAS;
However, rw_semaphore->count is 64-bit on Alpha, so
RWSEM_WAITING_BIAS has been defined as -0x0000000100000000L.
Obviously, this blows up in the write contention case.
|
|
From: Jim Houston <jim.houston@comcast.net>
- Adds idr_get_new_above(), whihc permits us to do a first-fit search
from a specified offset rather than always from zero.
- Add IDR_INIT() DEFINE_IDR() constructors. Often idr's are singletons
and having to cook up an initcall for them is a pain.
This is needed by the "Increase number of dynamic inodes in procfs" patch.
|
|
into kroah.com:/home/greg/linux/BK/driver-2.6
|
|
Fix various bogons and outright lies.
|
|
From: Rusty Russell <rusty@rustcorp.com.au>
clear_bit(n, addr) clears the nth bit.
test_and_clear_bit(n, addr) clears the nth bit.
cpu_clear(n, cpumask) clears the nth bit (vs. cpus_clear()).
bitmap_clear(bitmap, n) clears out all the bits up to n.
Moreover, there's a CLEAR_BITMAP() in linux/types.h which bitmap_clear() is
a wrapper for.
Rename bitmap_clear to bitmap_zero, which is harder to confuse (yes, it bit
me), and make everyone use it.
|
|
Add radix-tree tagging so we can look up dirty or writeback pages in
O(log64(n)) time.
Each radix-tree node gains two bits for each slot: one for page dirtiness and
one for page writebackness.
If a tag bit is set on a leaf node, it indicates that item at the
corresponding slot is tagged (say, a dirty page).
If a tag bit is set in a non-leaf node it indicates that the same tag bit is
set in the subtree which lies under the corresponding slot. ie: "there is a
dirty page under here somewhere, but you need to search down further to find
it".
A gang lookup function is provided which can walk the radix tree in
logarithmic time looking for items which are tagged, starting from a
specified offset. We use this for in-order searches for dirty or writeback
pages.
There is a userspace test harness for this code at
http://www.zip.com.au/~akpm/linux/patches/stuff/rtth.tar.gz
|
|
From: William Lee Irwin III <wli@holomorphy.com>
Chang bitmap_shift_left()/bitmap_shift_right() to have O(1) stackspace
requirements.
Given zeroed tail preconditions these implementations satisfy zeroed tail
postconditions, which makes them compatible with whatever changes from Paul
Jackson one may want to merge in the future. No particular effort was
required to ensure this.
A small (but hopefully forgiveable) cleanup is a spelling correction:
s/bitmap_shift_write/bitmap_shift_right/ in one of the kerneldoc comments.
The primary effect of the patch is to remove the MAX_BITMAP_BITS
limitation, so restoring the NR_CPUS to be limited only by stackspace and
slab allocator maximums. They also look vaguely more efficient than the
current code, though as this was not done for performance reasons, no
performance testing was done.
|
|
From: Joe Korty <joe.korty@ccur.com>
This patch replaces the call to bitmap_shift_right() in bitmap_parse() with
bitmap_shift_left().
I also prepended comments to the bitmap_shift_* functions defining what
'left' and 'right' means. This is under the theory that if I and all the
reviewers were bamboozled, others in the future occasionally might be too.
|
|
From: William Lee Irwin III <wli@holomorphy.com>
This addresses the issue with get_wchan() that the various functions acting
as scheduling-related primitives are not, in fact, contiguous in the text
segment. It creates an ELF section for scheduling primitives to be placed
in, and places currently-detected (i.e. skipped during stack decoding)
scheduling primitives and others like io_schedule() and down(), which are
currently missed by get_wchan() code, into this section also.
The net effects are more reliability of get_wchan()'s results and the new
ability, made use of by this code, to arbitrarily place scheduling
primitives in the source code without disturbing get_wchan()'s accuracy.
Suggestions by Arnd Bergmann and Matthew Wilcox regarding reducing the
invasiveness of the patch were incorporated during prior rounds of review.
I've at least tried to sweep all arches in this patch.
|
|
|
|
This cleans up a larger amount of superfluos ";;" statements in current
Linux kernel sources by converting them to the regular single ";"
statments.
It seems to be a common problem that at the end of a line the semicolon
key is producing an echo.
|
|
The gcc-3.5 patch broke building on x86_64 and possibly
others, because inflate.c does not pull in the definition
for noinline.
|
|
From: Matt Mackall <mpm@selenic.com>
Quick fix to work around gcc3.5's automatic inline and broken stack
requirements calculation. Without this, I see stack overflows at boot
with 4k stacks.
|
|
Various files keep per-cpu caches which need to be freed/moved when a
CPU goes down. All under CONFIG_HOTPLUG_CPU ifdefs.
scsi.c: drain dead cpu's scsi_done_q onto this cpu.
buffer.c: brelse the bh_lrus queue for dead cpu.
timer.c: migrate timers from dead cpu, being careful of lock order vs
__mod_timer.
radix_tree.c: free dead cpu's radix_tree_preloads
page_alloc.c: empty dead cpu's nr_pagecache_local into nr_pagecache, and
free pages on cpu's local cache.
slab.c: stop reap_timer for dead cpu, adjust each cache's free limit, and
free each slab cache's per-cpu block.
swap.c: drain dead cpu's lru_add_pvecs into ours, and empty its committed_space
counter into global counter.
dev.c: drain device queues from dead cpu into this one.
flow.c: drain dead cpu's flow cache.
|
|
From: "Randy.Dunlap" <rddunlap@osdl.org>
From: Michael Veeck <michael.veeck@gmx.net>
Remove unnecessary min/max macros and changes calls to use kernel.h macros
instead.
|
|
Based on the kobject structure, but much smaller and simpler to use.
|
|
From: Gerd Knorr <kraxel@suse.de>
Current gcc's error out if a function's declaration and definition disagree
about the register passing convention.
The patch adds a new `fastcall' declatation primitive, and uses that in all
the FASTCALL functions which we could find. A number of inconsistencies were
fixed up along the way.
|
|
|
|
|
|
From: Matt Domsch <Matt_Domsch@dell.com>
Patch below applies to both 2.4.25 and 2.6.3, and replaces the public
domain statement and non-warranty with the GPL, as is permitted by the code
being in the public domain, and is done with legal advice.
|
|
From: Tim Hockin <thockin@sun.com>
Remove the max_anon via dynamically allocation. We also change the
idr_pre_get() interface to take a gfp mask, which should have always been
there.
|
|
From: Joe Korty <joe.korty@ccur.com>
Rename bitmap_snprintf() to bitmap_scnprintf() and cpumask_snprintf() to
cpumask_scnprintf(), as these functions now belong to the scnprintf family
of functions.
|
|
From: Valdis.Kletnieks@vt.edu
15 changes of #if to #ifdef and 2 places CONFIG_FOO should be
defined(CONFIG_FOO). This gets rid of spurious warnings if you build with
"-Wundef" so you get a warning if you have a preprocessor command like:
#if CONFIG_ETRAX_DS1302_RSTBIT == 27
and you'll be told if it's substituting a zero rather than silent
weirdness and unexpected code generation.
|
|
From: Juergen Quade <quade@hsnr.de>
Lots of places in the kernel are using [v]snprintf wrongly: they assume it
returns the number of characters copied. It doesn't. It returns the
number of characters which _would_ have been copied had the buffer not been
filled up.
So create new functions vscnprintf() and scnprintf() which have the
expected (sane) semaptics, and migrate callers over to using them.
|
|
into kroah.com:/home/greg/linux/BK/driver-2.6
|
|
From: Joe Korty <joe.korty@ccur.com>
Now that bitmap_parse is part of bitmap.[ch], it is allowed to manipulate
bits directly as the other bitmap routines do.
|
|
Convert dev_alloc_name from O(n^2) lookup to O(n) by using a page as
bitmap to figure out how many devices of that pattern have been allocated.
This works for up to 32k devices (PAGE_SIZE*8) on i386, more on other
platforms. Correctly handles the boundary cases where number of devices
won't fit because name length is limited.
Adds strnchr to the string libraries since we need to find the % format
character, but only care if it is in the first 15 bytes.
|
|
into kroah.com:/home/greg/linux/BK/driver-2.6
|
|
From: <gb@phonema.ea.univpm.it>
The "%c" in sscanf actually reads and writes one extra character (i.e. 2
characters insted of just one), and may thus easily overflow caller's
buffer.
Also affects 2.4 tree, even if there "%c" seems not to be used at all.
|
|
From: Paul Jackson <pj@sgi.com>
Explain the snprintf() return value.
|
|
From: Pratik Solanki <pratik.solanki@timesys.com>
I came across this C standards issue while cross-compiling the Linux kernel
with gcc on Solaris. The file gen_crc32table.c uses the non-standard type
u_int32_t. It's possible that the host machine's sys/types.h does not
define u_int32_t. The attached patch replaces u_int32_t with the POSIX
standard uint32_t and includes POSIX inttypes.h instead of sys/types.h.
|
|
From: Joe Korty <joe.korty@ccur.com>
1) the version in 2.6.1 is broken, doesn't work on 64bit big endian
machines at all. This needed fixing. I thought it best to fix by
rewriting the printer/parser with an algorithm that is naturally endian &
sizeof(long) resistant.
2) I wanted all digits to print, eg, 0000ffff,00000004 not ffff,4.
3) I wanted exactly NR_CPUS bits to print (or whatever the bitmap size is
in bits, and not have what is displayed rounded up to the nearest full
byte, as the current version did.
4) The bitmap printer and parser should be part of bitmap.[ch] with syntax
and semantics to match. The original lib/mask.c versions did not
recognize this commonality.
|
|
From: Andi Kleen <ak@muc.de>
gcc 3.4 optimizes sprintf(foo,"%s",string) into strcpy. Unfortunately that
isn't seen by the inliner and linux/i386 has no out-of-line strcpy so you
end up with a linker error.
This patch adds out of line copies for most string functions to avoid this.
Actually it doesn't export them to modules yet, that would be the next
step.
BTW In my opinion we shouldn't use inline string functions at all. The
__builtin_str* in modern gcc are better (I used them very successfully on
x86-64) and for the bigger functions like strrchr,strtok et.al. it just
doesn't make any sense to inline them or even code them in assembler.
Also fix the bcopy prototype gcc was complaining about.
|
|
From: Andi Kleen <ak@muc.de>
Just many more warning fixes for a gcc 3.4 snapshot.
It warns for a lot of things now, e.g. for ?: and ({ ... }) and casts as
lvalues. And for functions marked inline in headers, but no body.
Actually there are more warnings, i stopped fixing at some point. Some of
the warnings seem to be dubious (e.g. the binfmt_elf.c one, which looks
more like a compiler bug to me)
I also fixed the _exit() prototype to be void because gcc was complaining
about this.
|
|
the size to "vsnprintf()".
That's a pretty clear case of overflow.
|
|
|
|
From: Jes Sorensen <jes@trained-monkey.org>
The new sort_extable and shared search_extable code doesn't work on ia64.
I have introduced two new #defines that archs can define to avoid the
common code being built. ARCH_HAS_SEARCH_EXTABLE and
ARCH_HAS_SORT_EXTABLE.
|
|
The exception table search code currently fails if addresses differ by more
than 2G. This is only a problem when using the 4g/4g address space split,
but it's more robust this way.
Also, shuffle the comparison order n there so the least likely case comes
last.
|
|
This patch arranges for the exception tables to be sorted on most
architectures. It sorts the main kernel exception table on startup
and the module exception tables when they get loaded. The main table
is sorted reasonably early - just after kmem_cache_init - but that
could be moved even earlier if necessary.
There is now a lib/extable.c which includes the sort_extable()
function from arch/ppc/mm/extable.c and the search_extable() function
from arch/i386/mm/extable.c, which had been copied to many
architectures. On many architectures, arch/$(ARCH)/mm/extable.c
became empty and so I have removed it.
There are four architectures which do things differently from i386:
alpha, ia64, sparc and sparc64. Alpha and ia64 store the offset from
the offset from the exception table entry to the instruction, and
sparc and sparc64 have range entries in the table. For those
architectures I have added empty sort_extable functions. The
maintainers for those architectures can implement something better if
they care to. As it is they are no worse off than before.
Although it is a moderately sizable patch, it ends up with a net
reduction of 377 lines in the size of the kernel source. :)
I have tested this on x86 and ppc with a module that uses __get_user
in an init function, deliberately laid out to get the exception table
out of order, and it works (whereas it oopsed without this patch).
|
|
into home.osdl.org:/home/torvalds/v2.5/linux
|
|
gcc miscompiles this. Scary.
|
|
- A couple of them are using alloca (via DECLARE_BITMAP) and this generates
a cannot-inline warning with -Winline.
- These functions are too big to inline anwyay.
|
|
Thanks to Hollis Blanchard <hollisb@us.ibm.com> for pointing this out.
|
|
make kobject hotplug mechanism public so that others may call it.
|
|
From: "H. Peter Anvin" <hpa@zytor.com>
This patch fixes the "non-terminating inflate" problem that Russell King
complained about on LKML earlier today.
I chose to use "goto" much like zlib does, in order to not require
setjmp/longjmp inside the kernel. It's a bit ugly, but it also lets each
function chose how it needs to be terminated on error, which is a good
thing.
|
|
From: Paul Jackson <pj@sgi.com>
This patch is a followup to one from Bill Irwin. On Nov
17, he had consolidated the half-dozen chunks of code
that displayed cpumasks in /proc/irq/prof_cpu_mask and
/proc/irq/<pid>/smp_affinity into a single routine, which he
called format_cpumask().
I believe that Andrew Morton has accepted Bill's patch into
his 2.6.0-test10-mm1 patch set as the "format_cpumask" patch.
I hope that the following patch will replace Bill's patch.
I look forward to Bill's feedback on this patch.
The following patch carries Bill's work further:
1) It also consolidates the input side (write syscalls).
2) It adapts a new format, same on input and output.
3) The core routines work for any multi-word bitmask,
not just cpumasks.
4) The core routines avoid overrunning their output
buffers.
Note esp. for David Mosberger:
The small patch I sent you and the linux-ia64 list
yesterday entitled: "check user access ok writing
/proc/irq/<pid>/smp_affinity" for arch ia64 only is
_separate_ from the following patch. Neither presumes the
other. However, they do collide on one line. Last one in
is a Monkey's Uncle and will need an updated patch from me
(or otherwise need to resolve the one obvious collision).
Details of the following patch:
Both the display and input of cpumasks on 9 arch's are
consolidated into a single pair of routines, which use the
same format for input and output, as recommended by Tony
Luck. The two common routines work on any multi-word bitmask
(array of unsigned longs). A pair of trivial inline wrappers
cpumask_snprintf() and cpumask_parse() hide this generality
for the common case of cpumask input and output.
My real motivation for consolidating this code will become
visible later - when I seek to add a nodemask_t that resembles
cpumask_t (just a different length). These common underlying
routines will be used there as well, following up on a suggestion
of Christoph Hellwig that I investigate implementing nodemask_t
as an ADT sharing infrastructure with cpumask_t. However, I
believe that this patch stands on its own merit, consolidating
a couple hundred lines of duplicated code, and making the
cpumask display format usable on very large systems.
There are two exceptions to the consolidation - the alpha and
sparc64 arch's manipulate bare unsigned longs, not cpumask_t's,
on input (write syscall), and do stuff that was more funky than
I could make sense of. So the input side of these two arch's
was left as-is. I'd welcome someone with access to either of
these systems to provide additional patches.
The new format consists of multiple 32 bit words, separated by
commas, displayed and input in hex. The following comment from
this patch describes this format further:
* The ascii representation of multi-word bit masks displays each
* 32bit word in hex (not zero filled), and for masks longer than
* one word, uses a comma separator between words. Words are
* displayed in big-endian order most significant first. And hex
* digits within a word are also in big-endian order, of course.
*
* Examples:
* A mask with just bit 0 set displays as "1".
* A mask with just bit 127 set displays as "80000000,0,0,0".
* A mask with just bit 64 set displays as "1,0,0".
* A mask with bits 0, 1, 2, 4, 8, 16, 32 and 64 set displays
* as "1,1,10117". The first "1" is for bit 64, the second
* for bit 32, the third for bit 16, and so forth, to the
* "7", which is for bits 2, 1 and 0.
* A mask with bits 32 through 39 set displays as "ff,0".
The essential reason for adding the comma breaks was to make
the long masks from our (SGI's) big 512 CPU systems parsable by
humans. An unbroken string of 128 hex digits is pretty difficult
to read. For those who are compiling systems with CONFIG_NR_CPUS
of 32 or less, there should be no visible change in format.
There are of course a thousand possible output formats that
meet similar criteria. If someone wants to lobby for and seek
consensus behind another such format, that's fine. Now that
the format is consolidated into a single pair of routines,
it should be easy to adapt whatever we choose.
Internally, the display routine uses snprintf to track the
remaining space in its output buffer, to avoid the risk of
overrunning it.
A new file, lib/mask.c, is added to the lib directory, to
hold the two common routines. I anticipate adding a few more
common routines for generic support of multi-word bit masks to
lib/mask.c, in subsequent patches that will add a nodemask_t
type as an ADT sharing implementation with cpumask_t.
|
|
From: Will Dyson <will_dyson@pobox.com>
Add documentation and comments to lib/parser.c and include/linux/parser.h
|
|
It turns out that the int_sqrt() function in oom_kill.c gets it wrong.
But fb_sqrt() in fbmon.c gets its math right. Move that function into
lib/int_sqrt.c, and consolidate.
(oom_kill.c fix from Thomas Schlichter <schlicht@uni-mannheim.de>)
|
|
|
|
If both ext2 and ext3 are built as modules there is nothing to pull
percpu_counter_mod() into the kernel build and the ext2 and ext3 modules do
not load.
So move percpu_counter_mod() out of lib.a.
|
|
This fixes the generic __div64_32() to correctly handle divisions by
large 32-bit values (as used by nanosleep() and friends, for example).
It's a simple bit-at-a-time implementation with a reduction of the high
32-bits handled manually. Architectures that can do 64/32-bit divisions
in hardware should implement their own more efficient versions.
|
|
|
|
Expand printk's traditional handling of null pointers so that anything in the
first page is considered a null pointer.
This gives us better behaviour when someone (acpi..) accidentally prints a
string which is embedded in a struct, the pointer to which is null.
|
|
into kernel.bkbits.net:/home/mochel/linux-2.5-core
|
|
|
|
into kernel.bkbits.net:/home/mochel/linux-2.5-core
|
|
Current match_token recognize "foo=" as "foo=%s". So this change the
nul string does not recognize as "%s".
|
|
into kernel.bkbits.net:/home/mochel/linux-2.5-core
|
|
From: "Randy.Dunlap" <rddunlap@osdl.org>, Will Dyson <will_dyson@pobox.com>, me
Add generic filesystem options parser (infrastructure) and use it to parse
mount options in several filesystems (adfs, affs, autofs, autofs4, ext2,
ext3, fat, hfs, hpfs, isofs, jfs, procfs, udf, and ufs).
It saves between 128 and 512 bytes per filesystem.
|
|
If kobject_set_name() is called when the kobject already has a name that was
dynamically allocated (too long for the static array), then we must free that
memory.
Noticed by Jon Corbet.
|
|
into osdl.org:/home/mochel/src/kernel/linux-2.5-core
|
|
Similar to the patch Brian Gerst sent for CRC32, this patch changes
ZLIB_{IN,DE}FLATE to be select'ed.
The dependencies are much better maintainable that way.
|
|
Use "select CRC32" in Kconfig instead of makefile includes.
|
|
From John Rose <johnrose@austin.ibm.com>
The patch below exposes some kset functions for use by modules. In the
development of a PPC64 pci hotplug drv, we have found it necessary to use ksets
of different types under a single subsystem. After discussing with GregKH,
we agreed that this change makes this possible.
|
|
From: Andre McCurdy <armcc2000@yahoo.com>
There is some inconsistency within lib/inflate.c and its users about
whether the error message text or the error() function should provide
the '\n'.
This patch tries to make everyone consistent - by removing the
newline from all message texts, and adding one to the only error()
function which did not provide it (in init/do_mounts_rd.c).
|
|
Bah, stupid mistake. After you call ->release(), you cannot touch the object.
|
|
Add ->k_name pointer which points to the name for a kobject. By default, this
points to ->name (the static name array).
Users of kobjects may use the helper function kobject_set_name() (and are
encouraged to do so in all cases). This function will determined whether or
not the name is short enough to fit in ->name. If so, great.
Otherwise, a dyanamic string is allocated and the name is stored there.
->k_name will point to that, and will be freed when the kobject is released.
kobject_set_name() may take a format string, like:
kobject_set_name(kobj,"%s%d",base_name,id);
and will behave as expected (will put in ->name, unless it's too long, in
which case a new string will be allocated and it will be stored in there).
|
|
This is Erik Andersen's excellent strncpy.
It works like magic. That "if" isn't a jump;
gcc uses a few integer instructions to wipe
out all jumps except for the loop itself and
the function call/return.
This has been exhaustively tested against glibc.
The existing code has 5 extra branches and
is over twice as large. (my gcc, etc.)
|
|
From: Yoshinori Sato <ysato@users.sourceforge.jp>
It writes one too many zeroes when nulling out the destination.
|
|
into kernel.bkbits.net:/home/davem/sparc-2.5
|
|
|
|
From: Leann Ogasawara <ogasawara@osdl.org>
Uninitialize static variables initialized to 0 so they are pushed to the
.bss instead of .data.
|
|
|
|
It used to depend on us having a signed type (which in turn is
incorrect for the later division).
|
|
- __div64_32(): remove __attribute_pure__ qualifier from the prototype
since this function obviously clobbers memory through &(n);
- do_div(): add a check to ensure (n) is type-compatible with uint64_t;
- as_update_iohist(): Use sector_div() instead of do_div().
(Whether the result of the addition should always be stored in 64bits
regardless of CONFIG_LBD is still being discussed, therefore it's
unadderessed here);
- Fix all places where do_div() was being called with a bad divisor argument.
|
|
- export the __div64_32 symbol for modules;
- add likely() to the fast path (divisor>>32 == 0);
- add __attribute__((pure)) to __div64_32() prototype so
the compiler knows global memory isn't clobbered;
- avoid building __div64_32() on 64bit architectures.
|
|
This offers a generic do_div64() that actually does the right thing,
unlike some architectures that "optimized" the 64-by-32 divide into
just a 32-bit divide.
Both ppc and sh were already providing an assembly optimized
__div64_32(). I called my function the same, so that their optimized
versions will automatically override mine in lib.a.
I've only tested extensively on m68knommu (uClinux) and made
sure generated code is reasonably short. Should be ok also on
parisc, since it's the same algorithm they were using before.
- add generic C implementations of the do_div() for 32bit and 64bit
archs in asm-generic/div64.h;
- add generic library support function __div64_32() to handle the
full 64/32 case on 32bit archs;
- kill multiple copies of generic do_div() in architecture
specific subdirs. Most copies were either buggy or not doing
what they were supposed to do;
- ensure all surviving instances of do_div() have their parameters
correctly parenthesized to avoid funny side-effects;
|
|
Based on a patch written by Dan Aloni <da-x@gmx.net>
|
|
- add dvb subsystem as a crc32 lib user
|
|
|
|
into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.make
|
|
Previously, we would insert kobjects into their kset's lists at different
locations based on if they had a parent or not - We kept an explicit
depth-first list by placing devices directly before their parents.
However, we don't need strict ordering. Assuming that a subordinate device
is always added after its parent (true), then by adding them to the end of
the list, then subordinate objects will always be farther down the list than
their parent objects. We don't need to do anything special..
|
|
into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.make
|
|
This removes the last sources of "non-ANSI parameter list" warnings for
zlib_deflate.
|
|
into mars.ravnborg.org:/home/sam/src/linux/kernel/bk/kbuild
|
|
More merging from zlib-1.1.4
force windowBits > 8 to avoid a bug in the encoder for a window size
of 256 bytes. (A complete fix will be available in 1.1.5).
James Carlson:
The problem is that s->strstart gets set to a very large
positive integer when wsize (local copy of s->w_size) is
subtracted in deflate.c:fill_window(). This happens because
MAX_DIST(s) resolves as a negative number when the window size
is 8 -- MAX_DIST(s) is defined as s->w_size-MIN_LOOKAHEAD in
deflate.h. MIN_LOOKAHEAD is MAX_MATCH+MIN_MATCH+1, and that
is 258+3+1 or 262. Since a window size of 8 gives s->w_size
256, MAX_DIST(s) is 256-262 or -6.
This results in read_buf() writing over memory outside of
s->window, and a crash.
|
|
Don't think anyone actually bothers to check specific error codes, but
it shouldn't hurt either.
|
|
This removes unnecessary NULL casting.
|
|
s/Z_NULL/NULL/g.
|
|
Simple s/local/static/.
|
|
Most of it is reformatting, but the functional bits should fix real
problems. A loop is introduced, just like in the turboc patch and one
of the three condition bodies has been expanded.
|
|
This is the first bit of the missing merge towards 1.1.4. Applies on
top of the previous cleanups.
This one rips out an ugly #ifdef and seems to catch a theoretical
error possibility. Always thought that they fixed more than they
officially admitted.
|
|
New makefile variable introduced: lib-y
The lib-y syntax allows you to do the usual tricks such as:
lib-$(CONFIG_SMP) += percpu_counter.o
A built-in.o is always present in a directory that list .o files in
either obj-* or lib-*.
In contrast, lib.a is made only when lib-y is defined.
I also updated lib/Makefile, so that crc32.o is now always built-in
if selected.
|
|
Here is another final K&R to ANSI C cleanup patch for zlib.
|
|
|
|
Jörn missed a few places of FAR conversion in inflate
|
|
Remove the stale support for K&R function declarations through the OF()
macro.
This is the last patch to clean up zconf.h, at least for now.
|
|
Just a simple s/ZEXPORT//.
|
|
This one was just simple s/ZEXTERN/extern/g.
|
|
This removes FAR, the typedefs using FAR (Bytef and friends) and the
function prototypes for zalloc and zfree that should have gone earlier
already.
|
|
|
|
The only thing preventing this from happening earlier was the circular sysfs
registration dependency - it would need to be initialized before it was
registered, but needed to be registered before it was initialized.
With kobjects gone from struct filesystem_type, the dependency no longer
exists and we don't have to special-case the possibility that a kobject will
be passed to kobject_get with a refcount == 0.
Note that a kobject with a count of 0 in that function is still a bug, but
one in the subsystem making the call. We should add a debugging hook to dump
the stack if it does happen.
|
|
- Make it very explicit that supplying an object desctructor is imperative
if using the interface for object reference counting.
- Add GPL statement to the source files.
- Add GFL (http://www.fsf.org/licenses/fdl.html) statement to documentation.
|
|
More zlib K&R to ANSI C function header conversions.
|
|
More K&R to ANSI C conversions for lib/zlib_deflate.
|
|
Here are some more K&R to ANSI C conversions.
|
|
Anybody who still thinks K&R makes sense should just be shot.
|
|
|
|
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
|
|
This patch from Alan went into 2.4 last august with the comment
"get the types right on the lib/inflate.c constants"
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
|
|
|
|
properly checked with the rest of the kernel.
|
|
The percpu counters break UML SMP compilation (in current 2.5.58 bk snapshot)
(first NR_CPUS undeclared in header, then dereference of incomplete structure
in .c file)
|
|
This is because some subsystems (cough, usb...) can grab a kobject from irq context.
This lock can be completely removed once the sysfs_init() code is cleaned up.
Patch originally by Andrew Morton.
|
|
From Steve Hemminger (shemminger@osdl.org)
|
|
Several places in ext2 and ext3 are using filesystem-wide counters which use
global locking. Mainly for the orlov allocator's heuristics.
To solve the contention which this causes we can trade off accuracy against
speed.
This patch introduces a "percpu_counter" library type in which the counts are
per-cpu and are periodically spilled into a global counter. Readers only
read the global counter.
These objects are *large*. On a 32 CPU P4, they are 4 kbytes. On a 4 way
p3, 128 bytes.
|
|
radix_tree_delete() currently returns 0 on success, -ENOENT if there was
nothing to delete.
But it is more useful to return the address of the deleted item on success
and NULL if there was no matching item. It can potentially save a
lookup+delete operation.
|
|
- allocated storage `envp' was being leaked on an error path
- kmalloc() returns void*, no need to cast it
- don't return 0 from a void-returning function
Greg has acked this patch.
|
|
This only happens if a kobject belongs to a subsystem that has specified
a set of hotplug operations.
Based on work done by Kevin Fleming <kpfleming@cox.net>
|
|
into nuts.ninka.net:/home/davem/src/BK/net-2.5
|
|
|
|
From: Eric Piel <Eric.Piel@Bull.Net>
Fixes some long/int confusion on 64-bit machines which was causing failures
on ia64 - we end up trying to set bits in the 32-63 range on an int and the
kernel locks up.
Also cleans up idr.h.
George has acked this change.
|
|
Patch from Joakim Tjernlund <joakim.tjernlund@lumentis.se>
Here is another update(against BK curr) for crc32(). A kind soul pointed out
the optimizations below.
lib/crc32defs.h:
- Make it possible to define new values for CRC_LE_BITS/CRC_BE_BITS without
modifying the source.
lib/crc32.c:
- Eliminate the need for ENDIAN_SHIFT. Saves a 24 bit shift in the byte
loops.
- Swap the XOR expression in DO_CRC. gcc for x86 can not do that simple
optimization itself(gcc 3.2.2 and RH gcc 2.96 tested). Will improve
performance with 20-25% on x86.
|
|
Various overflow problems compiling the lib/idr.c code for ppc64
|
|
into kroah.com:/home/greg/linux/BK/gregkh-2.5
|
|
This is version 23 or so of the POSIX timer code.
Internal changelog:
- Changed the signals code to match the new order of things. Also the
new xtime_lock code needed to be picked up. It made some things a lot
simpler.
- Fixed a spin lock hand off problem in locking timers (thanks
to Randy).
- Fixed nanosleep to test for out of bound nanoseconds
(thanks to Julie).
- Fixed a couple of id deallocation bugs that left old ids
laying around (hey I get this one).
- This version has a new timer id manager. Andrew Morton
suggested elimination of recursion (done) and I added code
to allow it to release unused nodes. The prior version only
released the leaf nodes. (The id manager uses radix tree
type nodes.) Also added is a reuse count so ids will not
repeat for at least 256 alloc/ free cycles.
- The changes for the new sys_call restart now allow one
restart function to handle both nanosleep and clock_nanosleep.
Saves a bit of code, nice.
- All the requested changes and Lindent too :).
- I also broke clock_nanosleep() apart much the same way
nanosleep() was with the 2.5.50-bk5 changes.
TIMER STORMS
The POSIX clocks and timers code prevents "timer storms" by
not putting repeating timers back in the timer list until
the signal is delivered for the prior expiry. Timer events
missed by this delay are accounted for in the timer overrun
count. The net result is MUCH lower system overhead while
presenting the same info to the user as would be the case if
an interrupt and timer processing were required for each
increment in the overrun count.
|
|
Use the kernel CRC routines rather than a do-it-yourself version.
By the way, I created a common USB Makefile.lib, rather than having
one for the class drivers, and one for speedtouch.
|
|
Patch from Szabolcs Berecz <szabi@mplayerhq.hu>
With the following patch maxindex is taken from an array instead of
recalculating it all the time.
|
|
Patch from Joakim Tjernlund <joakim.tjernlund@lumentis.se>
I did the optimizations in the crc32 patch Brian Murphy submitted a while ago.
Now I have cleaned it up a little and made some more optimizations.
gcc is quite bad at loop optimizations (at least for PPC) so I have
rewritten them to make gcc to generate better code. Even recent gcc's(3.2.x) produces
better code.
Also reduced the unrolling since it did not make a noticeable difference.
|
|
My printf manpage says:
z A following integer conversion corresponds to a
size_t or ssize_t argument. (Linux libc5 has Z with
this meaning. Don't use it.)
And the opengroup spec says
z Specifies that a following d , i , o , u , x , or X conversion specifier
applies to a size_t or the corresponding signed integer type argument; or
that a following n conversion specifier applies to a pointer to a signed
integer type corresponding to a size_t argument.
yet our vsnprintf implementation has
/* 'z' support added 23/7/1999 S.H. */
/* 'z' changed to 'Z' --davidm 1/25/99 */
I guess the path of least surprise is to support both. gcc-3.2.1 doesn't
seem to care.
|
|
Patch from: Szabolcs Berecz <szabi@mplayerhq.hu>
No need to check root->rnode in the loop. In the loop it remains nonzero.
|
|
One of the goals of the whole new modversions implementation:
export-objs is gone for good!
|
|
From Louis Zhang.
|
|
Originally from Louis Zhang.
|
|
- From Greg k-h
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
|
|
The operation is simple:
- Take read lock for kset.
- Iterate over kset->list.
- Compare name to each kobject's name.
- Return kobject if found.
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-kobject
|
|
The kobject core no longer references a subsystem directly through a kobject,
instead using the kobject's dominant kset to reference the subsystem. The
registrants of kobjects have been fixed up.
To aid in this process, a few helpers were introdcuced:
- kobj_set_kset_s(obj,subsys)
- kset_set_kset_s(obj,subsys)
- subsys_set_kset(obj,subsys)
that set the kset ptr of embedded kobjects for objects that have different
embedded types. See include/linux/kobject.h for more description and usage.
struct subsystem::kobj is also removed, relying solely on a subsystem's
embedded kset for hierarchy information. Since this requires modification
of the subsystem declarations, a helper macro has been defined:
decl_subsys(name,type)
which initializes the name and ktype fields of the subsystem's embedded
kset. All the subsystem declarations have been fixed up.
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
|
|
struct kset is what struct subsystem should have originally been called. It
is a set of kobjects, and nothing more, with a much less confusing name than
'subsystem.'
struct kset contains an embedded kobject, making it possible to represent it
in the object hierarchy, and sysfs. This also provides a means for objects
to easily express a list of subordinate objects.
struct subsystem still exists, and contains an rwsem, which its subordinate
ksets use to protect their lists.
An arbitrary number of ksets may belong to a subsystem. A ksets specifies
the subsystem it belongs to via its ->subsys field.
struct subsystem also contains a default kset, which may be used without
having to define a separate kset.
The objects that defined subordinate subsystems (bus and class drivers) have
been converted to use subordinate ksets instead.
Note that the usage of ksets is flexible.
- ksets may contain a list of objects of any type, not just kobjects.
- The objects registered with a kset do not have to be registered.
- ksets themselves do not have to be registered. One can be used by
simply calling kset_init().
- ksets do not need a name if they are not registered.
- Note however that locking must be done manually in these cases.
|
|
|
|
radix_tree_node_alloc() uses GFP_ATOMIC, under spinlocking. If the
allocation fails then userspace sees ENOMEM and application failure occurs.
A single add_to_page_cache() will require up to six radix_tree_nodes on
32-bit machines, twice this on 64-bit machines (quadruple the worst-case
storage on 64-bit).
My approach to solving this problem is to create a per-cpu pool of
preallocated radix_tree_nodes, private to the radix-tree code.
The radix-tree user will call the new radix-tree API function
radix_tree_preload() to ensure that this pool has sufficient nodes to cover
the worst-case. radix_tree_preload() should be called outside locks, with
GFP_KERNEL so that it can run page reclaim.
If it succeeds, radix_tree_preload() will return with preemption disabled so
that the per-cpu radix_tree_node pool is protected. The user must call
radix_tree_preload_end() to terminate the transaction.
In the common case, the per-cpu pools will never be touched:
radix_tree_insert() will only dip into the pool if kmem_cache_alloc() fails.
The pools will remain full at all times. This is to optimise the fastpath -
it is just a few instructions.
This patch also removes the now-unneeded radix-tree mempool. This saves 130
kbytes of permanently allocated kernel memory. 260k on 64-bit platforms.
|
|
This is the first step in morphing struct subsystem into something meaningful.
A subsystem is defined simply as a list of kobjects of a certain type, which
is far too generic. A subsystem should be representative of a large entity
of code (i.e. a subsystem of the kernel), not just a simple list.
This changeset:
- Creates struct kobj_type, a descriptor of the type a kobject is embedded
in.
- Extracts the fields that are specific to a particular object type from
struct subsystem and puts them in struct kobj_type, which are
- the object's release method.
- the sysfs operations for the object type.
- the default attributes of the object type.
- Adds ptr to struct kobject to point to its type descriptor.
- Converts the existing subsystem definitions to define struct kobj_type.
struct kobj_type's are not registered, as they do not have any explicit
representation in the object hierarchy, nor do they have any fields that
need runtime initialization.
A kobject's ktype should be set when it is registered, like its subsystem.
Note this obviates the need for defining a struct subsystem when an object
type does not need to be kept in a global list.
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
|
|
* ether_crc has always been wrong in 2.5.x. ug. we want
bitreverse crc32_le instead
* use ether_crc in natsemi
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
|
|
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
|
|
This patch combines my patch which statically initialises the crc32
tables so they can be used at any time (during initialisation) and
Joakim Tjernlund's patch to speed up the crc calculations by doing word
operations instead of exclusively byte.
The crc routines are used extensively in jffs2 where speed is very
important.
I need the crc32 routines to calculate a checksum on values read from an
eeprom which contain cpu speed and memory size information - so they are
needed very much earlier in the initialisation process than they are
currently available.
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
|
|
They are 260 bytes. We can get 15 per page without cacheline
alignment. But we're currently only getting ten per page on P4.
|
|
- check if subsystem is NULL during subsys_get().
- Don't increment parent's reference count before we check if we have a
valid kobject during kobject_add()
- Do kobject_add() in subsys_register(), instead of kobject_register(),
since we've already done kobject_init().
|
|
This patch is a rewrite of the insmod and boot parameter handling,
to unify them.
The new format is fairly simple: built on top of __module_param_call there
are several helpers, eg "module_param(foo, int, 000)". The final argument
is the permissions bits, for exposing parameters in sysfs (if
non-zero) at a later stage.
|
|
Makefiles no longer need to include Rules.make, which is currently an
empty file. This patch removes it from the remaining Makefiles, and
removes the empty Rules.make file.
|
|
Fix a radix-tree bug spotted by Vladimir Saveliev <vs@namesys.com>.
Each step in the radix tree spans six address bits. So a height=6 tree
spans 36-bits worth of nodes.
On 32-bit machines radix_tree_gang_lookup() doesn't handle this right -
at the 12TB mark it wraps back to zero, and returns pages at quite
wrong indices.
The patch fixes all that up, and tidies a couple of things.
A user-space test harness was developed so that the code can be sanely
tested. It is at
http://www.zip.com.au/~akpm/linux/patches/stuff/rtth.tar.gz
|
|
kobject_register() has the rude behavior that it will attempt to clean up
the kobject if kobject_add() fails. This replaces that with a WARN_ON() for
the return value, and leaves the cleanup to the caller.
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
|
|
By Kai Germaschewski:
"Well, I have another solution, which doesn't need additional Makefile
magic or anything.
I just put the module name into each .o file where <linux/module.h> is
included. Putting it into the section .gnu.linkonce.modname has the effect
that even for multi-part modules, we only end up with one copy of the
name.
Caveat: I'm using the preprocessor macro KBUILD_MODNAME to know what to
put into .gnu.linkonce.modname. The following used to happen:
(drivers/isdn/eicon/Makefile)
divas-objs := common.o Divas_mod.o ...
eicon-objs := common.o eicon_mod.o ...
Divas_mod.o is compiled with -DKBUILD_MODNAME=divas
eicon_mod.o is compiled with -DKBUILD_MODNAME=eicon
common.o is compiled with -DKBUILD_MODNAME=divas_eicon
So in the case above, both divas.o and eicon.o would end up with
a .gnu.linkonce.modname section containing "divas_eicon"
My fix to this is to not define KBUILD_MODNAME when compiling an object
whilch will be linked into more than one module - so common.o gets no
.gnu.linkonce.modname section at all. Works fine here.
Now, doing this I remove one of the reasons why we would need modules
linked as '.ko' ;), but it seems much cleaner than generating a temporary
file, using objcopy etc."
|
|
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
|
|
This patch fixes a problem which was discovered by Vladimir Saveliev
<vs@namesys.com>
Radix trees have a `height' field, which defines how far the pages are
from the root of the tree. It starts out at zero and increases as the
trees depth is grown.
But it is never decreased. It cannot be decreased without a full tree
traversal.
Because radix_tree_delete() does not decrease `height', we end up
returning inodes to their filesystem's inode slab cache with a non-zero
height.
And when that inode is reused from slab for a new file, it still has a
non-zero height. So we're breaking the slab rules by not putting
objects back in a fully reinitialised state.
So the new file starts out life with whatever height the previous owner
of the inode had. Which is space- and speed-inefficient.
The most efficient place to fix this would be in destroy_inode(). But
that only fixes the problem for inodes - there are other users of radix
trees.
So fix it in radix_tree_delete(): if the tree was emptied, reset
`height' to zero.
|
|
This is really handy for subsystems that have any attributes they want
to export, esp. if they have just a few, since they don't have to define
all of the infrastructure for creating and tearing down the attributes
for the high level type that they are.
- define struct subsys_attribute for declaring attributes of subsystems
themselves.
- define subsys_create_file() and subsys_remove_file().
- define subsys_sysfs_ops for forwarding sysfs reads and writes to the
subsystem attribute callbacks.
- Set the sysfs_ops to be the subsystem ones if the kobject doesn't belong
to a subsystem itself (meaning that it is a subsystem).
|
|
The interface should now be more sane and protect against races better.
kobject_register() was split into two helpers: kobject_init() and kobject_add().
It calls both consecutively, though both are also exposed for use by users
that want to use the objects w/o adding them to the object hierarchy.
kobject_unregister() was made simply a wrapper for kobject_del() and
kobject_put(), which are both also exposed. The guts of kobject_put() was
moved into kobject_cleanup(), which it calls when the reference count hits
0. (This was done for clarity).
The infrastructure now takes a lot in kobject_get() and kobject_put() when
checking and modifying the objects' reference counts. This was an obvious
one that hsould have been fixed long ago.
kobject_add() increments the refcount of the object, which is decremented
when kobject_del() is called. This guarantees that the object's memory
cannot be freed if it has been added to the hierarchy, and kobject_del()
has not been called on it.
kobject_init() is now the function that increments the refcount on the
object's subsystem, which is decremented only after its release() method
has been called for the object in kobject_cleanup().
The documentation has been updated to reflect these changes.
|
|
...since macro using it was changed from #if to #ifdef..
|
|
This patch implements a generic strcspn.
|
|
This is an implementation of the in-kernel module loader extending
the try_inc_mod_count() primitive and making its use compulsory.
This has the benifit of simplicity, and similarity to the existing
scheme. To reduce the cost of the constant increments and
decrements, reference counters are lockless and per-cpu.
Eliminated (coming in following patches):
o Modversions
o Module parameters
o kallsyms
o EXPORT_SYMBOL_GPL and MODULE_LICENCE checks
o DEVICE_TABLE support.
New features:
o Typesafe symbol_get/symbol_put
o Single "insert this module" syscall interface allows trivial userspace.
o Raceless loading and unloading
You will need the trivial replacement module utilities from:
http://ozlabs.org/~rusty/module-init-tools-0.6.tar.gz
|
|
|