12 Oct, 2009

1 commit

  • User applications frequently hit problems when they try to use
    the kernel headers directly, rather than the exported headers.

    This adds an explicit warning for this case, and points to
    a URL holding an explanation of why this is wrong and what
    to do about it.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Sam Ravnborg

    Arnd Bergmann
     

23 Sep, 2009

4 commits

  • abs() will truncate the input if is it outside the 2^32 range. Fix that
    by assuming `long' input.

    This might generate worse code in the common case.

    Signed-off-by: Rolf Eike Beer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rolf Eike Beer
     
  • gcc permitting variable length arrays makes the current construct used for
    BUILD_BUG_ON() useless, as that doesn't produce any diagnostic if the
    controlling expression isn't really constant. Instead, this patch makes
    it so that a bit field gets used here. Consequently, those uses where the
    condition isn't really constant now also need fixing.

    Note that in the gfp.h, kmemcheck.h, and virtio_config.h cases
    MAYBE_BUILD_BUG_ON() really just serves documentation purposes - even if
    the expression is compile time constant (__builtin_constant_p() yields
    true), the array is still deemed of variable length by gcc, and hence the
    whole expression doesn't have the intended effect.

    [akpm@linux-foundation.org: make arch/sparc/include/asm/vio.h compile]
    [akpm@linux-foundation.org: more nonsensical assertions in tpm.c..]
    Signed-off-by: Jan Beulich
    Cc: Andi Kleen
    Cc: Rusty Russell
    Cc: Catalin Marinas
    Cc: "David S. Miller"
    Cc: Rajiv Andrade
    Cc: Mimi Zohar
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Beulich
     
  • Using the type bool (instead of int) for the __print_once flag in the
    printk_once() macro matches the intent of the code better, and allows the
    compiler to generate smaller code; eg a typical callsite with gcc 4.3.3 on
    i386:

    add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6 (-6)
    function old new delta
    static.__print_once 4 1 -3
    get_cpu_vendor 146 143 -3

    Saving 6 bytes of object size per callsite by slightly improving the
    readability of the source seems like a win to me.

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

    Roland Dreier
     
  • When syslog is not possible, at the same time there's no serial/net
    console available, it will be hard to read the printk messages. For
    example oops/panic/warning messages in shutdown phase.

    Add a printk delay feature, we can make each printk message delay some
    milliseconds.

    Setting the delay by proc/sysctl interface: /proc/sys/kernel/printk_delay

    The value range from 0 - 10000, default value is 0

    [akpm@linux-foundation.org: fix a few things]
    Signed-off-by: Dave Young
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Young
     

18 Jul, 2009

2 commits

  • Add a preempt count base offset to compare against the current
    preempt level count. It prepares to pull up the might_sleep
    check from cond_resched() to cond_resched_lock() and
    cond_resched_bh().

    For these two helpers, we need to respectively ensure that once
    we'll unlock the given spinlock / reenable local softirqs, we
    will reach a sleepable state.

    Signed-off-by: Frederic Weisbecker
    [ Move and rename preempt_count_equals() ]
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     
  • Cover the off case for __might_sleep(), so that we avoid
    #ifdefs in files that make use of it. Especially, this prepares
    for the __might_sleep() pull up on cond_resched().

    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

26 Jun, 2009

1 commit

  • This patch introduces a new sysctl:

    /proc/sys/kernel/panic_on_io_nmi

    which defaults to 0 (off).

    When enabled, the kernel panics when the kernel receives an NMI
    caused by an IO error.

    The IO error triggered NMI indicates a serious system
    condition, which could result in IO data corruption. Rather
    than contiuing, panicing and dumping might be a better choice,
    so one can figure out what's causing the IO error.

    This could be especially important to companies running IO
    intensive applications where corruption must be avoided, e.g. a
    bank's databases.

    [ SuSE has been shipping it for a while, it was done at the
    request of a large database vendor, for their users. ]

    Signed-off-by: Kurt Garloff
    Signed-off-by: Roberto Angelino
    Signed-off-by: Greg Kroah-Hartman
    Cc: "Eric W. Biederman"
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Kurt Garloff
     

19 Jun, 2009

1 commit

  • Follow-up to "block: enable by default support for large devices
    and files on 32-bit archs".

    Rename CONFIG_LBD to CONFIG_LBDAF to:
    - allow update of existing [def]configs for "default y" change
    - reflect that it is used also for large files support nowadays

    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     

17 Jun, 2009

3 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (64 commits)
    debugfs: use specified mode to possibly mark files read/write only
    debugfs: Fix terminology inconsistency of dir name to mount debugfs filesystem.
    xen: remove driver_data direct access of struct device from more drivers
    usb: gadget: at91_udc: remove driver_data direct access of struct device
    uml: remove driver_data direct access of struct device
    block/ps3: remove driver_data direct access of struct device
    s390: remove driver_data direct access of struct device
    parport: remove driver_data direct access of struct device
    parisc: remove driver_data direct access of struct device
    of_serial: remove driver_data direct access of struct device
    mips: remove driver_data direct access of struct device
    ipmi: remove driver_data direct access of struct device
    infiniband: ehca: remove driver_data direct access of struct device
    ibmvscsi: gadget: at91_udc: remove driver_data direct access of struct device
    hvcs: remove driver_data direct access of struct device
    xen block: remove driver_data direct access of struct device
    thermal: remove driver_data direct access of struct device
    scsi: remove driver_data direct access of struct device
    pcmcia: remove driver_data direct access of struct device
    PCIE: remove driver_data direct access of struct device
    ...

    Manually fix up trivial conflicts due to different direct driver_data
    direct access fixups in drivers/block/{ps3disk.c,ps3vram.c}

    Linus Torvalds
     
  • This adds a KERN_DEFAULT loglevel marker, for when you cannot decide
    which loglevel you want, and just want to keep an existing printk
    with the default loglevel.

    The difference between having KERN_DEFAULT and having no log-level
    marker at all is two-fold:

    - having the log-level marker will now force a new-line if the
    previous printout had not added one (perhaps because it forgot,
    but perhaps because it expected a continuation)

    - having a log-level marker is required if you are printing out a
    message that otherwise itself could perhaps otherwise be mistaken
    for a log-level.

    Signed-of-by: Linus Torvalds

    Linus Torvalds
     
  • It used to be that we would only look at the log-level in a printk()
    after explicit newlines, which can cause annoying problems when the
    previous printk() did not end with a '\n'. In that case, the log-level
    marker would be just printed out in the middle of the line, and be
    seen as just noise rather than change the logging level.

    This changes things to always look at the log-level in the first
    bytes of the printout. If a log level marker is found, it is always
    used as the log-level. Additionally, if no newline existed, one is
    added (unless the log-level is the explicit KERN_CONT marker, to
    explicitly show that it's a continuation of a previous line).

    Acked-by: Arjan van de Ven
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

16 Jun, 2009

1 commit

  • Many developers use "/debug/" or "/debugfs/" or "/sys/kernel/debug/"
    directory name to mount debugfs filesystem for ftrace according to
    ./Documentation/tracers/ftrace.txt file.

    And, three directory names(ex:/debug/, /debugfs/, /sys/kernel/debug/) is
    existed in kernel source like ftrace, DRM, Wireless, Documentation,
    Network[sky2]files to mount debugfs filesystem.

    debugfs means debug filesystem for debugging easy to use by greg kroah
    hartman. "/sys/kernel/debug/" name is suitable as directory name
    of debugfs filesystem.
    - debugfs related reference: http://lwn.net/Articles/334546/

    Fix inconsistency of directory name to mount debugfs filesystem.

    * From Steven Rostedt
    - find_debugfs() and tracing_files() in this patch.

    Signed-off-by: GeunSik Lim
    Acked-by : Inaky Perez-Gonzalez
    Reviewed-by : Steven Rostedt
    Reviewed-by : James Smart
    CC: Jiri Kosina
    CC: David Airlie
    CC: Peter Osterlund
    CC: Ananth N Mavinakayanahalli
    CC: Anil S Keshavamurthy
    CC: Masami Hiramatsu
    Signed-off-by: Greg Kroah-Hartman

    GeunSik Lim
     

17 Apr, 2009

1 commit

  • pr_debug() used to produce zero code unless DEBUG was #defined. This is
    now no longer the case in practice[1].

    There are places where it's useful to have debugging printks, but we don't
    want them to generate any code in production kernels.

    So add a new macro, pr_devel(), for _devel_opment, to provide the old
    semantics, ie. if the programmer doesn't explicitly enable debugging, no
    code is produced.

    [1]: You can turn CONFIG_DYNAMIC_DEBUG off, but it's enabled in at least
    one distro kernel, so it's not really a solution.

    Signed-off-by: Michael Ellerman
    Cc: Jason Baron
    Cc: Greg Banks
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Michael Ellerman
     

06 Apr, 2009

2 commits

  • * 'tracing-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (413 commits)
    tracing, net: fix net tree and tracing tree merge interaction
    tracing, powerpc: fix powerpc tree and tracing tree interaction
    ring-buffer: do not remove reader page from list on ring buffer free
    function-graph: allow unregistering twice
    trace: make argument 'mem' of trace_seq_putmem() const
    tracing: add missing 'extern' keywords to trace_output.h
    tracing: provide trace_seq_reserve()
    blktrace: print out BLK_TN_MESSAGE properly
    blktrace: extract duplidate code
    blktrace: fix memory leak when freeing struct blk_io_trace
    blktrace: fix blk_probes_ref chaos
    blktrace: make classic output more classic
    blktrace: fix off-by-one bug
    blktrace: fix the original blktrace
    blktrace: fix a race when creating blk_tree_root in debugfs
    blktrace: fix timestamp in binary output
    tracing, Text Edit Lock: cleanup
    tracing: filter fix for TRACE_EVENT_FORMAT events
    ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release()
    x86: kretprobe-booster interrupt emulation code fix
    ...

    Fix up trivial conflicts in
    arch/parisc/include/asm/ftrace.h
    include/linux/memory.h
    kernel/extable.c
    kernel/module.c

    Linus Torvalds
     
  • * 'printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    printk: correct the behavior of printk_timed_ratelimit()
    vsprintf: unify the format decoding layer for its 3 users, cleanup
    fix regression from "vsprintf: unify the format decoding layer for its 3 users"
    vsprintf: fix bug in negative value printing
    vsprintf: unify the format decoding layer for its 3 users
    vsprintf: add binary printf
    printk: introduce printk_once()

    Fix trivial conflicts (printk_once vs log_buf_kexec_setup() added near
    each other) in include/linux/kernel.h.

    Linus Torvalds
     

03 Apr, 2009

1 commit

  • It would be nice to be able to extract the dmesg log from a vmcore file
    without needing to keep the debug symbols for the running kernel handy all
    the time. We have a facility to do this in /proc/vmcore. This patch adds
    the log_buf and log_end symbols to the vmcoreinfo area so that tools (like
    makedumpfile) can easily extract the dmesg logs from a vmcore image.

    [akpm@linux-foundation.org: several fixes and cleanups]
    [akpm@linux-foundation.org: fix unused log_buf_kexec_setup()]
    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Neil Horman
    Cc: Simon Horman
    Acked-by: Vivek Goyal
    Cc: Neil Horman
    Cc: Simon Horman
    Cc: Vivek Goyal
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Neil Horman
     

02 Apr, 2009

1 commit


01 Apr, 2009

1 commit

  • We cover all log-levels by pr_... macros except KERN_CONT one. Add it
    for convenience.

    Signed-off-by: Cyrill Gorcunov
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: Harvey Harrison
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cyrill Gorcunov
     

29 Mar, 2009

2 commits


25 Mar, 2009

2 commits

  • When CONFIG_DYNAMIC_DEBUG is enabled, allow callers of pr_debug()
    to provide their own definition of pr_fmt() even if that definition
    uses tricks like

    #define pr_fmt(fmt) "%s:" fmt, __func__

    Signed-off-by: Greg Banks
    Cc: Jason Baron
    Acked-by: Geert Uytterhoeven
    Signed-off-by: Greg Kroah-Hartman

    Greg Banks
     
  • This patch combines Greg Bank's dprintk() work with the existing dynamic
    printk patchset, we are now calling it 'dynamic debug'.

    The new feature of this patchset is a richer /debugfs control file interface,
    (an example output from my system is at the bottom), which allows fined grained
    control over the the debug output. The output can be controlled by function,
    file, module, format string, and line number.

    for example, enabled all debug messages in module 'nf_conntrack':

    echo -n 'module nf_conntrack +p' > /mnt/debugfs/dynamic_debug/control

    to disable them:

    echo -n 'module nf_conntrack -p' > /mnt/debugfs/dynamic_debug/control

    A further explanation can be found in the documentation patch.

    Signed-off-by: Greg Banks
    Signed-off-by: Jason Baron
    Signed-off-by: Greg Kroah-Hartman

    Jason Baron
     

17 Mar, 2009

1 commit


13 Mar, 2009

1 commit

  • Impact: fix callsites with dynamic format strings

    Since its new binary implementation, trace_printk() internally uses static
    containers for the format strings on each callsites. But the value is
    assigned once at build time, which means that it can't take dynamic
    formats.

    So this patch unearthes the raw trace_printk implementation for the callers
    that will need trace_printk to be able to carry these dynamic format
    strings. The trace_printk() macro will use the appropriate implementation
    for each callsite. Most of the time however, the binary implementation will
    still be used.

    The other impact of this patch is that mmiotrace_printk() will use the old
    implementation because it calls the low level trace_vprintk and we can't
    guess here whether the format passed in it is dynamic or not.

    Some parts of this patch have been written by Steven Rostedt (most notably
    the part that chooses the appropriate implementation for each callsites).

    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Steven Rostedt

    Frederic Weisbecker
     

09 Mar, 2009

1 commit

  • Impact: micro-optimization

    trace_printk() does this unconditionally:

    trace_printk_fmt = fmt;

    Where trace_printk_fmt is an entry into a global array. This is
    very SMP-unfriendly.

    So only write it once per bootup.

    Cc: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

07 Mar, 2009

2 commits

  • Impact: faster and lighter tracing

    Now that we have trace_bprintk() which is faster and consume lesser
    memory than trace_printk() and has the same purpose, we can now drop
    the old implementation in favour of the binary one from trace_bprintk(),
    which means we move all the implementation of trace_bprintk() to
    trace_printk(), so the Api doesn't change except that we must now use
    trace_seq_bprintk() to print the TRACE_PRINT entries.

    Some changes result of this:

    - Previously, trace_bprintk depended of a single tracer and couldn't
    work without. This tracer has been dropped and the whole implementation
    of trace_printk() (like the module formats management) is now integrated
    in the tracing core (comes with CONFIG_TRACING), though we keep the file
    trace_printk (previously trace_bprintk.c) where we can find the module
    management. Thus we don't overflow trace.c

    - changes some parts to use trace_seq_bprintk() to print TRACE_PRINT entries.

    - change a bit trace_printk/trace_vprintk macros to support non-builtin formats
    constants, and fix 'const' qualifiers warnings. But this is all transparent for
    developers.

    - etc...

    V2:

    - Rebase against last changes
    - Fix mispell on the changelog

    V3:

    - Rebase against last changes (moving trace_printk() to kernel.h)

    Signed-off-by: Frederic Weisbecker
    Acked-by: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     
  • Ingo Molnar
     

05 Mar, 2009

2 commits

  • Impact: cleanup

    The functions tracing_start/tracing_stop have been moved to kernel.h.
    These are not the functions a developer most likely wants to use
    when they want to insert a place to stop tracing and restart it from
    user space.

    tracing_start/tracing_stop was created to work with things like
    suspend to ram, where even calling smp_processor_id() can crash the
    system. The tracing_start/tracing_stop was used to stop the tracer from
    doing anything. These are still light weight functions, but add a bit
    more overhead to be able to stop the tracers. They also have no interface
    back to userland. That is, if the kernel calls tracing_stop, userland
    can not start tracing.

    What a developer most likely wants to use is tracing_on/tracing_off.
    These are very light weight functions (simply sets or clears a bit).
    These functions just stop recording into the ring buffer. The tracers
    don't even know that this happens except that they would receive NULL
    from the ring_buffer_lock_reserve function.

    Also, there's a way for the user land to enable or disable this bit.
    In debugfs/tracing/tracing_on, a user may echo "0" (same as tracing_off())
    or echo "1" (same as tracing_on()) into this file. This becomes handy when
    a kernel developer is debugging and wants tracing to turn off when it
    hits an anomaly. Then the developer can examine the trace, and restart
    tracing if they want to try again (echo 1 > tracing_on).

    This patch moves the prototypes for tracing_on/tracing_off to kernel.h
    and comments their use, so that a kernel developer will know how
    to use them.

    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • Make common utility functions such as trace_printk() and
    tracing_start()/tracing_stop() generally available to kernel
    code.

    Cc: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

06 Feb, 2009

1 commit


05 Feb, 2009

1 commit

  • This pattern shows up frequently in the kernel:

    static int once = 1;
    ...

    if (once) {
    once = 0;
    printk(KERN_ERR "message\n");
    }
    ...

    So add a printk_once() helper macro that reduces this to a single line
    of:

    printk_once(KERN_ERR "message\n");

    It works analogously to WARN_ONCE() & friends. (We use a macro not
    an inline because vararg expansion in inlines looks awkward and the
    macro is simple enough.)

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

09 Jan, 2009

1 commit


07 Jan, 2009

3 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (60 commits)
    uio: make uio_info's name and version const
    UIO: Documentation for UIO ioport info handling
    UIO: Pass information about ioports to userspace (V2)
    UIO: uio_pdrv_genirq: allow custom irq_flags
    UIO: use pci_ioremap_bar() in drivers/uio
    arm: struct device - replace bus_id with dev_name(), dev_set_name()
    libata: struct device - replace bus_id with dev_name(), dev_set_name()
    avr: struct device - replace bus_id with dev_name(), dev_set_name()
    block: struct device - replace bus_id with dev_name(), dev_set_name()
    chris: struct device - replace bus_id with dev_name(), dev_set_name()
    dmi: struct device - replace bus_id with dev_name(), dev_set_name()
    gadget: struct device - replace bus_id with dev_name(), dev_set_name()
    gpio: struct device - replace bus_id with dev_name(), dev_set_name()
    gpu: struct device - replace bus_id with dev_name(), dev_set_name()
    hwmon: struct device - replace bus_id with dev_name(), dev_set_name()
    i2o: struct device - replace bus_id with dev_name(), dev_set_name()
    IA64: struct device - replace bus_id with dev_name(), dev_set_name()
    i7300_idle: struct device - replace bus_id with dev_name(), dev_set_name()
    infiniband: struct device - replace bus_id with dev_name(), dev_set_name()
    ISDN: struct device - replace bus_id with dev_name(), dev_set_name()
    ...

    Linus Torvalds
     
  • Create a helper macro to divide two numbers and round the result to the
    nearest whole number. This is a helper macro for hwmon drivers that want
    to convert incoming sysfs values per standard hwmon practice, though the
    macro itself can be used by anyone.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Darrick J. Wong
     
  • Statically defined DEBUG should take precedence over
    dynamically enabled debugging; otherwise adding DEBUG
    (like, for example, via CONFIG_DEBUG_KOBJECT) does not
    have the expected result of printing pr_debug() and dev_dbg()
    messages unconditionally.

    Signed-off-by: Cornelia Huck
    Acked-by: Jason Baron
    Signed-off-by: Greg Kroah-Hartman

    Cornelia Huck
     

31 Dec, 2008

1 commit

  • * 'core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (63 commits)
    stacktrace: provide save_stack_trace_tsk() weak alias
    rcu: provide RCU options on non-preempt architectures too
    printk: fix discarding message when recursion_bug
    futex: clean up futex_(un)lock_pi fault handling
    "Tree RCU": scalable classic RCU implementation
    futex: rename field in futex_q to clarify single waiter semantics
    x86/swiotlb: add default swiotlb_arch_range_needs_mapping
    x86/swiotlb: add default physbus conversion
    x86: unify pci iommu setup and allow swiotlb to compile for 32 bit
    x86: add swiotlb allocation functions
    swiotlb: consolidate swiotlb info message printing
    swiotlb: support bouncing of HighMem pages
    swiotlb: factor out copy to/from device
    swiotlb: add arch hook to force mapping
    swiotlb: allow architectures to override physbusphys conversions
    swiotlb: add comment where we handle the overflow of a dma mask on 32 bit
    rcu: fix rcutorture behavior during reboot
    resources: skip sanity check of busy resources
    swiotlb: move some definitions to header
    swiotlb: allow architectures to override swiotlb pool allocation
    ...

    Fix up trivial conflicts in
    arch/x86/kernel/Makefile
    arch/x86/mm/init_32.c
    include/linux/hardirq.h
    as per Ingo's suggestions.

    Linus Torvalds
     

25 Nov, 2008

1 commit


19 Nov, 2008

1 commit


16 Nov, 2008

1 commit

  • A common reason for device drivers to implement their own printk macros
    is the lack of a printk prefix with the standard pr_xyz macros.
    Introduce a pr_fmt() macro that is applied for every pr_xyz macro to the
    format string.

    The most common use of the pr_fmt macro would be to add the name of the
    device driver to all pr_xyz messages in a source file.

    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Linus Torvalds

    Martin Schwidefsky