Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Jul 24, 2012
  1. Merge branch 'for-linus' of git://…

    Pull HID updates from Jiri Kosina:
     "The list of changes worth pointing out explicitly:
      - We are getting 'UHID', which is a new framework for implementing HID
        transport drivers in userspace (this is different from HIDRAW, which
        is transport-independent and provides report parsing facilities;
        uhid is for the other (transport) part of the pipeline).
        It's needed for (and currently being used by) Bluetooth-LowEnergy,
        as its specification mandates things we don't want in the kernel.
        Written by David Herrmann.
      - there have been quite a few bugs in runtime suspend/resume paths
        (probably never reported to actually happen in the wild, but still).
        Alan Stern fixed those.
      - a few other driver updates and fixes and random new device support."
    * 'for-linus' of git:// (45 commits)
      HID: add ASUS AIO keyboard model AK1D
      HID: add support for Cypress barcode scanner 04B4:ED81
      HID: Allow drivers to be their own listener
      HID: usbhid: fix error paths in suspend
      HID: usbhid: check for suspend or reset before restarting
      HID: usbhid: replace HID_REPORTED_IDLE with HID_SUSPENDED
      HID: usbhid: inline some simple routines
      HID: usbhid: fix autosuspend calls
      HID: usbhid: fix use-after-free bug
      HID: hid-core: optimize in case of hidraw
      HID: hidraw: fix list->buffer memleak
      HID: uhid: Fix sending events with invalid data
      HID: roccat: added sensor sysfs attribute for Savu
      HID: Add driver for Holtek based keyboards with broken HID
      HID: Add suport for the brightness control keys on HP keyboards
      HID: magicmouse: Implement Multi-touch Protocol B (MT-B)
      HID: magicmouse: Removing report_touches switch
      HID: roccat: rename roccat_common functions to roccat_common2
      HID: roccat: fix wrong hid_err usage on struct usb_device
      HID: roccat: move functionality to roccat-common
Commits on Jun 28, 2012
  1. @dahc

    samples: seccomp: add .gitignore for untracked executables

    dahc authored James Morris committed
    git status should be clean following make allmodconfig && make. Add
    a .gitignore file to the samples/seccomp directory to ignore binaries
    produced there.
    Signed-off-by: Chad Williamson <>
    Reviewed-By: Will Drewry <>
    Acked-by: Kees Cook <>
    Signed-off-by: James Morris <>
Commits on Jun 18, 2012
  1. @dvdhrm

    HID: uhid: add example program

    dvdhrm authored Jiri Kosina committed
    This adds an example user-space program that emulates a 3 button mouse
    with wheel. It detects keyboard presses and moves the mouse accordingly.
    It register a fake HID device to feed the raw HID reports into the kernel.
    In this example, you could use uinput to get the same result, but this
    shows how to get the same behavior with uhid so you don't need HID parsers
    in user-space.
    Signed-off-by: David Herrmann <>
    Signed-off-by: Jiri Kosina <>
Commits on Apr 19, 2012
  1. @redpig

    samples/seccomp: fix dependencies on arch macros

    redpig authored James Morris committed
    This change fixes the compilation error triggered here for
    i386 allmodconfig in linux-next:
    Logic attempting to predict the host architecture has been
    removed from the Makefile.  Instead, the bpf-direct sample
    should now compile on any architecture, but if the architecture
    is not supported, it will compile a minimal main() function.
    This change also ensures the samples are not compiled when
    there is no seccomp filter support.
    (Note, I wasn't able to reproduce the error locally, but
     the existing approach was clearly flawed.  This tweak
     should resolve your issue and avoid other future weirdness.)
    Reported-by: Paul Gortmaker <>
    Suggested-by: Kees Cook <>
    Signed-off-by: Will Drewry <>
    Signed-off-by: James Morris <>
