SLUB: add support for dynamic cacheline size determination
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=65c02d4cfbbd10188ded3d6577922ab034d943ba Commit: 65c02d4cfbbd10188ded3d6577922ab034d943ba Parent: 97416ce82e20a9511ec369822098a8d20998398a Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:35 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:44 2007 -0700 SLUB: add support for dynamic cacheline size determination SLUB currently assumes that the cacheline size is static. However, i386 f.e. supports dynamic cache line size determination. Use cache_line_size() instead of L1_CACHE_BYTES in the allocator. That also explains the purpose of SLAB_HWCACHE_ALIGN. So we will need to keep that one around to allow dynamic aligning of objects depending on boot determination of the cache line size. [EMAIL PROTECTED]: need to define it before we use it] Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slub.c | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 5db3da5..40e92d8 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -157,6 +157,11 @@ /* Internal SLUB flags */ #define __OBJECT_POISON 0x8000 /* Poison object */ +/* Not all arches define cache_line_size */ +#ifndef cache_line_size +#define cache_line_size() L1_CACHE_BYTES +#endif + static int kmem_size = sizeof(struct kmem_cache); #ifdef CONFIG_SMP @@ -1480,8 +1485,8 @@ static unsigned long calculate_alignment(unsigned long flags, * then use it. */ if ((flags SLAB_HWCACHE_ALIGN) - size L1_CACHE_BYTES / 2) - return max_t(unsigned long, align, L1_CACHE_BYTES); + size cache_line_size() / 2) + return max_t(unsigned long, align, cache_line_size()); if (align ARCH_SLAB_MINALIGN) return ARCH_SLAB_MINALIGN; @@ -1667,8 +1672,8 @@ static int calculate_sizes(struct kmem_cache *s) size += sizeof(void *); /* * Determine the alignment based on various parameters that the -* user specified (this is unecessarily complex due to the attempt -* to be compatible with SLAB. Should be cleaned up some day). +* user specified and the dynamic determination of cache line size +* on bootup. */ align = calculate_alignment(flags, align, s-objsize); @@ -2280,7 +2285,7 @@ void __init kmem_cache_init(void) printk(KERN_INFO SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d, Processors=%d, Nodes=%d\n, - KMALLOC_SHIFT_HIGH, L1_CACHE_BYTES, + KMALLOC_SHIFT_HIGH, cache_line_size(), slub_min_order, slub_max_order, slub_min_objects, nr_cpu_ids, nr_node_ids); } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
SLUB: after object padding only needed for Redzoning
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=be7b3fbcef34452127bed93632b8e788f685d70e Commit: be7b3fbcef34452127bed93632b8e788f685d70e Parent: 65c02d4cfbbd10188ded3d6577922ab034d943ba Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:36 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:44 2007 -0700 SLUB: after object padding only needed for Redzoning If no redzoning is selected then we do not need padding before the next object. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slub.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 40e92d8..beac34a 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1661,7 +1661,7 @@ static int calculate_sizes(struct kmem_cache *s) */ size += 2 * sizeof(struct track); - if (flags DEBUG_DEFAULT_FLAGS) + if (flags SLAB_RED_ZONE) /* * Add some empty padding so that we can catch * overwrites from earlier objects rather than let - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
SLUB: get rid of finish_bootstrap
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=26a7bd030254c462a9e771f6edc54cb972044034 Commit: 26a7bd030254c462a9e771f6edc54cb972044034 Parent: 1f99a283dc13b167b93b2e453a30782955f165c2 Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:39 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:45 2007 -0700 SLUB: get rid of finish_bootstrap Its only purpose was to bring some sort of symmetry to sysfs usage when dealing with bootstrapping per cpu flushing. Since we do not time out slabs anymore we have no need to run finish_bootstrap even without sysfs. Fold it back into slab_sysfs_init and drop the initcall for the !SYFS case. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slub.c | 30 ++ 1 files changed, 10 insertions(+), 20 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 5d425d7..03d26f7 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1704,23 +1704,6 @@ static int calculate_sizes(struct kmem_cache *s) } -static int __init finish_bootstrap(void) -{ - struct list_head *h; - int err; - - slab_state = SYSFS; - - list_for_each(h, slab_caches) { - struct kmem_cache *s = - container_of(h, struct kmem_cache, list); - - err = sysfs_slab_add(s); - BUG_ON(err); - } - return 0; -} - static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, const char *name, size_t size, size_t align, unsigned long flags, @@ -3482,6 +3465,7 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name) static int __init slab_sysfs_init(void) { + struct list_head *h; int err; err = subsystem_register(slab_subsys); @@ -3490,7 +3474,15 @@ static int __init slab_sysfs_init(void) return -ENOSYS; } - finish_bootstrap(); + slab_state = SYSFS; + + list_for_each(h, slab_caches) { + struct kmem_cache *s = + container_of(h, struct kmem_cache, list); + + err = sysfs_slab_add(s); + BUG_ON(err); + } while (alias_list) { struct saved_alias *al = alias_list; @@ -3506,6 +3498,4 @@ static int __init slab_sysfs_init(void) } __initcall(slab_sysfs_init); -#else -__initcall(finish_bootstrap); #endif - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
SLUB: update comments
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=672bba3a4b2e65ed95ebd0cf764bd628bd1da74f Commit: 672bba3a4b2e65ed95ebd0cf764bd628bd1da74f Parent: 26a7bd030254c462a9e771f6edc54cb972044034 Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:39 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:45 2007 -0700 SLUB: update comments Update comments throughout SLUB to reflect the new developments. Fix up various awkward sentences. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slub.c | 242 ++--- 1 files changed, 119 insertions(+), 123 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 03d26f7..15189d8 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -66,11 +66,11 @@ * SLUB assigns one slab for allocation to each processor. * Allocations only occur from these slabs called cpu slabs. * - * Slabs with free elements are kept on a partial list. - * There is no list for full slabs. If an object in a full slab is + * Slabs with free elements are kept on a partial list and during regular + * operations no list for full slabs is used. If an object in a full slab is * freed then the slab will show up again on the partial lists. - * Otherwise there is no need to track full slabs unless we have to - * track full slabs for debugging purposes. + * We track full slabs for debugging purposes though because otherwise we + * cannot scan all objects. * * Slabs are freed when they become empty. Teardown and setup is * minimal so we rely on the page allocators per cpu caches for @@ -92,8 +92,8 @@ * * - The per cpu array is updated for each new slab and and is a remote * cacheline for most nodes. This could become a bouncing cacheline given - * enough frequent updates. There are 16 pointers in a cacheline.so at - * max 16 cpus could compete. Likely okay. + * enough frequent updates. There are 16 pointers in a cacheline, so at + * max 16 cpus could compete for the cacheline which may be okay. * * - Support PAGE_ALLOC_DEBUG. Should be easy to do. * @@ -137,6 +137,7 @@ #define DEBUG_DEFAULT_FLAGS (SLAB_DEBUG_FREE | SLAB_RED_ZONE | \ SLAB_POISON | SLAB_STORE_USER) + /* * Set of flags that will prevent slab merging */ @@ -171,7 +172,7 @@ static struct notifier_block slab_notifier; static enum { DOWN, /* No slab functionality available */ PARTIAL,/* kmem_cache_open() works but kmalloc does not */ - UP, /* Everything works */ + UP, /* Everything works but does not show up in sysfs */ SYSFS /* Sysfs up */ } slab_state = DOWN; @@ -245,9 +246,9 @@ static void print_section(char *text, u8 *addr, unsigned int length) /* * Slow version of get and set free pointer. * - * This requires touching the cache lines of kmem_cache. - * The offset can also be obtained from the page. In that - * case it is in the cacheline that we already need to touch. + * This version requires touching the cache lines of kmem_cache which + * we avoid to do in the fast alloc free paths. There we obtain the offset + * from the page struct. */ static void *get_freepointer(struct kmem_cache *s, void *object) { @@ -429,26 +430,34 @@ static inline int check_valid_pointer(struct kmem_cache *s, * Bytes of the object to be managed. * If the freepointer may overlay the object then the free * pointer is the first word of the object. + * * Poisoning uses 0x6b (POISON_FREE) and the last byte is * 0xa5 (POISON_END) * * object + s-objsize * Padding to reach word boundary. This is also used for Redzoning. - * Padding is extended to word size if Redzoning is enabled - * and objsize == inuse. + * Padding is extended by another word if Redzoning is enabled and + * objsize == inuse. + * * We fill with 0xbb (RED_INACTIVE) for inactive objects and with * 0xcc (RED_ACTIVE) for objects in use. * * object + s-inuse + * Meta data starts here. + * * A. Free pointer (if we cannot overwrite object on free) * B. Tracking data for SLAB_STORE_USER - * C. Padding to reach required alignment boundary - * Padding is done using 0x5a (POISON_INUSE) + * C. Padding to reach required alignment boundary or at mininum + * one word if debuggin is on to be able to detect writes + * before the word boundary. + * + * Padding is done using 0x5a (POISON_INUSE) * * object + s-size + * Nothing is used beyond s-size. * - * If slabcaches are merged then the objsize and inuse boundaries are to - * be ignored. And therefore no slab options that rely on these boundaries + * If slabcaches are merged then
SLUB: add macros for scanning objects in a slab
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7656c72b5a631452ace361037ccf8384454d0f72 Commit: 7656c72b5a631452ace361037ccf8384454d0f72 Parent: 672bba3a4b2e65ed95ebd0cf764bd628bd1da74f Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:40 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:45 2007 -0700 SLUB: add macros for scanning objects in a slab Scanning of objects happens in a number of functions. Consolidate that code. DECLARE_BITMAP instead of coding the declaration for bitmaps. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slub.c | 75 +++- 1 files changed, 44 insertions(+), 31 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 15189d8..e97627b 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -209,6 +209,38 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) } /* + * Slow version of get and set free pointer. + * + * This version requires touching the cache lines of kmem_cache which + * we avoid to do in the fast alloc free paths. There we obtain the offset + * from the page struct. + */ +static inline void *get_freepointer(struct kmem_cache *s, void *object) +{ + return *(void **)(object + s-offset); +} + +static inline void set_freepointer(struct kmem_cache *s, void *object, void *fp) +{ + *(void **)(object + s-offset) = fp; +} + +/* Loop over all objects in a slab */ +#define for_each_object(__p, __s, __addr) \ + for (__p = (__addr); __p (__addr) + (__s)-objects * (__s)-size;\ + __p += (__s)-size) + +/* Scan freelist */ +#define for_each_free_object(__p, __s, __free) \ + for (__p = (__free); __p; __p = get_freepointer((__s), __p)) + +/* Determine object index from a given position */ +static inline int slab_index(void *p, struct kmem_cache *s, void *addr) +{ + return (p - addr) / s-size; +} + +/* * Object debugging */ static void print_section(char *text, u8 *addr, unsigned int length) @@ -244,23 +276,6 @@ static void print_section(char *text, u8 *addr, unsigned int length) } /* - * Slow version of get and set free pointer. - * - * This version requires touching the cache lines of kmem_cache which - * we avoid to do in the fast alloc free paths. There we obtain the offset - * from the page struct. - */ -static void *get_freepointer(struct kmem_cache *s, void *object) -{ - return *(void **)(object + s-offset); -} - -static void set_freepointer(struct kmem_cache *s, void *object, void *fp) -{ - *(void **)(object + s-offset) = fp; -} - -/* * Tracking user of a slab. */ struct track { @@ -852,7 +867,7 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) memset(start, POISON_INUSE, PAGE_SIZE s-order); last = start; - for (p = start + s-size; p end; p += s-size) { + for_each_object(p, s, start) { setup_object(s, page, last); set_freepointer(s, last, p); last = p; @@ -873,12 +888,10 @@ static void __free_slab(struct kmem_cache *s, struct page *page) int pages = 1 s-order; if (unlikely(PageError(page) || s-dtor)) { - void *start = page_address(page); - void *end = start + (pages PAGE_SHIFT); void *p; slab_pad_check(s, page); - for (p = start; p = end - s-size; p += s-size) { + for_each_object(p, s, page_address(page)) { if (s-dtor) s-dtor(p, s, 0); check_object(s, page, p, 0); @@ -2583,7 +2596,7 @@ static int validate_slab(struct kmem_cache *s, struct page *page) { void *p; void *addr = page_address(page); - unsigned long map[BITS_TO_LONGS(s-objects)]; + DECLARE_BITMAP(map, s-objects); if (!check_slab(s, page) || !on_freelist(s, page, NULL)) @@ -2592,14 +2605,14 @@ static int validate_slab(struct kmem_cache *s, struct page *page) /* Now we know that a valid freelist exists */ bitmap_zero(map, s-objects); - for(p = page-freelist; p; p = get_freepointer(s, p)) { - set_bit((p - addr) / s-size, map); + for_each_free_object(p, s, page-freelist) { + set_bit(slab_index(p, s, addr), map); if (!check_object(s, page, p, 0)) return 0; } - for(p = addr; p addr + s-objects * s-size; p += s-size) - if (!test_bit((p - addr) / s-size, map)) + for_each_object(p, s, addr) + if (!test_bit(slab_index(p, s, addr), map)) if (!check_object(s, page, p, 1))
SLUB: move resiliency check into SYSFS section
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b345970905e34c1b632fe4d80e2af14c7de99b45 Commit: b345970905e34c1b632fe4d80e2af14c7de99b45 Parent: 7656c72b5a631452ace361037ccf8384454d0f72 Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:41 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:45 2007 -0700 SLUB: move resiliency check into SYSFS section Move the resiliency check into the SYSFS section after validate_slab that is used by the resiliency check. This will avoid a forward declaration. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slub.c | 112 ++--- 1 files changed, 55 insertions(+), 57 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index e97627b..07492a8 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2512,63 +2512,6 @@ static int __init cpucache_init(void) __initcall(cpucache_init); #endif -#ifdef SLUB_RESILIENCY_TEST -static unsigned long validate_slab_cache(struct kmem_cache *s); - -static void resiliency_test(void) -{ - u8 *p; - - printk(KERN_ERR SLUB resiliency testing\n); - printk(KERN_ERR ---\n); - printk(KERN_ERR A. Corruption after allocation\n); - - p = kzalloc(16, GFP_KERNEL); - p[16] = 0x12; - printk(KERN_ERR \n1. kmalloc-16: Clobber Redzone/next pointer -0x12-0x%p\n\n, p + 16); - - validate_slab_cache(kmalloc_caches + 4); - - /* Hmmm... The next two are dangerous */ - p = kzalloc(32, GFP_KERNEL); - p[32 + sizeof(void *)] = 0x34; - printk(KERN_ERR \n2. kmalloc-32: Clobber next pointer/next slab -0x34 - -0x%p\n, p); - printk(KERN_ERR If allocated object is overwritten then not detectable\n\n); - - validate_slab_cache(kmalloc_caches + 5); - p = kzalloc(64, GFP_KERNEL); - p += 64 + (get_cycles() 0xff) * sizeof(void *); - *p = 0x56; - printk(KERN_ERR \n3. kmalloc-64: corrupting random byte 0x56-0x%p\n, - p); - printk(KERN_ERR If allocated object is overwritten then not detectable\n\n); - validate_slab_cache(kmalloc_caches + 6); - - printk(KERN_ERR \nB. Corruption after free\n); - p = kzalloc(128, GFP_KERNEL); - kfree(p); - *p = 0x78; - printk(KERN_ERR 1. kmalloc-128: Clobber first word 0x78-0x%p\n\n, p); - validate_slab_cache(kmalloc_caches + 7); - - p = kzalloc(256, GFP_KERNEL); - kfree(p); - p[50] = 0x9a; - printk(KERN_ERR \n2. kmalloc-256: Clobber 50th byte 0x9a-0x%p\n\n, p); - validate_slab_cache(kmalloc_caches + 8); - - p = kzalloc(512, GFP_KERNEL); - kfree(p); - p[512] = 0xab; - printk(KERN_ERR \n3. kmalloc-512: Clobber redzone 0xab-0x%p\n\n, p); - validate_slab_cache(kmalloc_caches + 9); -} -#else -static void resiliency_test(void) {}; -#endif - void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, void *caller) { struct kmem_cache *s = get_slab(size, gfpflags); @@ -2685,6 +2628,61 @@ static unsigned long validate_slab_cache(struct kmem_cache *s) return count; } +#ifdef SLUB_RESILIENCY_TEST +static void resiliency_test(void) +{ + u8 *p; + + printk(KERN_ERR SLUB resiliency testing\n); + printk(KERN_ERR ---\n); + printk(KERN_ERR A. Corruption after allocation\n); + + p = kzalloc(16, GFP_KERNEL); + p[16] = 0x12; + printk(KERN_ERR \n1. kmalloc-16: Clobber Redzone/next pointer +0x12-0x%p\n\n, p + 16); + + validate_slab_cache(kmalloc_caches + 4); + + /* Hmmm... The next two are dangerous */ + p = kzalloc(32, GFP_KERNEL); + p[32 + sizeof(void *)] = 0x34; + printk(KERN_ERR \n2. kmalloc-32: Clobber next pointer/next slab +0x34 - -0x%p\n, p); + printk(KERN_ERR If allocated object is overwritten then not detectable\n\n); + + validate_slab_cache(kmalloc_caches + 5); + p = kzalloc(64, GFP_KERNEL); + p += 64 + (get_cycles() 0xff) * sizeof(void *); + *p = 0x56; + printk(KERN_ERR \n3. kmalloc-64: corrupting random byte 0x56-0x%p\n, + p); + printk(KERN_ERR If allocated object is overwritten then not detectable\n\n); + validate_slab_cache(kmalloc_caches + 6); + + printk(KERN_ERR \nB. Corruption after free\n); + p = kzalloc(128, GFP_KERNEL); + kfree(p); + *p = 0x78; + printk(KERN_ERR 1. kmalloc-128: Clobber first word 0x78-0x%p\n\n, p); + validate_slab_cache(kmalloc_caches + 7); + + p = kzalloc(256, GFP_KERNEL); +
SLUB: move tracking definitions and check_valid_pointer() away from debug code
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=02cbc874463924de2c3403379b698bce3cd277a5 Commit: 02cbc874463924de2c3403379b698bce3cd277a5 Parent: 636f0d7de8dc0282cce9905e035c04dd60db19dd Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:43 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:45 2007 -0700 SLUB: move tracking definitions and check_valid_pointer() away from debug code Move the tracking definitions and the check_valid_pointer() function away from the debugging related functions. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slub.c | 58 +- 1 files changed, 29 insertions(+), 29 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index dfbd0d8..b9e0536 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -195,6 +195,18 @@ static enum { static DECLARE_RWSEM(slub_lock); LIST_HEAD(slab_caches); +/* + * Tracking user of a slab. + */ +struct track { + void *addr; /* Called from address */ + int cpu;/* Was running on cpu */ + int pid;/* Pid context */ + unsigned long when; /* When did the operation occur */ +}; + +enum track_item { TRACK_ALLOC, TRACK_FREE }; + #ifdef CONFIG_SYSFS static int sysfs_slab_add(struct kmem_cache *); static int sysfs_slab_alias(struct kmem_cache *, const char *); @@ -223,6 +235,23 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) #endif } +static inline int check_valid_pointer(struct kmem_cache *s, + struct page *page, const void *object) +{ + void *base; + + if (!object) + return 1; + + base = page_address(page); + if (object base || object = base + s-objects * s-size || + (object - base) % s-size) { + return 0; + } + + return 1; +} + /* * Slow version of get and set free pointer. * @@ -290,18 +319,6 @@ static void print_section(char *text, u8 *addr, unsigned int length) } } -/* - * Tracking user of a slab. - */ -struct track { - void *addr; /* Called from address */ - int cpu;/* Was running on cpu */ - int pid;/* Pid context */ - unsigned long when; /* When did the operation occur */ -}; - -enum track_item { TRACK_ALLOC, TRACK_FREE }; - static struct track *get_track(struct kmem_cache *s, void *object, enum track_item alloc) { @@ -436,23 +453,6 @@ static int check_bytes(u8 *start, unsigned int value, unsigned int bytes) return 1; } -static inline int check_valid_pointer(struct kmem_cache *s, - struct page *page, const void *object) -{ - void *base; - - if (!object) - return 1; - - base = page_address(page); - if (object base || object = base + s-objects * s-size || - (object - base) % s-size) { - return 0; - } - - return 1; -} - /* * Object layout: * - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
SLUB: add CONFIG_SLUB_DEBUG
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=41ecc55b8a8ca618e6d490982c7ce45d230d4399 Commit: 41ecc55b8a8ca618e6d490982c7ce45d230d4399 Parent: 02cbc874463924de2c3403379b698bce3cd277a5 Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:44 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:45 2007 -0700 SLUB: add CONFIG_SLUB_DEBUG CONFIG_SLUB_DEBUG can be used to switch off the debugging and sysfs components of SLUB. Thus SLUB will be able to replace SLOB. SLUB can arrange objects in a denser way than SLOB and the code size should be minimal without debugging and sysfs support. Note that CONFIG_SLUB_DEBUG is materially different from CONFIG_SLAB_DEBUG. CONFIG_SLAB_DEBUG is used to enable slab debugging in SLAB. SLUB enables debugging via a boot parameter. SLUB debug code should always be present. CONFIG_SLUB_DEBUG can be modified in the embedded config section. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- init/Kconfig |9 +++ mm/slub.c| 189 +++--- 2 files changed, 123 insertions(+), 75 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index d0edf42..da6a91c 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -504,6 +504,15 @@ config VM_EVENT_COUNTERS on EMBEDDED systems. /proc/vmstat will only show page counts if VM event counters are disabled. +config SLUB_DEBUG + default y + bool Enable SLUB debugging support if EMBEDDED + help + SLUB has extensive debug support features. Disabling these can + result in significant savings in code size. This also disables + SLUB sysfs support. /sys/slab will not exist and there will be + no support for cache validation etc. + choice prompt Choose SLAB allocator default SLAB diff --git a/mm/slub.c b/mm/slub.c index b9e0536..3e614c1 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -89,17 +89,25 @@ static inline int SlabDebug(struct page *page) { +#ifdef CONFIG_SLUB_DEBUG return PageError(page); +#else + return 0; +#endif } static inline void SetSlabDebug(struct page *page) { +#ifdef CONFIG_SLUB_DEBUG SetPageError(page); +#endif } static inline void ClearSlabDebug(struct page *page) { +#ifdef CONFIG_SLUB_DEBUG ClearPageError(page); +#endif } /* @@ -207,7 +215,7 @@ struct track { enum track_item { TRACK_ALLOC, TRACK_FREE }; -#ifdef CONFIG_SYSFS +#if defined(CONFIG_SYSFS) defined(CONFIG_SLUB_DEBUG) static int sysfs_slab_add(struct kmem_cache *); static int sysfs_slab_alias(struct kmem_cache *, const char *); static void sysfs_slab_remove(struct kmem_cache *); @@ -284,6 +292,14 @@ static inline int slab_index(void *p, struct kmem_cache *s, void *addr) return (p - addr) / s-size; } +#ifdef CONFIG_SLUB_DEBUG +/* + * Debug settings: + */ +static int slub_debug; + +static char *slub_debug_slabs; + /* * Object debugging */ @@ -821,6 +837,97 @@ static void trace(struct kmem_cache *s, struct page *page, void *object, int all } } +static int __init setup_slub_debug(char *str) +{ + if (!str || *str != '=') + slub_debug = DEBUG_DEFAULT_FLAGS; + else { + str++; + if (*str == 0 || *str == ',') + slub_debug = DEBUG_DEFAULT_FLAGS; + else + for( ;*str *str != ','; str++) + switch (*str) { + case 'f' : case 'F' : + slub_debug |= SLAB_DEBUG_FREE; + break; + case 'z' : case 'Z' : + slub_debug |= SLAB_RED_ZONE; + break; + case 'p' : case 'P' : + slub_debug |= SLAB_POISON; + break; + case 'u' : case 'U' : + slub_debug |= SLAB_STORE_USER; + break; + case 't' : case 'T' : + slub_debug |= SLAB_TRACE; + break; + default: + printk(KERN_ERR slub_debug option '%c' + unknown. skipped\n,*str); + } + } + + if (*str == ',') + slub_debug_slabs = str + 1; + return 1; +} + +__setup(slub_debug, setup_slub_debug); + +static void kmem_cache_open_debug_check(struct kmem_cache *s) +{ + /* +* The page-offset field is only 16 bit wide. This is an offset +* in units of words from the beginning of an object. If
SLUB: include lifetime stats and sets of cpus / nodes in tracking output
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=45edfa580b8e638c44ec26872bfe75b307ba12d1 Commit: 45edfa580b8e638c44ec26872bfe75b307ba12d1 Parent: 41ecc55b8a8ca618e6d490982c7ce45d230d4399 Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:45 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 SLUB: include lifetime stats and sets of cpus / nodes in tracking output We have information about how long an object existed and about the nodes and cpus where the allocations and frees took place. Add that information to the tracking output in /sys/slab/xx/alloc_calls and /sys/slab/free_calls This will then enable slabinfo to output nice reports like this: [EMAIL PROTECTED]:~/slub$ ./slabinfo kmalloc-128 Slabcache: kmalloc-128 Aliases: 0 Order : 0 Sizes (bytes) Slabs DebugMemory Object : 128 Total : 12 Sanity Checks : On Total: 49152 SlabObj: 200 Full : 7 Redzoning : On Used : 24832 SlabSiz:4096 Partial: 4 Poisoning : On Loss : 24320 Loss : 72 CpuSlab: 1 Tracking : On Lalig: 13968 Align : 8 Objects: 20 Tracing : Off Lpadd:1152 kmalloc-128 has no kmem_cache operations kmalloc-128: Kernel object allocation --- 6 param_sysfs_setup+0x71/0x130 age=284512/284512/284512 pid=1 nodes=0-1,3 11 percpu_populate+0x39/0x80 age=283914/284428/284512 pid=1 nodes=0 21 __register_chrdev_region+0x31/0x170 age=282896/284347/284473 pid=1-1705 nodes=0-2 1 sys_inotify_init+0x76/0x1c0 age=283423 pid=1004 nodes=0 19 as_get_io_context+0x32/0xd0 age=6/247567/283988 pid=1-11782 nodes=0,2 10 ida_pre_get+0x4a/0x80 age=277666/283773/284526 pid=0-2177 nodes=0,2 24 kobject_kset_add_dir+0x37/0xb0 age=282727/283860/284472 pid=1-1723 nodes=0-2 1 acpi_ds_build_internal_buffer_obj+0xd3/0x11d age=284508 pid=1 nodes=0 24 con_insert_unipair+0xd7/0x110 age=284438/284438/284438 pid=1 nodes=0,2 1 uart_open+0x2d2/0x4b0 age=283896 pid=1 nodes=0 26 dma_pool_create+0x73/0x1a0 age=282762/282833/282916 pid=1705-1723 nodes=0 1 neigh_table_init_no_netlink+0xd2/0x210 age=284461 pid=1 nodes=0 2 neigh_parms_alloc+0x2b/0xe0 age=284410/284411/284412 pid=1 nodes=2 2 neigh_resolve_output+0x1e1/0x280 age=276289/276291/276293 pid=0-2443 nodes=0 1 netlink_kernel_create+0x90/0x170 age=284472 pid=1 nodes=0 4 xt_alloc_table_info+0x39/0xf0 age=283958/283958/283959 pid=1 nodes=1 3 fn_hash_insert+0x473/0x720 age=277653/277661/277666 pid=2177-2185 nodes=0 1 get_mtrr_state+0x285/0x2a0 age=284526 pid=0 nodes=0 1 cacheinfo_cpu_callback+0x26d/0x3e0 age=284458 pid=1 nodes=0 29 kernel_param_sysfs_setup+0x25/0x90 age=284511/284511/284512 pid=1 nodes=0-1,3 5 process_zones+0x5e/0x170 age=284546/284546/284546 pid=0 nodes=0 1 drm_core_init+0x48/0x160 age=284421 pid=1 nodes=2 kmalloc-128: Kernel object freeing 163 not-available age=4295176847 pid=0 nodes=0-3 1 __vunmap+0x6e/0xf0 age=282907 pid=1723 nodes=0 28 free_as_io_context+0x12/0x90 age=9243/262197/283474 pid=42-11754 nodes=0 1 acpi_get_object_info+0x1b7/0x1d4 age=284475 pid=1 nodes=0 1 do_acpi_find_child+0x45/0x4e age=284475 pid=1 nodes=0 NUMA nodes :0123 -- All slabs 7221 Partial slabs 2200 Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slub.c | 96 +++- 1 files changed, 81 insertions(+), 15 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 3e614c1..ae28310 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1586,13 +1586,16 @@ static int calculate_order(int size) order MAX_ORDER; order++) { unsigned long slab_size = PAGE_SIZE order; - if (slub_max_order order + if (order slub_max_order slab_size slub_min_objects * size) continue; if (slab_size size) continue; + if (order =
Fix spellings of slab allocator section in init/Kconfig
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=34013886ef47ea72e412beb04558431b57a68d51 Commit: 34013886ef47ea72e412beb04558431b57a68d51 Parent: 7ae439ce0c01d7db0c70d1542985969e95ef750d Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:47 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 Fix spellings of slab allocator section in init/Kconfig Fix some of the spelling issues. Fix sentences. Discourage SLOB use since SLUB can pack objects denser. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Cc: Matt Mackall [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- init/Kconfig | 15 +++ 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index da6a91c..4ad6de1 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -523,9 +523,9 @@ config SLAB bool SLAB help The regular slab allocator that is established and known to work - well in all environments. It organizes chache hot objects in + well in all environments. It organizes cache hot objects in per cpu and per node queues. SLAB is the default choice for - slab allocator. + a slab allocator. config SLUB depends on EXPERIMENTAL !ARCH_USES_SLAB_PAGE_STRUCT @@ -535,21 +535,20 @@ config SLUB instead of managing queues of cached objects (SLAB approach). Per cpu caching is realized using slabs of objects instead of queues of objects. SLUB can use memory efficiently - way and has enhanced diagnostics. + and has enhanced diagnostics. config SLOB # -# SLOB cannot support SMP because SLAB_DESTROY_BY_RCU does not work -# properly. +# SLOB does not support SMP because SLAB_DESTROY_BY_RCU is unsupported # depends on EMBEDDED !SMP !SPARSEMEM bool SLOB (Simple Allocator) help SLOB replaces the SLAB allocator with a drastically simpler allocator. SLOB is more space efficient that SLAB but does not - scale well (single lock for all operations) and is more susceptible - to fragmentation. SLOB it is a great choice to reduce - memory usage and code size for embedded systems. + scale well (single lock for all operations) and is also highly + susceptible to fragmentation. SLUB can accomplish a higher object + density. It is usually better to use SLUB instead of SLOB. endchoice - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm crypt: disable barriers
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9c89f8be1a7d14aad9d2c3f7d90d7d88f82c61e2 Commit: 9c89f8be1a7d14aad9d2c3f7d90d7d88f82c61e2 Parent: 6ad36fe2b451cc85cc7b14f4128286759e217124 Author: Milan Broz [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:51 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 dm crypt: disable barriers Disable barriers in dm-crypt because of current workqueue processing can reorder requests. This must be addresed later but for now disabling barriers is needed to prevent data corruption. Signed-off-by: Milan Broz [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Cc: Jens Axboe [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-crypt.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index d812123..8527827 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -954,6 +954,9 @@ static int crypt_map(struct dm_target *ti, struct bio *bio, struct crypt_config *cc = ti-private; struct crypt_io *io; + if (bio_barrier(bio)) + return -EOPNOTSUPP; + io = mempool_alloc(cc-io_pool, GFP_NOIO); io-target = ti; io-base_bio = bio; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm crypt: fix call to clone_init
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=027581f3515b5ec2218847dab578afa439a9d6b9 Commit: 027581f3515b5ec2218847dab578afa439a9d6b9 Parent: 9c89f8be1a7d14aad9d2c3f7d90d7d88f82c61e2 Author: Olaf Kirch [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:52 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 dm crypt: fix call to clone_init Call clone_init early We need to call clone_init as early as possible - at least before call bio_put(clone) in any error path. Otherwise, the destructor will try to dereference bi_private, which may still be NULL. Signed-off-by: Olaf Kirch [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-crypt.c | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 8527827..db43936 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -107,6 +107,8 @@ struct crypt_config { static struct kmem_cache *_crypt_io_pool; +static void clone_init(struct crypt_io *, struct bio *); + /* * Different IV generation algorithms: * @@ -379,9 +381,10 @@ static int crypt_convert(struct crypt_config *cc, * May return a smaller bio when running out of pages */ static struct bio * -crypt_alloc_buffer(struct crypt_config *cc, unsigned int size, +crypt_alloc_buffer(struct crypt_io *io, unsigned int size, struct bio *base_bio, unsigned int *bio_vec_idx) { + struct crypt_config *cc = io-target-private; struct bio *clone; unsigned int nr_iovecs = (size + PAGE_SIZE - 1) PAGE_SHIFT; gfp_t gfp_mask = GFP_NOIO | __GFP_HIGHMEM; @@ -396,7 +399,7 @@ crypt_alloc_buffer(struct crypt_config *cc, unsigned int size, if (!clone) return NULL; - clone-bi_destructor = dm_crypt_bio_destructor; + clone_init(io, clone); /* if the last bio was not complete, continue where that one ended */ clone-bi_idx = *bio_vec_idx; @@ -562,6 +565,7 @@ static void clone_init(struct crypt_io *io, struct bio *clone) clone-bi_end_io = crypt_endio; clone-bi_bdev= cc-dev-bdev; clone-bi_rw = io-base_bio-bi_rw; + clone-bi_destructor = dm_crypt_bio_destructor; } static void process_read(struct crypt_io *io) @@ -585,7 +589,6 @@ static void process_read(struct crypt_io *io) } clone_init(io, clone); - clone-bi_destructor = dm_crypt_bio_destructor; clone-bi_idx = 0; clone-bi_vcnt = bio_segments(base_bio); clone-bi_size = base_bio-bi_size; @@ -615,7 +618,7 @@ static void process_write(struct crypt_io *io) * so repeat the whole process until all the data can be handled. */ while (remaining) { - clone = crypt_alloc_buffer(cc, base_bio-bi_size, + clone = crypt_alloc_buffer(io, base_bio-bi_size, io-first_clone, bvec_idx); if (unlikely(!clone)) { dec_pending(io, -ENOMEM); @@ -631,7 +634,6 @@ static void process_write(struct crypt_io *io) return; } - clone_init(io, clone); clone-bi_sector = cc-start + sector; if (!io-first_clone) { - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm crypt: fix avoid cloned bio ref after free
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=98221eb757de03d9aa6262b1eded2be708640ccc Commit: 98221eb757de03d9aa6262b1eded2be708640ccc Parent: 027581f3515b5ec2218847dab578afa439a9d6b9 Author: Olaf Kirch [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:52 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 dm crypt: fix avoid cloned bio ref after free Do not access the bio after generic_make_request We should never access a bio after generic_make_request - there's no guarantee it still exists. Signed-off-by: Olaf Kirch [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Cc: Jens Axboe [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-crypt.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index db43936..1dc2c62 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -655,9 +655,12 @@ static void process_write(struct crypt_io *io) generic_make_request(clone); + /* Do not reference clone after this - it +* may be gone already. */ + /* out of memory - run queues */ if (remaining) - congestion_wait(bio_data_dir(clone), HZ/100); + congestion_wait(WRITE, HZ/100); } } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm crypt: fix remove first_clone
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2f9941b6c55d70103c1bc3f2c7676acd9f20bf8a Commit: 2f9941b6c55d70103c1bc3f2c7676acd9f20bf8a Parent: 98221eb757de03d9aa6262b1eded2be708640ccc Author: Olaf Kirch [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:53 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 dm crypt: fix remove first_clone Get rid of first_clone in dm-crypt This gets rid of first_clone, which is not really needed. Apparently, cloned bios used to share their bvec some time way in the past - this is no longer the case. Contrarily, this even hurts us if we try to create a clone off first_clone after it has completed, and crypt_endio has destroyed its bvec. Signed-off-by: Olaf Kirch [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Cc: Jens Axboe [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-crypt.c | 34 ++ 1 files changed, 6 insertions(+), 28 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 1dc2c62..339b575 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -33,7 +33,6 @@ struct crypt_io { struct dm_target *target; struct bio *base_bio; - struct bio *first_clone; struct work_struct work; atomic_t pending; int error; @@ -380,9 +379,8 @@ static int crypt_convert(struct crypt_config *cc, * This should never violate the device limitations * May return a smaller bio when running out of pages */ -static struct bio * -crypt_alloc_buffer(struct crypt_io *io, unsigned int size, - struct bio *base_bio, unsigned int *bio_vec_idx) +static struct bio *crypt_alloc_buffer(struct crypt_io *io, unsigned int size, + unsigned int *bio_vec_idx) { struct crypt_config *cc = io-target-private; struct bio *clone; @@ -390,12 +388,7 @@ crypt_alloc_buffer(struct crypt_io *io, unsigned int size, gfp_t gfp_mask = GFP_NOIO | __GFP_HIGHMEM; unsigned int i; - if (base_bio) { - clone = bio_alloc_bioset(GFP_NOIO, base_bio-bi_max_vecs, cc-bs); - __bio_clone(clone, base_bio); - } else - clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, cc-bs); - + clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, cc-bs); if (!clone) return NULL; @@ -498,9 +491,6 @@ static void dec_pending(struct crypt_io *io, int error) if (!atomic_dec_and_test(io-pending)) return; - if (io-first_clone) - bio_put(io-first_clone); - bio_endio(io-base_bio, io-base_bio-bi_size, io-error); mempool_free(io, cc-io_pool); @@ -618,8 +608,7 @@ static void process_write(struct crypt_io *io) * so repeat the whole process until all the data can be handled. */ while (remaining) { - clone = crypt_alloc_buffer(io, base_bio-bi_size, - io-first_clone, bvec_idx); + clone = crypt_alloc_buffer(io, base_bio-bi_size, bvec_idx); if (unlikely(!clone)) { dec_pending(io, -ENOMEM); return; @@ -635,21 +624,11 @@ static void process_write(struct crypt_io *io) } clone-bi_sector = cc-start + sector; - - if (!io-first_clone) { - /* -* hold a reference to the first clone, because it -* holds the bio_vec array and that can't be freed -* before all other clones are released -*/ - bio_get(clone); - io-first_clone = clone; - } - remaining -= clone-bi_size; sector += bio_sectors(clone); - /* prevent bio_put of first_clone */ + /* Grab another reference to the io struct +* before we kick off the request */ if (remaining) atomic_inc(io-pending); @@ -965,7 +944,6 @@ static int crypt_map(struct dm_target *ti, struct bio *bio, io = mempool_alloc(cc-io_pool, GFP_NOIO); io-target = ti; io-base_bio = bio; - io-first_clone = NULL; io-error = io-post_process = 0; atomic_set(io-pending, 0); kcryptd_queue_io(io); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm crypt: use smaller bvecs in clones
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f97380bcadd6bd2e368727de4061aaba4989c426 Commit: f97380bcadd6bd2e368727de4061aaba4989c426 Parent: 2f9941b6c55d70103c1bc3f2c7676acd9f20bf8a Author: Olaf Kirch [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:54 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 dm crypt: use smaller bvecs in clones Allocate smaller clones With the previous dm-crypt fixes, there is no need for the clone bios to have the same bvec size as the original - we just need to make them big enough for the remaining number of pages. The only requirement is that we clear the out index in convert_context, so that crypt_convert starts storing data at the right position within the clone bio. Signed-off-by: Olaf Kirch [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Cc: Jens Axboe [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-crypt.c | 29 - 1 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 339b575..1ecee5e 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -379,8 +379,7 @@ static int crypt_convert(struct crypt_config *cc, * This should never violate the device limitations * May return a smaller bio when running out of pages */ -static struct bio *crypt_alloc_buffer(struct crypt_io *io, unsigned int size, - unsigned int *bio_vec_idx) +static struct bio *crypt_alloc_buffer(struct crypt_io *io, unsigned int size) { struct crypt_config *cc = io-target-private; struct bio *clone; @@ -394,16 +393,7 @@ static struct bio *crypt_alloc_buffer(struct crypt_io *io, unsigned int size, clone_init(io, clone); - /* if the last bio was not complete, continue where that one ended */ - clone-bi_idx = *bio_vec_idx; - clone-bi_vcnt = *bio_vec_idx; - clone-bi_size = 0; - clone-bi_flags = ~(1 BIO_SEG_VALID); - - /* clone-bi_idx pages have already been allocated */ - size -= clone-bi_idx * PAGE_SIZE; - - for (i = clone-bi_idx; i nr_iovecs; i++) { + for (i = 0; i nr_iovecs; i++) { struct bio_vec *bv = bio_iovec_idx(clone, i); bv-bv_page = mempool_alloc(cc-page_pool, gfp_mask); @@ -415,7 +405,7 @@ static struct bio *crypt_alloc_buffer(struct crypt_io *io, unsigned int size, * return a partially allocated bio, the caller will then try * to allocate additional bios while submitting this partial bio */ - if ((i - clone-bi_idx) == (MIN_BIO_PAGES - 1)) + if (i == (MIN_BIO_PAGES - 1)) gfp_mask = (gfp_mask | __GFP_NOWARN) ~__GFP_WAIT; bv-bv_offset = 0; @@ -434,12 +424,6 @@ static struct bio *crypt_alloc_buffer(struct crypt_io *io, unsigned int size, return NULL; } - /* -* Remember the last bio_vec allocated to be able -* to correctly continue after the splitting. -*/ - *bio_vec_idx = clone-bi_vcnt; - return clone; } @@ -597,7 +581,6 @@ static void process_write(struct crypt_io *io) struct convert_context ctx; unsigned remaining = base_bio-bi_size; sector_t sector = base_bio-bi_sector - io-target-begin; - unsigned bvec_idx = 0; atomic_inc(io-pending); @@ -608,13 +591,14 @@ static void process_write(struct crypt_io *io) * so repeat the whole process until all the data can be handled. */ while (remaining) { - clone = crypt_alloc_buffer(io, base_bio-bi_size, bvec_idx); + clone = crypt_alloc_buffer(io, remaining); if (unlikely(!clone)) { dec_pending(io, -ENOMEM); return; } ctx.bio_out = clone; + ctx.idx_out = 0; if (unlikely(crypt_convert(cc, ctx) 0)) { crypt_free_buffer_pages(cc, clone, clone-bi_size); @@ -623,6 +607,9 @@ static void process_write(struct crypt_io *io) return; } + /* crypt_convert should have filled the clone bio */ + BUG_ON(ctx.idx_out clone-bi_vcnt); + clone-bi_sector = cc-start + sector; remaining -= clone-bi_size; sector += bio_sectors(clone); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm crypt: add null iv
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=46b477306afcd0516924b26792c7a42f4dbfa9f0 Commit: 46b477306afcd0516924b26792c7a42f4dbfa9f0 Parent: f97380bcadd6bd2e368727de4061aaba4989c426 Author: Ludwig Nussel [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:55 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 dm crypt: add null iv Add a new IV generation method 'null' to read old filesystem images created with SuSE's loop_fish2 module. Signed-off-by: Ludwig Nussel [EMAIL PROTECTED] Acked-By: Christophe Saout [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-crypt.c | 18 +- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 1ecee5e..7b0fcfc 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -121,6 +121,9 @@ static void clone_init(struct crypt_io *, struct bio *); * benbi: the 64-bit big-endian 'narrow block'-count, starting at 1 *(needed for LRW-32-AES and possible other narrow block modes) * + * null: the initial vector is always zero. Provides compatibility with + * obsolete loop_fish2 devices. Do not use for new devices. + * * plumb: unimplemented, see: * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454 */ @@ -257,6 +260,13 @@ static int crypt_iv_benbi_gen(struct crypt_config *cc, u8 *iv, sector_t sector) return 0; } +static int crypt_iv_null_gen(struct crypt_config *cc, u8 *iv, sector_t sector) +{ + memset(iv, 0, cc-iv_size); + + return 0; +} + static struct crypt_iv_operations crypt_iv_plain_ops = { .generator = crypt_iv_plain_gen }; @@ -273,6 +283,10 @@ static struct crypt_iv_operations crypt_iv_benbi_ops = { .generator = crypt_iv_benbi_gen }; +static struct crypt_iv_operations crypt_iv_null_ops = { + .generator = crypt_iv_null_gen +}; + static int crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, struct scatterlist *in, unsigned int length, @@ -803,6 +817,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) cc-iv_gen_ops = crypt_iv_essiv_ops; else if (strcmp(ivmode, benbi) == 0) cc-iv_gen_ops = crypt_iv_benbi_ops; + else if (strcmp(ivmode, null) == 0) + cc-iv_gen_ops = crypt_iv_null_ops; else { ti-error = Invalid IV mode; goto bad2; @@ -1030,7 +1046,7 @@ error: static struct target_type crypt_target = { .name = crypt, - .version= {1, 3, 0}, + .version= {1, 5, 0}, .module = THIS_MODULE, .ctr= crypt_ctr, .dtr= crypt_dtr, - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm mpath: log device name
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=79eb885c96b5ccf8bbffd0dddc4c15a5dd436a1c Commit: 79eb885c96b5ccf8bbffd0dddc4c15a5dd436a1c Parent: 46b477306afcd0516924b26792c7a42f4dbfa9f0 Author: Edward Goggin [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:56 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:46 2007 -0700 dm mpath: log device name Make the mapped device structure accessible to hardware handlers so error messages can include the device name. Signed-off-by: Edward Goggin [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-hw-handler.h |1 + drivers/md/dm-mpath.c |3 +++ drivers/md/dm.c|1 + 3 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/md/dm-hw-handler.h b/drivers/md/dm-hw-handler.h index 32eff28..e0832e6 100644 --- a/drivers/md/dm-hw-handler.h +++ b/drivers/md/dm-hw-handler.h @@ -16,6 +16,7 @@ struct hw_handler_type; struct hw_handler { struct hw_handler_type *type; + struct mapped_device *md; void *context; }; diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 3aa0135..de54b39 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -668,6 +668,9 @@ static int parse_hw_handler(struct arg_set *as, struct multipath *m) return -EINVAL; } + m-hw_handler.md = dm_table_get_md(ti-table); + dm_put(m-hw_handler.md); + r = hwht-create(m-hw_handler, hw_argc - 1, as-argv); if (r) { dm_put_hw_handler(hwht); diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 11a98df..2717a35 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1236,6 +1236,7 @@ void dm_put(struct mapped_device *md) free_dev(md); } } +EXPORT_SYMBOL_GPL(dm_put); /* * Process the deferred bios - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm: allow offline devices
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2cd54d9bedb79a97f014e86c0da393416b264eb3 Commit: 2cd54d9bedb79a97f014e86c0da393416b264eb3 Parent: 79eb885c96b5ccf8bbffd0dddc4c15a5dd436a1c Author: Mike Anderson [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:57 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm: allow offline devices Allow check_device_area to succeed if a device has an i_size of zero. This addresses an issue seen on DASD devices setting up a multipath table for paths in online and offline state. Signed-off-by: Mike Anderson [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-table.c | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 05befa9..2fc199b 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -425,13 +425,15 @@ static void close_dev(struct dm_dev *d, struct mapped_device *md) } /* - * If possible (ie. blk_size[major] is set), this checks an area - * of a destination device is valid. + * If possible, this checks an area of a destination device is valid. */ static int check_device_area(struct dm_dev *dd, sector_t start, sector_t len) { - sector_t dev_size; - dev_size = dd-bdev-bd_inode-i_size SECTOR_SHIFT; + sector_t dev_size = dd-bdev-bd_inode-i_size SECTOR_SHIFT; + + if (!dev_size) + return 1; + return ((start dev_size) (len = (dev_size - start))); } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm log: fault detection
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=01d03a660e73fb524957c09825a3eb7c2ae7c205 Commit: 01d03a660e73fb524957c09825a3eb7c2ae7c205 Parent: 2cd54d9bedb79a97f014e86c0da393416b264eb3 Author: Jonathan E Brassow [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:57 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm log: fault detection This patch gives the disk logging code the ability to store the fact that an error occured on the log device. In addition, an event is raised when an error is encountered during I/O to the log device. Signed-off-by: Jonathan E Brassow [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-log.c | 30 +++--- 1 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index 6a92613..a503d12 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c @@ -152,6 +152,7 @@ struct log_c { /* * Disk log fields */ + int log_dev_failed; struct dm_dev *log_dev; struct log_header header; @@ -315,6 +316,7 @@ static int create_log_context(struct dirty_log *log, struct dm_target *ti, lc-disk_header = NULL; } else { lc-log_dev = dev; + lc-log_dev_failed = 0; lc-header_location.bdev = lc-log_dev-bdev; lc-header_location.sector = 0; @@ -437,6 +439,15 @@ static int count_bits32(uint32_t *addr, unsigned size) return count; } +static void fail_log_device(struct log_c *lc) +{ + if (lc-log_dev_failed) + return; + + lc-log_dev_failed = 1; + dm_table_event(lc-ti-table); +} + static int disk_resume(struct dirty_log *log) { int r; @@ -446,8 +457,12 @@ static int disk_resume(struct dirty_log *log) /* read the disk header */ r = read_header(lc); - if (r) + if (r) { + DMWARN(%s: Failed to read header on mirror log device, + lc-log_dev-name); + fail_log_device(lc); return r; + } /* set or clear any new bits -- device has grown */ if (lc-sync == NOSYNC) @@ -472,7 +487,14 @@ static int disk_resume(struct dirty_log *log) lc-header.nr_regions = lc-region_count; /* write the new header */ - return write_header(lc); + r = write_header(lc); + if (r) { + DMWARN(%s: Failed to write header on mirror log device, + lc-log_dev-name); + fail_log_device(lc); + } + + return r; } static uint32_t core_get_region_size(struct dirty_log *log) @@ -516,7 +538,9 @@ static int disk_flush(struct dirty_log *log) return 0; r = write_header(lc); - if (!r) + if (r) + fail_log_device(lc); + else lc-touched = 0; return r; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm raid1: add handle_errors feature flag
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a8e6afa2363de7ee0dea1a3297f6236f421c2dd4 Commit: a8e6afa2363de7ee0dea1a3297f6236f421c2dd4 Parent: 315dcc226f066c1d3cef79283dcde807fe0e32d1 Author: Jonathan E Brassow [EMAIL PROTECTED] AuthorDate: Wed May 9 02:32:59 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm raid1: add handle_errors feature flag This patch adds the ability to specify desired features in the mirror constructor/mapping table. The first feature of interest is handle_errors. Currently, mirroring will ignore any I/O errors from the devices. Subsequent patches will check for this flag and handle the errors. If flag/feature is not present, mirror will do nothing - maintaining backwards compatibility. Signed-off-by: Jonathan E Brassow [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-raid1.c | 65 +++- 1 files changed, 63 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index cb3f318..2a3e2f8 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c @@ -22,6 +22,8 @@ #define DM_MSG_PREFIX raid1 +#define DM_RAID1_HANDLE_ERRORS 0x01 + static DECLARE_WAIT_QUEUE_HEAD(_kmirrord_recovery_stopped); /*- @@ -118,6 +120,7 @@ struct mirror_set { struct list_head list; struct region_hash rh; struct kcopyd_client *kcopyd_client; + uint64_t features; spinlock_t lock;/* protects the next two lists */ struct bio_list reads; @@ -1010,14 +1013,54 @@ static struct dirty_log *create_dirty_log(struct dm_target *ti, return dl; } +static int parse_features(struct mirror_set *ms, unsigned argc, char **argv, + unsigned *args_used) +{ + unsigned num_features; + struct dm_target *ti = ms-ti; + + *args_used = 0; + + if (!argc) + return 0; + + if (sscanf(argv[0], %u, num_features) != 1) { + ti-error = Invalid number of features; + return -EINVAL; + } + + argc--; + argv++; + (*args_used)++; + + if (num_features argc) { + ti-error = Not enough arguments to support feature count; + return -EINVAL; + } + + if (!strcmp(handle_errors, argv[0])) + ms-features |= DM_RAID1_HANDLE_ERRORS; + else { + ti-error = Unrecognised feature requested; + return -EINVAL; + } + + (*args_used)++; + + return 0; +} + /* * Construct a mirror mapping: * * log_type #log_params log_params * #mirrors [mirror_path offset]{2,} + * [#features features] * * log_type is core or disk * #log_params is between 1 and 3 + * + * If present, features must be handle_errors. */ #define DM_IO_PAGES 64 static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) @@ -1043,8 +1086,8 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) argv++, argc--; - if (argc != nr_mirrors * 2) { - ti-error = Wrong number of mirror arguments; + if (argc nr_mirrors * 2) { + ti-error = Too few mirror arguments; dm_destroy_dirty_log(dl); return -EINVAL; } @@ -1077,6 +1120,21 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) } INIT_WORK(ms-kmirrord_work, do_mirror); + r = parse_features(ms, argc, argv, args_used); + if (r) { + free_context(ms, ti, ms-nr_mirrors); + return r; + } + + argv += args_used; + argc -= args_used; + + if (argc) { + ti-error = Too many mirror arguments; + free_context(ms, ti, ms-nr_mirrors); + return -EINVAL; + } + r = kcopyd_client_create(DM_IO_PAGES, ms-kcopyd_client); if (r) { destroy_workqueue(ms-kmirrord_wq); @@ -1230,6 +1288,9 @@ static int mirror_status(struct dm_target *ti, status_type_t type, for (m = 0; m ms-nr_mirrors; m++) DMEMIT( %s %llu, ms-mirror[m].dev-name, (unsigned long long)ms-mirror[m].offset); + + if (ms-features DM_RAID1_HANDLE_ERRORS) + DMEMIT( 1 handle_errors); } return 0; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm kcopyd: update dm io interface
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=373a392bd76c4cc2cbbdab3906aee2ae4dc6702e Commit: 373a392bd76c4cc2cbbdab3906aee2ae4dc6702e Parent: c8b03afe3d38a635861e4bfa5c563d844e754a91 Author: Milan Broz [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:02 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm kcopyd: update dm io interface This patch ports kcopyd.c to the new, scalable dm_io() interface. Signed-off-by: Milan Broz [EMAIL PROTECTED] Signed-off-by: Heinz Mauelshagen [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/kcopyd.c | 28 ++-- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index b46f6c5..dbc234e 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2002 Sistina Software (UK) Limited. + * Copyright (C) 2006 Red Hat GmbH * * This file is released under the GPL. * @@ -45,6 +46,8 @@ struct kcopyd_client { unsigned int nr_pages; unsigned int nr_free_pages; + struct dm_io_client *io_client; + wait_queue_head_t destroyq; atomic_t nr_jobs; }; @@ -342,16 +345,20 @@ static void complete_io(unsigned long error, void *context) static int run_io_job(struct kcopyd_job *job) { int r; + struct dm_io_request io_req = { + .bi_rw = job-rw, + .mem.type = DM_IO_PAGE_LIST, + .mem.ptr.pl = job-pages, + .mem.offset = job-offset, + .notify.fn = complete_io, + .notify.context = job, + .client = job-kc-io_client, + }; if (job-rw == READ) - r = dm_io_async(1, job-source, job-rw, - job-pages, - job-offset, complete_io, job); - + r = dm_io(io_req, 1, job-source, NULL); else - r = dm_io_async(job-num_dests, job-dests, job-rw, - job-pages, - job-offset, complete_io, job); + r = dm_io(io_req, job-num_dests, job-dests, NULL); return r; } @@ -670,8 +677,9 @@ int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result) return r; } - r = dm_io_get(nr_pages); - if (r) { + kc-io_client = dm_io_client_create(nr_pages); + if (IS_ERR(kc-io_client)) { + r = PTR_ERR(kc-io_client); client_free_pages(kc); kfree(kc); kcopyd_exit(); @@ -691,7 +699,7 @@ void kcopyd_client_destroy(struct kcopyd_client *kc) /* Wait for completion of all jobs submitted by this client. */ wait_event(kc-destroyq, !atomic_read(kc-nr_jobs)); - dm_io_put(kc-nr_pages); + dm_io_client_destroy(kc-io_client); client_free_pages(kc); client_del(kc); kfree(kc); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm exception store: update dm io interface
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6cca1e7af543aa396b3e4919c251080741a49e69 Commit: 6cca1e7af543aa396b3e4919c251080741a49e69 Parent: 373a392bd76c4cc2cbbdab3906aee2ae4dc6702e Author: Heinz Mauelshagen [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:02 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm exception store: update dm io interface This patch ports dm-exception-store.c to the new, scalable dm_io() interface. It replaces dm_io_get()/dm_io_put() by dm_io_client_create()/dm_io_client_destroy() calls and dm_io_sync_vm() by dm_io() to achive this. Signed-off-by: Heinz Mauelshagen [EMAIL PROTECTED] Cc: Milan Broz [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-exception-store.c | 54 +-- 1 files changed, 29 insertions(+), 25 deletions(-) diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c index 99cdffa..07e0a0c 100644 --- a/drivers/md/dm-exception-store.c +++ b/drivers/md/dm-exception-store.c @@ -1,7 +1,8 @@ /* - * dm-snapshot.c + * dm-exception-store.c * * Copyright (C) 2001-2002 Sistina Software (UK) Limited. + * Copyright (C) 2006 Red Hat GmbH * * This file is released under the GPL. */ @@ -123,6 +124,7 @@ struct pstore { atomic_t pending_count; uint32_t callback_count; struct commit_callback *callbacks; + struct dm_io_client *io_client; }; static inline unsigned int sectors_to_pages(unsigned int sectors) @@ -159,14 +161,20 @@ static void free_area(struct pstore *ps) */ static int chunk_io(struct pstore *ps, uint32_t chunk, int rw) { - struct io_region where; - unsigned long bits; - - where.bdev = ps-snap-cow-bdev; - where.sector = ps-snap-chunk_size * chunk; - where.count = ps-snap-chunk_size; - - return dm_io_sync_vm(1, where, rw, ps-area, bits); + struct io_region where = { + .bdev = ps-snap-cow-bdev, + .sector = ps-snap-chunk_size * chunk, + .count = ps-snap-chunk_size, + }; + struct dm_io_request io_req = { + .bi_rw = rw, + .mem.type = DM_IO_VMA, + .mem.ptr.vma = ps-area, + .client = ps-io_client, + .notify.fn = NULL, + }; + + return dm_io(io_req, 1, where, NULL); } /* @@ -213,17 +221,18 @@ static int read_header(struct pstore *ps, int *new_snapshot) chunk_size_supplied = 0; } - r = dm_io_get(sectors_to_pages(ps-snap-chunk_size)); - if (r) - return r; + ps-io_client = dm_io_client_create(sectors_to_pages(ps-snap- +chunk_size)); + if (IS_ERR(ps-io_client)) + return PTR_ERR(ps-io_client); r = alloc_area(ps); if (r) - goto bad1; + return r; r = chunk_io(ps, 0, READ); if (r) - goto bad2; + goto bad; dh = (struct disk_header *) ps-area; @@ -235,7 +244,7 @@ static int read_header(struct pstore *ps, int *new_snapshot) if (le32_to_cpu(dh-magic) != SNAP_MAGIC) { DMWARN(Invalid or corrupt snapshot); r = -ENXIO; - goto bad2; + goto bad; } *new_snapshot = 0; @@ -252,27 +261,22 @@ static int read_header(struct pstore *ps, int *new_snapshot) (unsigned long long)ps-snap-chunk_size); /* We had a bogus chunk_size. Fix stuff up. */ - dm_io_put(sectors_to_pages(ps-snap-chunk_size)); free_area(ps); ps-snap-chunk_size = chunk_size; ps-snap-chunk_mask = chunk_size - 1; ps-snap-chunk_shift = ffs(chunk_size) - 1; - r = dm_io_get(sectors_to_pages(chunk_size)); + r = dm_io_client_resize(sectors_to_pages(ps-snap-chunk_size), + ps-io_client); if (r) return r; r = alloc_area(ps); - if (r) - goto bad1; - - return 0; + return r; -bad2: +bad: free_area(ps); -bad1: - dm_io_put(sectors_to_pages(ps-snap-chunk_size)); return r; } @@ -405,7 +409,7 @@ static void persistent_destroy(struct exception_store *store) { struct pstore *ps = get_info(store); - dm_io_put(sectors_to_pages(ps-snap-chunk_size)); + dm_io_client_destroy(ps-io_client); vfree(ps-callbacks); free_area(ps); kfree(ps); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm log: update dm io interface
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5d234d1e03d0a4cef4da32177be6657b45cc513f Commit: 5d234d1e03d0a4cef4da32177be6657b45cc513f Parent: 6cca1e7af543aa396b3e4919c251080741a49e69 Author: Heinz Mauelshagen [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:03 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm log: update dm io interface This patch ports dm-log.c to the new dm-io interface in order to make it scalable to have a large number of persistent dirty logs active in parallel. Signed-off-by: Heinz Mauelshagen [EMAIL PROTECTED] Cc: Milan Broz [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-log.c | 31 --- 1 files changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index 8d30140..a60acf8 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c @@ -149,6 +149,8 @@ struct log_c { FORCESYNC, /* Force a sync to happen */ } sync; + struct dm_io_request io_req; + /* * Disk log fields */ @@ -200,13 +202,20 @@ static void header_from_disk(struct log_header *core, struct log_header *disk) core-nr_regions = le64_to_cpu(disk-nr_regions); } +static int rw_header(struct log_c *lc, int rw) +{ + lc-io_req.bi_rw = rw; + lc-io_req.mem.ptr.vma = lc-disk_header; + lc-io_req.notify.fn = NULL; + + return dm_io(lc-io_req, 1, lc-header_location, NULL); +} + static int read_header(struct log_c *log) { int r; - unsigned long ebits; - r = dm_io_sync_vm(1, log-header_location, READ, - log-disk_header, ebits); + r = rw_header(log, READ); if (r) return r; @@ -234,11 +243,8 @@ static int read_header(struct log_c *log) static inline int write_header(struct log_c *log) { - unsigned long ebits; - header_to_disk(log-header, log-disk_header); - return dm_io_sync_vm(1, log-header_location, WRITE, -log-disk_header, ebits); + return rw_header(log, WRITE); } /* @@ -257,6 +263,7 @@ static int create_log_context(struct dirty_log *log, struct dm_target *ti, uint32_t region_size; unsigned int region_count; size_t bitset_size, buf_size; + int r; if (argc 1 || argc 2) { DMWARN(wrong number of arguments to mirror log); @@ -326,6 +333,15 @@ static int create_log_context(struct dirty_log *log, struct dm_target *ti, buf_size = dm_round_up((LOG_OFFSET SECTOR_SHIFT) + bitset_size, ti-limits.hardsect_size); lc-header_location.count = buf_size SECTOR_SHIFT; + lc-io_req.mem.type = DM_IO_VMA; + lc-io_req.client = dm_io_client_create(dm_div_up(buf_size, + PAGE_SIZE)); + if (IS_ERR(lc-io_req.client)) { + r = PTR_ERR(lc-io_req.client); + DMWARN(couldn't allocate disk io client); + kfree(lc); + return -ENOMEM; + } lc-disk_header = vmalloc(buf_size); if (!lc-disk_header) { @@ -426,6 +442,7 @@ static void disk_dtr(struct dirty_log *log) dm_put_device(lc-ti, lc-log_dev); vfree(lc-disk_header); + dm_io_client_destroy(lc-io_req.client); destroy_log_context(lc); } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm raid1: update dm io interface
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=88be163abb5324bab09f5eff9646590eec5314eb Commit: 88be163abb5324bab09f5eff9646590eec5314eb Parent: 5d234d1e03d0a4cef4da32177be6657b45cc513f Author: Milan Broz [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:04 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm raid1: update dm io interface This patch ports dm-raid1.c to the new dm-io interface. Signed-off-by: Milan Broz [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-raid1.c | 25 + 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 2a3e2f8..bde9046 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c @@ -21,6 +21,7 @@ #include linux/workqueue.h #define DM_MSG_PREFIX raid1 +#define DM_IO_PAGES 64 #define DM_RAID1_HANDLE_ERRORS 0x01 @@ -126,6 +127,8 @@ struct mirror_set { struct bio_list reads; struct bio_list writes; + struct dm_io_client *io_client; + /* recovery */ region_t nr_regions; int in_sync; @@ -796,6 +799,14 @@ static void do_write(struct mirror_set *ms, struct bio *bio) unsigned int i; struct io_region io[KCOPYD_MAX_REGIONS+1]; struct mirror *m; + struct dm_io_request io_req = { + .bi_rw = WRITE, + .mem.type = DM_IO_BVEC, + .mem.ptr.bvec = bio-bi_io_vec + bio-bi_idx, + .notify.fn = write_callback, + .notify.context = bio, + .client = ms-io_client, + }; for (i = 0; i ms-nr_mirrors; i++) { m = ms-mirror + i; @@ -806,9 +817,8 @@ static void do_write(struct mirror_set *ms, struct bio *bio) } bio_set_ms(bio, ms); - dm_io_async_bvec(ms-nr_mirrors, io, WRITE, -bio-bi_io_vec + bio-bi_idx, -write_callback, bio); + + (void) dm_io(io_req, ms-nr_mirrors, io, NULL); } static void do_writes(struct mirror_set *ms, struct bio_list *writes) @@ -924,6 +934,13 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors, ms-in_sync = 0; ms-default_mirror = ms-mirror[DEFAULT_MIRROR]; + ms-io_client = dm_io_client_create(DM_IO_PAGES); + if (IS_ERR(ms-io_client)) { + ti-error = Error creating dm_io client; + kfree(ms); + return NULL; + } + if (rh_init(ms-rh, ms, dl, region_size, ms-nr_regions)) { ti-error = Error creating dirty region hash; kfree(ms); @@ -939,6 +956,7 @@ static void free_context(struct mirror_set *ms, struct dm_target *ti, while (m--) dm_put_device(ti, ms-mirror[m].dev); + dm_io_client_destroy(ms-io_client); rh_exit(ms-rh); kfree(ms); } @@ -1062,7 +1080,6 @@ static int parse_features(struct mirror_set *ms, unsigned argc, char **argv, * * If present, features must be handle_errors. */ -#define DM_IO_PAGES 64 static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) { int r; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm io: remove old interface
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bf17ce3a604d943f29bf1bc1a66a4e0d2ad4ec96 Commit: bf17ce3a604d943f29bf1bc1a66a4e0d2ad4ec96 Parent: 88be163abb5324bab09f5eff9646590eec5314eb Author: Milan Broz [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:05 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm io: remove old interface Remove old dm-io interface. Signed-off-by: Milan Broz [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-io.c | 131 ++-- drivers/md/dm-io.h | 51 +--- 2 files changed, 7 insertions(+), 175 deletions(-) diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 0c63809..352c6fb 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c @@ -13,8 +13,6 @@ #include linux/sched.h #include linux/slab.h -static struct bio_set *_bios; - struct dm_io_client { mempool_t *pool; struct bio_set *bios; @@ -35,74 +33,12 @@ struct io { * io. Since async io is likely to be the majority of io we'll * have the same number of io contexts as bios! (FIXME: must reduce this). */ -static unsigned _num_ios; -static mempool_t *_io_pool; - -/* - * Temporary functions to allow old and new interfaces to co-exist. - */ -static struct bio_set *bios(struct dm_io_client *client) -{ - return client ? client-bios : _bios; -} - -static mempool_t *io_pool(struct dm_io_client *client) -{ - return client ? client-pool : _io_pool; -} static unsigned int pages_to_ios(unsigned int pages) { return 4 * pages; /* too many ? */ } -static int resize_pool(unsigned int new_ios) -{ - int r = 0; - - if (_io_pool) { - if (new_ios == 0) { - /* free off the pool */ - mempool_destroy(_io_pool); - _io_pool = NULL; - bioset_free(_bios); - - } else { - /* resize the pool */ - r = mempool_resize(_io_pool, new_ios, GFP_KERNEL); - } - - } else { - /* create new pool */ - _io_pool = mempool_create_kmalloc_pool(new_ios, - sizeof(struct io)); - if (!_io_pool) - return -ENOMEM; - - _bios = bioset_create(16, 16); - if (!_bios) { - mempool_destroy(_io_pool); - _io_pool = NULL; - return -ENOMEM; - } - } - - if (!r) - _num_ios = new_ios; - - return r; -} - -int dm_io_get(unsigned int num_pages) -{ - return resize_pool(_num_ios + pages_to_ios(num_pages)); -} - -void dm_io_put(unsigned int num_pages) -{ - resize_pool(_num_ios - pages_to_ios(num_pages)); -} - /* * Create a client with mempool and bioset. */ @@ -182,7 +118,7 @@ static void dec_count(struct io *io, unsigned int region, int error) io_notify_fn fn = io-callback; void *context = io-context; - mempool_free(io, io_pool(io-client)); + mempool_free(io, io-client-pool); fn(r, context); } } @@ -310,7 +246,7 @@ static void dm_bio_destructor(struct bio *bio) { struct io *io = bio-bi_private; - bio_free(bio, bios(io-client)); + bio_free(bio, io-client-bios); } /* @@ -358,7 +294,7 @@ static void do_region(int rw, unsigned int region, struct io_region *where, * to hide it from bio_add_page(). */ num_bvecs = (remaining / (PAGE_SIZE SECTOR_SHIFT)) + 2; - bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, bios(io-client)); + bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, io-client-bios); bio-bi_sector = where-sector + (where-count - remaining); bio-bi_bdev = where-bdev; bio-bi_end_io = endio; @@ -462,7 +398,7 @@ static int async_io(struct dm_io_client *client, unsigned int num_regions, return -EIO; } - io = mempool_alloc(io_pool(client), GFP_NOIO); + io = mempool_alloc(client-pool, GFP_NOIO); io-error = 0; atomic_set(io-count, 1); /* see dispatch_io() */ io-sleeper = NULL; @@ -474,56 +410,6 @@ static int async_io(struct dm_io_client *client, unsigned int num_regions, return 0; } -int dm_io_sync(unsigned int num_regions, struct io_region *where, int rw, - struct page_list *pl, unsigned int offset, - unsigned long *error_bits) -{ - struct dpages dp; -
dm: bio list helpers
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0ba699347e96b5468b42b3decf1f381abbf99652 Commit: 0ba699347e96b5468b42b3decf1f381abbf99652 Parent: bf17ce3a604d943f29bf1bc1a66a4e0d2ad4ec96 Author: Heinz Mauelshagen [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:05 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm: bio list helpers More bio_list helper functions for new targets (including dm-delay and dm-loop) to manipulate lists of bios. Signed-off-by: Heinz Mauelshagen [EMAIL PROTECTED] Signed-off-by: Bryn Reeves [EMAIL PROTECTED] Signed-off-by: Milan Broz [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-bio-list.h | 26 ++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/drivers/md/dm-bio-list.h b/drivers/md/dm-bio-list.h index da43496..c6be888 100644 --- a/drivers/md/dm-bio-list.h +++ b/drivers/md/dm-bio-list.h @@ -8,17 +8,43 @@ #define DM_BIO_LIST_H #include linux/bio.h +#include linux/prefetch.h struct bio_list { struct bio *head; struct bio *tail; }; +static inline int bio_list_empty(const struct bio_list *bl) +{ + return bl-head == NULL; +} + +#define BIO_LIST_INIT { .head = NULL, .tail = NULL } + +#define BIO_LIST(bl) \ + struct bio_list bl = BIO_LIST_INIT + static inline void bio_list_init(struct bio_list *bl) { bl-head = bl-tail = NULL; } +#define bio_list_for_each(bio, bl) \ + for (bio = (bl)-head; bio ({ prefetch(bio-bi_next); 1; }); \ +bio = bio-bi_next) + +static inline unsigned bio_list_size(const struct bio_list *bl) +{ + unsigned sz = 0; + struct bio *bio; + + bio_list_for_each(bio, bl) + sz++; + + return sz; +} + static inline void bio_list_add(struct bio_list *bl, struct bio *bio) { bio-bi_next = NULL; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm: delay target
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=26b9f228703f0518a90e7513d6fe7b6abeed5138 Commit: 26b9f228703f0518a90e7513d6fe7b6abeed5138 Parent: 0ba699347e96b5468b42b3decf1f381abbf99652 Author: Heinz Mauelshagen [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:06 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:47 2007 -0700 dm: delay target New device-mapper target that can delay I/O (for testing). Reads can be separated from writes, redirected to different underlying devices and delayed by differing amounts of time. Signed-off-by: Heinz Mauelshagen [EMAIL PROTECTED] Signed-off-by: Milan Broz [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- Documentation/device-mapper/delay.txt | 26 +++ drivers/md/Kconfig|9 + drivers/md/Makefile |1 + drivers/md/dm-delay.c | 383 + 4 files changed, 419 insertions(+), 0 deletions(-) diff --git a/Documentation/device-mapper/delay.txt b/Documentation/device-mapper/delay.txt new file mode 100644 index 000..15adc55 --- /dev/null +++ b/Documentation/device-mapper/delay.txt @@ -0,0 +1,26 @@ +dm-delay + + +Device-Mapper's delay target delays reads and/or writes +and maps them to different devices. + +Parameters: +device offset delay [write_device write_offset write_delay] + +With separate write parameters, the first set is only used for reads. +Delays are specified in milliseconds. + +Example scripts +=== +[[ +#!/bin/sh +# Create device delaying rw operation for 500ms +echo 0 `blockdev --getsize $1` delay $1 0 500 | dmsetup create delayed +]] + +[[ +#!/bin/sh +# Create device delaying only write operation for 500ms and +# splitting reads and writes to different devices $1 $2 +echo 0 `blockdev --getsize $1` delay $1 0 0 $2 0 500 | dmsetup create delayed +]] diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index 4540ade..7df934d 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig @@ -262,6 +262,15 @@ config DM_MULTIPATH_EMC ---help--- Multipath support for EMC CX/AX series hardware. +config DM_DELAY + tristate I/O delaying target (EXPERIMENTAL) + depends on BLK_DEV_DM EXPERIMENTAL + ---help--- + A target that delays reads and/or writes and can send + them to different devices. Useful for testing. + + If unsure, say N. + endmenu endif diff --git a/drivers/md/Makefile b/drivers/md/Makefile index 34957a6..3875408 100644 --- a/drivers/md/Makefile +++ b/drivers/md/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o obj-$(CONFIG_BLK_DEV_MD) += md-mod.o obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o obj-$(CONFIG_DM_CRYPT) += dm-crypt.o +obj-$(CONFIG_DM_DELAY) += dm-delay.o obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c new file mode 100644 index 000..52c7cf9 --- /dev/null +++ b/drivers/md/dm-delay.c @@ -0,0 +1,383 @@ +/* + * Copyright (C) 2005-2007 Red Hat GmbH + * + * A target that delays reads and/or writes and can send + * them to different devices. + * + * This file is released under the GPL. + */ + +#include linux/module.h +#include linux/init.h +#include linux/blkdev.h +#include linux/bio.h +#include linux/slab.h + +#include dm.h +#include dm-bio-list.h + +#define DM_MSG_PREFIX delay + +struct delay_c { + struct timer_list delay_timer; + struct semaphore timer_lock; + struct work_struct flush_expired_bios; + struct list_head delayed_bios; + atomic_t may_delay; + mempool_t *delayed_pool; + + struct dm_dev *dev_read; + sector_t start_read; + unsigned read_delay; + unsigned reads; + + struct dm_dev *dev_write; + sector_t start_write; + unsigned write_delay; + unsigned writes; +}; + +struct delay_info { + struct delay_c *context; + struct list_head list; + struct bio *bio; + unsigned long expires; +}; + +static DEFINE_MUTEX(delayed_bios_lock); + +static struct workqueue_struct *kdelayd_wq; +static struct kmem_cache *delayed_cache; + +static void handle_delayed_timer(unsigned long data) +{ + struct delay_c *dc = (struct delay_c *)data; + + queue_work(kdelayd_wq, dc-flush_expired_bios); +} + +static void queue_timeout(struct delay_c *dc, unsigned long expires) +{ + down(dc-timer_lock); + + if (!timer_pending(dc-delay_timer) || expires dc-delay_timer.expires) + mod_timer(dc-delay_timer, expires); + + up(dc-timer_lock); +} + +static void flush_bios(struct bio *bio) +{ +
dm raid1: fix to commit pending clear region requests
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f5353cd7c9cd10cdf9d62a5487f3db77b7b68105 Commit: f5353cd7c9cd10cdf9d62a5487f3db77b7b68105 Parent: 26b9f228703f0518a90e7513d6fe7b6abeed5138 Author: Jonathan Brassow [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:07 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 dm raid1: fix to commit pending clear region requests With the code as it is, it is possible for oustanding clear region requests never to get flushed when a mirror is deactivated or suspended. This means there will always be some resync work required when a mirror is activated, even though it may very well be in-sync. Always requesting the flush doesn't hurt us. This is because the log tracks whether any changes occurred and, if not, no flush is performed. Signed-off-by: Jonathan Brassow [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-raid1.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index bde9046..85d254e 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c @@ -405,8 +405,7 @@ static void rh_update_states(struct region_hash *rh) mempool_free(reg, rh-region_pool); } - if (!list_empty(recovered)) - rh-log-type-flush(rh-log); + rh-log-type-flush(rh-log); list_for_each_entry_safe (reg, next, clean, list) mempool_free(reg, rh-region_pool); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm raid1: switch rh_in_sync to blocking in do_reads
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b997b82d266c9fb910fc2ad95b9bb93b3bccf9be Commit: b997b82d266c9fb910fc2ad95b9bb93b3bccf9be Parent: f5353cd7c9cd10cdf9d62a5487f3db77b7b68105 Author: Jonathan Brassow [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:08 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 dm raid1: switch rh_in_sync to blocking in do_reads The call to rh_in_sync() in do_reads() should be allowed to block. It is in the mirror worker thread which already permits blocking operations. This will be needed to support clustered mirroring which will perform network operations. Signed-off-by: Jonathan Brassow [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-raid1.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 85d254e..ef124b7 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c @@ -741,7 +741,7 @@ static void do_reads(struct mirror_set *ms, struct bio_list *reads) /* * We can only read balance if the region is in sync. */ - if (rh_in_sync(ms-rh, region, 0)) + if (rh_in_sync(ms-rh, region, 1)) m = choose_mirror(ms, bio-bi_sector); else m = ms-default_mirror; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
dm log: fix resume failed log device
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ba8b45cea5f632540d561d37d94c71c07f6af1aa Commit: ba8b45cea5f632540d561d37d94c71c07f6af1aa Parent: b997b82d266c9fb910fc2ad95b9bb93b3bccf9be Author: Jonathan Brassow [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:08 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 dm log: fix resume failed log device This patch removes the possibility of having uninitialized log state if the log device has failed. When a mirror resumes operation, it calls 'resume' on the logging module. If disk based logging is being used, the log device is read to fill in the log state. If the log device has failed, we cannot simply return, because this would leave the in-memory log state uninitialized. Instead, we assume all regions are out-of-sync and reset the log state. Failure to do this could result in the logging code reporting a region as in-sync, even though it isn't; which could result in a corrupted mirror. Signed-off-by: Jonathan Brassow [EMAIL PROTECTED] Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/md/dm-log.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index a60acf8..a66428d 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c @@ -478,7 +478,14 @@ static int disk_resume(struct dirty_log *log) DMWARN(%s: Failed to read header on mirror log device, lc-log_dev-name); fail_log_device(lc); - return r; + /* +* If the log device cannot be read, we must assume +* all regions are out-of-sync. If we simply return +* here, the state will be uninitialized and could +* lead us to return 'in-sync' status for regions +* that are actually 'out-of-sync'. +*/ + lc-header.nr_regions = 0; } /* set or clear any new bits -- device has grown */ - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
fix leaky resv_huge_pages when cpuset is in use
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ace4bd29c248b51db3f8a97e9b59740dc6caa074 Commit: ace4bd29c248b51db3f8a97e9b59740dc6caa074 Parent: ba8b45cea5f632540d561d37d94c71c07f6af1aa Author: Ken Chen [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:09 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 fix leaky resv_huge_pages when cpuset is in use The internal hugetlb resv_huge_pages variable can permanently leak nonzero value in the error path of hugetlb page fault handler when hugetlb page is used in combination of cpuset. The leaked count can permanently trap N number of hugetlb pages in unusable reserved state. Steps to reproduce the bug: (1) create two cpuset, user1 and user2 (2) reserve 50 htlb pages in cpuset user1 (3) attempt to shmget/shmat 50 htlb page inside cpuset user2 (4) kernel oom the user process in step 3 (5) ipcrm the shm segment At this point resv_huge_pages will have a count of 49, even though there are no active hugetlbfs file nor hugetlb shared memory segment in the system. The leak is permanent and there is no recovery method other than system reboot. The leaked count will hold up all future use of that many htlb pages in all cpusets. The culprit is that the error path of alloc_huge_page() did not properly undo the change it made to resv_huge_page, causing inconsistent state. Signed-off-by: Ken Chen [EMAIL PROTECTED] Cc: David Gibson [EMAIL PROTECTED] Cc: Adam Litke [EMAIL PROTECTED] Cc: Martin Bligh [EMAIL PROTECTED] Acked-by: David Gibson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/hugetlb.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 36db012..88e708b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -140,6 +140,8 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, return page; fail: + if (vma-vm_flags VM_MAYSHARE) + resv_huge_pages++; spin_unlock(hugetlb_lock); return NULL; } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
swsusp: clean up printk
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d60846c4d16f9518b098b905af2b87cb6bf6dc42 Commit: d60846c4d16f9518b098b905af2b87cb6bf6dc42 Parent: ace4bd29c248b51db3f8a97e9b59740dc6caa074 Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:17 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 swsusp: clean up printk Remove an inexplicable / Cc: Rafael J. Wysocki [EMAIL PROTECTED] Cc: Pavel Machek [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/power/snapshot.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index b703977..48383ea 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1227,7 +1227,7 @@ asmlinkage int swsusp_save(void) nr_copy_pages = nr_pages; nr_meta_pages = DIV_ROUND_UP(nr_pages * sizeof(long), PAGE_SIZE); - printk(swsusp: critical section/: done (%d pages copied)\n, nr_pages); + printk(swsusp: critical section: done (%d pages copied)\n, nr_pages); return 0; } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
PM: Separate hibernation code from suspend code
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a3d25c275d383975504dc53c25b691df59bd3c48 Commit: a3d25c275d383975504dc53c25b691df59bd3c48 Parent: d60846c4d16f9518b098b905af2b87cb6bf6dc42 Author: Rafael J. Wysocki [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:18 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 PM: Separate hibernation code from suspend code [ With Johannes Berg [EMAIL PROTECTED] ] Separate the hibernation (aka suspend to disk code) from the other suspend code. In particular: * Remove the definitions related to hibernation from include/linux/pm.h * Introduce struct hibernation_ops and a new hibernate() function to hibernate the system, defined in include/linux/suspend.h * Separate suspend code in kernel/power/main.c from hibernation-related code in kernel/power/disk.c and kernel/power/user.c (with the help of hibernation_ops) * Switch ACPI (the only user of pm_ops.pm_disk_mode) to hibernation_ops Signed-off-by: Rafael J. Wysocki [EMAIL PROTECTED] Cc: Greg KH [EMAIL PROTECTED] Cc: Pavel Machek [EMAIL PROTECTED] Cc: Nigel Cunningham [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- Documentation/power/userland-swsusp.txt | 26 +++-- drivers/acpi/sleep/main.c | 67 +--- drivers/acpi/sleep/proc.c |2 +- drivers/i2c/chips/tps65010.c|2 +- include/linux/pm.h | 31 +- include/linux/suspend.h | 24 kernel/power/disk.c | 195 +-- kernel/power/main.c | 42 +++ kernel/power/power.h|7 +- kernel/power/user.c | 13 +- kernel/sys.c|2 +- 11 files changed, 226 insertions(+), 185 deletions(-) diff --git a/Documentation/power/userland-swsusp.txt b/Documentation/power/userland-swsusp.txt index 000556c..e00c6cf 100644 --- a/Documentation/power/userland-swsusp.txt +++ b/Documentation/power/userland-swsusp.txt @@ -93,21 +93,23 @@ SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to to resume the system from RAM if there's enough battery power or restore its state on the basis of the saved suspend image otherwise) -SNAPSHOT_PMOPS - enable the usage of the pmops-prepare, pmops-enter and - pmops-finish methods (the in-kernel swsusp knows these as the platform - method) which are needed on many machines to (among others) speed up - the resume by letting the BIOS skip some steps or to let the system - recognise the correct state of the hardware after the resume (in - particular on many machines this ensures that unplugged AC - adapters get correctly detected and that kacpid does not run wild after - the resume). The last ioctl() argument can take one of the three - values, defined in kernel/power/power.h: +SNAPSHOT_PMOPS - enable the usage of the hibernation_ops-prepare, + hibernate_ops-enter and hibernation_ops-finish methods (the in-kernel + swsusp knows these as the platform method) which are needed on many + machines to (among others) speed up the resume by letting the BIOS skip + some steps or to let the system recognise the correct state of the + hardware after the resume (in particular on many machines this ensures + that unplugged AC adapters get correctly detected and that kacpid does + not run wild after the resume). The last ioctl() argument can take one + of the three values, defined in kernel/power/power.h: PMOPS_PREPARE - make the kernel carry out the - pm_ops-prepare(PM_SUSPEND_DISK) operation + hibernation_ops-prepare() operation PMOPS_ENTER - make the kernel power off the system by calling - pm_ops-enter(PM_SUSPEND_DISK) + hibernation_ops-enter() PMOPS_FINISH - make the kernel carry out the - pm_ops-finish(PM_SUSPEND_DISK) operation + hibernation_ops-finish() operation + Note that the actual constants are misnamed because they surface + internal kernel implementation details that have changed. The device's read() operation can be used to transfer the snapshot image from the kernel. It has the following limitations: diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index f8c6341..52b2347 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c @@ -29,7 +29,6 @@ static u32 acpi_suspend_states[] = { [PM_SUSPEND_ON] = ACPI_STATE_S0, [PM_SUSPEND_STANDBY] = ACPI_STATE_S1, [PM_SUSPEND_MEM] = ACPI_STATE_S3, - [PM_SUSPEND_DISK] = ACPI_STATE_S4,
uml: fix build breakage
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1e0cb0c3bf04850fa6fb300293d9e85ba81b605f Commit: 1e0cb0c3bf04850fa6fb300293d9e85ba81b605f Parent: a3d25c275d383975504dc53c25b691df59bd3c48 Author: Jeff Dike [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:19 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 uml: fix build breakage UML now needs required-features.h to build - an empty one suffices. Signed-off-by: Jeff Dike [EMAIL PROTECTED] Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/asm-um/required-features.h |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/include/asm-um/required-features.h b/include/asm-um/required-features.h new file mode 100644 index 000..dfb967b --- /dev/null +++ b/include/asm-um/required-features.h @@ -0,0 +1,9 @@ +#ifndef __UM_REQUIRED_FEATURES_H +#define __UM_REQUIRED_FEATURES_H + +/* + * Nothing to see, just need something for the i386 and x86_64 asm + * headers to include. + */ + +#endif - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
uml: turn on SCSI support
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0ff563830209d2f5ea2ece071f7ea71aff934544 Commit: 0ff563830209d2f5ea2ece071f7ea71aff934544 Parent: 1e0cb0c3bf04850fa6fb300293d9e85ba81b605f Author: Peter Zijlstra [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:20 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 uml: turn on SCSI support Enable (i)SCSI on UML, dunno why SCSI was deemed broken, it works like a charm. Signed-off-by: Peter Zijlstra [EMAIL PROTECTED] Signed-off-by: Jeff Dike [EMAIL PROTECTED] Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- arch/um/Kconfig | 16 +- arch/um/Kconfig.scsi | 58 -- 2 files changed, 1 insertions(+), 73 deletions(-) diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 354cc6b..b9c0f30 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig @@ -320,21 +320,7 @@ source crypto/Kconfig source lib/Kconfig -menu SCSI support -depends on BROKEN - -config SCSI - tristate SCSI support - -# This gives us free_dma, which scsi.c wants. -config GENERIC_ISA_DMA - bool - depends on SCSI - default y - -source arch/um/Kconfig.scsi - -endmenu +source drivers/scsi/Kconfig source drivers/md/Kconfig diff --git a/arch/um/Kconfig.scsi b/arch/um/Kconfig.scsi deleted file mode 100644 index c291c94..000 --- a/arch/um/Kconfig.scsi +++ /dev/null @@ -1,58 +0,0 @@ -comment SCSI support type (disk, tape, CD-ROM) - depends on SCSI - -config BLK_DEV_SD - tristate SCSI disk support - depends on SCSI - -config SD_EXTRA_DEVS - int Maximum number of SCSI disks that can be loaded as modules - depends on BLK_DEV_SD - default 40 - -config CHR_DEV_ST - tristate SCSI tape support - depends on SCSI - -config BLK_DEV_SR - tristate SCSI CD-ROM support - depends on SCSI - -config BLK_DEV_SR_VENDOR - bool Enable vendor-specific extensions (for SCSI CDROM) - depends on BLK_DEV_SR - -config SR_EXTRA_DEVS - int Maximum number of CDROM devices that can be loaded as modules - depends on BLK_DEV_SR - default 2 - -config CHR_DEV_SG - tristate SCSI generic support - depends on SCSI - -comment Some SCSI devices (e.g. CD jukebox) support multiple LUNs - depends on SCSI - -#if [ $CONFIG_EXPERIMENTAL = y ]; then -config SCSI_DEBUG_QUEUES - bool Enable extra checks in new queueing code - depends on SCSI - -#fi -config SCSI_MULTI_LUN - bool Probe all LUNs on each SCSI device - depends on SCSI - -config SCSI_CONSTANTS - bool Verbose SCSI error reporting (kernel size +=12K) - depends on SCSI - -config SCSI_LOGGING - bool SCSI logging facility - depends on SCSI - -config SCSI_DEBUG - tristate SCSI debugging host simulator (EXPERIMENTAL) - depends on SCSI - - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
uml: mark a tt-only function
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=231f7e9d029a710c14352bff3b8d3753cb9bfde8 Commit: 231f7e9d029a710c14352bff3b8d3753cb9bfde8 Parent: 0ff563830209d2f5ea2ece071f7ea71aff934544 Author: Jeff Dike [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:21 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 uml: mark a tt-only function Mark another function as tt-mode only. Signed-off-by: Jeff Dike [EMAIL PROTECTED] Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- arch/um/os-Linux/process.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index 92a7b59..2d9d2ca 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c @@ -239,6 +239,7 @@ out: return ok; } +#ifdef UML_CONFIG_MODE_TT void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)) { int flags = 0, pages; @@ -260,6 +261,7 @@ void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)) errno = %d\n, errno); } } +#endif void init_new_thread_signals(void) { - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Fix Linuxdoc comment
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cb0c78cc94a63871cad051674516b38e4a8aef95 Commit: cb0c78cc94a63871cad051674516b38e4a8aef95 Parent: 231f7e9d029a710c14352bff3b8d3753cb9bfde8 Author: Jeff Dike [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:22 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 Fix Linuxdoc comment A linuxdoc comment had fallen out of date - it refers to an argument which no longer exists. Signed-off-by: Jeff Dike [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/irq/handle.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 32e1ab1..e391cbb 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c @@ -22,7 +22,6 @@ * handle_bad_irq - handle spurious and unhandled irqs * @irq: the interrupt number * @desc: description of the interrupt - * @regs: pointer to a register structure * * Handles spurious and unhandled IRQ's. It also prints a debugmessage. */ - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
uml: turn build warnings into comments
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e7d18b57c39bedcbd181e3c06d13572b33e5380 Commit: 0e7d18b57c39bedcbd181e3c06d13572b33e5380 Parent: cb0c78cc94a63871cad051674516b38e4a8aef95 Author: Miklos Szeredi [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:22 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 uml: turn build warnings into comments These haven't been fixed for ages. Just make comments out of them. arch/um/kernel/skas/process.c:181:2: warning: #warning Need to look up +userspace_pid by cpu arch/um/kernel/skas/process.c:187:2: warning: #warning Need to look up +userspace_pid by cpu arch/um/kernel/skas/process.c:194:2: warning: #warning need to loop over +userspace_pids in kill_off_processes_skas Signed-off-by: Miklos Szeredi [EMAIL PROTECTED] Signed-off-by: Jeff Dike [EMAIL PROTECTED] Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- arch/um/kernel/skas/process.c |9 ++--- arch/um/os-Linux/skas/mem.c |2 +- arch/um/os-Linux/skas/process.c |2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index ef36fac..a96ae1a 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c @@ -178,20 +178,23 @@ int start_uml_skas(void) int external_pid_skas(struct task_struct *task) { -#warning Need to look up userspace_pid by cpu + /* FIXME: Need to look up userspace_pid by cpu */ return(userspace_pid[0]); } int thread_pid_skas(struct task_struct *task) { -#warning Need to look up userspace_pid by cpu + /* FIXME: Need to look up userspace_pid by cpu */ return(userspace_pid[0]); } void kill_off_processes_skas(void) { if(proc_mm) -#warning need to loop over userspace_pids in kill_off_processes_skas + /* +* FIXME: need to loop over userspace_pids in +* kill_off_processes_skas +*/ os_kill_ptraced_process(userspace_pid[0], 1); else { struct task_struct *p; diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index 8e490ff..5c89463 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c @@ -68,7 +68,7 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) int err, pid = mm_idp-u.pid; if(proc_mm) -#warning Need to look up userspace_pid by cpu + /* FIXME: Need to look up userspace_pid by cpu */ pid = userspace_pid[0]; multi_count++; diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 5c088a5..6a0e466 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c @@ -586,7 +586,7 @@ void switch_mm_skas(struct mm_id *mm_idp) { int err; -#warning need cpu pid in switch_mm_skas + /* FIXME: need cpu pid in switch_mm_skas */ if(proc_mm){ err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, mm_idp-u.mm_fd); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Display all possible partitions when the root filesystem failed to mount
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd2a345f8f002845636dbf5d2d768bb5cd8a5f59 Commit: dd2a345f8f002845636dbf5d2d768bb5cd8a5f59 Parent: 0e7d18b57c39bedcbd181e3c06d13572b33e5380 Author: Dave Gilbert [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:24 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 Display all possible partitions when the root filesystem failed to mount Display all possible partitions when the root filesystem is not mounted. This helps to track spell'o's and missing drivers. Updated to work with newer kernels. Example output: VFS: Cannot open root device foobar or unknown-block(0,0) Please append a correct root= boot option; here are the available partitions: 08008388608 sda driver: sd 0801 192748 sda1 08028193150 sda2 08104194304 sdb driver: sd Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) [EMAIL PROTECTED]: cleanups, fix printk warnings] Signed-off-by: Jan Engelhardt [EMAIL PROTECTED] Cc: Dave Gilbert [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- block/genhd.c | 53 + include/linux/genhd.h |1 + init/do_mounts.c |7 +- 3 files changed, 60 insertions(+), 1 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index b566444..93a2cf6 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -213,6 +213,59 @@ struct gendisk *get_gendisk(dev_t dev, int *part) return kobj ? to_disk(kobj) : NULL; } +/* + * print a full list of all partitions - intended for places where the root + * filesystem can't be mounted and thus to give the victim some idea of what + * went wrong + */ +void __init printk_all_partitions(void) +{ + int n; + struct gendisk *sgp; + + mutex_lock(block_subsys_lock); + /* For each block device... */ + list_for_each_entry(sgp, block_subsys.list, kobj.entry) { + char buf[BDEVNAME_SIZE]; + /* +* Don't show empty devices or things that have been surpressed +*/ + if (get_capacity(sgp) == 0 || + (sgp-flags GENHD_FL_SUPPRESS_PARTITION_INFO)) + continue; + + /* +* Note, unlike /proc/partitions, I am showing the numbers in +* hex - the same format as the root= option takes. +*/ + printk(%02x%02x %10llu %s, + sgp-major, sgp-first_minor, + (unsigned long long)get_capacity(sgp) 1, + disk_name(sgp, 0, buf)); + if (sgp-driverfs_dev != NULL + sgp-driverfs_dev-driver != NULL) + printk( driver: %s\n, + sgp-driverfs_dev-driver-name); + else + printk( (driver?)\n); + + /* now show the partitions */ + for (n = 0; n sgp-minors - 1; ++n) { + if (sgp-part[n] == NULL) + continue; + if (sgp-part[n]-nr_sects == 0) + continue; + printk( %02x%02x %10llu %s\n, + sgp-major, n + 1 + sgp-first_minor, + (unsigned long long)sgp-part[n]-nr_sects 1, + disk_name(sgp, n + 1, buf)); + } /* partition subloop */ + } /* Block device loop */ + + mutex_unlock(block_subsys_lock); + return; +} + #ifdef CONFIG_PROC_FS /* iterator */ static void *part_start(struct seq_file *part, loff_t *pos) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 2c65da7..f589559 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -413,6 +413,7 @@ char *disk_name (struct gendisk *hd, int part, char *buf); extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); extern void add_partition(struct gendisk *, int, sector_t, sector_t, int); extern void delete_partition(struct gendisk *, int); +extern void printk_all_partitions(void); extern struct gendisk *alloc_disk_node(int minors, int node_id); extern struct gendisk *alloc_disk(int minors); diff --git a/init/do_mounts.c b/init/do_mounts.c index 3f57ed4..46fe407 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -7,6 +7,7 @@ #include linux/root_dev.h #include linux/security.h #include linux/delay.h +#include linux/genhd.h #include linux/mount.h #include linux/device.h #include linux/init.h @@ -308,17 +309,21 @@ retry: /* * Allow the user to distinguish between failed sys_open * and bad superblock on
Remove hardcoding of hard_smp_processor_id on UP systems
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2f4dfe206a2fc07099dfad77a8ea2f4b4ae2140f Commit: 2f4dfe206a2fc07099dfad77a8ea2f4b4ae2140f Parent: dd2a345f8f002845636dbf5d2d768bb5cd8a5f59 Author: Fernando Luis Vazquez Cao [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:25 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 Remove hardcoding of hard_smp_processor_id on UP systems With the advent of kdump, the assumption that the boot CPU when booting an UP kernel is always the CPU with a particular hardware ID (often 0) (usually referred to as BSP on some architectures) is not valid anymore. The reason being that the dump capture kernel boots on the crashed CPU (the CPU that invoked crash_kexec), which may be or may not be that particular CPU. Move definition of hard_smp_processor_id for the UP case to architecture-specific code (asm/smp.h) where it belongs, so that each architecture can provide its own implementation. Signed-off-by: Fernando Luis Vazquez Cao [EMAIL PROTECTED] Cc: Luck, Tony [EMAIL PROTECTED] Acked-by: Andi Kleen [EMAIL PROTECTED] Cc: Eric W. Biederman [EMAIL PROTECTED] Cc: Vivek Goyal [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- arch/sparc64/kernel/traps.c |1 + include/asm-alpha/smp.h |1 + include/asm-i386/smp.h |3 ++- include/asm-ia64/smp.h |3 ++- include/asm-m32r/smp.h |6 +- include/asm-powerpc/smp.h |1 + include/asm-s390/smp.h |1 + include/asm-sparc/smp.h |1 + include/asm-sparc64/smp.h |1 + include/asm-um/smp.h|4 include/asm-x86_64/smp.h|4 +++- include/linux/smp.h |1 - 12 files changed, 22 insertions(+), 5 deletions(-) diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index dc652f2..d0fde36 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c @@ -19,6 +19,7 @@ #include linux/init.h #include linux/kdebug.h +#include asm/smp.h #include asm/delay.h #include asm/system.h #include asm/ptrace.h diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h index a1a1eca..286e1d8 100644 --- a/include/asm-alpha/smp.h +++ b/include/asm-alpha/smp.h @@ -51,6 +51,7 @@ int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, in #else /* CONFIG_SMP */ +#define hard_smp_processor_id()0 #define smp_call_function_on_cpu(func,info,retry,wait,cpu)({ 0; }) #endif /* CONFIG_SMP */ diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index 090abc1..3243fa6 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h @@ -147,12 +147,13 @@ extern unsigned int num_processors; #else /* CONFIG_SMP */ +#define hard_smp_processor_id()0 #define safe_smp_processor_id()0 #define cpu_physical_id(cpu) boot_cpu_physical_apicid #define NO_PROC_ID 0xFF/* No processor magic marker */ -#endif +#endif /* CONFIG_SMP */ #ifndef __ASSEMBLY__ diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h index 60fd4ae..62014b6 100644 --- a/include/asm-ia64/smp.h +++ b/include/asm-ia64/smp.h @@ -128,8 +128,9 @@ extern void unlock_ipi_calllock(void); extern void identify_siblings (struct cpuinfo_ia64 *); extern int is_multithreading_enabled(void); -#else +#else /* CONFIG_SMP */ +#define hard_smp_processor_id()0 #define cpu_logical_id(i) 0 #define cpu_physical_id(i) ia64_get_lid() diff --git a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h index abd937a..078e1a5 100644 --- a/include/asm-m32r/smp.h +++ b/include/asm-m32r/smp.h @@ -108,6 +108,10 @@ extern unsigned long send_IPI_mask_phys(cpumask_t, int, int); #define IPI_SHIFT (0) #define NR_IPIS(8) -#endif /* CONFIG_SMP */ +#else /* CONFIG_SMP */ + +#define hard_smp_processor_id()0 + +#endif /* CONFIG_SMP */ #endif /* _ASM_M32R_SMP_H */ diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h index 01717f2..d037f50 100644 --- a/include/asm-powerpc/smp.h +++ b/include/asm-powerpc/smp.h @@ -83,6 +83,7 @@ extern void __cpu_die(unsigned int cpu); #else /* for UP */ +#define hard_smp_processor_id()0 #define smp_setup_cpu_maps() #endif /* CONFIG_SMP */ diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index 0a28e6d..76e424f 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h @@ -110,6 +110,7 @@ static inline void smp_send_stop(void) __load_psw_mask(psw_kernel_bits ~PSW_MASK_MCHECK); } +#define hard_smp_processor_id()0 #define smp_cpu_not_running(cpu) 1 #define smp_setup_cpu_possible_map() do { } while (0) #endif diff --git
Use the APIC to determine the hardware processor id - i386
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a36166c6ef45081fea6eeaf5ca785d7ed786b6e2 Commit: a36166c6ef45081fea6eeaf5ca785d7ed786b6e2 Parent: 2f4dfe206a2fc07099dfad77a8ea2f4b4ae2140f Author: Fernando Luis Vazquez Cao [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:27 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 Use the APIC to determine the hardware processor id - i386 hard_smp_processor_id used to be just a macro that hard-coded hard_smp_processor_id to 0 in the non SMP case. When booting non SMP kernels on hardware where the boot ioapic id is not 0 this turns out to be a problem. This is happens frequently in the case of kdump and once in a great while in the case of real hardware. Use the APIC to determine the hardware processor id in both UP and SMP kernels to fix this issue. Notice that hard_smp_processor_id is only used by SMP code or by code that works with apics so we do not need to handle the case when apics are not present and hard_smp_processor_id should never be called there. Signed-off-by: Fernando Luis Vazquez Cao [EMAIL PROTECTED] Cc: Luck, Tony [EMAIL PROTECTED] Acked-by: Andi Kleen [EMAIL PROTECTED] Cc: Eric W. Biederman [EMAIL PROTECTED] Cc: Vivek Goyal [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- arch/i386/mach-generic/probe.c |2 -- include/asm-i386/smp.h | 36 +--- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/i386/mach-generic/probe.c b/arch/i386/mach-generic/probe.c index a7b3999..74f3da6 100644 --- a/arch/i386/mach-generic/probe.c +++ b/arch/i386/mach-generic/probe.c @@ -119,9 +119,7 @@ int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) return 0; } -#ifdef CONFIG_SMP int hard_smp_processor_id(void) { return genapic-get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID)); } -#endif diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index 3243fa6..0c71327 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h @@ -124,20 +124,6 @@ static inline int num_booting_cpus(void) return cpus_weight(cpu_callout_map); } -#ifdef CONFIG_X86_LOCAL_APIC - -#ifdef APIC_DEFINITION -extern int hard_smp_processor_id(void); -#else -#include mach_apicdef.h -static inline int hard_smp_processor_id(void) -{ - /* we don't want to mark this access volatile - bad code generation */ - return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); -} -#endif -#endif - extern int safe_smp_processor_id(void); extern int __cpu_disable(void); extern void __cpu_die(unsigned int cpu); @@ -147,7 +133,6 @@ extern unsigned int num_processors; #else /* CONFIG_SMP */ -#define hard_smp_processor_id()0 #define safe_smp_processor_id()0 #define cpu_physical_id(cpu) boot_cpu_physical_apicid @@ -157,6 +142,27 @@ extern unsigned int num_processors; #ifndef __ASSEMBLY__ +#ifdef CONFIG_X86_LOCAL_APIC + +#ifdef APIC_DEFINITION +extern int hard_smp_processor_id(void); +#else +#include mach_apicdef.h +static inline int hard_smp_processor_id(void) +{ + /* we don't want to mark this access volatile - bad code generation */ + return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); +} +#endif /* APIC_DEFINITION */ + +#else /* CONFIG_X86_LOCAL_APIC */ + +#ifndef CONFIG_SMP +#define hard_smp_processor_id()0 +#endif + +#endif /* CONFIG_X86_LOCAL_APIC */ + extern u8 apicid_2_node[]; #ifdef CONFIG_X86_LOCAL_APIC - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Use the APIC to determine the hardware processor id - x86_64
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd988528f4a7d64908b427c251d727f3c3e88add Commit: dd988528f4a7d64908b427c251d727f3c3e88add Parent: a36166c6ef45081fea6eeaf5ca785d7ed786b6e2 Author: Fernando Luis Vazquez Cao [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:28 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:48 2007 -0700 Use the APIC to determine the hardware processor id - x86_64 hard_smp_processor_id used to be just a macro that hard-coded hard_smp_processor_id to 0 in the non SMP case. When booting non SMP kernels on hardware where the boot ioapic id is not 0 this turns out to be a problem. This is happens frequently in the case of kdump and once in a great while in the case of real hardware. Use the APIC to determine the hardware processor id in both UP and SMP kernels to fix this issue. Notice that hard_smp_processor_id is only used by SMP code or by code that works with apics so we do not need to handle the case when apics are not present and hard_smp_processor_id should never be called there. Signed-off-by: Fernando Luis Vazquez Cao [EMAIL PROTECTED] Cc: Luck, Tony [EMAIL PROTECTED] Acked-by: Andi Kleen [EMAIL PROTECTED] Cc: Eric W. Biederman [EMAIL PROTECTED] Cc: Vivek Goyal [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/asm-x86_64/smp.h | 14 ++ 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index f62fda5..3f303d2 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h @@ -57,12 +57,6 @@ static inline int num_booting_cpus(void) #define raw_smp_processor_id() read_pda(cpunumber) -static inline int hard_smp_processor_id(void) -{ - /* we don't want to mark this access volatile - bad code generation */ - return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); -} - extern int __cpu_disable(void); extern void __cpu_die(unsigned int cpu); extern void prefill_possible_map(void); @@ -71,10 +65,14 @@ extern unsigned __cpuinitdata disabled_cpus; #define NO_PROC_ID 0xFF/* No processor magic marker */ -#else /* CONFIG_SMP */ -#define hard_smp_processor_id() 0 #endif /* CONFIG_SMP */ +static inline int hard_smp_processor_id(void) +{ + /* we don't want to mark this access volatile - bad code generation */ + return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); +} + /* * Some lowlevel functions might want to know about * the real APIC ID - CPU # mapping. - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Always ask the hardware to obtain hardware processor id - ia64
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=818563dceccf695a71f8bd683a249e7bb09e3240 Commit: 818563dceccf695a71f8bd683a249e7bb09e3240 Parent: dd988528f4a7d64908b427c251d727f3c3e88add Author: Fernando Luis Vazquez Cao [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:28 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 Always ask the hardware to obtain hardware processor id - ia64 Always ask the hardware to determine the hardware processor id in both UP and SMP kernels. Signed-off-by: Fernando Luis Vazquez Cao [EMAIL PROTECTED] Cc: Luck, Tony [EMAIL PROTECTED] Cc: Andi Kleen [EMAIL PROTECTED] Cc: Eric W. Biederman [EMAIL PROTECTED] Cc: Vivek Goyal [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/asm-ia64/smp.h |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h index 62014b6..c600249 100644 --- a/include/asm-ia64/smp.h +++ b/include/asm-ia64/smp.h @@ -38,6 +38,8 @@ ia64_get_lid (void) return lid.f.id 8 | lid.f.eid; } +#define hard_smp_processor_id()ia64_get_lid() + #ifdef CONFIG_SMP #define XTP_OFFSET 0x1e0008 @@ -110,8 +112,6 @@ max_xtp (void) writeb(0x0f, ipi_base_addr + XTP_OFFSET); /* Set XTP to max */ } -#define hard_smp_processor_id()ia64_get_lid() - /* Upping and downing of CPUs */ extern int __cpu_disable (void); extern void __cpu_die (unsigned int cpu); @@ -130,7 +130,6 @@ extern int is_multithreading_enabled(void); #else /* CONFIG_SMP */ -#define hard_smp_processor_id()0 #define cpu_logical_id(i) 0 #define cpu_physical_id(i) ia64_get_lid() - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
mca: fix bus matching
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=809aa5048fb7e7fd3bf0aa1fb169c42db0f63b08 Commit: 809aa5048fb7e7fd3bf0aa1fb169c42db0f63b08 Parent: 818563dceccf695a71f8bd683a249e7bb09e3240 Author: James Bottomley [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:29 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 mca: fix bus matching There's a bug in the MCA bus matching algorithm in that it promotes from signed short to int before comparing with the actual id and does sign extension on anything 0x7fff (which means that pos ids 0x7fff never get correctly matched). Signed-off-by: James Bottomley [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/mca/mca-bus.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c index da862e4..a70fe00 100644 --- a/drivers/mca/mca-bus.c +++ b/drivers/mca/mca-bus.c @@ -47,7 +47,7 @@ static int mca_bus_match (struct device *dev, struct device_driver *drv) { struct mca_device *mca_dev = to_mca_device (dev); struct mca_driver *mca_drv = to_mca_driver (drv); - const short *mca_ids = mca_drv-id_table; + const unsigned short *mca_ids = mca_drv-id_table; int i; if (!mca_ids) - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
mca: add integrated device bus matching
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8813d1c00ca923c1683da625ff85959be1db9a49 Commit: 8813d1c00ca923c1683da625ff85959be1db9a49 Parent: 809aa5048fb7e7fd3bf0aa1fb169c42db0f63b08 Author: James Bottomley [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:30 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 mca: add integrated device bus matching The MCA bus has a few integrated functions, which are effectively virtual slots on the bus. The problem is that these special functions don't have dedicated pos IDs, so we have to manufacture ids for them outside the pos space ... and these ids can't be matched by the standard matching function, so add a special registration that requests a list of pos ids or a particular integrated function. Signed-off-by: James Bottomley [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/mca/mca-bus.c| 26 -- drivers/mca/mca-driver.c | 13 + include/linux/mca.h |2 ++ 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c index a70fe00..67b8e94 100644 --- a/drivers/mca/mca-bus.c +++ b/drivers/mca/mca-bus.c @@ -48,18 +48,24 @@ static int mca_bus_match (struct device *dev, struct device_driver *drv) struct mca_device *mca_dev = to_mca_device (dev); struct mca_driver *mca_drv = to_mca_driver (drv); const unsigned short *mca_ids = mca_drv-id_table; - int i; - - if (!mca_ids) - return 0; - - for(i = 0; mca_ids[i]; i++) { - if (mca_ids[i] == mca_dev-pos_id) { - mca_dev-index = i; - return 1; + int i = 0; + + if (mca_ids) { + for(i = 0; mca_ids[i]; i++) { + if (mca_ids[i] == mca_dev-pos_id) { + mca_dev-index = i; + return 1; + } } } - + /* If the integrated id is present, treat it as though it were an +* additional id in the id_table (it can't be because by definition, +* integrated id's overflow a short */ + if (mca_drv-integrated_id mca_dev-pos_id == + mca_drv-integrated_id) { + mca_dev-index = i; + return 1; + } return 0; } diff --git a/drivers/mca/mca-driver.c b/drivers/mca/mca-driver.c index 2223466..32cd39b 100644 --- a/drivers/mca/mca-driver.c +++ b/drivers/mca/mca-driver.c @@ -36,12 +36,25 @@ int mca_register_driver(struct mca_driver *mca_drv) mca_drv-driver.bus = mca_bus_type; if ((r = driver_register(mca_drv-driver)) 0) return r; + mca_drv-integrated_id = 0; } return 0; } EXPORT_SYMBOL(mca_register_driver); +int mca_register_driver_integrated(struct mca_driver *mca_driver, + int integrated_id) +{ + int r = mca_register_driver(mca_driver); + + if (!r) + mca_driver-integrated_id = integrated_id; + + return r; +} +EXPORT_SYMBOL(mca_register_driver_integrated); + void mca_unregister_driver(struct mca_driver *mca_drv) { if (MCA_bus) diff --git a/include/linux/mca.h b/include/linux/mca.h index 5cff292..3797270 100644 --- a/include/linux/mca.h +++ b/include/linux/mca.h @@ -94,6 +94,7 @@ struct mca_bus { struct mca_driver { const short *id_table; void*driver_data; + int integrated_id; struct device_driverdriver; }; #define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver) @@ -125,6 +126,7 @@ extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev); extern struct bus_type mca_bus_type; extern int mca_register_driver(struct mca_driver *drv); +extern int mca_register_driver_integrated(struct mca_driver *, int); extern void mca_unregister_driver(struct mca_driver *drv); /* WARNING: only called by the boot time device setup */ - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
cm4000_cs: fix error paths
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=54493c10069741a02cd34c2b44a6bfdb85e7de6a Commit: 54493c10069741a02cd34c2b44a6bfdb85e7de6a Parent: 8813d1c00ca923c1683da625ff85959be1db9a49 Author: Akinobu Mita [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:31 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 cm4000_cs: fix error paths This patch fixes error paths in module_init and probe functions in cm4000_cs and cm4040_cs drivers. Cc: Harald Welte [EMAIL PROTECTED] Signed-off-by: Akinobu Mita [EMAIL PROTECTED] Cc: Dominik Brodowski [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/char/pcmcia/cm4000_cs.c |9 +++-- drivers/char/pcmcia/cm4040_cs.c |7 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index e91b43a..8cbc64f 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1881,8 +1881,11 @@ static int cm4000_probe(struct pcmcia_device *link) init_waitqueue_head(dev-readq); ret = cm4000_config(link, i); - if (ret) + if (ret) { + dev_table[i] = NULL; + kfree(dev); return ret; + } class_device_create(cmm_class, NULL, MKDEV(major, i), NULL, cmm%d, i); @@ -1907,7 +1910,7 @@ static void cm4000_detach(struct pcmcia_device *link) cm4000_release(link); dev_table[devno] = NULL; - kfree(dev); + kfree(dev); class_device_destroy(cmm_class, MKDEV(major, devno)); @@ -1956,12 +1959,14 @@ static int __init cmm_init(void) if (major 0) { printk(KERN_WARNING MODULE_NAME : could not get major number\n); + class_destroy(cmm_class); return major; } rc = pcmcia_register_driver(cm4000_driver); if (rc 0) { unregister_chrdev(major, DEVICE_NAME); + class_destroy(cmm_class); return rc; } diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index f2e4ec4..af88181 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -636,8 +636,11 @@ static int reader_probe(struct pcmcia_device *link) setup_timer(dev-poll_timer, cm4040_do_poll, 0); ret = reader_config(link, i); - if (ret) + if (ret) { + dev_table[i] = NULL; + kfree(dev); return ret; + } class_device_create(cmx_class, NULL, MKDEV(major, i), NULL, cmx%d, i); @@ -708,12 +711,14 @@ static int __init cm4040_init(void) if (major 0) { printk(KERN_WARNING MODULE_NAME : could not get major number\n); + class_destroy(cmx_class); return major; } rc = pcmcia_register_driver(reader_driver); if (rc 0) { unregister_chrdev(major, DEVICE_NAME); + class_destroy(cmx_class); return rc; } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
cm4000_cs: use bitrev
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=884c3d751093446918c2f7a4b2c745f28cf91c39 Commit: 884c3d751093446918c2f7a4b2c745f28cf91c39 Parent: 54493c10069741a02cd34c2b44a6bfdb85e7de6a Author: Akinobu Mita [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:32 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 cm4000_cs: use bitrev Cleanup using bitrev8 in cm4000_cs driver. Cc: Harald Welte [EMAIL PROTECTED] Signed-off-by: Akinobu Mita [EMAIL PROTECTED] Cc: Dominik Brodowski [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/char/pcmcia/Kconfig |1 + drivers/char/pcmcia/cm4000_cs.c | 35 ++- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/drivers/char/pcmcia/Kconfig b/drivers/char/pcmcia/Kconfig index 27c1179..f25facd 100644 --- a/drivers/char/pcmcia/Kconfig +++ b/drivers/char/pcmcia/Kconfig @@ -21,6 +21,7 @@ config SYNCLINK_CS config CARDMAN_4000 tristate Omnikey Cardman 4000 support depends on PCMCIA + select BITREVERSE help Enable support for the Omnikey Cardman 4000 PCMCIA Smartcard reader. diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 8cbc64f..561d0e1 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -31,6 +31,7 @@ #include linux/init.h #include linux/fs.h #include linux/delay.h +#include linux/bitrev.h #include asm/uaccess.h #include asm/io.h @@ -194,41 +195,17 @@ static inline unsigned char xinb(unsigned short port) } #endif -#defineb_ 15 -#defineb_0001 14 -#defineb_0010 13 -#defineb_0011 12 -#defineb_0100 11 -#defineb_0101 10 -#defineb_0110 9 -#defineb_0111 8 -#defineb_1000 7 -#defineb_1001 6 -#defineb_1010 5 -#defineb_1011 4 -#defineb_1100 3 -#defineb_1101 2 -#defineb_1110 1 -#defineb_ 0 - -static unsigned char irtab[16] = { - b_, b_1000, b_0100, b_1100, - b_0010, b_1010, b_0110, b_1110, - b_0001, b_1001, b_0101, b_1101, - b_0011, b_1011, b_0111, b_ -}; +static inline unsigned char invert_revert(unsigned char ch) +{ + return bitrev8(~ch); +} static void str_invert_revert(unsigned char *b, int len) { int i; for (i = 0; i len; i++) - b[i] = (irtab[b[i] 0x0f] 4) | irtab[b[i] 4]; -} - -static unsigned char invert_revert(unsigned char ch) -{ - return (irtab[ch 0x0f] 4) | irtab[ch 4]; + b[i] = invert_revert(b[i]); } #defineATRLENCK(dev,pos) \ - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
use simple_read_from_buffer() in fs/
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=92f4c701aad794de9e4cf7341d0a486aed027c46 Commit: 92f4c701aad794de9e4cf7341d0a486aed027c46 Parent: 884c3d751093446918c2f7a4b2c745f28cf91c39 Author: Akinobu Mita [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:32 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 use simple_read_from_buffer() in fs/ Cleanup using simple_read_from_buffer() in binfmt_misc, configfs, and sysfs. Cc: Greg Kroah-Hartman [EMAIL PROTECTED] Cc: Joel Becker [EMAIL PROTECTED] Signed-off-by: Akinobu Mita [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/binfmt_misc.c | 13 + fs/configfs/file.c | 33 ++--- fs/sysfs/file.c| 33 ++--- 3 files changed, 5 insertions(+), 74 deletions(-) diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 18657f0..72d0b41 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -675,19 +675,8 @@ static ssize_t bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { char *s = enabled ? enabled : disabled; - int len = strlen(s); - loff_t pos = *ppos; - if (pos 0) - return -EINVAL; - if (pos = len) - return 0; - if (len pos + nbytes) - nbytes = len - pos; - if (copy_to_user(buf, s + pos, nbytes)) - return -EFAULT; - *ppos = pos + nbytes; - return nbytes; + return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s)); } static ssize_t bm_status_write(struct file * file, const char __user * buffer, diff --git a/fs/configfs/file.c b/fs/configfs/file.c index d98be5e..3527c7c 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c @@ -77,36 +77,6 @@ static int fill_read_buffer(struct dentry * dentry, struct configfs_buffer * buf return ret; } - -/** - * flush_read_buffer - push buffer to userspace. - * @buffer:data buffer for file. - * @userbuf: user-passed buffer. - * @count: number of bytes requested. - * @ppos: file position. - * - * Copy the buffer we filled in fill_read_buffer() to userspace. - * This is done at the reader's leisure, copying and advancing - * the amount they specify each time. - * This may be called continuously until the buffer is empty. - */ -static int flush_read_buffer(struct configfs_buffer * buffer, char __user * buf, -size_t count, loff_t * ppos) -{ - int error; - - if (*ppos buffer-count) - return 0; - - if (count (buffer-count - *ppos)) - count = buffer-count - *ppos; - - error = copy_to_user(buf,buffer-page + *ppos,count); - if (!error) - *ppos += count; - return error ? -EFAULT : count; -} - /** * configfs_read_file - read an attribute. * @file: file pointer. @@ -139,7 +109,8 @@ configfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *pp } pr_debug(%s: count = %zd, ppos = %lld, buf = %s\n, __FUNCTION__, count, *ppos, buffer-page); - retval = flush_read_buffer(buffer,buf,count,ppos); + retval = simple_read_from_buffer(buf, count, ppos, buffer-page, +buffer-count); out: up(buffer-sem); return retval; diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 0e637ad..b502c71 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -111,36 +111,6 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer return ret; } - -/** - * flush_read_buffer - push buffer to userspace. - * @buffer:data buffer for file. - * @buf: user-passed buffer. - * @count: number of bytes requested. - * @ppos: file position. - * - * Copy the buffer we filled in fill_read_buffer() to userspace. - * This is done at the reader's leisure, copying and advancing - * the amount they specify each time. - * This may be called continuously until the buffer is empty. - */ -static int flush_read_buffer(struct sysfs_buffer * buffer, char __user * buf, -size_t count, loff_t * ppos) -{ - int error; - - if (*ppos buffer-count) - return 0; - - if (count (buffer-count - *ppos)) - count = buffer-count - *ppos; - - error = copy_to_user(buf,buffer-page + *ppos,count); - if (!error) - *ppos += count; - return error ? -EFAULT : count; -} - /** * sysfs_read_file - read an attribute. * @file: file pointer. @@ -177,7 +147,8 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t
use simple_read_from_buffer in kernel/
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=85badbdf5120d246ce2bb3f1a7689a805f9c9006 Commit: 85badbdf5120d246ce2bb3f1a7689a805f9c9006 Parent: 92f4c701aad794de9e4cf7341d0a486aed027c46 Author: Akinobu Mita [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:33 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 use simple_read_from_buffer in kernel/ Cleanup using simple_read_from_buffer() for /dev/cpuset/tasks and /proc/config.gz. Cc: Paul Jackson [EMAIL PROTECTED] Cc: Randy Dunlap [EMAIL PROTECTED] Signed-off-by: Akinobu Mita [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/configs.c | 15 +++ kernel/cpuset.c |7 +-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/kernel/configs.c b/kernel/configs.c index 8fa1fb2..e84d3f9 100644 --- a/kernel/configs.c +++ b/kernel/configs.c @@ -61,18 +61,9 @@ static ssize_t ikconfig_read_current(struct file *file, char __user *buf, size_t len, loff_t * offset) { - loff_t pos = *offset; - ssize_t count; - - if (pos = kernel_config_data_size) - return 0; - - count = min(len, (size_t)(kernel_config_data_size - pos)); - if (copy_to_user(buf, kernel_config_data + MAGIC_SIZE + pos, count)) - return -EFAULT; - - *offset += count; - return count; + return simple_read_from_buffer(buf, len, offset, + kernel_config_data + MAGIC_SIZE, + kernel_config_data_size); } static const struct file_operations ikconfig_file_ops = { diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 88b416d..f57854b 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -1772,12 +1772,7 @@ static ssize_t cpuset_tasks_read(struct file *file, char __user *buf, { struct ctr_struct *ctr = file-private_data; - if (*ppos + nbytes ctr-bufsz) - nbytes = ctr-bufsz - *ppos; - if (copy_to_user(buf, ctr-buf + *ppos, nbytes)) - return -EFAULT; - *ppos += nbytes; - return nbytes; + return simple_read_from_buffer(buf, nbytes, ppos, ctr-buf, ctr-bufsz); } static int cpuset_tasks_release(struct inode *unused_inode, struct file *file) - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
pretend cpuset has some form of hugetlb page reservation
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8a63011275e1a0ec9389e8c7d9b08caab8957ca0 Commit: 8a63011275e1a0ec9389e8c7d9b08caab8957ca0 Parent: 85badbdf5120d246ce2bb3f1a7689a805f9c9006 Author: Ken Chen [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:34 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 pretend cpuset has some form of hugetlb page reservation When cpuset is configured, it breaks the strict hugetlb page reservation as the accounting is done on a global variable. Such reservation is completely rubbish in the presence of cpuset because the reservation is not checked against page availability for the current cpuset. Application can still potentially OOM'ed by kernel with lack of free htlb page in cpuset that the task is in. Attempt to enforce strict accounting with cpuset is almost impossible (or too ugly) because cpuset is too fluid that task or memory node can be dynamically moved between cpusets. The change of semantics for shared hugetlb mapping with cpuset is undesirable. However, in order to preserve some of the semantics, we fall back to check against current free page availability as a best attempt and hopefully to minimize the impact of changing semantics that cpuset has on hugetlb. Signed-off-by: Ken Chen [EMAIL PROTECTED] Cc: Paul Jackson [EMAIL PROTECTED] Cc: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/hugetlb.c | 31 +++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 88e708b..eb7180d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -174,6 +174,17 @@ static int __init hugetlb_setup(char *s) } __setup(hugepages=, hugetlb_setup); +static unsigned int cpuset_mems_nr(unsigned int *array) +{ + int node; + unsigned int nr = 0; + + for_each_node_mask(node, cpuset_current_mems_allowed) + nr += array[node]; + + return nr; +} + #ifdef CONFIG_SYSCTL static void update_and_free_page(struct page *page) { @@ -819,6 +830,26 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to) chg = region_chg(inode-i_mapping-private_list, from, to); if (chg 0) return chg; + /* +* When cpuset is configured, it breaks the strict hugetlb page +* reservation as the accounting is done on a global variable. Such +* reservation is completely rubbish in the presence of cpuset because +* the reservation is not checked against page availability for the +* current cpuset. Application can still potentially OOM'ed by kernel +* with lack of free htlb page in cpuset that the task is in. +* Attempt to enforce strict accounting with cpuset is almost +* impossible (or too ugly) because cpuset is too fluid that +* task or memory node can be dynamically moved between cpusets. +* +* The change of semantics for shared hugetlb mapping with cpuset is +* undesirable. However, in order to preserve some of the semantics, +* we fall back to check against current free page availability as +* a best attempt and hopefully to minimize the impact of changing +* semantics that cpuset has. +*/ + if (chg cpuset_mems_nr(free_huge_pages_node)) + return -ENOMEM; + ret = hugetlb_acct_memory(chg); if (ret 0) return ret; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Add info about whitespace to SubmitChecklist
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4d3556329926bde7c1e80cd6c650525326652ea4 Commit: 4d3556329926bde7c1e80cd6c650525326652ea4 Parent: 8a63011275e1a0ec9389e8c7d9b08caab8957ca0 Author: Roland Dreier [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:35 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 Add info about whitespace to SubmitChecklist Signed-off-by: Roland Dreier [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- Documentation/SubmitChecklist |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist index bd23dc0..6491b2c 100644 --- a/Documentation/SubmitChecklist +++ b/Documentation/SubmitChecklist @@ -80,3 +80,7 @@ kernel patches. 23: Tested after it has been merged into the -mm patchset to make sure that it still works with all of the other queued patches and various changes in the VM, VFS, and other subsystems. + +24: Avoid whitespace damage such as indenting with spaces or whitespace +at the end of lines. You can test this by feeding the patch to +git apply --check --whitespace=error-all - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
pasemi: hardware rng driver
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b8cb34481edfee6692c83d3b283e29820e840280 Commit: b8cb34481edfee6692c83d3b283e29820e840280 Parent: 4d3556329926bde7c1e80cd6c650525326652ea4 Author: Olof Johansson [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:35 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 pasemi: hardware rng driver Driver for the on-chip hardware random number generator on PA Semi PA6T-1682M. Signed-off-by: Egor Martovetsky [EMAIL PROTECTED] Signed-off-by: Olof Johansson [EMAIL PROTECTED] Signed-off-by: Michael Buesch [EMAIL PROTECTED] Cc: Paul Mackerras [EMAIL PROTECTED] Cc: Kumar Gala [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/char/hw_random/Kconfig | 14 +++ drivers/char/hw_random/Makefile |1 + drivers/char/hw_random/pasemi-rng.c | 156 +++ 3 files changed, 171 insertions(+), 0 deletions(-) diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 5f3acd8..7cda04b 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -91,3 +91,17 @@ config HW_RANDOM_OMAP module will be called omap-rng. If unsure, say Y. + +config HW_RANDOM_PASEMI + tristate PA Semi HW Random Number Generator support + depends on HW_RANDOM PPC_PASEMI + default HW_RANDOM + ---help--- + This driver provides kernel-side support for the Random Number + Generator hardware found on PA6T-1682M processor. + + To compile this driver as a module, choose M here: the + module will be called pasemi-rng. + + If unsure, say Y. + diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index c41fa19..c8b7300 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o +obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c new file mode 100644 index 000..fa6040b --- /dev/null +++ b/drivers/char/hw_random/pasemi-rng.c @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2006-2007 PA Semi, Inc + * + * Maintained by: Olof Johansson [EMAIL PROTECTED] + * + * Driver for the PWRficient onchip rng + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include linux/module.h +#include linux/kernel.h +#include linux/platform_device.h +#include linux/hw_random.h +#include asm/of_platform.h +#include asm/io.h + +#define SDCRNG_CTL_REG 0x00 +#define SDCRNG_CTL_FVLD_M0xf000 +#define SDCRNG_CTL_FVLD_S12 +#define SDCRNG_CTL_KSZ 0x0800 +#define SDCRNG_CTL_RSRC_CRG 0x0010 +#define SDCRNG_CTL_RSRC_RRG 0x +#define SDCRNG_CTL_CE0x0004 +#define SDCRNG_CTL_RE0x0002 +#define SDCRNG_CTL_DR0x0001 +#define SDCRNG_CTL_SELECT_RRG_RNG(SDCRNG_CTL_RE | SDCRNG_CTL_RSRC_RRG) +#define SDCRNG_CTL_SELECT_CRG_RNG(SDCRNG_CTL_CE | SDCRNG_CTL_RSRC_CRG) +#define SDCRNG_VAL_REG 0x20 + +#define MODULE_NAME pasemi_rng + +static int pasemi_rng_data_present(struct hwrng *rng) +{ + void __iomem *rng_regs = (void __iomem *)rng-priv; + + return (in_le32(rng_regs + SDCRNG_CTL_REG) +SDCRNG_CTL_FVLD_M) ? 1 : 0; +} + +static int pasemi_rng_data_read(struct hwrng *rng, u32 *data) +{ + void __iomem *rng_regs = (void __iomem *)rng-priv; + *data = in_le32(rng_regs + SDCRNG_VAL_REG); + return 4; +} + +static int pasemi_rng_init(struct hwrng *rng) +{ + void __iomem *rng_regs = (void __iomem *)rng-priv; + u32 ctl; + + ctl = SDCRNG_CTL_DR | SDCRNG_CTL_SELECT_RRG_RNG | SDCRNG_CTL_KSZ; + out_le32(rng_regs + SDCRNG_CTL_REG, ctl); + out_le32(rng_regs + SDCRNG_CTL_REG, ctl ~SDCRNG_CTL_DR); + + return 0; +} + +static void pasemi_rng_cleanup(struct hwrng *rng) +{ +
nbd: check the return value of sysfs_create_file
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=84963048ca8093e0aa71ac90c2a5fe7af5f617c3 Commit: 84963048ca8093e0aa71ac90c2a5fe7af5f617c3 Parent: b8cb34481edfee6692c83d3b283e29820e840280 Author: WANG Cong [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:36 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 nbd: check the return value of sysfs_create_file [EMAIL PROTECTED]: fix it] Signed-off-by: WANG Cong [EMAIL PROTECTED] Cc: Paul Clements [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/block/nbd.c | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 090796b..069ae39 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -366,20 +366,25 @@ static struct disk_attribute pid_attr = { .show = pid_show, }; -static void nbd_do_it(struct nbd_device *lo) +static int nbd_do_it(struct nbd_device *lo) { struct request *req; + int ret; BUG_ON(lo-magic != LO_MAGIC); lo-pid = current-pid; - sysfs_create_file(lo-disk-kobj, pid_attr.attr); + ret = sysfs_create_file(lo-disk-kobj, pid_attr.attr); + if (ret) { + printk(KERN_ERR nbd: sysfs_create_file failed!); + return ret; + } while ((req = nbd_read_stat(lo)) != NULL) nbd_end_request(req); sysfs_remove_file(lo-disk-kobj, pid_attr.attr); - return; + return 0; } static void nbd_clear_que(struct nbd_device *lo) @@ -569,7 +574,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file, case NBD_DO_IT: if (!lo-file) return -EINVAL; - nbd_do_it(lo); + error = nbd_do_it(lo); + if (error) + return error; /* on return tidy up in case we have a signal */ /* Forcibly shutdown the socket causing all listeners * to error - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
tty_set_ldisc() receive_room fix
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ae030e435f5400cff77c52506a8d3d7278f0947c Commit: ae030e435f5400cff77c52506a8d3d7278f0947c Parent: 55c0d1f83e481dd6c77f52f7dcfeb043b8b740fa Author: Paul Fulghum [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:38 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 tty_set_ldisc() receive_room fix Fix tty_set_ldisc in tty_io.c so that tty-receive_room is only cleared if actually changing line disciplines. Without this fix a problem occurs when requesting the line discipline to change to the same line discipline. In this case tty-receive_room is cleared but ldisc-open() is not called to set tty-receive_room back to a sane value. The result is that tty-receive_room is stuck at 0 preventing the tty flip buffer from passing receive data to the line discipline. For example: a switch from N_TTY to N_TTY followed by a select() call for read input results in data never being received because tty-receive_room is stuck at zero. A switch from N_TTY to N_TTY followed by a read() call works because the read() call itself sets tty-receive_room correctly (but select does not). Previously ( 2.6.18) this was not a problem because the tty flip buffer pushed data to the line discipline without regard for tty-receive room. Signed-off-by: Paul Fulghum [EMAIL PROTECTED] Acked-by: Alan Cox [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/char/tty_io.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 7710a6a..bf5a001 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -934,13 +934,6 @@ restart: return -EINVAL; /* -* No more input please, we are switching. The new ldisc -* will update this value in the ldisc open function -*/ - - tty-receive_room = 0; - - /* * Problem: What do we do if this blocks ? */ @@ -951,6 +944,13 @@ restart: return 0; } + /* +* No more input please, we are switching. The new ldisc +* will update this value in the ldisc open function +*/ + + tty-receive_room = 0; + o_ldisc = tty-ldisc; o_tty = tty-link; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
mutex_lock_interruptible(): add __must_check
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=18d8362d517cb2bd97761294924fe6c2a6ee5e3c Commit: 18d8362d517cb2bd97761294924fe6c2a6ee5e3c Parent: ae030e435f5400cff77c52506a8d3d7278f0947c Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:39 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 mutex_lock_interruptible(): add __must_check It's not sane to use mutex_lock_interruptible() and to then ignore the result. Ditto down_interruptible(), but I'm lazy. Cc: Ingo Molnar [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/linux/mutex.h |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mutex.h b/include/linux/mutex.h index b81bc2a..0d50ea3 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -121,11 +121,12 @@ static inline int fastcall mutex_is_locked(struct mutex *lock) * Also see Documentation/mutex-design.txt. */ extern void fastcall mutex_lock(struct mutex *lock); -extern int fastcall mutex_lock_interruptible(struct mutex *lock); +extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock); #ifdef CONFIG_DEBUG_LOCK_ALLOC extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); -extern int mutex_lock_interruptible_nested(struct mutex *lock, unsigned int subclass); +extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, + unsigned int subclass); #else # define mutex_lock_nested(lock, subclass) mutex_lock(lock) # define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
clocksource: spelling error in watchdog code
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=35c35d1afa8f9afe01d922ff9668a14c5d879b02 Commit: 35c35d1afa8f9afe01d922ff9668a14c5d879b02 Parent: 18d8362d517cb2bd97761294924fe6c2a6ee5e3c Author: Daniel Walker [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:40 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 clocksource: spelling error in watchdog code There's more that need fixing, and fix my own subject spelling error too. Signed-off-by: Daniel Walker [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/time/clocksource.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index fe5c7db..db0c725 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -75,14 +75,14 @@ static struct timer_list watchdog_timer; static DEFINE_SPINLOCK(watchdog_lock); static cycle_t watchdog_last; /* - * Interval: 0.5sec Treshold: 0.0625s + * Interval: 0.5sec Threshold: 0.0625s */ #define WATCHDOG_INTERVAL (HZ 1) -#define WATCHDOG_TRESHOLD (NSEC_PER_SEC 4) +#define WATCHDOG_THRESHOLD (NSEC_PER_SEC 4) static void clocksource_ratewd(struct clocksource *cs, int64_t delta) { - if (delta -WATCHDOG_TRESHOLD delta WATCHDOG_TRESHOLD) + if (delta -WATCHDOG_THRESHOLD delta WATCHDOG_THRESHOLD) return; printk(KERN_WARNING Clocksource %s unstable (delta = %Ld ns)\n, - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
fs: fix indentation in do_path_lookup
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=62ce39c531860aee6c12128c629b0a82f656a306 Commit: 62ce39c531860aee6c12128c629b0a82f656a306 Parent: 35c35d1afa8f9afe01d922ff9668a14c5d879b02 Author: Josef 'Jeff' Sipek [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:41 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:49 2007 -0700 fs: fix indentation in do_path_lookup Signed-off-by: Josef 'Jeff' Sipek [EMAIL PROTECTED] Acked-by: Christoph Hellwig [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/namei.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 856b2f5..19f178e 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1155,11 +1155,9 @@ static int fastcall do_path_lookup(int dfd, const char *name, current-total_link_count = 0; retval = link_path_walk(name, nd); out: - if (likely(retval == 0)) { - if (unlikely(!audit_dummy_context() nd nd-dentry + if (unlikely(!retval !audit_dummy_context() nd-dentry nd-dentry-d_inode)) audit_inode(name, nd-dentry-d_inode); - } out_fail: return retval; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
fs: use path_walk in do_path_lookup
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2dfdd266b9a2f2d93a3fdbee89969f6ea9ec5377 Commit: 2dfdd266b9a2f2d93a3fdbee89969f6ea9ec5377 Parent: 62ce39c531860aee6c12128c629b0a82f656a306 Author: Josef 'Jeff' Sipek [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:41 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:50 2007 -0700 fs: use path_walk in do_path_lookup Since path_walk sets the total_link_count to 0 and calls link_path_walk, we can just call path_walk directly. Signed-off-by: Josef 'Jeff' Sipek [EMAIL PROTECTED] Acked-by: Christoph Hellwig [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/namei.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 19f178e..b3780e3 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1152,8 +1152,8 @@ static int fastcall do_path_lookup(int dfd, const char *name, fput_light(file, fput_needed); } - current-total_link_count = 0; - retval = link_path_walk(name, nd); + + retval = path_walk(name, nd); out: if (unlikely(!retval !audit_dummy_context() nd-dentry nd-dentry-d_inode)) - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
kernel-doc: small kernel-doc optimization
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0366299bd2de283091f4394c0f446e58b5f94815 Commit: 0366299bd2de283091f4394c0f446e58b5f94815 Parent: 66effdc6a6a79c11f1c0d607d0de299108d69507 Author: Borislav Petkov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:43 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:50 2007 -0700 kernel-doc: small kernel-doc optimization Get the kernel version string only once from the environment, thus slightly speeding up kernel-doc. Signed-off-by: Borislav Petkov [EMAIL PROTECTED] Signed-off-by: Randy Dunlap [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- scripts/kernel-doc |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index a325a0c..e5bf649 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -337,6 +337,7 @@ sub get_kernel_version() { } return $version; } +my $kernelversion = get_kernel_version(); # generate a sequence of code that will splice in highlighting information # using the s// operator. @@ -610,7 +611,7 @@ sub output_function_xml(%) { print refmeta\n; print refentrytitlephrase.$args{'function'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; -print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; +print refmiscinfo class=\version\ . $kernelversion . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refname.$args{'function'}./refname\n; @@ -687,7 +688,7 @@ sub output_struct_xml(%) { print refmeta\n; print refentrytitlephrase.$args{'type'}. .$args{'struct'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; -print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; +print refmiscinfo class=\version\ . $kernelversion . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refname.$args{'type'}. .$args{'struct'}./refname\n; @@ -772,7 +773,7 @@ sub output_enum_xml(%) { print refmeta\n; print refentrytitlephraseenum .$args{'enum'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; -print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; +print refmiscinfo class=\version\ . $kernelversion . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refnameenum .$args{'enum'}./refname\n; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Fix printk format warnings in timer_list.c
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9b04bd27564cfd7224e0135ba37df778f1d490bf Commit: 9b04bd27564cfd7224e0135ba37df778f1d490bf Parent: 0366299bd2de283091f4394c0f446e58b5f94815 Author: David Miller [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:43 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:50 2007 -0700 Fix printk format warnings in timer_list.c u64 and s64 are not necessarily 'long long' on some 64-bit platforms, so explicit the type to kill the compiler warnings. Also consistently use '%Lu' which is unsigned. Signed-off-by: David S. Miller [EMAIL PROTECTED] Cc: Thomas Gleixner [EMAIL PROTECTED] Cc: Ingo Molnar [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/time/timer_list.c | 25 ++--- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index b734ca4..8bbcfb7 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c @@ -65,7 +65,7 @@ print_timer(struct seq_file *m, struct hrtimer *timer, int idx, u64 now) SEQ_printf(m, , %s/%d, tmp, timer-start_pid); #endif SEQ_printf(m, \n); - SEQ_printf(m, # expires at %Ld nsecs [in %Ld nsecs]\n, + SEQ_printf(m, # expires at %Lu nsecs [in %Lu nsecs]\n, (unsigned long long)ktime_to_ns(timer-expires), (unsigned long long)(ktime_to_ns(timer-expires) - now)); } @@ -111,14 +111,14 @@ print_base(struct seq_file *m, struct hrtimer_clock_base *base, u64 now) { SEQ_printf(m, .index: %d\n, base-index); - SEQ_printf(m, .resolution: %Ld nsecs\n, + SEQ_printf(m, .resolution: %Lu nsecs\n, (unsigned long long)ktime_to_ns(base-resolution)); SEQ_printf(m, .get_time: ); print_name_offset(m, base-get_time); SEQ_printf(m, \n); #ifdef CONFIG_HIGH_RES_TIMERS - SEQ_printf(m, .offset: %Ld nsecs\n, - ktime_to_ns(base-offset)); + SEQ_printf(m, .offset: %Lu nsecs\n, + (unsigned long long) ktime_to_ns(base-offset)); #endif SEQ_printf(m, active timers:\n); print_active_timers(m, base, now); @@ -135,10 +135,11 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now) print_base(m, cpu_base-clock_base + i, now); } #define P(x) \ - SEQ_printf(m, .%-15s: %Ld\n, #x, (u64)(cpu_base-x)) + SEQ_printf(m, .%-15s: %Lu\n, #x, \ + (unsigned long long)(cpu_base-x)) #define P_ns(x) \ - SEQ_printf(m, .%-15s: %Ld nsecs\n, #x, \ - (u64)(ktime_to_ns(cpu_base-x))) + SEQ_printf(m, .%-15s: %Lu nsecs\n, #x, \ + (unsigned long long)(ktime_to_ns(cpu_base-x))) #ifdef CONFIG_HIGH_RES_TIMERS P_ns(expires_next); @@ -150,10 +151,11 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now) #ifdef CONFIG_TICK_ONESHOT # define P(x) \ - SEQ_printf(m, .%-15s: %Ld\n, #x, (u64)(ts-x)) + SEQ_printf(m, .%-15s: %Lu\n, #x, \ + (unsigned long long)(ts-x)) # define P_ns(x) \ - SEQ_printf(m, .%-15s: %Ld nsecs\n, #x, \ - (u64)(ktime_to_ns(ts-x))) + SEQ_printf(m, .%-15s: %Lu nsecs\n, #x, \ + (unsigned long long)(ktime_to_ns(ts-x))) { struct tick_sched *ts = tick_get_tick_sched(cpu); P(nohz_mode); @@ -167,7 +169,8 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now) P(last_jiffies); P(next_jiffies); P_ns(idle_expires); - SEQ_printf(m, jiffies: %Ld\n, (u64)jiffies); + SEQ_printf(m, jiffies: %Lu\n, + (unsigned long long)jiffies); } #endif - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
AFS: export a couple of core functions for AFS write support
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ef71c15c46a053818f7e69098ebb052b31ffa56b Commit: ef71c15c46a053818f7e69098ebb052b31ffa56b Parent: 9b04bd27564cfd7224e0135ba37df778f1d490bf Author: David Howells [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:44 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:50 2007 -0700 AFS: export a couple of core functions for AFS write support Export a couple of core functions for AFS write support to use: find_get_pages_contig() find_get_pages_tag() Signed-off-by: David Howells [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/filemap.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 9cbf4fe..9e56fd1 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -750,6 +750,7 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index, read_unlock_irq(mapping-tree_lock); return i; } +EXPORT_SYMBOL(find_get_pages_contig); /** * find_get_pages_tag - find and return pages that match @tag @@ -778,6 +779,7 @@ unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index, read_unlock_irq(mapping-tree_lock); return ret; } +EXPORT_SYMBOL(find_get_pages_tag); /** * grab_cache_page_nowait - returns locked page at given index in given cache - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
AFS: implement basic file write support
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=31143d5d515ece617ffccb7df5ff75e4d1dfa120 Commit: 31143d5d515ece617ffccb7df5ff75e4d1dfa120 Parent: 416351f28d2b31d15ff73e9aff699b2163704c95 Author: David Howells [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:46 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:50 2007 -0700 AFS: implement basic file write support Implement support for writing to regular AFS files, including: (1) write (2) truncate (3) fsync, fdatasync (4) chmod, chown, chgrp, utime. AFS writeback attempts to batch writes into as chunks as large as it can manage up to the point that it writes back 65535 pages in one chunk or it meets a locked page. Furthermore, if a page has been written to using a particular key, then should another write to that page use some other key, the first write will be flushed before the second is allowed to take place. If the first write fails due to a security error, then the page will be scrapped and reread before the second write takes place. If a page is dirty and the callback on it is broken by the server, then the dirty data is not discarded (same behaviour as NFS). Shared-writable mappings are not supported by this patch. [EMAIL PROTECTED]: fix a bunch of warnings] Signed-off-by: David Howells [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/afs/Makefile |3 +- fs/afs/afs_fs.h |2 + fs/afs/dir.c |1 + fs/afs/file.c | 32 ++- fs/afs/fsclient.c | 332 - fs/afs/inode.c| 47 +++- fs/afs/internal.h | 66 - fs/afs/rxrpc.c| 80 +- fs/afs/super.c|5 +- fs/afs/vnode.c| 107 +++ fs/afs/write.c| 835 + 11 files changed, 1483 insertions(+), 27 deletions(-) diff --git a/fs/afs/Makefile b/fs/afs/Makefile index cf83e5d..73ce561 100644 --- a/fs/afs/Makefile +++ b/fs/afs/Makefile @@ -22,6 +22,7 @@ kafs-objs := \ vlclient.o \ vlocation.o \ vnode.o \ - volume.o + volume.o \ + write.o obj-$(CONFIG_AFS_FS) := kafs.o diff --git a/fs/afs/afs_fs.h b/fs/afs/afs_fs.h index 89e0d16..2198006 100644 --- a/fs/afs/afs_fs.h +++ b/fs/afs/afs_fs.h @@ -18,6 +18,8 @@ enum AFS_FS_Operations { FSFETCHDATA = 130, /* AFS Fetch file data */ FSFETCHSTATUS = 132, /* AFS Fetch file status */ + FSSTOREDATA = 133, /* AFS Store file data */ + FSSTORESTATUS = 135, /* AFS Store file status */ FSREMOVEFILE= 136, /* AFS Remove a file */ FSCREATEFILE= 137, /* AFS Create a file */ FSRENAME= 138, /* AFS Rename or move a file or directory */ diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 51f177a..2fb3127 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -56,6 +56,7 @@ const struct inode_operations afs_dir_inode_operations = { .rename = afs_rename, .permission = afs_permission, .getattr= afs_getattr, + .setattr= afs_setattr, }; static struct dentry_operations afs_fs_dentry_operations = { diff --git a/fs/afs/file.c b/fs/afs/file.c index 3eb3fc7..3e25795 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -15,32 +15,43 @@ #include linux/slab.h #include linux/fs.h #include linux/pagemap.h +#include linux/writeback.h #include internal.h static int afs_readpage(struct file *file, struct page *page); static void afs_invalidatepage(struct page *page, unsigned long offset); static int afs_releasepage(struct page *page, gfp_t gfp_flags); +static int afs_launder_page(struct page *page); const struct file_operations afs_file_operations = { .open = afs_open, .release= afs_release, .llseek = generic_file_llseek, .read = do_sync_read, + .write = do_sync_write, .aio_read = generic_file_aio_read, + .aio_write = afs_file_write, .mmap = generic_file_readonly_mmap, .sendfile = generic_file_sendfile, + .fsync = afs_fsync, }; const struct inode_operations afs_file_inode_operations = { .getattr= afs_getattr, + .setattr= afs_setattr, .permission = afs_permission, }; const struct address_space_operations afs_fs_aops = { .readpage = afs_readpage, - .set_page_dirty = __set_page_dirty_nobuffers, + .set_page_dirty = afs_set_page_dirty, + .launder_page = afs_launder_page, .releasepage= afs_releasepage, .invalidatepage = afs_invalidatepage, + .prepare_write = afs_prepare_write, +
atmel_spi: remove unnecessary (and wrong) #ifdefs
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a1e3cf418fc1e6b13bdc472ffb60bd02735e41a6 Commit: a1e3cf418fc1e6b13bdc472ffb60bd02735e41a6 Parent: e7498281d3caec1141d7542ec494c4e4a1d404c9 Author: Haavard Skinnemoen [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:50 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:50 2007 -0700 atmel_spi: remove unnecessary (and wrong) #ifdefs Now that the cpu_is_xxx() macros are available both on AVR32 and AT91, we can remove a couple of #ifdefs from this driver. One of them is actually wrong -- new_1 should be set on AVR32 but isn't. This causes the bus clock to run at twice the speed it is configured to. Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED] Cc: David Brownell [EMAIL PROTECTED] Acked-by: Andrew Victor [EMAIL PROTECTED] Cc: Nicolas Ferre [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/spi/atmel_spi.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 66e7bc9..1d8a2f6 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c @@ -22,10 +22,7 @@ #include asm/io.h #include asm/arch/board.h #include asm/arch/gpio.h - -#ifdef CONFIG_ARCH_AT91 #include asm/arch/cpu.h -#endif #include atmel_spi.h @@ -552,10 +549,8 @@ static int __init atmel_spi_probe(struct platform_device *pdev) goto out_free_buffer; as-irq = irq; as-clk = clk; -#ifdef CONFIG_ARCH_AT91 if (!cpu_is_at91rm9200()) as-new_1 = 1; -#endif ret = request_irq(irq, atmel_spi_interrupt, 0, pdev-dev.bus_id, master); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
schedule_on_each_cpu(): use preempt_disable()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e18f3ffb9c3ddfc1b4ad8f38f5f2acae8c16f0c9 Commit: e18f3ffb9c3ddfc1b4ad8f38f5f2acae8c16f0c9 Parent: a1e3cf418fc1e6b13bdc472ffb60bd02735e41a6 Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:50 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:50 2007 -0700 schedule_on_each_cpu(): use preempt_disable() We take workqueue_mutex in there to keep CPU hotplug away. But preempt_disable() will suffice for that. Cc: Ingo Molnar [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index b6fa5e6..1ea4bcb 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -638,7 +638,7 @@ int schedule_on_each_cpu(work_func_t func) if (!works) return -ENOMEM; - mutex_lock(workqueue_mutex); + preempt_disable(); /* CPU hotplug */ for_each_online_cpu(cpu) { struct work_struct *work = per_cpu_ptr(works, cpu); @@ -646,7 +646,7 @@ int schedule_on_each_cpu(work_func_t func) set_bit(WORK_STRUCT_PENDING, work_data_bits(work)); __queue_work(per_cpu_ptr(keventd_wq-cpu_wq, cpu), work); } - mutex_unlock(workqueue_mutex); + preempt_enable(); flush_workqueue(keventd_wq); free_percpu(works); return 0; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
implement flush_work()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b89deed32ccc96098bd6bc953c64bba6b847774f Commit: b89deed32ccc96098bd6bc953c64bba6b847774f Parent: fc2e4d70410546307344821eed6fd23803a45286 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:52 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:50 2007 -0700 implement flush_work() A basic problem with flush_scheduled_work() is that it blocks behind _all_ presently-queued works, rather than just the work whcih the caller wants to flush. If the caller holds some lock, and if one of the queued work happens to want that lock as well then accidental deadlocks can occur. One example of this is the phy layer: it wants to flush work while holding rtnl_lock(). But if a linkwatch event happens to be queued, the phy code will deadlock because the linkwatch callback function takes rtnl_lock. So we implement a new function which will flush a *single* work - just the one which the caller wants to free up. Thus we avoid the accidental deadlocks which can arise from unrelated subsystems' callbacks taking shared locks. flush_work() non-blockingly dequeues the work_struct which we want to kill, then it waits for its handler to complete on all CPUs. Add -current_work to the struct cpu_workqueue_struct, it points to currently running struct work_struct. When flush_work(work) detects -current_work == work, it inserts a barrier at the _head_ of -worklist (and thus right _after_ that work) and waits for completition. This means that the next work fired on that CPU will be this barrier, or another barrier queued by concurrent flush_work(), so the caller of flush_work() will be woken before any regular work has a chance to run. When wait_on_work() unlocks workqueue_mutex (or whatever we choose to protect against CPU hotplug), CPU may go away. But in that case take_over_work() will move a barrier we queued to another CPU, it will be fired sometime, and wait_on_work() will be woken. Actually, we are doing cleanup_workqueue_thread()-kthread_stop() before take_over_work(), so cwq-thread should complete its -worklist (and thus the barrier), because currently we don't check kthread_should_stop() in run_workqueue(). But even if we did, everything should be ok. [EMAIL PROTECTED]: cleanup] [EMAIL PROTECTED]: add flush_work_keventd() wrapper] Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/linux/workqueue.h |4 +- kernel/workqueue.c| 95 +++- 2 files changed, 95 insertions(+), 4 deletions(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index f16ba1e..26a7099 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -178,6 +178,8 @@ extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct delay extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, struct delayed_work *work, unsigned long delay); extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq)); +extern void flush_work(struct workqueue_struct *wq, struct work_struct *work); +extern void flush_work_keventd(struct work_struct *work); extern int FASTCALL(schedule_work(struct work_struct *work)); extern int FASTCALL(run_scheduled_work(struct work_struct *work)); @@ -199,7 +201,7 @@ int execute_in_process_context(work_func_t fn, struct execute_work *); * Kill off a pending schedule_delayed_work(). Note that the work callback * function may still be running on return from cancel_delayed_work(), unless * it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or - * cancel_work_sync() to wait on it. + * flush_work() or cancel_work_sync() to wait on it. */ static inline int cancel_delayed_work(struct delayed_work *work) { diff --git a/kernel/workqueue.c b/kernel/workqueue.c index b7bb37a..918d552 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -46,6 +46,7 @@ struct cpu_workqueue_struct { struct workqueue_struct *wq; struct task_struct *thread; + struct work_struct *current_work; int run_depth; /* Detect run_workqueue() recursion depth */ @@ -120,6 +121,7 @@ static int __run_work(struct cpu_workqueue_struct *cwq, struct work_struct *work work_pending(work) !list_empty(work-entry)) { work_func_t f = work-func; + cwq-current_work = work; list_del_init(work-entry); spin_unlock_irqrestore(cwq-lock, flags); @@ -128,6 +130,7 @@ static int __run_work(struct cpu_workqueue_struct *cwq, struct work_struct *work f(work);
flush_workqueue(): use preempt_disable to hold off cpu hotplug
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=edab2516a6c1752e8e5e3d55727cabf12346e5df Commit: edab2516a6c1752e8e5e3d55727cabf12346e5df Parent: b89deed32ccc96098bd6bc953c64bba6b847774f Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:53 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:51 2007 -0700 flush_workqueue(): use preempt_disable to hold off cpu hotplug Cc: Oleg Nesterov [EMAIL PROTECTED] Cc: Srivatsa Vaddagiri [EMAIL PROTECTED] Cc: Gautham Shenoy [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 918d552..5176d51 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -419,18 +419,22 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) * Probably keventd trying to flush its own queue. So simply run * it by hand rather than deadlocking. */ - mutex_unlock(workqueue_mutex); + preempt_enable(); + /* +* We can still touch *cwq here because we are keventd, and +* hot-unplug will be waiting us to exit. +*/ run_workqueue(cwq); - mutex_lock(workqueue_mutex); + preempt_disable(); } else { struct wq_barrier barr; init_wq_barrier(barr); __queue_work(cwq, barr.work); - mutex_unlock(workqueue_mutex); + preempt_enable(); /* Can no longer touch *cwq */ wait_for_completion(barr.done); - mutex_lock(workqueue_mutex); + preempt_disable(); } } @@ -449,7 +453,7 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) */ void fastcall flush_workqueue(struct workqueue_struct *wq) { - mutex_lock(workqueue_mutex); + preempt_disable(); /* CPU hotplug */ if (is_single_threaded(wq)) { /* Always use first cpu's area. */ flush_cpu_workqueue(per_cpu_ptr(wq-cpu_wq, singlethread_cpu)); @@ -459,7 +463,7 @@ void fastcall flush_workqueue(struct workqueue_struct *wq) for_each_online_cpu(cpu) flush_cpu_workqueue(per_cpu_ptr(wq-cpu_wq, cpu)); } - mutex_unlock(workqueue_mutex); + preempt_enable(); } EXPORT_SYMBOL_GPL(flush_workqueue); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
aio: use flush_work()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a9df62c7585e6caa1e7d2425b2b14460ec3afc20 Commit: a9df62c7585e6caa1e7d2425b2b14460ec3afc20 Parent: 83c22520c51bf67529367e8237f95c03fe44e2da Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:54 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:51 2007 -0700 aio: use flush_work() Migrate AIO over to use flush_work(). Cc: Maciej W. Rozycki [EMAIL PROTECTED] Cc: David Howells [EMAIL PROTECTED] Cc: Zach Brown [EMAIL PROTECTED] Cc: Benjamin LaHaise [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/aio.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index b97ab80..d18690b 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -346,10 +346,9 @@ void fastcall exit_aio(struct mm_struct *mm) wait_for_all_aios(ctx); /* -* this is an overkill, but ensures we don't leave -* the ctx on the aio_wq +* Ensure we don't leave the ctx on the aio_wq */ - flush_workqueue(aio_wq); + flush_work(aio_wq, ctx-wq.work); if (1 != atomic_read(ctx-users)) printk(KERN_DEBUG @@ -372,7 +371,7 @@ void fastcall __put_ioctx(struct kioctx *ctx) BUG_ON(ctx-reqs_active); cancel_delayed_work(ctx-wq); - flush_workqueue(aio_wq); + flush_work(aio_wq, ctx-wq.work); aio_free_ring(ctx); mmdrop(ctx-mm); ctx-mm = NULL; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
kblockd: use flush_work
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=19a75d83ffeab004cfcfac64024ad3997bac7220 Commit: 19a75d83ffeab004cfcfac64024ad3997bac7220 Parent: a9df62c7585e6caa1e7d2425b2b14460ec3afc20 Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:56 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:51 2007 -0700 kblockd: use flush_work Switch the kblockd flushing from a global flush to a more specific flush_work(). (akpm: bypassed maintainers, sorry. There are other patches which depend on this) Cc: Maciej W. Rozycki [EMAIL PROTECTED] Cc: David Howells [EMAIL PROTECTED] Cc: Jens Axboe [EMAIL PROTECTED] Cc: Nick Piggin [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- block/as-iosched.c |2 +- block/ll_rw_blk.c |7 +++ include/linux/blkdev.h |2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/block/as-iosched.c b/block/as-iosched.c index 640aa83..109e91b 100644 --- a/block/as-iosched.c +++ b/block/as-iosched.c @@ -1306,7 +1306,7 @@ static void as_exit_queue(elevator_t *e) struct as_data *ad = e-elevator_data; del_timer_sync(ad-antic_timer); - kblockd_flush(); + kblockd_flush_work(ad-antic_work); BUG_ON(!list_empty(ad-fifo_list[REQ_SYNC])); BUG_ON(!list_empty(ad-fifo_list[REQ_ASYNC])); diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index d99d402..c059767 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -1712,7 +1712,6 @@ EXPORT_SYMBOL(blk_stop_queue); void blk_sync_queue(struct request_queue *q) { del_timer_sync(q-unplug_timer); - kblockd_flush(); } EXPORT_SYMBOL(blk_sync_queue); @@ -3632,11 +3631,11 @@ int kblockd_schedule_work(struct work_struct *work) EXPORT_SYMBOL(kblockd_schedule_work); -void kblockd_flush(void) +void kblockd_flush_work(struct work_struct *work) { - flush_workqueue(kblockd_workqueue); + flush_work(kblockd_workqueue, work); } -EXPORT_SYMBOL(kblockd_flush); +EXPORT_SYMBOL(kblockd_flush_work); int __init blk_dev_init(void) { diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index a686eab..db5b00a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -854,7 +854,7 @@ static inline void put_dev_sector(Sector p) struct work_struct; int kblockd_schedule_work(struct work_struct *work); -void kblockd_flush(void); +void kblockd_flush_work(struct work_struct *work); #define MODULE_ALIAS_BLOCKDEV(major,minor) \ MODULE_ALIAS(block-major- __stringify(major) - __stringify(minor)) - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
tg3: use flush_work_keventd()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b3cb2e778811a1df99e37fd7c359837501ab103 Commit: 2b3cb2e778811a1df99e37fd7c359837501ab103 Parent: 19a75d83ffeab004cfcfac64024ad3997bac7220 Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:57 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:51 2007 -0700 tg3: use flush_work_keventd() Convert tg3 over to flush_work_keventd(). Remove nasty now-unneeded deadlock avoidance logic. (akpm: bypassed maintainers, sorry. There are other patches which depend on this) Cc: Maciej W. Rozycki [EMAIL PROTECTED] Cc: David Howells [EMAIL PROTECTED] Cc: David S. Miller [EMAIL PROTECTED] Cc: Michael Chan [EMAIL PROTECTED] Cc: Jeff Garzik [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/net/tg3.c | 11 +-- drivers/net/tg3.h |2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index e5e901e..0c0f9c8 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -3716,10 +3716,8 @@ static void tg3_reset_task(struct work_struct *work) unsigned int restart_timer; tg3_full_lock(tp, 0); - tp-tg3_flags |= TG3_FLAG_IN_RESET_TASK; if (!netif_running(tp-dev)) { - tp-tg3_flags = ~TG3_FLAG_IN_RESET_TASK; tg3_full_unlock(tp); return; } @@ -3750,8 +3748,6 @@ static void tg3_reset_task(struct work_struct *work) mod_timer(tp-timer, jiffies + 1); out: - tp-tg3_flags = ~TG3_FLAG_IN_RESET_TASK; - tg3_full_unlock(tp); } @@ -7390,12 +7386,7 @@ static int tg3_close(struct net_device *dev) { struct tg3 *tp = netdev_priv(dev); - /* Calling flush_scheduled_work() may deadlock because -* linkwatch_event() may be on the workqueue and it will try to get -* the rtnl_lock which we are holding. -*/ - while (tp-tg3_flags TG3_FLAG_IN_RESET_TASK) - msleep(1); + flush_work_keventd(tp-reset_task); netif_stop_queue(dev); diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 4d334cf..bd9f4f4 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h @@ -2228,7 +2228,7 @@ struct tg3 { #define TG3_FLAG_JUMBO_RING_ENABLE 0x0080 #define TG3_FLAG_10_100_ONLY 0x0100 #define TG3_FLAG_PAUSE_AUTONEG 0x0200 -#define TG3_FLAG_IN_RESET_TASK 0x0400 + #define TG3_FLAG_40BIT_DMA_BUG 0x0800 #define TG3_FLAG_BROKEN_CHECKSUMS 0x1000 #define TG3_FLAG_SUPPORT_MSI 0x2000 - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
e1000: use flush_work_keventd()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d9ef8b92887c35f113cb749270530f87961f7a0a Commit: d9ef8b92887c35f113cb749270530f87961f7a0a Parent: 2b3cb2e778811a1df99e37fd7c359837501ab103 Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:58 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:51 2007 -0700 e1000: use flush_work_keventd() Switch e1000 over to flush_work_keventd(). This probably fixes a netdev-close versus linkwatch rtnl_lock() deadlock which nobody knew about. (akpm: bypassed maintainers, sorry. There are other patches which depend on this) Cc: Maciej W. Rozycki [EMAIL PROTECTED] Cc: David Howells [EMAIL PROTECTED] Cc: David S. Miller [EMAIL PROTECTED] Cc: Jeff Garzik [EMAIL PROTECTED] Acked-by: Auke Kok [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/net/e1000/e1000_main.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 3a03a74..397e25b 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -1214,7 +1214,7 @@ e1000_remove(struct pci_dev *pdev) int i; #endif - flush_scheduled_work(); + flush_work_keventd(adapter-reset_task); e1000_release_manageability(adapter); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
libata: use flush_work()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=67ac58edf771b10f8e89bf9fe1ccf6c9b92ce063 Commit: 67ac58edf771b10f8e89bf9fe1ccf6c9b92ce063 Parent: d9ef8b92887c35f113cb749270530f87961f7a0a Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:33:59 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:51 2007 -0700 libata: use flush_work() (akpm: bypassed maintainers, sorry. There are other patches which depend on this) Cc: Maciej W. Rozycki [EMAIL PROTECTED] Cc: David Howells [EMAIL PROTECTED] Cc: Jeff Garzik [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Cc: Tejun Heo [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/ata/libata-core.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index a795088..b74e56c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -1316,7 +1316,7 @@ void ata_port_flush_task(struct ata_port *ap) spin_unlock_irqrestore(ap-lock, flags); DPRINTK(flush #1\n); - flush_workqueue(ata_wq); + flush_work(ata_wq, ap-port_task.work); /* akpm: seems unneeded */ /* * At this point, if a task is running, it's guaranteed to see @@ -1327,7 +1327,7 @@ void ata_port_flush_task(struct ata_port *ap) if (ata_msg_ctl(ap)) ata_port_printk(ap, KERN_DEBUG, %s: flush #2\n, __FUNCTION__); - flush_workqueue(ata_wq); + flush_work(ata_wq, ap-port_task.work); } spin_lock_irqsave(ap-lock, flags); @@ -6475,9 +6475,9 @@ void ata_port_detach(struct ata_port *ap) /* Flush hotplug task. The sequence is similar to * ata_port_flush_task(). */ - flush_workqueue(ata_aux_wq); + flush_work(ata_aux_wq, ap-hotplug_task.work); /* akpm: why? */ cancel_delayed_work(ap-hotplug_task); - flush_workqueue(ata_aux_wq); + flush_work(ata_aux_wq, ap-hotplug_task.work); skip_eh: /* remove the associated SCSI host */ - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
phy: use flush_work_keventd()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d0758bc334780d70266c1d1b974ed26f740a0819 Commit: d0758bc334780d70266c1d1b974ed26f740a0819 Parent: 67ac58edf771b10f8e89bf9fe1ccf6c9b92ce063 Author: Andrew Morton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:00 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:51 2007 -0700 phy: use flush_work_keventd() (akpm: bypassed maintainers, sorry. There are other patches which depend on this) Cc: Maciej W. Rozycki [EMAIL PROTECTED] Cc: David Howells [EMAIL PROTECTED] Cc: Jeff Garzik [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/net/phy/phy.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index eed433d..f445c46 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -662,10 +662,10 @@ int phy_stop_interrupts(struct phy_device *phydev) phy_error(phydev); /* -* Finish any pending work; we might have been scheduled -* to be called from keventd ourselves, though. +* Finish any pending work; we might have been scheduled to be called +* from keventd ourselves, but flush_work_keventd() handles that. */ - run_scheduled_work(phydev-phy_queue); + flush_work_keventd(phydev-phy_queue); free_irq(phydev-irq, phydev); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Extend notifier_call_chain to count nr_calls made
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6f7cc11aa6c7d5002e16096c7590944daece70ed Commit: 6f7cc11aa6c7d5002e16096c7590944daece70ed Parent: 7c9cb38302e78d24e37f7d8a2ea7eed4ae5f2fa7 Author: Gautham R Shenoy [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:02 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:51 2007 -0700 Extend notifier_call_chain to count nr_calls made Since 2.6.18-something, the community has been bugged by the problem to provide a clean and a stable mechanism to postpone a cpu-hotplug event as lock_cpu_hotplug was badly broken. This is another proposal towards solving that problem. This one is along the lines of the solution provided in kernel/workqueue.c Instead of having a global mechanism like lock_cpu_hotplug, we allow the subsytems to define their own per-subsystem hot cpu mutexes. These would be taken(released) where ever we are currently calling lock_cpu_hotplug(unlock_cpu_hotplug). Also, in the per-subsystem hotcpu callback function,we take this mutex before we handle any pre-cpu-hotplug events and release it once we finish handling the post-cpu-hotplug events. A standard means for doing this has been provided in [PATCH 2/4] and demonstrated in [PATCH 3/4]. The ordering of these per-subsystem mutexes might still prove to be a problem, but hopefully lockdep should help us get out of that muddle. The patch set to be applied against linux-2.6.19-rc5 is as follows: [PATCH 1/4] : Extend notifier_call_chain with an option to specify the number of notifications to be sent and also count the number of notifications actually sent. [PATCH 2/4] : Define events CPU_LOCK_ACQUIRE and CPU_LOCK_RELEASE and send out notifications for these in _cpu_up and _cpu_down. This would help us standardise the acquire and release of the subsystem locks in the hotcpu callback functions of these subsystems. [PATCH 3/4] : Eliminate lock_cpu_hotplug from kernel/sched.c. [PATCH 4/4] : In workqueue_cpu_callback function, acquire(release) the workqueue_mutex while handling CPU_LOCK_ACQUIRE(CPU_LOCK_RELEASE). If the per-subsystem-locking approach survives the test of time, we can expect a slow phasing out of lock_cpu_hotplug, which has not yet been eliminated in these patches :) This patch: Provide notifier_call_chain with an option to call only a specified number of notifiers and also record the number of call to notifiers made. The need for this enhancement was identified in the post entitled Slab - Eliminate lock_cpu_hotplug from slab (http://lkml.org/lkml/2006/10/28/92) by Ravikiran G Thirumalai and Andrew Morton. This patch adds two additional parameters to notifier_call_chain API namely - int nr_to_calls : Number of notifier_functions to be called. The don't care value is -1. - unsigned int *nr_calls : Records the total number of notifier_funtions called by notifier_call_chain. The don't care value is NULL. [EMAIL PROTECTED]: build fix] Credit: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Gautham R Shenoy [EMAIL PROTECTED] Signed-off-by: Michal Piotrowski [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/linux/notifier.h | 52 +++--- kernel/sys.c | 94 + 2 files changed, 107 insertions(+), 39 deletions(-) diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 10a43ed..e34221b 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -112,32 +112,40 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); #ifdef __KERNEL__ -extern int atomic_notifier_chain_register(struct atomic_notifier_head *, - struct notifier_block *); -extern int blocking_notifier_chain_register(struct blocking_notifier_head *, - struct notifier_block *); -extern int raw_notifier_chain_register(struct raw_notifier_head *, - struct notifier_block *); -extern int srcu_notifier_chain_register(struct srcu_notifier_head *, - struct notifier_block *); - -extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *, - struct notifier_block *); -extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *, - struct notifier_block *); -extern int raw_notifier_chain_unregister(struct raw_notifier_head *, - struct notifier_block *); -extern int
workqueue: make init_workqueues() __init
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c12920d19078eb8fd99560ec232a6e05c6ff1aa8 Commit: c12920d19078eb8fd99560ec232a6e05c6ff1aa8 Parent: cce1a1656c9a3fdc6c6c1029b576e4ab6ecaac37 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:14 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:52 2007 -0700 workqueue: make init_workqueues() __init The only caller of init_workqueues() is do_basic_setup(). Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Cc: Ingo Molnar [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 32b1091..e858e93 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -823,7 +823,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, return NOTIFY_OK; } -void init_workqueues(void) +void __init init_workqueues(void) { cpu_populated_map = cpu_online_map; singlethread_cpu = first_cpu(cpu_possible_map); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
workqueues: shift kthread_bind() from CPU_UP_PREPARE to CPU_ONLINE
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=06ba38a9a0f6ceffe70343f684c5a690e3710ef4 Commit: 06ba38a9a0f6ceffe70343f684c5a690e3710ef4 Parent: c12920d19078eb8fd99560ec232a6e05c6ff1aa8 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:15 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:52 2007 -0700 workqueues: shift kthread_bind() from CPU_UP_PREPARE to CPU_ONLINE CPU_UP_PREPARE binds cwq-thread to the new CPU. So CPU_UP_CANCELED tries to wake up the task which is bound to the failed CPU. With this patch we don't bind cwq-thread until CPU becomes online. The first wake_up() after kthread_create() is a bit special, make a simple helper for that. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Cc: Gautham R Shenoy [EMAIL PROTECTED] Cc: Rafael J. Wysocki [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c | 23 +++ 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index e858e93..7d1ebfc 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -668,15 +668,21 @@ static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) cwq-thread = p; cwq-should_stop = 0; - if (!is_single_threaded(wq)) - kthread_bind(p, cpu); - - if (is_single_threaded(wq) || cpu_online(cpu)) - wake_up_process(p); return 0; } +static void start_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) +{ + struct task_struct *p = cwq-thread; + + if (p != NULL) { + if (cpu = 0) + kthread_bind(p, cpu); + wake_up_process(p); + } +} + struct workqueue_struct *__create_workqueue(const char *name, int singlethread, int freezeable) { @@ -702,6 +708,7 @@ struct workqueue_struct *__create_workqueue(const char *name, if (singlethread) { cwq = init_cpu_workqueue(wq, singlethread_cpu); err = create_workqueue_thread(cwq, singlethread_cpu); + start_workqueue_thread(cwq, -1); } else { mutex_lock(workqueue_mutex); list_add(wq-list, workqueues); @@ -711,6 +718,7 @@ struct workqueue_struct *__create_workqueue(const char *name, if (err || !cpu_online(cpu)) continue; err = create_workqueue_thread(cwq, cpu); + start_workqueue_thread(cwq, cpu); } mutex_unlock(workqueue_mutex); } @@ -808,12 +816,11 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, return NOTIFY_BAD; case CPU_ONLINE: - wake_up_process(cwq-thread); + start_workqueue_thread(cwq, cpu); break; case CPU_UP_CANCELED: - if (cwq-thread) - wake_up_process(cwq-thread); + start_workqueue_thread(cwq, -1); case CPU_DEAD: cleanup_workqueue_thread(cwq, cpu); break; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
workqueue: introduce wq_per_cpu() helper
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a848e3b67c07ed79374bd0f9b82f9ce45a419643 Commit: a848e3b67c07ed79374bd0f9b82f9ce45a419643 Parent: 63bc0362521cbaae3ed17b8de7b094f9492453f0 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:17 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:52 2007 -0700 workqueue: introduce wq_per_cpu() helper Cleanup. A number of per_cpu_ptr(wq-cpu_wq, cpu) users have to check that cpu is valid for this wq. Make a simple helper. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c | 26 +- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 0eb9b33..985902e 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -86,6 +86,14 @@ static const cpumask_t *wq_cpu_map(struct workqueue_struct *wq) ? cpu_singlethread_map : cpu_populated_map; } +static +struct cpu_workqueue_struct *wq_per_cpu(struct workqueue_struct *wq, int cpu) +{ + if (unlikely(is_single_threaded(wq))) + cpu = singlethread_cpu; + return per_cpu_ptr(wq-cpu_wq, cpu); +} + /* * Set the workqueue on which a work item is to be run * - Must *only* be called if the pending flag is set @@ -142,16 +150,14 @@ static void __queue_work(struct cpu_workqueue_struct *cwq, */ int fastcall queue_work(struct workqueue_struct *wq, struct work_struct *work) { - int ret = 0, cpu = get_cpu(); + int ret = 0; if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) { - if (unlikely(is_single_threaded(wq))) - cpu = singlethread_cpu; BUG_ON(!list_empty(work-entry)); - __queue_work(per_cpu_ptr(wq-cpu_wq, cpu), work); + __queue_work(wq_per_cpu(wq, get_cpu()), work); + put_cpu(); ret = 1; } - put_cpu(); return ret; } EXPORT_SYMBOL_GPL(queue_work); @@ -161,12 +167,8 @@ void delayed_work_timer_fn(unsigned long __data) struct delayed_work *dwork = (struct delayed_work *)__data; struct cpu_workqueue_struct *cwq = get_wq_data(dwork-work); struct workqueue_struct *wq = cwq-wq; - int cpu = smp_processor_id(); - - if (unlikely(is_single_threaded(wq))) - cpu = singlethread_cpu; - __queue_work(per_cpu_ptr(wq-cpu_wq, cpu), dwork-work); + __queue_work(wq_per_cpu(wq, smp_processor_id()), dwork-work); } /** @@ -209,9 +211,7 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, BUG_ON(!list_empty(work-entry)); /* This stores cwq for the moment, for the timer_fn */ - set_wq_data(work, - per_cpu_ptr(wq-cpu_wq, wq-singlethread ? - singlethread_cpu : raw_smp_processor_id())); + set_wq_data(work, wq_per_cpu(wq, raw_smp_processor_id())); timer-expires = jiffies + delay; timer-data = (unsigned long)dwork; timer-function = delayed_work_timer_fn; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
make cancel_rearming_delayed_work() work on any workqueue, not just keventd_wq
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1634c48f8b85dcb05101f1eb2eab9af40b5976da Commit: 1634c48f8b85dcb05101f1eb2eab9af40b5976da Parent: a848e3b67c07ed79374bd0f9b82f9ce45a419643 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:18 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:52 2007 -0700 make cancel_rearming_delayed_work() work on any workqueue, not just keventd_wq cancel_rearming_delayed_workqueue(wq, dwork) doesn't need the first parameter. We don't hang on un-queued dwork any longer, and work-data doesn't change its type. This means we can always figure out wq from dwork when it is needed. Remove this parameter, and rename the function to cancel_rearming_delayed_work(). Re-create an inline obsolete cancel_rearming_delayed_workqueue(wq) which just calls cancel_rearming_delayed_work(). Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/linux/workqueue.h | 13 ++--- kernel/workqueue.c| 27 +-- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 2a58f16..27110c0 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -191,9 +191,6 @@ extern int current_is_keventd(void); extern int keventd_up(void); extern void init_workqueues(void); -void cancel_rearming_delayed_work(struct delayed_work *work); -void cancel_rearming_delayed_workqueue(struct workqueue_struct *, - struct delayed_work *); int execute_in_process_context(work_func_t fn, struct execute_work *); /* @@ -212,4 +209,14 @@ static inline int cancel_delayed_work(struct delayed_work *work) return ret; } +extern void cancel_rearming_delayed_work(struct delayed_work *work); + +/* Obsolete. use cancel_rearming_delayed_work() */ +static inline +void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq, + struct delayed_work *work) +{ + cancel_rearming_delayed_work(work); +} + #endif diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 985902e..41eaffd 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -555,32 +555,23 @@ void flush_work_keventd(struct work_struct *work) EXPORT_SYMBOL(flush_work_keventd); /** - * cancel_rearming_delayed_workqueue - kill off a delayed work whose handler rearms the delayed work. - * @wq: the controlling workqueue structure + * cancel_rearming_delayed_work - kill off a delayed work whose handler rearms the delayed work. * @dwork: the delayed work struct * * Note that the work callback function may still be running on return from * cancel_delayed_work(). Run flush_workqueue() or flush_work() to wait on it. */ -void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq, - struct delayed_work *dwork) +void cancel_rearming_delayed_work(struct delayed_work *dwork) { - /* Was it ever queued ? */ - if (!get_wq_data(dwork-work)) - return; + struct cpu_workqueue_struct *cwq = get_wq_data(dwork-work); - while (!cancel_delayed_work(dwork)) - flush_workqueue(wq); -} -EXPORT_SYMBOL(cancel_rearming_delayed_workqueue); + /* Was it ever queued ? */ + if (cwq != NULL) { + struct workqueue_struct *wq = cwq-wq; -/** - * cancel_rearming_delayed_work - kill off a delayed keventd work whose handler rearms the delayed work. - * @dwork: the delayed work struct - */ -void cancel_rearming_delayed_work(struct delayed_work *dwork) -{ - cancel_rearming_delayed_workqueue(keventd_wq, dwork); + while (!cancel_delayed_work(dwork)) + flush_workqueue(wq); + } } EXPORT_SYMBOL(cancel_rearming_delayed_work); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
ipvs: flush defense_work before module unload
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c214b2cc5f9be7c236f9b91acf524688ff0e3e72 Commit: c214b2cc5f9be7c236f9b91acf524688ff0e3e72 Parent: 1634c48f8b85dcb05101f1eb2eab9af40b5976da Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:18 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:52 2007 -0700 ipvs: flush defense_work before module unload net/ipv4/ipvs/ip_vs_core.c module_exit ip_vs_cleanup ip_vs_control_cleanup cancel_rearming_delayed_work // done This is unsafe. The module may be unloaded and the memory may be freed while defense_work's handler is still running/preempted. Do flush_work(defense_work.work) after cancel_rearming_delayed_work(). Alternatively, we could add flush_work() to cancel_rearming_delayed_work(), but note that we can't change cancel_delayed_work() in the same manner because it may be called from atomic context. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Cc: David S. Miller [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- net/ipv4/ipvs/ip_vs_ctl.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index b3050a6..342e836 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c @@ -2387,6 +2387,7 @@ void ip_vs_control_cleanup(void) EnterFunction(2); ip_vs_trash_cleanup(); cancel_rearming_delayed_work(defense_work); + flush_work_keventd(defense_work.work); ip_vs_kill_estimator(ip_vs_stats); unregister_sysctl_table(sysctl_header); proc_net_remove(ip_vs_stats); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
workqueue: kill NOAUTOREL works
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=23b2e5991afde5af91a1a661d7f47ee56120759e Commit: 23b2e5991afde5af91a1a661d7f47ee56120759e Parent: c214b2cc5f9be7c236f9b91acf524688ff0e3e72 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:19 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:52 2007 -0700 workqueue: kill NOAUTOREL works We don't have any users, and it is not so trivial to use NOAUTOREL works correctly. It is better to simplify API. Delete NOAUTOREL support and rename work_release to work_clear_pending to avoid a confusion. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Acked-by: David Howells [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/linux/workqueue.h | 64 ++-- kernel/workqueue.c|5 +-- 2 files changed, 11 insertions(+), 58 deletions(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 27110c0..e1581dc 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -24,15 +24,13 @@ typedef void (*work_func_t)(struct work_struct *work); struct work_struct { atomic_long_t data; #define WORK_STRUCT_PENDING 0 /* T if work item pending execution */ -#define WORK_STRUCT_NOAUTOREL 1/* F if work item automatically released on exec */ #define WORK_STRUCT_FLAG_MASK (3UL) #define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK) struct list_head entry; work_func_t func; }; -#define WORK_DATA_INIT(autorelease) \ - ATOMIC_LONG_INIT((autorelease) WORK_STRUCT_NOAUTOREL) +#define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) struct delayed_work { struct work_struct work; @@ -44,14 +42,8 @@ struct execute_work { }; #define __WORK_INITIALIZER(n, f) { \ - .data = WORK_DATA_INIT(0), \ -.entry = { (n).entry, (n).entry }, \ - .func = (f),\ - } - -#define __WORK_INITIALIZER_NAR(n, f) { \ - .data = WORK_DATA_INIT(1), \ -.entry = { (n).entry, (n).entry }, \ + .data = WORK_DATA_INIT(), \ + .entry = { (n).entry, (n).entry }, \ .func = (f),\ } @@ -60,23 +52,12 @@ struct execute_work { .timer = TIMER_INITIALIZER(NULL, 0, 0), \ } -#define __DELAYED_WORK_INITIALIZER_NAR(n, f) { \ - .work = __WORK_INITIALIZER_NAR((n).work, (f)), \ - .timer = TIMER_INITIALIZER(NULL, 0, 0), \ - } - #define DECLARE_WORK(n, f) \ struct work_struct n = __WORK_INITIALIZER(n, f) -#define DECLARE_WORK_NAR(n, f) \ - struct work_struct n = __WORK_INITIALIZER_NAR(n, f) - #define DECLARE_DELAYED_WORK(n, f) \ struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f) -#define DECLARE_DELAYED_WORK_NAR(n, f) \ - struct dwork_struct n = __DELAYED_WORK_INITIALIZER_NAR(n, f) - /* * initialize a work item's function pointer */ @@ -95,16 +76,9 @@ struct execute_work { * assignment of the work data initializer allows the compiler * to generate better code. */ -#define INIT_WORK(_work, _func)\ - do {\ - (_work)-data = (atomic_long_t) WORK_DATA_INIT(0); \ - INIT_LIST_HEAD((_work)-entry);\ - PREPARE_WORK((_work), (_func)); \ - } while (0) - -#define INIT_WORK_NAR(_work, _func)\ +#define INIT_WORK(_work, _func) \ do {\ - (_work)-data = (atomic_long_t) WORK_DATA_INIT(1); \ + (_work)-data = (atomic_long_t) WORK_DATA_INIT(); \ INIT_LIST_HEAD((_work)-entry);\ PREPARE_WORK((_work), (_func)); \ } while (0) @@ -115,12 +89,6 @@ struct execute_work { init_timer((_work)-timer);\ } while (0) -#define INIT_DELAYED_WORK_NAR(_work, _func)\ - do {\ - INIT_WORK_NAR((_work)-work, (_func)); \ - init_timer((_work)-timer);\ - } while (0) - #define
worker_thread: don't play with signals
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b9aac8e0d32499217417ff0b494731811f185b18 Commit: b9aac8e0d32499217417ff0b494731811f185b18 Parent: 23b2e5991afde5af91a1a661d7f47ee56120759e Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:20 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 worker_thread: don't play with signals worker_thread() doesn't need to Block and flush all signals, this was already done by its caller, kthread(). Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c |7 --- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 0611de8..87693b3 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -290,18 +290,11 @@ static int worker_thread(void *__cwq) struct cpu_workqueue_struct *cwq = __cwq; DEFINE_WAIT(wait); struct k_sigaction sa; - sigset_t blocked; if (!cwq-wq-freezeable) current-flags |= PF_NOFREEZE; set_user_nice(current, -5); - - /* Block and flush all signals */ - sigfillset(blocked); - sigprocmask(SIG_BLOCK, blocked, NULL); - flush_signals(current); - /* * We inherited MPOL_INTERLEAVE from the booting kernel. * Set MPOL_DEFAULT to insure node local allocations. - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
worker_thread: fix racy try_to_freeze() usage
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=85f4186af944c1240c84934a9ab578743df2d69b Commit: 85f4186af944c1240c84934a9ab578743df2d69b Parent: b9aac8e0d32499217417ff0b494731811f185b18 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:20 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 worker_thread: fix racy try_to_freeze() usage worker_thread() can miss freeze_process()-signal_wake_up() if it happens between try_to_freeze() and prepare_to_wait(). We should check freezing() before entering schedule(). This race was introduced by me in [PATCH 1/1] workqueue: don't migrate pending works from the dead CPU Looks like mm/vmscan.c:kswapd() has the same race. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 87693b3..63885ab 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -308,14 +308,14 @@ static int worker_thread(void *__cwq) do_sigaction(SIGCHLD, sa, (struct k_sigaction *)0); for (;;) { - if (cwq-wq-freezeable) - try_to_freeze(); - prepare_to_wait(cwq-more_work, wait, TASK_INTERRUPTIBLE); - if (!cwq-should_stop list_empty(cwq-worklist)) + if (!freezing(current) !cwq-should_stop +list_empty(cwq-worklist)) schedule(); finish_wait(cwq-more_work, wait); + try_to_freeze(); + if (cwq_should_stop(cwq)) break; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
slab: shut down cache_reaper when cpu goes down
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5830c5902138f80b0a097b797200c739466beedd Commit: 5830c5902138f80b0a097b797200c739466beedd Parent: a4798833d26b293fd18b7bf102991426aa0b56fd Author: Christoph Lameter [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:22 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 slab: shut down cache_reaper when cpu goes down Shutdown the cache_reaper if the cpu is brought down and set the cache_reap.func to NULL. Otherwise hotplug shuts down the reaper for good. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- mm/slab.c | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index cceb347..1a7a10d 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1279,6 +1279,20 @@ static int __cpuinit cpuup_callback(struct notifier_block *nfb, start_cpu_timer(cpu); break; #ifdef CONFIG_HOTPLUG_CPU + case CPU_DOWN_PREPARE: + /* +* Shutdown cache reaper. Note that the cache_chain_mutex is +* held so that if cache_reap() is invoked it cannot do +* anything expensive but will only modify reap_work +* and reschedule the timer. + */ + cancel_rearming_delayed_work(per_cpu(reap_work, cpu)); + /* Now the cache_reaper is guaranteed to be not running. */ + per_cpu(reap_work, cpu).work.func = NULL; + break; + case CPU_DOWN_FAILED: + start_cpu_timer(cpu); + break; case CPU_DEAD: /* * Even if all the cpus of a node are down, we don't free the - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
unify flush_work/flush_work_keventd and rename it to cancel_work_sync
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=28e53bddf814485699a4142bc056fd37d4e11dd4 Commit: 28e53bddf814485699a4142bc056fd37d4e11dd4 Parent: 5830c5902138f80b0a097b797200c739466beedd Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:22 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 unify flush_work/flush_work_keventd and rename it to cancel_work_sync flush_work(wq, work) doesn't need the first parameter, we can use cwq-wq (this was possible from the very beginnig, I missed this). So we can unify flush_work_keventd and flush_work. Also, rename flush_work() to cancel_work_sync() and fix all callers. Perhaps this is not the best name, but flush_work is really bad. (akpm: this is why the earlier patches bypassed maintainers) Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Cc: Jeff Garzik [EMAIL PROTECTED] Cc: David S. Miller [EMAIL PROTECTED] Cc: Jens Axboe [EMAIL PROTECTED] Cc: Tejun Heo [EMAIL PROTECTED] Cc: Auke Kok [EMAIL PROTECTED], Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- block/ll_rw_blk.c |2 +- drivers/ata/libata-core.c |8 drivers/net/e1000/e1000_main.c |2 +- drivers/net/phy/phy.c |4 ++-- drivers/net/tg3.c |2 +- fs/aio.c |4 ++-- include/linux/workqueue.h | 21 - kernel/workqueue.c | 36 +--- net/ipv4/ipvs/ip_vs_ctl.c |2 +- 9 files changed, 41 insertions(+), 40 deletions(-) diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index c059767..df50657 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -3633,7 +3633,7 @@ EXPORT_SYMBOL(kblockd_schedule_work); void kblockd_flush_work(struct work_struct *work) { - flush_work(kblockd_workqueue, work); + cancel_work_sync(work); } EXPORT_SYMBOL(kblockd_flush_work); diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b74e56c..fef87dd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -1316,7 +1316,7 @@ void ata_port_flush_task(struct ata_port *ap) spin_unlock_irqrestore(ap-lock, flags); DPRINTK(flush #1\n); - flush_work(ata_wq, ap-port_task.work); /* akpm: seems unneeded */ + cancel_work_sync(ap-port_task.work); /* akpm: seems unneeded */ /* * At this point, if a task is running, it's guaranteed to see @@ -1327,7 +1327,7 @@ void ata_port_flush_task(struct ata_port *ap) if (ata_msg_ctl(ap)) ata_port_printk(ap, KERN_DEBUG, %s: flush #2\n, __FUNCTION__); - flush_work(ata_wq, ap-port_task.work); + cancel_work_sync(ap-port_task.work); } spin_lock_irqsave(ap-lock, flags); @@ -6475,9 +6475,9 @@ void ata_port_detach(struct ata_port *ap) /* Flush hotplug task. The sequence is similar to * ata_port_flush_task(). */ - flush_work(ata_aux_wq, ap-hotplug_task.work); /* akpm: why? */ + cancel_work_sync(ap-hotplug_task.work); /* akpm: why? */ cancel_delayed_work(ap-hotplug_task); - flush_work(ata_aux_wq, ap-hotplug_task.work); + cancel_work_sync(ap-hotplug_task.work); skip_eh: /* remove the associated SCSI host */ diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 397e25b..637ae8f 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -1214,7 +1214,7 @@ e1000_remove(struct pci_dev *pdev) int i; #endif - flush_work_keventd(adapter-reset_task); + cancel_work_sync(adapter-reset_task); e1000_release_manageability(adapter); diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index f445c46..f71dab3 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -663,9 +663,9 @@ int phy_stop_interrupts(struct phy_device *phydev) /* * Finish any pending work; we might have been scheduled to be called -* from keventd ourselves, but flush_work_keventd() handles that. +* from keventd ourselves, but cancel_work_sync() handles that. */ - flush_work_keventd(phydev-phy_queue); + cancel_work_sync(phydev-phy_queue); free_irq(phydev-irq, phydev); diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 0c0f9c8..923b9c7 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -7386,7 +7386,7 @@ static int tg3_close(struct net_device *dev) { struct tg3 *tp = netdev_priv(dev); - flush_work_keventd(tp-reset_task); + cancel_work_sync(tp-reset_task); netif_stop_queue(dev); diff --git a/fs/aio.c b/fs/aio.c index d18690b..ac1c158 100644 ---
____call_usermodehelper: don't flush_signals()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c93465181fed0f8f5942a41108943dadea0aa345 Commit: c93465181fed0f8f5942a41108943dadea0aa345 Parent: 28e53bddf814485699a4142bc056fd37d4e11dd4 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:23 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 call_usermodehelper: don't flush_signals() call_usermodehelper() has no reason for flush_signals(). It is a fresh forked process which is going to exec a user-space application or exit on failure. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Cc: Rusty Russell [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/kmod.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/kernel/kmod.c b/kernel/kmod.c index 49cc4b9..6cea9db 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -135,7 +135,6 @@ static int call_usermodehelper(void *data) /* Unblock all signals and set the session keyring. */ new_session = key_get(sub_info-ring); - flush_signals(current); spin_lock_irq(current-sighand-siglock); old_session = __install_session_keyring(current, new_session); flush_signal_handlers(current, 1); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
kthread: don't depend on work queues
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=73c279927f89561ecb45b2dfdf9314bafcfd9f67 Commit: 73c279927f89561ecb45b2dfdf9314bafcfd9f67 Parent: c93465181fed0f8f5942a41108943dadea0aa345 Author: Eric W. Biederman [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:32 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 kthread: don't depend on work queues Currently there is a circular reference between work queue initialization and kthread initialization. This prevents the kthread infrastructure from initializing until after work queues have been initialized. We want the properties of tasks created with kthread_create to be as close as possible to the init_task and to not be contaminated by user processes. The later we start our kthreadd that creates these tasks the harder it is to avoid contamination from user processes and the more of a mess we have to clean up because the defaults have changed on us. So this patch modifies the kthread support to not use work queues but to instead use a simple list of structures, and to have kthreadd start from init_task immediately after our kernel thread that execs /sbin/init. By being a true child of init_task we only have to change those process settings that we want to have different from init_task, such as our process name, the cpus that are allowed, blocking all signals and setting SIGCHLD to SIG_IGN so that all of our children are reaped automatically. By being a true child of init_task we also naturally get our ppid set to 0 and do not wind up as a child of PID == 1. Ensuring that tasks generated by kthread_create will not slow down the functioning of the wait family of functions. [EMAIL PROTECTED]: use interruptible sleeps] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/linux/kthread.h |3 + init/main.c |5 ++ kernel/kthread.c| 124 ++- 3 files changed, 76 insertions(+), 56 deletions(-) diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 1c65e7a..00dd957 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -30,4 +30,7 @@ void kthread_bind(struct task_struct *k, unsigned int cpu); int kthread_stop(struct task_struct *k); int kthread_should_stop(void); +int kthreadd(void *unused); +extern struct task_struct *kthreadd_task; + #endif /* _LINUX_KTHREAD_H */ diff --git a/init/main.c b/init/main.c index c1537e0..e8d080c 100644 --- a/init/main.c +++ b/init/main.c @@ -54,6 +54,7 @@ #include linux/lockdep.h #include linux/pid_namespace.h #include linux/device.h +#include linux/kthread.h #include asm/io.h #include asm/bugs.h @@ -425,8 +426,12 @@ static void __init setup_command_line(char *command_line) static void noinline rest_init(void) __releases(kernel_lock) { + int pid; + kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND); numa_default_policy(); + pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES); + kthreadd_task = find_task_by_pid(pid); unlock_kernel(); /* diff --git a/kernel/kthread.c b/kernel/kthread.c index 87c50cc..0eb0070 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -1,7 +1,7 @@ /* Kernel thread helper functions. * Copyright (C) 2004 IBM Corporation, Rusty Russell. * - * Creation is done via keventd, so that we get a clean environment + * Creation is done via kthreadd, so that we get a clean environment * even if we're invoked from userspace (think modprobe, hotplug cpu, * etc.). */ @@ -15,24 +15,22 @@ #include linux/mutex.h #include asm/semaphore.h -/* - * We dont want to execute off keventd since it might - * hold a semaphore our callers hold too: - */ -static struct workqueue_struct *helper_wq; +static DEFINE_SPINLOCK(kthread_create_lock); +static LIST_HEAD(kthread_create_list); +struct task_struct *kthreadd_task; struct kthread_create_info { - /* Information passed to kthread() from keventd. */ + /* Information passed to kthread() from kthreadd. */ int (*threadfn)(void *data); void *data; struct completion started; - /* Result passed back to kthread_create() from keventd. */ + /* Result passed back to kthread_create() from kthreadd. */ struct task_struct *result; struct completion done; - struct work_struct work; + struct list_head list; }; struct kthread_stop_info @@ -60,42 +58,17 @@ int kthread_should_stop(void) } EXPORT_SYMBOL(kthread_should_stop); -static void kthread_exit_files(void) -{ - struct fs_struct *fs; - struct task_struct *tsk = current; - -
Change reparent_to_init to reparent_to_kthreadd
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=49d769d52e16efabd3ad47b7995522fff771371d Commit: 49d769d52e16efabd3ad47b7995522fff771371d Parent: 73c279927f89561ecb45b2dfdf9314bafcfd9f67 Author: Eric W. Biederman [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:33 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 Change reparent_to_init to reparent_to_kthreadd When a kernel thread calls daemonize, instead of reparenting the thread to init reparent the thread to kthreadd next to the threads created by kthread_create. This is really just a stop gap until daemonize goes away, but it does ensure no kernel threads are under init and they are all in one place that is easy to find. Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/exit.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kernel/exit.c b/kernel/exit.c index f5a7abb..bc982cd 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -26,6 +26,7 @@ #include linux/profile.h #include linux/mount.h #include linux/proc_fs.h +#include linux/kthread.h #include linux/mempolicy.h #include linux/taskstats_kern.h #include linux/delayacct.h @@ -254,26 +255,25 @@ static int has_stopped_jobs(struct pid *pgrp) } /** - * reparent_to_init - Reparent the calling kernel thread to the init task of the pid space that the thread belongs to. + * reparent_to_kthreadd - Reparent the calling kernel thread to kthreadd * * If a kernel thread is launched as a result of a system call, or if - * it ever exits, it should generally reparent itself to init so that - * it is correctly cleaned up on exit. + * it ever exits, it should generally reparent itself to kthreadd so it + * isn't in the way of other processes and is correctly cleaned up on exit. * * The various task state such as scheduling policy and priority may have * been inherited from a user process, so we reset them to sane values here. * - * NOTE that reparent_to_init() gives the caller full capabilities. + * NOTE that reparent_to_kthreadd() gives the caller full capabilities. */ -static void reparent_to_init(void) +static void reparent_to_kthreadd(void) { write_lock_irq(tasklist_lock); ptrace_unlink(current); /* Reparent to init */ remove_parent(current); - current-parent = child_reaper(current); - current-real_parent = child_reaper(current); + current-real_parent = current-parent = kthreadd_task; add_parent(current); /* Set the exit signal to SIGCHLD so we signal init on exit */ @@ -400,7 +400,7 @@ void daemonize(const char *name, ...) current-files = init_task.files; atomic_inc(current-files-count); - reparent_to_init(); + reparent_to_kthreadd(); } EXPORT_SYMBOL(daemonize); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
usbatm_heavy_init: don't use CLONE_SIGHAND
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b8a124da9261873e3e3541898d5c46d273afee34 Commit: b8a124da9261873e3e3541898d5c46d273afee34 Parent: 49d769d52e16efabd3ad47b7995522fff771371d Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:35 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 usbatm_heavy_init: don't use CLONE_SIGHAND usbatm_do_heavy_init() calls allow_signal() which plays with parent process's -sighand. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Acked-by: Duncan Sands [EMAIL PROTECTED] Cc: Greg KH [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- drivers/usb/atm/usbatm.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index b082d95..11e9b15 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c @@ -1033,7 +1033,7 @@ static int usbatm_do_heavy_init(void *arg) static int usbatm_heavy_init(struct usbatm_data *instance) { - int ret = kernel_thread(usbatm_do_heavy_init, instance, CLONE_KERNEL); + int ret = kernel_thread(usbatm_do_heavy_init, instance, CLONE_FS | CLONE_FILES); if (ret 0) { usb_err(instance, %s: failed to create kernel_thread (%d)!\n, __func__, ret); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
wait_for_helper: remove unneeded do_sigaction()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=90cce03d9bfcb28600a56efef6b0a5a4fbf6c2b1 Commit: 90cce03d9bfcb28600a56efef6b0a5a4fbf6c2b1 Parent: b8a124da9261873e3e3541898d5c46d273afee34 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:36 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 wait_for_helper: remove unneeded do_sigaction() allow_signal(SIGCHLD) does all necessary job, no need to call do_sigaction() prior to. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Cc: Rusty Russell [EMAIL PROTECTED] Cc: Eric W. Biederman [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/kmod.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/kernel/kmod.c b/kernel/kmod.c index 6cea9db..4d32eb0 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -185,14 +185,9 @@ static int wait_for_helper(void *data) { struct subprocess_info *sub_info = data; pid_t pid; - struct k_sigaction sa; /* Install a handler: if SIGCLD isn't handled sys_wait4 won't * populate the status, but will return -ECHILD. */ - sa.sa.sa_handler = SIG_IGN; - sa.sa.sa_flags = 0; - siginitset(sa.sa.sa_mask, sigmask(SIGCHLD)); - do_sigaction(SIGCHLD, sa, NULL); allow_signal(SIGCHLD); pid = kernel_thread(call_usermodehelper, sub_info, SIGCHLD); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
worker_thread: don't play with SIGCHLD and numa policy
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5de18d169739293e27e0cf9acfc75a2d2f4aa572 Commit: 5de18d169739293e27e0cf9acfc75a2d2f4aa572 Parent: 90cce03d9bfcb28600a56efef6b0a5a4fbf6c2b1 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:36 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 worker_thread: don't play with SIGCHLD and numa policy worker_thread() inherits ignored SIGCHLD and numa_default_policy() from its parent, kthreadd. No need to setup this again. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Acked-by: Eric W. Biederman [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c | 12 1 files changed, 0 insertions(+), 12 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c9ab429..25cee1a 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -289,23 +289,11 @@ static int worker_thread(void *__cwq) { struct cpu_workqueue_struct *cwq = __cwq; DEFINE_WAIT(wait); - struct k_sigaction sa; if (!cwq-wq-freezeable) current-flags |= PF_NOFREEZE; set_user_nice(current, -5); - /* -* We inherited MPOL_INTERLEAVE from the booting kernel. -* Set MPOL_DEFAULT to insure node local allocations. -*/ - numa_default_policy(); - - /* SIG_IGN makes children autoreap: see do_notify_parent(). */ - sa.sa.sa_handler = SIG_IGN; - sa.sa.sa_flags = 0; - siginitset(sa.sa.sa_mask, sigmask(SIGCHLD)); - do_sigaction(SIGCHLD, sa, (struct k_sigaction *)0); for (;;) { prepare_to_wait(cwq-more_work, wait, TASK_INTERRUPTIBLE); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
change kernel threads to ignore signals instead of blocking them
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=10ab825bdef8df510f99c703a5a2d9b13a4e31a5 Commit: 10ab825bdef8df510f99c703a5a2d9b13a4e31a5 Parent: 5de18d169739293e27e0cf9acfc75a2d2f4aa572 Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:37 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 change kernel threads to ignore signals instead of blocking them Currently kernel threads use sigprocmask(SIG_BLOCK) to protect against signals. This doesn't prevent the signal delivery, this only blocks signal_wake_up(). Every killall -33 kthreadd means a struct siginfo leak. Change kthreadd_setup() to set all handlers to SIG_IGN instead of blocking them (make a new helper ignore_signals() for that). If the kernel thread needs some signal, it should use allow_signal() anyway, and in that case it should not use CLONE_SIGHAND. Note that we can't change daemonize() (should die!) in the same way, because it can be used along with CLONE_SIGHAND. This means that allow_signal() still should unblock the signal to work correctly with daemonize()ed threads. However, disallow_signal() doesn't block the signal any longer but ignores it. NOTE: with or without this patch the kernel threads are not protected from handle_stop_signal(), this seems harmless, but not good. Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Acked-by: Eric W. Biederman [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/linux/sched.h |1 + kernel/exit.c |2 +- kernel/kthread.c | 17 +++-- kernel/signal.c | 10 ++ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 3d95c48..28000b1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1317,6 +1317,7 @@ extern int in_egroup_p(gid_t); extern void proc_caches_init(void); extern void flush_signals(struct task_struct *); +extern void ignore_signals(struct task_struct *); extern void flush_signal_handlers(struct task_struct *, int force_default); extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info); diff --git a/kernel/exit.c b/kernel/exit.c index bc982cd..b0c6f0c 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -347,7 +347,7 @@ int disallow_signal(int sig) return -EINVAL; spin_lock_irq(current-sighand-siglock); - sigaddset(current-blocked, sig); + current-sighand-action[(sig)-1].sa.sa_handler = SIG_IGN; recalc_sigpending(); spin_unlock_irq(current-sighand-siglock); return 0; diff --git a/kernel/kthread.c b/kernel/kthread.c index 0eb0070..df8a8e8 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -215,24 +215,13 @@ EXPORT_SYMBOL(kthread_stop); static __init void kthreadd_setup(void) { struct task_struct *tsk = current; - struct k_sigaction sa; - sigset_t blocked; set_task_comm(tsk, kthreadd); - /* Block and flush all signals */ - sigfillset(blocked); - sigprocmask(SIG_BLOCK, blocked, NULL); - flush_signals(tsk); + ignore_signals(tsk); - /* SIG_IGN makes children autoreap: see do_notify_parent(). */ - sa.sa.sa_handler = SIG_IGN; - sa.sa.sa_flags = 0; - siginitset(sa.sa.sa_mask, sigmask(SIGCHLD)); - do_sigaction(SIGCHLD, sa, (struct k_sigaction *)0); - - set_user_nice(current, -5); - set_cpus_allowed(current, CPU_MASK_ALL); + set_user_nice(tsk, -5); + set_cpus_allowed(tsk, CPU_MASK_ALL); } int kthreadd(void *unused) diff --git a/kernel/signal.c b/kernel/signal.c index 23ae6d6..2ac3a66 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -209,6 +209,16 @@ void flush_signals(struct task_struct *t) spin_unlock_irqrestore(t-sighand-siglock, flags); } +void ignore_signals(struct task_struct *t) +{ + int i; + + for (i = 0; i _NSIG; ++i) + t-sighand-action[i].sa.sa_handler = SIG_IGN; + + flush_signals(t); +} + /* * Flush all handlers for a task. */ - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Remove kthread_bind() call from _cpu_down()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7b0834c26fd796c79dfcc3939ed2b9122b75246f Commit: 7b0834c26fd796c79dfcc3939ed2b9122b75246f Parent: 10ab825bdef8df510f99c703a5a2d9b13a4e31a5 Author: Gautham R Shenoy [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:41 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 Remove kthread_bind() call from _cpu_down() We are anyway kthread_stop()ping other per-cpu kernel threads after move_task_off_dead_cpu(), so we can do it with the stop_machine_run thread as well. I just checked with Vatsa if there was any subtle reason why they had put in the kthread_bind() in cpu.c. Vatsa cannot seem to recollect any and I can't see any. So let us just remove the kthread_bind. Signed-off-by: Gautham R Shenoy [EMAIL PROTECTED] Cc: Oleg Nesterov [EMAIL PROTECTED] Cc: Eric W. Biederman [EMAIL PROTECTED] Cc: Rafael J. Wysocki [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/cpu.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 1a82394..28cb6c7 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -175,10 +175,6 @@ static int _cpu_down(unsigned int cpu) /* This actually kills the CPU. */ __cpu_die(cpu); - /* Move it here so it can run. */ - kthread_bind(p, get_cpu()); - put_cpu(); - /* CPU is completely dead: tell everyone. Too late to complain. */ if (raw_notifier_call_chain(cpu_chain, CPU_DEAD, hcpu) == NOTIFY_BAD) BUG(); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
make cancel_rearming_delayed_work() reliable
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6e84d644b5929789398914b0ccf447355dec6fb0 Commit: 6e84d644b5929789398914b0ccf447355dec6fb0 Parent: 7b0834c26fd796c79dfcc3939ed2b9122b75246f Author: Oleg Nesterov [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:46 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:53 2007 -0700 make cancel_rearming_delayed_work() reliable Thanks to Jarek Poplawski for the ideas and for spotting the bug in the initial draft patch. cancel_rearming_delayed_work() currently has many limitations, because it requires that dwork always re-arms itself via queue_delayed_work(). So it hangs forever if dwork doesn't do this, or cancel_rearming_delayed_work/ cancel_delayed_work was already called. It uses flush_workqueue() in a loop, so it can't be used if workqueue was freezed, and it is potentially live- lockable on busy system if delay is small. With this patch cancel_rearming_delayed_work() doesn't make any assumptions about dwork, it can re-arm itself via queue_delayed_work(), or queue_work(), or do nothing. As a side effect, cancel_work_sync() was changed to handle re-arming works as well. Disadvantages: - this patch adds wmb() to insert_work(). - slowdowns the fast path (when del_timer() succeeds on entry) of cancel_rearming_delayed_work(), because wait_on_work() is called unconditionally. In that case, compared to the old version, we are doing unneeded lock/unlock for each online CPU. On the other hand, this means we don't need to use cancel_work_sync() after cancel_rearming_delayed_work(). - complicates the code (.text grows by 130 bytes). [EMAIL PROTECTED]: fix speling] Signed-off-by: Oleg Nesterov [EMAIL PROTECTED] Cc: David Chinner [EMAIL PROTECTED] Cc: David Howells [EMAIL PROTECTED] Cc: Gautham Shenoy [EMAIL PROTECTED] Acked-by: Jarek Poplawski [EMAIL PROTECTED] Cc: Srivatsa Vaddagiri [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- kernel/workqueue.c | 140 ++-- 1 files changed, 91 insertions(+), 49 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 25cee1a..b976ed8 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -120,6 +120,11 @@ static void insert_work(struct cpu_workqueue_struct *cwq, struct work_struct *work, int tail) { set_wq_data(work, cwq); + /* +* Ensure that we get the right work-data if we see the +* result of list_add() below, see try_to_grab_pending(). +*/ + smp_wmb(); if (tail) list_add_tail(work-entry, cwq-worklist); else @@ -383,7 +388,46 @@ void fastcall flush_workqueue(struct workqueue_struct *wq) } EXPORT_SYMBOL_GPL(flush_workqueue); -static void wait_on_work(struct cpu_workqueue_struct *cwq, +/* + * Upon a successful return, the caller owns WORK_STRUCT_PENDING bit, + * so this work can't be re-armed in any way. + */ +static int try_to_grab_pending(struct work_struct *work) +{ + struct cpu_workqueue_struct *cwq; + int ret = 0; + + if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) + return 1; + + /* +* The queueing is in progress, or it is already queued. Try to +* steal it from -worklist without clearing WORK_STRUCT_PENDING. +*/ + + cwq = get_wq_data(work); + if (!cwq) + return ret; + + spin_lock_irq(cwq-lock); + if (!list_empty(work-entry)) { + /* +* This work is queued, but perhaps we locked the wrong cwq. +* In that case we must see the new value after rmb(), see +* insert_work()-wmb(). +*/ + smp_rmb(); + if (cwq == get_wq_data(work)) { + list_del_init(work-entry); + ret = 1; + } + } + spin_unlock_irq(cwq-lock); + + return ret; +} + +static void wait_on_cpu_work(struct cpu_workqueue_struct *cwq, struct work_struct *work) { struct wq_barrier barr; @@ -400,20 +444,7 @@ static void wait_on_work(struct cpu_workqueue_struct *cwq, wait_for_completion(barr.done); } -/** - * cancel_work_sync - block until a work_struct's callback has terminated - * @work: the work which is to be flushed - * - * cancel_work_sync() will attempt to cancel the work if it is queued. If the - * work's callback appears to be running, cancel_work_sync() will block until - * it has completed. - * - * cancel_work_sync() is designed to be used when the caller is tearing
remove nfs4_acl_add_ace()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8842c9655b2b7f0e8e6c50a773b649e5d8a57678 Commit: 8842c9655b2b7f0e8e6c50a773b649e5d8a57678 Parent: 6e84d644b5929789398914b0ccf447355dec6fb0 Author: Adrian Bunk [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:46 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:54 2007 -0700 remove nfs4_acl_add_ace() nfs4_acl_add_ace() can now be removed. Signed-off-by: Adrian Bunk [EMAIL PROTECTED] Acked-by: Neil Brown [EMAIL PROTECTED] Acked-by: J. Bruce Fields [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/nfsd/nfs4acl.c| 17 - include/linux/nfs4_acl.h |1 - 2 files changed, 0 insertions(+), 18 deletions(-) diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index 673a53c..cc3b7ba 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c @@ -137,7 +137,6 @@ struct ace_container { static short ace2type(struct nfs4_ace *); static void _posix_to_nfsv4_one(struct posix_acl *, struct nfs4_acl *, unsigned int); -void nfs4_acl_add_ace(struct nfs4_acl *, u32, u32, u32, int, uid_t); struct nfs4_acl * nfs4_acl_posix_to_nfsv4(struct posix_acl *pacl, struct posix_acl *dpacl, @@ -785,21 +784,6 @@ nfs4_acl_new(int n) return acl; } -void -nfs4_acl_add_ace(struct nfs4_acl *acl, u32 type, u32 flag, u32 access_mask, - int whotype, uid_t who) -{ - struct nfs4_ace *ace = acl-aces + acl-naces; - - ace-type = type; - ace-flag = flag; - ace-access_mask = access_mask; - ace-whotype = whotype; - ace-who = who; - - acl-naces++; -} - static struct { char *string; int stringlen; @@ -851,6 +835,5 @@ nfs4_acl_write_who(int who, char *p) } EXPORT_SYMBOL(nfs4_acl_new); -EXPORT_SYMBOL(nfs4_acl_add_ace); EXPORT_SYMBOL(nfs4_acl_get_whotype); EXPORT_SYMBOL(nfs4_acl_write_who); diff --git a/include/linux/nfs4_acl.h b/include/linux/nfs4_acl.h index 409b6e0..c9c05a7 100644 --- a/include/linux/nfs4_acl.h +++ b/include/linux/nfs4_acl.h @@ -44,7 +44,6 @@ #define NFS4_ACL_MAX 170 struct nfs4_acl *nfs4_acl_new(int); -void nfs4_acl_add_ace(struct nfs4_acl *, u32, u32, u32, int, uid_t); int nfs4_acl_get_whotype(char *, u32); int nfs4_acl_write_who(int who, char *p); int nfs4_acl_permission(struct nfs4_acl *acl, uid_t owner, gid_t group, - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
The NFSv2/NFSv3 server does not handle zero length WRITE requests correctly
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f34b95689d2ce001c157b1604289ff240b4bdee0 Commit: f34b95689d2ce001c157b1604289ff240b4bdee0 Parent: 8842c9655b2b7f0e8e6c50a773b649e5d8a57678 Author: Peter Staubach [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:48 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:54 2007 -0700 The NFSv2/NFSv3 server does not handle zero length WRITE requests correctly The NFSv2 and NFSv3 servers do not handle WRITE requests for 0 bytes correctly. The specifications indicate that the server should accept the request, but it should mostly turn into a no-op. Currently, the server will return an XDR decode error, which it should not. Attached is a patch which addresses this issue. It also adds some boundary checking to ensure that the request contains as much data as was requested to be written. It also correctly handles an NFSv3 request which requests to write more data than the server has stated that it is prepared to handle. Previously, there was some support which looked like it should work, but wasn't quite right. Signed-off-by: Peter Staubach [EMAIL PROTECTED] Acked-by: Neil Brown [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/nfsd/nfs3xdr.c | 48 ++-- fs/nfsd/nfsxdr.c | 46 +++--- 2 files changed, 77 insertions(+), 17 deletions(-) diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 7e4bb0a..43fb360 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c @@ -369,7 +369,7 @@ int nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd3_writeargs *args) { - unsigned int len, v, hdr; + unsigned int len, v, hdr, dlen; u32 max_blocksize = svc_max_payload(rqstp); if (!(p = decode_fh(p, args-fh)) @@ -379,18 +379,47 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, args-count = ntohl(*p++); args-stable = ntohl(*p++); len = args-len = ntohl(*p++); + /* +* The count must equal the amount of data passed. +*/ + if (args-count != args-len) + return 0; + /* +* Check to make sure that we got the right number of +* bytes. +* +* If more than one page was used, then compute the length +* of the data in the request as the total size of the +* request minus the transport protocol headers minus the +* RPC protocol headers minus the NFS protocol fields +* already consumed. If the request fits into a single +* page, then compete the length of the data as the size +* of the NFS portion of the request minus the NFS +* protocol fields already consumed. +*/ hdr = (void*)p - rqstp-rq_arg.head[0].iov_base; - if (rqstp-rq_arg.len hdr || - rqstp-rq_arg.len - hdr len) + if (rqstp-rq_respages != rqstp-rq_pages + 1) { + dlen = rqstp-rq_arg.len - + (PAGE_SIZE - rqstp-rq_arg.head[0].iov_len) - hdr; + } else { + dlen = rqstp-rq_arg.head[0].iov_len - hdr; + } + /* +* Round the length of the data which was specified up to +* the next multiple of XDR units and then compare that +* against the length which was actually received. +*/ + if (dlen != ((len + 3) ~0x3)) return 0; + if (args-count max_blocksize) { + args-count = max_blocksize; + len = args-len = max_blocksize; + } rqstp-rq_vec[0].iov_base = (void*)p; rqstp-rq_vec[0].iov_len = rqstp-rq_arg.head[0].iov_len - hdr; - - if (len max_blocksize) - len = max_blocksize; - v= 0; + v = 0; while (len rqstp-rq_vec[v].iov_len) { len -= rqstp-rq_vec[v].iov_len; v++; @@ -398,9 +427,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, rqstp-rq_vec[v].iov_len = PAGE_SIZE; } rqstp-rq_vec[v].iov_len = len; - args-vlen = v+1; - - return args-count == args-len rqstp-rq_vec[0].iov_len 0; + args-vlen = v + 1; + return 1; } int diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index 0c24b9e..6035e03 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c @@ -284,8 +284,9 @@ int nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_writeargs *args) { - unsigned int len; + unsigned int len, hdr, dlen; int v; + if (!(p = decode_fh(p, args-fh))) return 0; @@ -293,11 +294,42 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32
knfsd: rename sk_defer_lock to sk_lock
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7ac1bea5507218da03f6005d228789da5a831c3f Commit: 7ac1bea5507218da03f6005d228789da5a831c3f Parent: f34b95689d2ce001c157b1604289ff240b4bdee0 Author: NeilBrown [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:48 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:54 2007 -0700 knfsd: rename sk_defer_lock to sk_lock Now that sk_defer_lock protects two different things, make the name more generic. Also don't bother with disabling _bh as the lock is only ever taken from process context. Signed-off-by: Neil Brown [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- include/linux/sunrpc/svcsock.h |3 ++- net/sunrpc/svcauth_unix.c | 10 +- net/sunrpc/svcsock.c | 13 +++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 7909687..e21dd93 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h @@ -37,7 +37,8 @@ struct svc_sock { atomic_tsk_reserved;/* space on outq that is reserved */ - spinlock_t sk_defer_lock; /* protects sk_deferred */ + spinlock_t sk_lock;/* protects sk_deferred and +* sk_info_authunix */ struct list_headsk_deferred;/* deferred requests that need to * be revisted */ struct mutexsk_mutex; /* to serialize sending data */ diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 2bd23ea..07dcd20 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c @@ -385,7 +385,7 @@ ip_map_cached_get(struct svc_rqst *rqstp) { struct ip_map *ipm; struct svc_sock *svsk = rqstp-rq_sock; - spin_lock_bh(svsk-sk_defer_lock); + spin_lock(svsk-sk_lock); ipm = svsk-sk_info_authunix; if (ipm != NULL) { if (!cache_valid(ipm-h)) { @@ -395,13 +395,13 @@ ip_map_cached_get(struct svc_rqst *rqstp) * same IP address. */ svsk-sk_info_authunix = NULL; - spin_unlock_bh(svsk-sk_defer_lock); + spin_unlock(svsk-sk_lock); cache_put(ipm-h, ip_map_cache); return NULL; } cache_get(ipm-h); } - spin_unlock_bh(svsk-sk_defer_lock); + spin_unlock(svsk-sk_lock); return ipm; } @@ -410,14 +410,14 @@ ip_map_cached_put(struct svc_rqst *rqstp, struct ip_map *ipm) { struct svc_sock *svsk = rqstp-rq_sock; - spin_lock_bh(svsk-sk_defer_lock); + spin_lock(svsk-sk_lock); if (svsk-sk_sock-type == SOCK_STREAM svsk-sk_info_authunix == NULL) { /* newly cached, keep the reference */ svsk-sk_info_authunix = ipm; ipm = NULL; } - spin_unlock_bh(svsk-sk_defer_lock); + spin_unlock(svsk-sk_lock); if (ipm) cache_put(ipm-h, ip_map_cache); } diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 22f61ae..fdb1386 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -53,7 +53,8 @@ * svc_serv-sv_lock protects sv_tempsocks, sv_permsocks, sv_tmpcnt. * when both need to be taken (rare), svc_serv-sv_lock is first. * BKL protects svc_serv-sv_nrthread. - * svc_sock-sk_defer_lock protects the svc_sock-sk_deferred list + * svc_sock-sk_lock protects the svc_sock-sk_deferred list + * and the -sk_info_authunix cache. * svc_sock-sk_flags.SK_BUSY prevents a svc_sock being enqueued multiply. * * Some flags can be set to certain values at any time @@ -1633,7 +1634,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, svsk-sk_server = serv; atomic_set(svsk-sk_inuse, 1); svsk-sk_lastrecv = get_seconds(); - spin_lock_init(svsk-sk_defer_lock); + spin_lock_init(svsk-sk_lock); INIT_LIST_HEAD(svsk-sk_deferred); INIT_LIST_HEAD(svsk-sk_ready); mutex_init(svsk-sk_mutex); @@ -1857,9 +1858,9 @@ static void svc_revisit(struct cache_deferred_req *dreq, int too_many) dprintk(revisit queued\n); svsk = dr-svsk; dr-svsk = NULL; - spin_lock_bh(svsk-sk_defer_lock); + spin_lock(svsk-sk_lock); list_add(dr-handle.recent, svsk-sk_deferred); - spin_unlock_bh(svsk-sk_defer_lock); + spin_unlock(svsk-sk_lock); set_bit(SK_DEFERRED, svsk-sk_flags); svc_sock_enqueue(svsk); svc_sock_put(svsk); @@ -1925,7 +1926,7 @@ static struct
nfsd/nfs4state: remove unnecessary daemonize call
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=669716433598a1498049e75a84a5aaf69c8da173 Commit: 669716433598a1498049e75a84a5aaf69c8da173 Parent: 7ac1bea5507218da03f6005d228789da5a831c3f Author: Eric W. Biederman [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:49 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:54 2007 -0700 nfsd/nfs4state: remove unnecessary daemonize call Acked-by: Neil Brown [EMAIL PROTECTED] Cc: Trond Myklebust [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/nfsd/nfs4state.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 678f3be..3cc8ce4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1326,8 +1326,6 @@ do_recall(void *__dp) { struct nfs4_delegation *dp = __dp; - daemonize(nfsv4-recall); - nfsd4_cb_recall(dp); return 0; } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
sunrpc: fix error path in module_init
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5bd5f5812bfa753218e02cb773e06ede48055798 Commit: 5bd5f5812bfa753218e02cb773e06ede48055798 Parent: cd123012d99fde4759500fee611e724e4f3016e3 Author: Akinobu Mita [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:51 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:54 2007 -0700 sunrpc: fix error path in module_init register_rpc_pipefs() needs to clean up rpc_inode_cache by kmem_cache_destroy() on register_filesystem() failure. init_sunrpc() needs to unregister rpc_pipe_fs by unregister_rpc_pipefs() when rpc_init_mempool() returns error. Signed-off-by: Akinobu Mita [EMAIL PROTECTED] Cc: Neil Brown [EMAIL PROTECTED] Cc: Trond Myklebust [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- net/sunrpc/rpc_pipe.c|9 - net/sunrpc/sunrpc_syms.c |6 -- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index ad39b47..a2f1893 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -845,6 +845,8 @@ init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) int register_rpc_pipefs(void) { + int err; + rpc_inode_cachep = kmem_cache_create(rpc_inode_cache, sizeof(struct rpc_inode), 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| @@ -852,7 +854,12 @@ int register_rpc_pipefs(void) init_once, NULL); if (!rpc_inode_cachep) return -ENOMEM; - register_filesystem(rpc_pipe_fs_type); + err = register_filesystem(rpc_pipe_fs_type); + if (err) { + kmem_cache_destroy(rpc_inode_cachep); + return err; + } + return 0; } diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 43ecf62..0d35bc7 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c @@ -146,9 +146,11 @@ init_sunrpc(void) int err = register_rpc_pipefs(); if (err) goto out; - err = rpc_init_mempool() != 0; - if (err) + err = rpc_init_mempool(); + if (err) { + unregister_rpc_pipefs(); goto out; + } #ifdef RPC_DEBUG rpc_register_sysctl(); #endif - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RPC: add wrapper for svc_reserve to account for checksum
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cd123012d99fde4759500fee611e724e4f3016e3 Commit: cd123012d99fde4759500fee611e724e4f3016e3 Parent: 669716433598a1498049e75a84a5aaf69c8da173 Author: Jeff Layton [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:50 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:54 2007 -0700 RPC: add wrapper for svc_reserve to account for checksum When the kernel calls svc_reserve to downsize the expected size of an RPC reply, it fails to account for the possibility of a checksum at the end of the packet. If a client mounts a NFSv2/3 with sec=krb5i/p, and does I/O then you'll generally see messages similar to this in the server's ring buffer: RPC request reserved 164 but used 208 While I was never able to verify it, I suspect that this problem is also the root cause of some oopses I've seen under these conditions: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=227726 This is probably also a problem for other sec= types and for NFSv4. The large reserved size for NFSv4 compound packets seems to generally paper over the problem, however. This patch adds a wrapper for svc_reserve that accounts for the possibility of a checksum. It also fixes up the appropriate callers of svc_reserve to call the wrapper. For now, it just uses a hardcoded value that I determined via testing. That value may need to be revised upward as things change, or we may want to eventually add a new auth_op that attempts to calculate this somehow. Unfortunately, there doesn't seem to be a good way to reliably determine the expected checksum length prior to actually calculating it, particularly with schemes like spkm3. Signed-off-by: Jeff Layton [EMAIL PROTECTED] Acked-by: Neil Brown [EMAIL PROTECTED] Cc: Trond Myklebust [EMAIL PROTECTED] Acked-by: J. Bruce Fields [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/nfsd/nfs3proc.c |2 +- fs/nfsd/nfsproc.c |2 +- include/linux/sunrpc/svc.h | 19 +++ net/sunrpc/svc.c |2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index 7f5bad0..eac8283 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -177,7 +177,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp, if (max_blocksize resp-count) resp-count = max_blocksize; - svc_reserve(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)2) + resp-count +4); + svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)2) + resp-count +4); fh_copy(resp-fh, argp-fh); nfserr = nfsd_read(rqstp, resp-fh, NULL, diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 5cc2eec..b2c7147 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -155,7 +155,7 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, argp-count); argp-count = NFSSVC_MAXBLKSIZE_V2; } - svc_reserve(rqstp, (192) + argp-count + 4); + svc_reserve_auth(rqstp, (192) + argp-count + 4); resp-count = argp-count; nfserr = nfsd_read(rqstp, fh_copy(resp-fh, argp-fh), NULL, diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 35fa4d5..4a7ae8a 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -396,4 +396,23 @@ char *svc_print_addr(struct svc_rqst *, char *, size_t); #defineRPC_MAX_ADDRBUFLEN (63U) +/* + * When we want to reduce the size of the reserved space in the response + * buffer, we need to take into account the size of any checksum data that + * may be at the end of the packet. This is difficult to determine exactly + * for all cases without actually generating the checksum, so we just use a + * static value. + */ +static inline void +svc_reserve_auth(struct svc_rqst *rqstp, int space) +{ + int added_space = 0; + + switch(rqstp-rq_authop-flavour) { + case RPC_AUTH_GSS: + added_space = RPC_MAX_AUTH_SIZE; + } + return svc_reserve(rqstp, space + added_space); +} + #endif /* SUNRPC_SVC_H */ diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index b7503c1..e673ef9 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -907,7 +907,7 @@ svc_process(struct svc_rqst *rqstp) * better idea of reply size */ if (procp-pc_xdrressize) - svc_reserve(rqstp, procp-pc_xdrressize2); + svc_reserve_auth(rqstp, procp-pc_xdrressize2); /* Call the function that processes the request. */ if (!versp-vs_dispatch) { - To unsubscribe from this list: send the
knfsd: avoid use of unitialised variables on error path when nfs exports
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=402acd29e552cb80109d1d5c0ada53f634465d87 Commit: 402acd29e552cb80109d1d5c0ada53f634465d87 Parent: 5bd5f5812bfa753218e02cb773e06ede48055798 Author: NeilBrown [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:52 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:54 2007 -0700 knfsd: avoid use of unitialised variables on error path when nfs exports We need to zero various parts of 'exp' before any 'goto out', otherwise when we go to free the contents... we die. Signed-off-by: Neil Brown [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- fs/nfsd/export.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 6f24768..79bd03b 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -469,6 +469,13 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) nd.dentry = NULL; exp.ex_path = NULL; + /* fs locations */ + exp.ex_fslocs.locations = NULL; + exp.ex_fslocs.locations_count = 0; + exp.ex_fslocs.migrated = 0; + + exp.ex_uuid = NULL; + if (mesg[mlen-1] != '\n') return -EINVAL; mesg[mlen-1] = 0; @@ -509,13 +516,6 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) if (exp.h.expiry_time == 0) goto out; - /* fs locations */ - exp.ex_fslocs.locations = NULL; - exp.ex_fslocs.locations_count = 0; - exp.ex_fslocs.migrated = 0; - - exp.ex_uuid = NULL; - /* flags */ err = get_int(mesg, an_int); if (err == -ENOENT) - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: rpc: fix server-side wrapping of krb5i replies
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=153e44d22fb5f98198f90fbf56e89b345e48534d Commit: 153e44d22fb5f98198f90fbf56e89b345e48534d Parent: 402acd29e552cb80109d1d5c0ada53f634465d87 Author: NeilBrown [EMAIL PROTECTED] AuthorDate: Wed May 9 02:34:52 2007 -0700 Committer: Linus Torvalds [EMAIL PROTECTED] CommitDate: Wed May 9 12:30:54 2007 -0700 knfsd: rpc: fix server-side wrapping of krb5i replies It's not necessarily correct to assume that the xdr_buf used to hold the server's reply must have page data whenever it has tail data. And there's no need for us to deal with that case separately anyway. Acked-by: J. Bruce Fields [EMAIL PROTECTED] Signed-off-by: Neil Brown [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Linus Torvalds [EMAIL PROTECTED] --- net/sunrpc/auth_gss/svcauth_gss.c |8 +--- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index db298b5..c678f5f 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -1196,13 +1196,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) if (xdr_buf_subsegment(resbuf, integ_buf, integ_offset, integ_len)) BUG(); - if (resbuf-page_len == 0 -resbuf-head[0].iov_len + RPC_MAX_AUTH_SIZE -PAGE_SIZE) { - BUG_ON(resbuf-tail[0].iov_len); - /* Use head for everything */ - resv = resbuf-head[0]; - } else if (resbuf-tail[0].iov_base == NULL) { + if (resbuf-tail[0].iov_base == NULL) { if (resbuf-head[0].iov_len + RPC_MAX_AUTH_SIZE PAGE_SIZE) goto out_err; resbuf-tail[0].iov_base = resbuf-head[0].iov_base - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html