01 Feb, 2011

1 commit

  • Fix kernel-doc warning in kernel.h from commit 7ef88ad56145
    ("BUILD_BUG_ON: make it handle more cases"):

    Warning(include/linux/kernel.h:605): No description found for parameter 'condition'
    Warning(include/linux/kernel.h:605): Excess function parameter 'cond' description in 'BUILD_BUG_ON'

    Signed-off-by: Randy Dunlap
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

24 Jan, 2011

2 commits

  • Now BUILD_BUG_ON() can handle optimizable constants, we don't need
    MAYBE_BUILD_BUG_ON any more.

    Signed-off-by: Rusty Russell

    Rusty Russell
     
  • BUILD_BUG_ON used to use the optimizer to do code elimination or fail
    at link time; it was changed to first the size of a negative array (a
    nicer compile time error), then (in
    8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield.

    This forced us to change some non-constant cases to MAYBE_BUILD_BUG_ON();
    as Jan points out in that commit, it didn't work as intended anyway.

    bitfields: needs a literal constant at parse time, and can't be put under
    "if (__builtin_constant_p(x))" for example.
    negative array: can handle anything, but if the compiler can't tell it's
    a constant, silently has no effect.
    link time: breaks link if the compiler can't determine the value, but the
    linker output is not usually as informative as a compiler error.

    If we use the negative-array-size method *and* the link time trick,
    we get the ability to use BUILD_BUG_ON() under __builtin_constant_p()
    branches, and maximal ability for the compiler to detect errors at
    build time.

    We also document it thoroughly.

    Signed-off-by: Rusty Russell
    Cc: Jan Beulich
    Acked-by: Hollis Blanchard

    Rusty Russell
     

20 Jan, 2011

1 commit

  • During early boot, local IRQ is disabled until IRQ subsystem is
    properly initialized. During this time, no one should enable
    local IRQ and some operations which usually are not allowed with
    IRQ disabled, e.g. operations which might sleep or require
    communications with other processors, are allowed.

    lockdep tracked this with early_boot_irqs_off/on() callbacks.
    As other subsystems need this information too, move it to
    init/main.c and make it generally available. While at it,
    toggle the boolean to early_boot_irqs_disabled instead of
    enabled so that it can be initialized with %false and %true
    indicates the exceptional condition.

    Signed-off-by: Tejun Heo
    Acked-by: Peter Zijlstra
    Acked-by: Pekka Enberg
    Cc: Linus Torvalds
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tejun Heo
     

14 Jan, 2011

2 commits

  • Lumpy reclaim is disruptive. It reclaims a large number of pages and
    ignores the age of the pages it reclaims. This can incur significant
    stalls and potentially increase the number of major faults.

    Compaction has reached the point where it is considered reasonably stable
    (meaning it has passed a lot of testing) and is a potential candidate for
    displacing lumpy reclaim. This patch introduces an alternative to lumpy
    reclaim whe compaction is available called reclaim/compaction. The basic
    operation is very simple - instead of selecting a contiguous range of
    pages to reclaim, a number of order-0 pages are reclaimed and then
    compaction is later by either kswapd (compact_zone_order()) or direct
    compaction (__alloc_pages_direct_compact()).

    [akpm@linux-foundation.org: fix build]
    [akpm@linux-foundation.org: use conventional task_struct naming]
    Signed-off-by: Mel Gorman
    Cc: Andrea Arcangeli
    Cc: KOSAKI Motohiro
    Cc: Rik van Riel
    Acked-by: Johannes Weiner
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • Michal reports:

    In the framebuffer subsystem the abs() macro is often used as a part of
    the calculation of a Manhattan metric, which in turn is used as a measure
    of similarity between video modes. The arguments of abs() are sometimes
    unsigned numbers. This worked fine until commit a49c59c0 ("Make sure the
    value in abs() does not get truncated if it is greater than 2^32:) , which
    changed the definition of abs() to prevent truncation. As a result of
    this change, in the following piece of code:

    u32 a = 0, b = 1;
    u32 c = abs(a - b);

    'c' will end up with a value of 0xffffffff instead of the expected 0x1.

    A problem caused by this change and visible by the end user is that
    framebuffer drivers relying on functions from modedb.c will fail to find
    high resolution video modes similar to that explicitly requested by the
    user if an exact match cannot be found (see e.g.

    Fix this by special-casing `long' types within abs().

    This patch reduces x86_64 code size a bit - drivers/video/uvesafb.o shrunk
    by 15 bytes, presumably because it is doing abs() on 4-byte quantities,
    and expanding those to 8-byte longs adds code.

    testcase:

    #define oldabs(x) ({ \
    long __x = (x); \
    (__x < 0) ? -__x : __x; \
    })

    #define newabs(x) ({ \
    long ret; \
    if (sizeof(x) == sizeof(long)) { \
    long __x = (x); \
    ret = (__x < 0) ? -__x : __x; \
    } else { \
    int __x = (x); \
    ret = (__x < 0) ? -__x : __x; \
    } \
    ret; \
    })

    typedef unsigned int u32;

    main()
    {
    u32 a = 0;
    u32 b = 1;
    u32 oldc = oldabs(a - b);
    u32 newc = newabs(a - b);

    printf("%u %u\n", oldc, newc);
    }

    akpm:/home/akpm> gcc t.c
    akpm:/home/akpm> ./a.out
    4294967295 1

    Reported-by: Michal Januszewski
    Cc: Rolf Eike Beer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

29 Nov, 2010

2 commits


16 Nov, 2010

1 commit


12 Nov, 2010

1 commit

  • The kernel syslog contains debugging information that is often useful
    during exploitation of other vulnerabilities, such as kernel heap
    addresses. Rather than futilely attempt to sanitize hundreds (or
    thousands) of printk statements and simultaneously cripple useful
    debugging functionality, it is far simpler to create an option that
    prevents unprivileged users from reading the syslog.

    This patch, loosely based on grsecurity's GRKERNSEC_DMESG, creates the
    dmesg_restrict sysctl. When set to "0", the default, no restrictions are
    enforced. When set to "1", only users with CAP_SYS_ADMIN can read the
    kernel syslog via dmesg(8) or other mechanisms.

    [akpm@linux-foundation.org: explain the config option in kernel.txt]
    Signed-off-by: Dan Rosenberg
    Acked-by: Ingo Molnar
    Acked-by: Eugene Teo
    Acked-by: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Rosenberg
     

10 Nov, 2010

1 commit


09 Nov, 2010

1 commit


27 Oct, 2010

4 commits

  • The current implementation of div64_u64 for 32bit systems returns an
    approximately correct result when the divisor exceeds 32bits. Since doing
    64bit division using 32bit hardware is a long since solved problem we just
    use one of the existing proven methods.

    Additionally, add a div64_s64 function to correctly handle doing signed
    64bit division.

    Addresses https://bugzilla.redhat.com/show_bug.cgi?id=616105

    Signed-off-by: Brian Behlendorf
    Signed-off-by: Oleg Nesterov
    Cc: Ben Woodard
    Cc: Jeremy Fitzhardinge
    Cc: Mark Grondona
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Brian Behlendorf
     
  • printk_ratelimit() was a bad idea - we don't want subsytem A causing
    ratelimiting of subsystem B's messages.

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • The whole point to using the strict functions is to check the return
    value. If you don't, strict_strto*() will return you uninitialised
    garbage. Offenders have been observed in the wild.

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Introduce two additional min/max macros to compare three operands. This
    will save some cycles as well as some bytes on the stack and last but not
    least more pleasing as macro nesting.

    [akpm@linux-foundation.org: fix warnings]
    Signed-off-by: Hagen Paul Pfeifer
    Cc: Joe Perches
    Cc: Ingo Molnar
    Cc: Hartley Sweeten
    Cc: Russell King
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Herbert Xu
    Cc: Roland Dreier
    Cc: Sean Hefty
    Cc: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hagen Paul Pfeifer
     

23 Oct, 2010

1 commit

  • * 'for-2.6.37/core' of git://git.kernel.dk/linux-2.6-block: (39 commits)
    cfq-iosched: Fix a gcc 4.5 warning and put some comments
    block: Turn bvec_k{un,}map_irq() into static inline functions
    block: fix accounting bug on cross partition merges
    block: Make the integrity mapped property a bio flag
    block: Fix double free in blk_integrity_unregister
    block: Ensure physical block size is unsigned int
    blkio-throttle: Fix possible multiplication overflow in iops calculations
    blkio-throttle: limit max iops value to UINT_MAX
    blkio-throttle: There is no need to convert jiffies to milli seconds
    blkio-throttle: Fix link failure failure on i386
    blkio: Recalculate the throttled bio dispatch time upon throttle limit change
    blkio: Add root group to td->tg_list
    blkio: deletion of a cgroup was causes oops
    blkio: Do not export throttle files if CONFIG_BLK_DEV_THROTTLING=n
    block: set the bounce_pfn to the actual DMA limit rather than to max memory
    block: revert bad fix for memory hotplug causing bounces
    Fix compile error in blk-exec.c for !CONFIG_DETECT_HUNG_TASK
    block: set the bounce_pfn to the actual DMA limit rather than to max memory
    block: Prevent hang_check firing during long I/O
    cfq: improve fsync performance for small files
    ...

    Fix up trivial conflicts due to __rcu sparse annotation in include/linux/genhd.h

    Linus Torvalds
     

21 Oct, 2010

2 commits

  • Currently the roundup macro references it's arguments more than one time.
    This patch changes it so it will only use its arguments once.

    Suggested-by: Andrew Morton
    Signed-off-by: Eric Paris
    Signed-off-by: James Morris

    Eric Paris
     
  • The roundup() helper function will round a given value up to a multiple of
    another given value. aka roundup(11, 7) would give 14 = 7 * 2. This new
    function does the opposite. It will round a given number down to the
    nearest multiple of the second number: rounddown(11, 7) would give 7.

    I need this in some future SELinux code and can carry the macro myself, but
    figured I would put it in the core kernel so others might find and use it
    if need be.

    Signed-off-by: Eric Paris
    Signed-off-by: James Morris

    Eric Paris
     

11 Sep, 2010

1 commit


13 Aug, 2010

1 commit


11 Aug, 2010

2 commits

  • We are missing the oops end marker for the exception based WARN implementation
    in lib/bug.c. This is useful for logfile analysis tools.

    Signed-off-by: Anton Blanchard
    Cc: Ingo Molnar
    Cc: Arjan van de Ven
    Cc: "Kirill A. Shutemov"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Anton Blanchard
     
  • To keep panic_timeout accuracy when running under a hypervisor, the
    current implementation only spins on long time (1 second) calls to mdelay.
    That brings a good effect, but the problem is the keyboard LEDs don't
    blink at all on that situation.

    This patch changes to call to panic_blink_enter() between every mdelay and
    keeps blinking in spite of long spin timer mode.

    The time to call to mdelay is now 100ms. Even this change will keep
    panic_timeout accuracy enough when running under a hypervisor.

    Signed-off-by: TAMUKI Shoichi
    Cc: Ben Dooks
    Cc: Russell King
    Acked-by: Dmitry Torokhov
    Cc: Anton Blanchard
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    TAMUKI Shoichi
     

10 Aug, 2010

1 commit


07 Aug, 2010

2 commits

  • * 'x86-mce-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86, mce: Use HW_ERR in MCE handler
    x86, mce: Add HW_ERR printk prefix for hardware error logging
    x86, mce: Fix MSR_IA32_MCI_CTL2 CMCI threshold setup
    x86, mce: Rename MSR_IA32_MCx_CTL2 value

    Linus Torvalds
     
  • …git/tip/linux-2.6-tip

    * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (162 commits)
    tracing/kprobes: unregister_trace_probe needs to be called under mutex
    perf: expose event__process function
    perf events: Fix mmap offset determination
    perf, powerpc: fsl_emb: Restore setting perf_sample_data.period
    perf, powerpc: Convert the FSL driver to use local64_t
    perf tools: Don't keep unreferenced maps when unmaps are detected
    perf session: Invalidate last_match when removing threads from rb_tree
    perf session: Free the ref_reloc_sym memory at the right place
    x86,mmiotrace: Add support for tracing STOS instruction
    perf, sched migration: Librarize task states and event headers helpers
    perf, sched migration: Librarize the GUI class
    perf, sched migration: Make the GUI class client agnostic
    perf, sched migration: Make it vertically scrollable
    perf, sched migration: Parameterize cpu height and spacing
    perf, sched migration: Fix key bindings
    perf, sched migration: Ignore unhandled task states
    perf, sched migration: Handle ignored migrate out events
    perf: New migration tool overview
    tracing: Drop cpparg() macro
    perf: Use tracepoint_synchronize_unregister() to flush any pending tracepoint call
    ...

    Fix up trivial conflicts in Makefile and drivers/cpufreq/cpufreq.c

    Linus Torvalds
     

05 Aug, 2010

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (48 commits)
    Documentation: update broken web addresses.
    fix comment typo "choosed" -> "chosen"
    hostap:hostap_hw.c Fix typo in comment
    Fix spelling contorller -> controller in comments
    Kconfig.debug: FAIL_IO_TIMEOUT: typo Faul -> Fault
    fs/Kconfig: Fix typo Userpace -> Userspace
    Removing dead MACH_U300_BS26
    drivers/infiniband: Remove unnecessary casts of private_data
    fs/ocfs2: Remove unnecessary casts of private_data
    libfc: use ARRAY_SIZE
    scsi: bfa: use ARRAY_SIZE
    drm: i915: use ARRAY_SIZE
    drm: drm_edid: use ARRAY_SIZE
    synclink: use ARRAY_SIZE
    block: cciss: use ARRAY_SIZE
    comment typo fixes: charater => character
    fix comment typos concerning "challenge"
    arm: plat-spear: fix typo in kerneldoc
    reiserfs: typo comment fix
    update email address
    ...

    Linus Torvalds
     

20 Jul, 2010

1 commit

  • Special traces type was only used by sysprof. Lets remove it now
    that sysprof ftrace plugin has been dropped.

    Signed-off-by: Frederic Weisbecker
    Acked-by: Soeren Sandmann
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Li Zefan

    Frederic Weisbecker
     

12 Jul, 2010

1 commit

  • Move the preprocessor #warning message:
    warning: #warning Attempt to use kernel headers from user space,
    see http://kernelnewbies.org/KernelHeaders
    from kernel.h to types.h.

    And also fixe the #warning message due to the preprocessor not being able to
    read the web address due to it thinking it was the start of a comment. also
    remove the extra #ifndef _KERNEL_ since it's already there.

    Signed-off-by: Justin P. Mattock
    Cc: Arnd Bergmann
    Signed-off-by: Jiri Kosina

    Justin P. Mattock
     

05 Jul, 2010

1 commit

  • Add the ability to print a format and va_list from a structure pointer

    Allows __dev_printk to be implemented as a single printk while
    minimizing string space duplication.

    %pV should not be used without some mechanism to verify the
    format and argument use ala __attribute__(format (printf(...))).

    Signed-off-by: Joe Perches
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: David S. Miller

    Joe Perches
     

11 Jun, 2010

1 commit


25 May, 2010

4 commits

  • hex_to_bin() is a little method which converts hex digit to its actual
    value. There are plenty of places where such functionality is needed.

    [akpm@linux-foundation.org: use tolower(), saving 3 bytes, test the more common case first - it's quicker]
    [akpm@linux-foundation.org: relocate tolower to make it even faster! (Joe)]
    Signed-off-by: Andy Shevchenko
    Cc: Tilman Schmidt
    Cc: Duncan Sands
    Cc: Eric W. Biederman
    Cc: Greg Kroah-Hartman
    Cc: "Richard Russon (FlatCap)"
    Cc: John W. Linville
    Cc: Len Brown
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     
  • ratelimit_state initialization of printk_ratelimited() seems broken. This
    fixes it by using DEFINE_RATELIMIT_STATE() to initialize spinlock
    properly.

    Signed-off-by: OGAWA Hirofumi
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • The current logging macros are
    pr_, dev_, netdev_, and netif_.
    pr_ uses warning, the other use warn.

    Standardize these logging macros a bit more by adding pr_warn and
    pr_warn_ratelimited.

    Right now, there are:

    $ for level in emerg alert crit err warn warning notice info ; do \
    for prefix in pr dev netdev netif ; do \
    echo -n "${prefix}_${level}: `git grep -w "${prefix}_${level}" | wc -l` " ; \
    done ; \
    echo ; \
    done
    pr_emerg: 45 dev_emerg: 4 netdev_emerg: 1 netif_emerg: 4
    pr_alert: 24 dev_alert: 36 netdev_alert: 1 netif_alert: 6
    pr_crit: 24 dev_crit: 22 netdev_crit: 1 netif_crit: 4
    pr_err: 2013 dev_err: 8467 netdev_err: 267 netif_err: 240
    pr_warn: 0 dev_warn: 1818 netdev_warn: 126 netif_warn: 23
    pr_warning: 773 dev_warning: 0 netdev_warning: 0 netif_warning: 0
    pr_notice: 148 dev_notice: 111 netdev_notice: 9 netif_notice: 3
    pr_info: 1717 dev_info: 3007 netdev_info: 101 netif_info: 85

    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • - C99 knows about USHRT_MAX/SHRT_MAX/SHRT_MIN, not
    USHORT_MAX/SHORT_MAX/SHORT_MIN.

    - Make SHRT_MIN of type s16, not int, for consistency.

    [akpm@linux-foundation.org: fix drivers/dma/timb_dma.c]
    [akpm@linux-foundation.org: fix security/keys/keyring.c]
    Signed-off-by: Alexey Dobriyan
    Acked-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

22 May, 2010

1 commit

  • * git://git.infradead.org/iommu-2.6:
    intel-iommu: Set a more specific taint flag for invalid BIOS DMAR tables
    intel-iommu: Combine the BIOS DMAR table warning messages
    panic: Add taint flag TAINT_FIRMWARE_WORKAROUND ('I')
    panic: Allow warnings to set different taint flags
    intel-iommu: intel_iommu_map_range failed at very end of address space
    intel-iommu: errors with smaller iommu widths
    intel-iommu: Fix boot inside 64bit virtualbox with io-apic disabled
    intel-iommu: use physfn to search drhd for VF
    intel-iommu: Print out iommu seq_id
    intel-iommu: Don't complain that ACPI_DMAR_SCOPE_TYPE_IOAPIC is not supported
    intel-iommu: Avoid global flushes with caching mode.
    intel-iommu: Use correct domain ID when caching mode is enabled
    intel-iommu mistakenly uses offset_pfn when caching mode is enabled
    intel-iommu: use for_each_set_bit()
    intel-iommu: Fix section mismatch dmar_ir_support() uses dmar_tbl.

    Linus Torvalds
     

19 May, 2010

2 commits


22 Apr, 2010

1 commit

  • The ftrace_dump_on_oops kernel parameter, sysctl and sysrq let one
    dump every cpu buffers when an oops or panic happens.

    It's nice when you have few cpus but it may take ages if have many,
    plus you miss the real origin of the problem in all the cpu traces.

    Sometimes, all you need is to dump the cpu buffer that triggered the
    opps, most of the time it is our main interest.

    This patch modifies ftrace_dump_on_oops to handle this choice.

    The ftrace_dump_on_oops kernel parameter, when it comes alone, has
    the same behaviour than before. But ftrace_dump_on_oops=orig_cpu
    will only dump the buffer of the cpu that oops'ed.

    Similarly, sysctl kernel.ftrace_dump_on_oops=1 and
    echo 1 > /proc/sys/kernel/ftrace_dump_on_oops keep their previous
    behaviour. But setting 2 jumps into cpu origin dump mode.

    v2: Fix double setup
    v3: Fix spelling issues reported by Randy Dunlap
    v4: Also update __ftrace_dump in the selftests

    Signed-off-by: Frederic Weisbecker
    Acked-by: David S. Miller
    Acked-by: Steven Rostedt
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Li Zefan
    Cc: Lai Jiangshan

    Frederic Weisbecker
     

20 Apr, 2010

1 commit