1. 09 10月, 2012 22 次提交
  2. 06 10月, 2012 16 次提交
    • H
      lib/decompress.c add __init to decompress_method and data · 33e2a422
      Hein Tibosch 提交于
      Fix the warning:
      
        WARNING: vmlinux.o(.text+0x14cfd8): Section mismatch in reference from the variable compressed_formats to the function .init.text:gunzip()
        The function compressed_formats() references
        the function __init gunzip().
        etc..
      
      Within decompress.c, compressed_formats[] needs 'a __initdata annotation',
      because some of it's data members refer to functions which will be
      unloaded after init.
      
      Consequently, its user decompress_method() will get the __init prefix.
      Signed-off-by: NHein Tibosch <hein_tibosch@yahoo.es>
      Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
      Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      33e2a422
    • T
      scatterlist: atomic sg_mapping_iter() no longer needs disabled IRQs · 8290e2d2
      Tejun Heo 提交于
      SG mapping iterator w/ SG_MITER_ATOMIC set required IRQ disabled because
      it originally used KM_BIO_SRC_IRQ to allow use from IRQ handlers.
      kmap_atomic() has long been updated to handle stacking atomic mapping
      requests on per-cpu basis and only requires not sleeping while mapped.
      
      Update sg_mapping_iter such that atomic iterators only require disabling
      preemption instead of disabling IRQ.
      
      While at it, convert wte weird @ARG@ notations to @ARG in the comment of
      sg_miter_start().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Maxim Levitsky <maximlevitsky@gmail.com>
      Cc: Alex Dubov <oakad@yahoo.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8290e2d2
    • B
      lib/plist.c: make plist test announcements KERN_DEBUG · 17d7aac9
      Borislav Petkov 提交于
      They show up in dmesg
      
      [    4.041094] start plist test
      [    4.045804] end plist test
      
      without a lot of meaning so hide them behind debug loglevel.
      Signed-off-by: NBorislav Petkov <borislav.petkov@amd.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      17d7aac9
    • J
      lib/vsprintf.c: improve standard conformance of sscanf() · da99075c
      Jan Beulich 提交于
      Xen's pciback points out a couple of deficiencies with vsscanf()'s
      standard conformance:
      
      - Trailing character matching cannot be checked by the caller: With a
        format string of "(%x:%x.%x) %n" absence of the closing parenthesis
        cannot be checked, as input of "(00:00.0)" doesn't cause the %n to be
        evaluated (because of the code not skipping white space before the
        trailing %n).
      
      - The parameter corresponding to a trailing %n could get filled even if
        there was a matching error: With a format string of "(%x:%x.%x)%n",
        input of "(00:00.0]" would still fill the respective variable pointed to
        (and hence again make the mismatch non-detectable by the caller).
      
      This patch aims at fixing those, but leaves other non-conforming aspects
      of it untouched, among them these possibly relevant ones:
      
      - improper handling of the assignment suppression character '*' (blindly
        discarding all succeeding non-white space from the format and input
        strings),
      
      - not honoring conversion specifiers for %n, - not recognizing the C99
        conversion specifier 't' (recognized by vsprintf()).
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      da99075c
    • V
      lib/spinlock_debug: avoid livelock in do_raw_spin_lock() · 214f766e
      Vikram Mulukutla 提交于
      The logic in do_raw_spin_lock() attempts to acquire a spinlock by invoking
      arch_spin_trylock() in a loop with a delay between each attempt.  Now
      consider the following situation in a 2 CPU system:
      
      1. CPU-0 continually acquires and releases a spinlock in a
         tight loop; it stays in this loop until some condition X
         is satisfied. X can only be satisfied by another CPU.
      
      2. CPU-1 tries to acquire the same spinlock, in an attempt
         to satisfy the aforementioned condition X. However, it
         never sees the unlocked value of the lock because the
         debug spinlock code uses trylock instead of just lock;
         it checks at all the wrong moments - whenever CPU-0 has
         locked the lock.
      
      Now in the absence of debug spinlocks, the architecture specific spinlock
      code can correctly allow CPU-1 to wait in a "queue" (e.g., ticket
      spinlocks), ensuring that it acquires the lock at some point.  However,
      with the debug spinlock code, livelock can easily occur due to the use of
      try_lock, which obviously cannot put the CPU in that "queue".  This
      queueing mechanism is implemented in both x86 and ARM spinlock code.
      
      Note that the situation mentioned above is not hypothetical.  A real
      problem was encountered where CPU-0 was running hrtimer_cancel with
      interrupts disabled, and CPU-1 was attempting to run the hrtimer that
      CPU-0 was trying to cancel.
      
      Address this by actually attempting arch_spin_lock once it is suspected
      that there is a spinlock lockup.  If we're in a situation that is
      described above, the arch_spin_lock should succeed; otherwise other
      timeout mechanisms (e.g., watchdog) should alert the system of a lockup.
      Therefore, if there is a genuine system problem and the spinlock can't be
      acquired, the end result (irrespective of this change being present) is
      the same.  If there is a livelock caused by the debug code, this change
      will allow the lock to be acquired, depending on the implementation of the
      lower level arch specific spinlock code.
      
      [akpm@linux-foundation.org: tweak comment]
      Signed-off-by: NVikram Mulukutla <markivx@codeaurora.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      214f766e
    • B
      genalloc: make it possible to use a custom allocation algorithm · ca279cf1
      Benjamin Gaignard 提交于
      Premit use of another algorithm than the default first-fit one.  For
      example a custom algorithm could be used to manage alignment requirements.
      
      As I can't predict all the possible requirements/needs for all allocation
      uses cases, I add a "free" field 'void *data' to pass any needed
      information to the allocation function.  For example 'data' could be used
      to handle a structure where you store the alignment, the expected memory
      bank, the requester device, or any information that could influence the
      allocation algorithm.
      
      An usage example may look like this:
      struct my_pool_constraints {
      	int align;
      	int bank;
      	...
      };
      
      unsigned long my_custom_algo(unsigned long *map, unsigned long size,
      		unsigned long start, unsigned int nr, void *data)
      {
      	struct my_pool_constraints *constraints = data;
      	...
      	deal with allocation contraints
      	...
      	return the index in bitmap where perform the allocation
      }
      
      void create_my_pool()
      {
      	struct my_pool_constraints c;
      	struct gen_pool *pool = gen_pool_create(...);
      	gen_pool_add(pool, ...);
      	gen_pool_set_algo(pool, my_custom_algo, &c);
      }
      
      Add of best-fit algorithm function:
      most of the time best-fit is slower then first-fit but memory fragmentation
      is lower. The random buffer allocation/free tests don't show any arithmetic
      relation between the allocation time and fragmentation but the
      best-fit algorithm
      is sometime able to perform the allocation when the first-fit can't.
      
      This new algorithm help to remove static allocations on ESRAM, a small but
      fast on-chip RAM of few KB, used for high-performance uses cases like DMA
      linked lists, graphic accelerators, encoders/decoders. On the Ux500
      (in the ARM tree) we have define 5 ESRAM banks of 128 KB each and use of
      static allocations becomes unmaintainable:
      cd arch/arm/mach-ux500 && grep -r ESRAM .
      ./include/mach/db8500-regs.h:/* Base address and bank offsets for ESRAM */
      ./include/mach/db8500-regs.h:#define U8500_ESRAM_BASE   0x40000000
      ./include/mach/db8500-regs.h:#define U8500_ESRAM_BANK_SIZE      0x00020000
      ./include/mach/db8500-regs.h:#define U8500_ESRAM_BANK0  U8500_ESRAM_BASE
      ./include/mach/db8500-regs.h:#define U8500_ESRAM_BANK1       (U8500_ESRAM_BASE + U8500_ESRAM_BANK_SIZE)
      ./include/mach/db8500-regs.h:#define U8500_ESRAM_BANK2       (U8500_ESRAM_BANK1 + U8500_ESRAM_BANK_SIZE)
      ./include/mach/db8500-regs.h:#define U8500_ESRAM_BANK3       (U8500_ESRAM_BANK2 + U8500_ESRAM_BANK_SIZE)
      ./include/mach/db8500-regs.h:#define U8500_ESRAM_BANK4       (U8500_ESRAM_BANK3 + U8500_ESRAM_BANK_SIZE)
      ./include/mach/db8500-regs.h:#define U8500_ESRAM_DMA_LCPA_OFFSET     0x10000
      ./include/mach/db8500-regs.h:#define U8500_DMA_LCPA_BASE
      (U8500_ESRAM_BANK0 + U8500_ESRAM_DMA_LCPA_OFFSET)
      ./include/mach/db8500-regs.h:#define U8500_DMA_LCLA_BASE U8500_ESRAM_BANK4
      
      I want to use genalloc to do dynamic allocations but I need to be able to
      fine tune the allocation algorithm. I my case best-fit algorithm give
      better results than first-fit, but it will not be true for every use case.
      Signed-off-by: NBenjamin Gaignard <benjamin.gaignard@stericsson.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ca279cf1
    • D
      lib/gcd.c: prevent possible div by 0 · e9687567
      Davidlohr Bueso 提交于
      Account for all properties when a and/or b are 0:
      gcd(0, 0) = 0
      gcd(a, 0) = a
      gcd(0, b) = b
      
      Fixes no known problems in current kernels.
      Signed-off-by: NDavidlohr Bueso <dave@gnu.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e9687567
    • J
      lib/Kconfig.debug: adjust hard-lockup related Kconfig options · 8f1f66ed
      Jan Beulich 提交于
      The main option should not appear in the resulting .config when the
      dependencies aren't met (i.e.  use "depends on" rather than directly
      setting the default from the combined dependency values).
      
      The sub-options should depend on the main option rather than a more
      generic higher level one.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Acked-by: NDon Zickus <dzickus@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8f1f66ed
    • A
      lib/parser.c: avoid overflow in match_number() · 77dd3b0b
      Alex Elder 提交于
      The result of converting an integer value to another signed integer type
      that's unable to represent the original value is implementation defined.
      (See notes in section 6.3.1.3 of the C standard.)
      
      In match_number(), the result of simple_strtol() (which returns type long)
      is assigned to a value of type int.
      
      Instead, handle the result of simple_strtol() in a well-defined way, and
      return -ERANGE if the result won't fit in the int variable used to hold
      the parsed result.
      
      No current callers pay attention to the particular error value returned,
      so this additional return code shouldn't do any harm.
      
      [akpm@linux-foundation.org: coding-style tweaks]
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Cc: Randy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      77dd3b0b
    • F
      idr: rename MAX_LEVEL to MAX_IDR_LEVEL · 125c4c70
      Fengguang Wu 提交于
      To avoid name conflicts:
      
        drivers/video/riva/fbdev.c:281:9: sparse: preprocessor token MAX_LEVEL redefined
      
      While at it, also make the other names more consistent and add
      parentheses.
      
      [akpm@linux-foundation.org: repair fallout]
      [sfr@canb.auug.org.au: IB/mlx4: fix for MAX_ID_MASK to MAX_IDR_MASK name change]
      Signed-off-by: NFengguang Wu <fengguang.wu@intel.com>
      Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
      Cc: walter harms <wharms@bfs.de>
      Cc: Glauber Costa <glommer@parallels.com>
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      125c4c70
    • A
    • G
      lib: vsprintf: fix broken comments · f4000516
      George Spelvin 提交于
      Numbering the 8 potential digits 2 though 9 never did make a lot of sense.
      Signed-off-by: NGeorge Spelvin <linux@horizon.com>
      Cc: Denys Vlasenko <vda.linux@googlemail.com>
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f4000516
    • G
      lib: vsprintf: optimize put_dec_trunc8() · cb239d0a
      George Spelvin 提交于
      If you're going to have a conditional branch after each 32x32->64-bit
      multiply, might as well shrink the code and make it a loop.
      
      This also avoids using the long multiply for small integers.
      
      (This leaves the comments in a confusing state, but that's a separate
      patch to make review easier.)
      Signed-off-by: NGeorge Spelvin <linux@horizon.com>
      Cc: Denys Vlasenko <vda.linux@googlemail.com>
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Cc: Rabin Vincent <rabin@rab.in>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cb239d0a
    • G
      lib: vsprintf: optimize division by 10000 · 2359172a
      George Spelvin 提交于
      The same multiply-by-inverse technique can be used to convert division by
      10000 to a 32x32->64-bit multiply.
      Signed-off-by: NGeorge Spelvin <linux@horizon.com>
      Cc: Denys Vlasenko <vda.linux@googlemail.com>
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2359172a
    • G
      lib: vsprintf: optimize division by 10 for small integers · e49317d4
      George Spelvin 提交于
      Shrink the reciprocal approximations used in put_dec_full4() based on the
      comments in put_dec_full9().
      Signed-off-by: NGeorge Spelvin <linux@horizon.com>
      Cc: Denys Vlasenko <vda.linux@googlemail.com>
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e49317d4
    • J
      sections: fix const sections for crc32 table · 8f243af4
      Joe Mario 提交于
      Fix the const sections for the code generated by crc32 table.  There's
      no ro version of the cacheline aligned section, so we cannot put in
      const data without a conflict Just don't make the crc tables const for
      now.
      
      [ak@linux.intel.com: some fixes and new description]
      [akpm@linux-foundation.org: checkpatch fixes]
      Signed-off-by: NJoe Mario <jmario@redhat.com>
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8f243af4
  3. 02 10月, 2012 1 次提交
  4. 25 9月, 2012 1 次提交