Commits on Apr 14, 2012
  1. @redpig

    Documentation: prctl/seccomp_filter

    redpig authored James Morris committed
    Documents how system call filtering using Berkeley Packet
    Filter programs works and how it may be used.
    Includes an example for x86 and a semi-generic
    example using a macro-based code generator.
    Acked-by: Eric Paris <>
    Signed-off-by: Will Drewry <>
    Acked-by: Kees Cook <>
    v18: - added acked by
         - update no new privs numbers
    v17: - remove @compat note and add Pitfalls section for arch checking
    v16: -
    v15: -
    v14: - rebase/nochanges
    v13: - rebase on to 88ebdda
    v12: - comment on the ptrace_event use
         - update arch support comment
         - note the behavior of SECCOMP_RET_DATA when there are multiple filters
         - lots of samples/ clean up incl 64-bit bpf-direct support
         - rebase to linux-next
    v11: - overhaul return value language, updates (
         - comment on do_exit(SIGSYS)
    v10: - update for SIGSYS
         - update for new seccomp_data layout
         - update for ptrace option use
    v9: - updated bpf-direct.c for SIGILL
    v8: - add PR_SET_NO_NEW_PRIVS to the samples.
    v7: - updated for all the new stuff in v7: TRAP, TRACE
        - only talk about PR_SET_SECCOMP now
        - fixed bad JLE32 check (
        - adds dropper.c: a simple system call disabler
    v6: - tweak the language to note the requirement of
          PR_SET_NO_NEW_PRIVS being called prior to use. (
    v5: - update sample to use system call arguments
        - adds a "fancy" example using a macro-based generator
        - cleaned up bpf in the sample
        - update docs to mention arguments
        - fix prctl value (
        - language cleanup (
    v4: - update for no_new_privs use
        - minor tweaks
    v3: - call out BPF <-> Berkeley Packet Filter (
        - document use of tentative always-unprivileged
        - guard sample compilation for i386 and x86_64
    v2: - move code to samples (
    Signed-off-by: James Morris <>
Commits on Feb 8, 2012
  1. @ohadbc

    samples/rpmsg: add an rpmsg driver sample

    ohadbc authored
    Add an rpmsg driver sample, which demonstrates how to communicate with
    an AMP-configured remote processor over the rpmsg bus.
    Note how once probed, the driver can immediately start sending messages
    using the rpmsg_send() API, without having to worry about creating endpoints
    or allocating rpmsg addresses: all that work is done by the rpmsg bus,
    and the required information is already embedded in the rpmsg channel
    that the driver is probed with.
    In this sample, the driver simply sends a "Hello World!" message to the remote
    processor repeatedly.
    Designed with Brian Swetland <>.
    Signed-off-by: Ohad Ben-Cohen <>
    Cc: Brian Swetland <>
    Cc: Arnd Bergmann <>
    Cc: Grant Likely <>
    Cc: Tony Lindgren <>
    Cc: Russell King <>
    Cc: Rusty Russell <>
    Cc: Andrew Morton <>
    Cc: Greg KH <>
    Cc: Stephen Boyd <>
Commits on Oct 31, 2011
  1. @pebolle @michal42

    samples: drop unused Kconfig symbol

    pebolle authored michal42 committed
    Signed-off-by: Paul Bolle <>
    Signed-off-by: Michal Marek <>
Commits on Jul 1, 2011
  1. perf: Add context field to perf_event

    Avi Kivity authored Ingo Molnar committed
    The perf_event overflow handler does not receive any caller-derived
    argument, so many callers need to resort to looking up the perf_event
    in their local data structure.  This is ugly and doesn't scale if a
    single callback services many perf_events.
    Fix by adding a context parameter to perf_event_create_kernel_counter()
    (and derived hardware breakpoints APIs) and storing it in the perf_event.
    The field can be accessed from the callback as event->overflow_handler_context.
    All callers are updated.
    Signed-off-by: Avi Kivity <>
    Signed-off-by: Peter Zijlstra <>
    Signed-off-by: Ingo Molnar <>
  2. perf: Remove the nmi parameter from the swevent and overflow interface

    Peter Zijlstra authored Ingo Molnar committed
    The nmi parameter indicated if we could do wakeups from the current
    context, if not, we would set some state and self-IPI and let the
    resulting interrupt do the wakeup.
    For the various event classes:
      - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from
        the PMI-tail (ARM etc.)
      - tracepoint: nmi=0; since tracepoint could be from NMI context.
      - software: nmi=[0,1]; some, like the schedule thing cannot
        perform wakeups, and hence need 0.
    As one can see, there is very little nmi=1 usage, and the down-side of
    not using it is that on some platforms some software events can have a
    jiffy delay in wakeup (when arch_irq_work_raise isn't implemented).
    The up-side however is that we can remove the nmi parameter and save a
    bunch of conditionals in fast paths.
    Signed-off-by: Peter Zijlstra <>
    Cc: Michael Cree <>
    Cc: Will Deacon <>
    Cc: Deng-Cheng Zhu <>
    Cc: Anton Blanchard <>
    Cc: Eric B Munson <>
    Cc: Heiko Carstens <>
    Cc: Paul Mundt <>
    Cc: David S. Miller <>
    Cc: Frederic Weisbecker <>
    Cc: Jason Wessel <>
    Cc: Don Zickus <>
    Signed-off-by: Ingo Molnar <>
Commits on May 23, 2011
  1. Merge branches 'doc', 'multitouch', 'upstream' and 'upstream-fixes' i…

    Jiri Kosina authored
    …nto for-linus
Commits on Apr 21, 2011
  1. HID: hid-example: fix some build issues

    Randy Dunlap authored Jiri Kosina committed
    samples/hid-example.o needs some Kconfig and Makefile additions in order
    to build.  It should use <linux/*.h> headers from the build tree, so use
    HEADERS_CHECK to require that those header files be present.
    Change the kconfig symbol from tristate to bool since userspace cannot be
    built as loadable modules.
    However, I don't understand why the userspace header files are not present
    as reported in Andrew's build log, since it builds OK on x86_64 without
    any of these changes.
    Signed-off-by: Randy Dunlap <>
    Cc: Alan Ott <>
    Cc: Jiri Kosina <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Jiri Kosina <>
Commits on Apr 8, 2011
  1. HID: hidraw: fix samples miscompilation

    Jiri Kosina authored
    On systems where userspace doesn't have new hidraw.h populated to
    /usr/include, the hidraw sample won't compile as it's missing the new
    ioctl defitions.
    Introduce temporary ugly workaround to define the ioctls "manually"
    in such cases, just to avoid miscompilation in allmodconfig cases.
    Reported-by: Stephen Rothwell <>
    Signed-off-by: Jiri Kosina <>
Commits on Mar 31, 2011
  1. @lucasdemarchi

    Fix common misspellings

    lucasdemarchi authored
    Fixes generated by 'codespell' and manually reviewed.
    Signed-off-by: Lucas De Marchi <>
Commits on Mar 22, 2011
  1. @signal11

    HID: Documentation for hidraw

    signal11 authored Jiri Kosina committed
    Documenation for the hidraw driver, with sample program.
    Signed-off-by: Alan Ott <>
    Signed-off-by: Jiri Kosina <>
Commits on Oct 29, 2010
  1. @jwessel

    kdb: Add kdb kernel module sample

    jwessel authored
    Add an example of how to add a dynamic kdb shell command via a kernel
    Signed-off-by: Jason Wessel <>
Commits on Oct 22, 2010
  1. Merge branch 'llseek' of git://…

    * 'llseek' of git://
      vfs: make no_llseek the default
      vfs: don't use BKL in default_llseek
      llseek: automatically add .llseek fop
      libfs: use generic_file_llseek for simple_attr
      mac80211: disallow seeks in minstrel debug code
      lirc: make chardev nonseekable
      viotape: use noop_llseek
      raw: use explicit llseek file operations
      ibmasmfs: use generic_file_llseek
      spufs: use llseek in all file operations
      arm/omap: use generic_file_llseek in iommu_debug
      lkdtm: use generic_file_llseek in debugfs
      net/wireless: use generic_file_llseek in debugfs
      drm: use noop_llseek
Commits on Oct 15, 2010
  1. @arndb

    llseek: automatically add .llseek fop

    arndb authored
    All file_operations should get a .llseek operation so we can make
    nonseekable_open the default for future file operations without a
    .llseek pointer.
    The three cases that we can automatically detect are no_llseek, seq_lseek
    and default_llseek. For cases where we can we can automatically prove that
    the file offset is always ignored, we use noop_llseek, which maintains
    the current behavior of not returning an error from a seek.
    New drivers should normally not use noop_llseek but instead use no_llseek
    and call nonseekable_open at open time.  Existing drivers can be converted
    to do the same when the maintainer knows for certain that no user code
    relies on calling seek on the device file.
    The generated code is often incorrectly indented and right now contains
    comments that clarify for each added line why a specific variant was
    chosen. In the version that gets submitted upstream, the comments will
    be gone and I will manually fix the indentation, because there does not
    seem to be a way to do that using coccinelle.
    Some amount of new code is currently sitting in linux-next that should get
    the same modifications, which I will do at the end of the merge window.
    Many thanks to Julia Lawall for helping me learn to write a semantic
    patch that does all this.
    ===== begin semantic patch =====
    // This adds an llseek= method to all file operations,
    // as a preparation for making no_llseek the default.
    // The rules are
    // - use no_llseek explicitly if we do nonseekable_open
    // - use seq_lseek for sequential files
    // - use default_llseek if we know we access f_pos
    // - use noop_llseek if we know we don't access f_pos,
    //   but we still want to allow users to call lseek
    @ open1 exists @
    identifier nested_open;
    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    int open_f(struct inode *i, struct file *f)
    @ read disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
       *off = E
       *off += E
       func(..., off, ...)
       E = *off
    @ read_no_fpos disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    ... when != off
    @ write @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      *off = E
      *off += E
      func(..., off, ...)
      E = *off
    @ write_no_fpos @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    ... when != off
    @ fops0 @
    identifier fops;
    struct file_operations fops = {
    @ has_llseek depends on fops0 @
    identifier fops0.fops;
    identifier llseek_f;
    struct file_operations fops = {
     .llseek = llseek_f,
    @ has_read depends on fops0 @
    identifier fops0.fops;
    identifier read_f;
    struct file_operations fops = {
     .read = read_f,
    @ has_write depends on fops0 @
    identifier fops0.fops;
    identifier write_f;
    struct file_operations fops = {
     .write = write_f,
    @ has_open depends on fops0 @
    identifier fops0.fops;
    identifier open_f;
    struct file_operations fops = {
     .open = open_f,
    // use no_llseek if we call nonseekable_open
    @ nonseekable1 depends on !has_llseek && has_open @
    identifier fops0.fops;
    identifier nso ~= "nonseekable_open";
    struct file_operations fops = {
    ...  .open = nso, ...
    +.llseek = no_llseek, /* nonseekable */
    @ nonseekable2 depends on !has_llseek @
    identifier fops0.fops;
    identifier open.open_f;
    struct file_operations fops = {
    ...  .open = open_f, ...
    +.llseek = no_llseek, /* open uses nonseekable */
    // use seq_lseek for sequential files
    @ seq depends on !has_llseek @
    identifier fops0.fops;
    identifier sr ~= "seq_read";
    struct file_operations fops = {
    ...  .read = sr, ...
    +.llseek = seq_lseek, /* we have seq_read */
    // use default_llseek if there is a readdir
    @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier readdir_e;
    // any other fop is used that changes pos
    struct file_operations fops = {
    ... .readdir = readdir_e, ...
    +.llseek = default_llseek, /* readdir is present */
    // use default_llseek if at least one of read/write touches f_pos
    @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read.read_f;
    // read fops use offset
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = default_llseek, /* read accesses f_pos */
    @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write.write_f;
    // write fops use offset
    struct file_operations fops = {
    ... .write = write_f, ...
    +	.llseek = default_llseek, /* write accesses f_pos */
    // Use noop_llseek if neither read nor write accesses f_pos
    @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    identifier write_no_fpos.write_f;
    // write fops use offset
    struct file_operations fops = {
     .write = write_f,
     .read = read_f,
    +.llseek = noop_llseek, /* read and write both use no f_pos */
    @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write_no_fpos.write_f;
    struct file_operations fops = {
    ... .write = write_f, ...
    +.llseek = noop_llseek, /* write uses no f_pos */
    @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = noop_llseek, /* read uses no f_pos */
    @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    struct file_operations fops = {
    +.llseek = noop_llseek, /* no read or write fn */
    ===== End semantic patch =====
    Signed-off-by: Arnd Bergmann <>
    Cc: Julia Lawall <>
    Cc: Christoph Hellwig <>
Commits on Oct 1, 2010
  1. kfifo: fix scatterlist usage

    Ira W. Snyder authored committed
    The kfifo_dma family of functions use sg_mark_end() on the last element in
    their scatterlist.  This forces use of a fresh scatterlist for each DMA
    operation, which makes recycling a single scatterlist impossible.
    Change the behavior of the kfifo_dma functions to match the usage of the
    dma_map_sg function.  This means that users must respect the returned
    nents value.  The sample code is updated to reflect the change.
    This bug is trivial to cause: call kfifo_dma_in_prepare() such that it
    prepares a scatterlist with a single entry comprising the whole fifo.
    This is the case when you map the entirety of a newly created empty fifo.
    This causes the setup_sgl() function to mark the first scatterlist entry
    as the end of the chain, no matter what comes after it.
    Afterwards, add and remove some data from the fifo such that another call
    to kfifo_dma_in_prepare() will create two scatterlist entries.  It returns
    nents=2.  However, due to the previous sg_mark_end() call, sg_is_last()
    will now return true for the first scatterlist element.  This causes the
    sample code to print a single scatterlist element when it should print
    By removing the call to sg_mark_end(), we make the API as similar as
    possible to the DMA mapping API.  All users are required to respect the
    returned nents.
    Signed-off-by: Ira W. Snyder <>
    Cc: Stefani Seibold <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>
Commits on Aug 20, 2010
  1. kfifo: add explicit error checking in all the examples

    Andrea Righi authored committed
    Provide a check in all the kfifo examples to validate the correct
    execution of each testcase.
    Signed-off-by: Andrea Righi <>
    Acked-by: Stefani Seibold <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>
  2. kfifo: fix a memory leak in dma example

    Andrea Righi authored committed
    We use a dynamically allocated kfifo in the dma example, so we need to
    free it when unloading the module.
    Signed-off-by: Andrea Righi <>
    Acked-by: Stefani Seibold <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>
  3. kfifo: fix kernel BUG in dma example

    Andrea Righi authored committed
    The scatterlist is used uninitialized in kfifo_dma_in_prepare().  This
    triggers the following bug if CONFIG_DEBUG_SG=y:
      ------------[ cut here ]------------
      kernel BUG at include/linux/scatterlist.h:65!
      invalid opcode: 0000 [#1] PREEMPT SMP
      Call Trace:
       [<ffffffff810a1eab>] setup_sgl+0x6b/0xe0
       [<ffffffffa03d7000>] ? example_init+0x0/0x265 [dma_example]
       [<ffffffff810a2021>] __kfifo_dma_in_prepare+0x21/0x30
       [<ffffffffa03d7124>] example_init+0x124/0x265 [dma_example]
       [<ffffffff810f9c55>] ? trace_module_notify+0x25/0x370
       [<ffffffff81110c6e>] ? free_pages_prepare+0x11e/0x1e0
       [<ffffffff8106f2b1>] ? get_parent_ip+0x11/0x50
       [<ffffffff810f9c55>] ? trace_module_notify+0x25/0x370
       [<ffffffff810b65fd>] ? trace_hardirqs_on+0xd/0x10
       [<ffffffff814beade>] ? mutex_unlock+0xe/0x10
       [<ffffffff810f9c71>] ? trace_module_notify+0x41/0x370
       [<ffffffff810a77d5>] ? __blocking_notifier_call_chain+0x45/0x80
       [<ffffffff81137b7a>] ? vfree+0x2a/0x30
       [<ffffffff810a6ac3>] ? up_read+0x23/0x40
       [<ffffffff810a77f5>] ? __blocking_notifier_call_chain+0x65/0x80
       [<ffffffff810001e3>] do_one_initcall+0x43/0x180
       [<ffffffff810c577a>] sys_init_module+0xba/0x200
       [<ffffffff8103819b>] system_call_fastpath+0x16/0x1b
      RIP  [<ffffffff810a1e31>] setup_sgl_buf+0x1a1/0x1b0
       RSP <ffff88006720dc98>
      ---[ end trace a72b979fd3c1d3a5 ]---
    Add the proper initialization to avoid the bug.
    Signed-off-by: Andrea Righi <>
    Acked-by: Stefani Seibold <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>
  4. kfifo: add explicit error checking in byte stream example

    Andrea Righi authored committed
    Provide a static array of expected items that kfifo should contain at the
    end of the test to validate it.
    Signed-off-by: Andrea Righi <>
    Cc: Stefani Seibold <>
    Cc: Greg KH <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>
  5. kfifo: add kfifo_skip() testcase

    Andrea Righi authored committed
    Add a testcase for kfifo_skip() to the byte stream fifo example.
    Signed-off-by: Andrea Righi <>
    Cc: Greg KH <>
    Acked-by: Stefani Seibold <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>
Commits on Aug 11, 2010
  1. @sstefani

    kfifo: add example files to the kernel sample directory

    sstefani authored committed
    Add four examples to the kernel sample directory.
    It shows how to handle:
    - a byte stream fifo
    - a integer type fifo
    - a dynamic record sized fifo
    - the fifo DMA functions
    [ coding-style fixes]
    Signed-off-by: Stefani Seibold <>
    Cc: Greg KH <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>
Commits on Aug 5, 2010
  1. @ralfbaechle

    SAMPLES: kprobe_example: Make it print something on MIPS.

    David Daney authored ralfbaechle committed
    This KProbes example is a little useless if it doesn't print anything.
    For MIPS print similar messages to those produced on x86 and PPC.
    Signed-off-by: David Daney <>
    Signed-off-by: Ralf Baechle <>
Commits on May 14, 2010
  1. @rostedt

    tracing: Let tracepoints have data passed to tracepoint callbacks

    Steven Rostedt authored rostedt committed
    This patch adds data to be passed to tracepoint callbacks.
    The created functions from DECLARE_TRACE() now need a mandatory data
    parameter. For example:
    DECLARE_TRACE(mytracepoint, int value, value)
    Will create the register function:
    int register_trace_mytracepoint((void(*)(void *data, int value))probe,
                                    void *data);
    As the first argument, all callbacks (probes) must take a (void *data)
    parameter. So a callback for the above tracepoint will look like:
    void myprobe(void *data, int value)
    The callback may choose to ignore the data parameter.
    This change allows callbacks to register a private data pointer along
    with the function probe.
    	void mycallback(void *data, int value);
    	register_trace_mytracepoint(mycallback, mydata);
    Then the mycallback() will receive the "mydata" as the first parameter
    before the args.
    A more detailed example:
      DECLARE_TRACE(mytracepoint, TP_PROTO(int status), TP_ARGS(status));
      /* In the C file */
      DEFINE_TRACE(mytracepoint, TP_PROTO(int status), TP_ARGS(status));
      /* In a file registering this tracepoint */
      int my_callback(void *data, int status)
    	struct my_struct my_data = data;
    	my_data = kmalloc(sizeof(*my_data), GFP_KERNEL);
    	register_trace_mytracepoint(my_callback, my_data);
    The same callback can also be registered to the same tracepoint as long
    as the data registered is different. Note, the data must also be used
    to unregister the callback:
    	unregister_trace_mytracepoint(my_callback, my_data);
    Because of the data parameter, tracepoints declared this way can not have
    no args. That is:
      DECLARE_TRACE(mytracepoint, TP_PROTO(void), TP_ARGS());
    will cause an error.
    If no arguments are needed, a new macro can be used instead:
    Since there are no arguments, the proto and args fields are left out.
    This is part of a series to make the tracepoint footprint smaller:
       text	   data	    bss	    dec	    hex	filename
    4913961	1088356	 861512	6863829	 68bbd5	vmlinux.orig
    4914025	1088868	 861512	6864405	 68be15	vmlinux.class
    4918492	1084612	 861512	6864616	 68bee8	vmlinux.tracepoint
    Again, this patch also increases the size of the kernel, but
    lays the ground work for decreasing it.
     v5: Fixed net/core/drop_monitor.c to handle these updates.
     v4: Moved the DECLARE_TRACE() DECLARE_TRACE_NOARGS out of the
         #ifdef CONFIG_TRACE_POINTS, since the two are the same in both
         cases. The __DECLARE_TRACE() is what changes.
         Thanks to Frederic Weisbecker for pointing this out.
     v3: Made all register_* functions require data to be passed and
         all callbacks to take a void * parameter as its first argument.
         This makes the calling functions comply with C standards.
         Also added more comments to the modifications of DECLARE_TRACE().
     v2: Made the DECLARE_TRACE() have the ability to pass arguments
         and added a new DECLARE_TRACE_NOARGS() for tracepoints that
         do not need any arguments.
    Acked-by: Mathieu Desnoyers <>
    Acked-by: Masami Hiramatsu <>
    Acked-by: Frederic Weisbecker <>
    Cc: Neil Horman <>
    Cc: David S. Miller <>
    Signed-off-by: Steven Rostedt <>
Commits on Mar 30, 2010
  1. include cleanup: Update gfp.h and slab.h includes to prepare for brea…

    Tejun Heo authored
    …king implicit slab.h inclusion from percpu.h
    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files.  percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.
    percpu.h -> slab.h dependency is about to be removed.  Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability.  As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.
    The script does the followings.
    * Scan files for gfp and slab usages and update includes such that
      only the necessary includes are there.  ie. if only gfp is used,
      gfp.h, if slab is used, slab.h.
    * When the script inserts a new include, it looks at the include
      blocks and try to put the new include such that its order conforms
      to its surrounding.  It's put in the include block which contains
      core kernel includes, in the same order that the rest are ordered -
      alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
      doesn't seem to be any matching order.
    * If the script can't find a place to put a new include (mostly
      because the file doesn't have fitting include block), it prints out
      an error message indicating which .h file needs to be added to the
    The conversion was done in the following steps.
    1. The initial automatic conversion of all .c files updated slightly
       over 4000 files, deleting around 700 includes and adding ~480 gfp.h
       and ~3000 slab.h inclusions.  The script emitted errors for ~400
    2. Each error was manually checked.  Some didn't need the inclusion,
       some needed manual addition while adding it to implementation .h or
       embedding .c file was more appropriate for others.  This step added
       inclusions to around 150 files.
    3. The script was run again and the output was compared to the edits
       from #2 to make sure no file was left behind.
    4. Several build tests were done and a couple of problems were fixed.
       e.g. lib/decompress_*.c used malloc/free() wrappers around slab
       APIs requiring slab.h to be added manually.
    5. The script was run on all .h files but without automatically
       editing them as sprinkling gfp.h and slab.h inclusions around .h
       files could easily lead to inclusion dependency hell.  Most gfp.h
       inclusion directives were ignored as stuff from gfp.h was usually
       wildly available and often used in preprocessor macros.  Each
       slab.h inclusion directive was examined and added manually as
    6. percpu.h was updated not to include slab.h.
    7. Build test were done on the following configurations and failures
       were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
       distributed build env didn't work with gcov compiles) and a few
       more options had to be turned off depending on archs to make things
       build (like ipr on powerpc/64 which failed due to missing writeq).
       * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
       * powerpc and powerpc64 SMP allmodconfig
       * sparc and sparc64 SMP allmodconfig
       * ia64 SMP allmodconfig
       * s390 SMP allmodconfig
       * alpha SMP allmodconfig
       * um on x86_64 SMP allmodconfig
    8. percpu.h modifications were reverted so that it could be applied as
       a separate patch and serve as bisection point.
    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.
    Signed-off-by: Tejun Heo <>
    Guess-its-ok-by: Christoph Lameter <>
    Cc: Ingo Molnar <>
    Cc: Lee Schermerhorn <>
Commits on Mar 9, 2010
  1. Merge commit 'v2.6.34-rc1' into perf/urgent

    Ingo Molnar authored
    Merge reason: Pick up -rc1 and resolve the conflict as well.
    Signed-off-by: Ingo Molnar <>
Commits on Mar 8, 2010
  1. @ephox-gcc-plugins @gregkh

    Driver core: Constify struct sysfs_ops in struct kobj_type

    ephox-gcc-plugins authored gregkh committed
    Constify struct sysfs_ops.
    This is part of the ops structure constification
    effort started by Arjan van de Ven et al.
    Benefits of this constification:
     * prevents modification of data that is shared
       (referenced) by many other structure instances
       at runtime
     * detects/prevents accidental (but not intentional)
       modification attempts on archs that enforce
       read-only kernel data at runtime
     * potentially better optimized code as the compiler
       can assume that the const data cannot be changed
     * the compiler/linker move const data into .rodata
       and therefore exclude them from false sharing
    Signed-off-by: Emese Revfy <>
    Acked-by: David Teigland <>
    Acked-by: Matt Domsch <>
    Acked-by: Maciej Sosnowski <>
    Acked-by: Hans J. Koch <>
    Acked-by: Pekka Enberg <>
    Acked-by: Jens Axboe <>
    Acked-by: Stephen Hemminger <>
    Signed-off-by: Greg Kroah-Hartman <>
  2. @gregkh

    kset-example: Spelling fixes.

    Radu Voicilas authored gregkh committed
    No change in functionality.
    Signed-off-by: Radu Voicilas <>
    Signed-off-by: Greg Kroah-Hartman <>
  3. @gregkh

    kobject-example: Spelling fixes.

    Radu Voicilas authored gregkh committed
    No change in functionality.
    Signed-off-by: Radu Voicilas <>
    Signed-off-by: Greg Kroah-Hartman <>
Commits on Feb 27, 2010
  1. @fweisbec

    percpu: Add __percpu sparse annotations to hw_breakpoint

    Tejun Heo authored fweisbec committed
    Add __percpu sparse annotations to hw_breakpoint.
    These annotations are to make sparse consider percpu variables to be
    in a different address space and warn if accessed without going
    through percpu accessors.  This patch doesn't affect normal builds.
    In kernel/hw_breakpoint.c, per_cpu(nr_task_bp_pinned, cpu)'s will
    trigger spurious noderef related warnings from sparse.  Changing it to
    &per_cpu(nr_task_bp_pinned[0], cpu) will work around the problem but
    deemed to ugly by the maintainer.  Leave it alone until better
    solution can be found.
    Signed-off-by: Tejun Heo <>
    Cc: Stephen Rothwell <>
    Cc: K.Prasad <>
    LKML-Reference: <>
    Signed-off-by: Frederic Weisbecker <>
Commits on Dec 12, 2009
  1. Merge branch 'perf-fixes-for-linus' of git://…

    * 'perf-fixes-for-linus' of git:// (57 commits)
      x86, perf events: Check if we have APIC enabled
      perf_event: Fix variable initialization in other codepaths
      perf kmem: Fix unused argument build warning
      perf symbols: perf_header__read_build_ids() offset'n'size should be u64
      perf symbols: dsos__read_build_ids() should read both user and kernel buildids
      perf tools: Align long options which have no short forms
      perf kmem: Show usage if no option is specified
      sched: Mark sched_clock() as notrace
      perf sched: Add max delay time snapshot
      perf tools: Correct size given to memset
      perf_event: Fix perf_swevent_hrtimer() variable initialization
      perf sched: Fix for getting task's execution time
      tracing/kprobes: Fix field creation's bad error handling
      perf_event: Cleanup for cpu_clock_perf_event_update()
      perf_event: Allocate children's perf_event_ctxp at the right time
      perf_event: Clean up __perf_event_init_context()
      hw-breakpoints: Modify breakpoints without unregistering them
      perf probe: Update perf-probe document
      perf probe: Support --del option
      trace-kprobe: Support delete probe syntax
Commits on Dec 7, 2009
  1. Merge branch 'for-next' into for-linus

    Jiri Kosina authored
Commits on Dec 6, 2009
  1. @fweisbec

    hw-breakpoints: Use overflow handler instead of the event callback

    fweisbec authored
    struct perf_event::event callback was called when a breakpoint
    triggers. But this is a rather opaque callback, pretty
    tied-only to the breakpoint API and not really integrated into perf
    as it triggers even when we don't overflow.
    We prefer to use overflow_handler() as it fits into the perf events
    rules, being called only when we overflow.
    Reported-by: Peter Zijlstra <>
    Signed-off-by: Frederic Weisbecker <>
    Cc: Paul Mackerras <>
    Cc: Arnaldo Carvalho de Melo <>
    Cc: "K. Prasad" <>
Something went wrong with that request. Please try again.