11 Aug, 2015

1 commit

  • commit c9d120b0b2b5069cb2ae62f8eac0cef31c8544be upstream.

    If dma-debug is disabled due to a memory error, DMA unmaps do not affect
    the dma_active_cacheline radix tree anymore, and debug_dma_assert_idle()
    can print false warnings.

    Disable debug_dma_assert_idle() when dma_debug_disabled() is true.

    Signed-off-by: Haggai Eran
    Fixes: 0abdd7a81b7e ("dma-debug: introduce debug_dma_assert_idle()")
    Cc: Dan Williams
    Cc: Joerg Roedel
    Cc: Vinod Koul
    Cc: Russell King
    Cc: James Bottomley
    Cc: Florian Fainelli
    Cc: Sebastian Ott
    Cc: Jiri Kosina
    Cc: Horia Geanta
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Haggai Eran
     

17 Apr, 2015

1 commit

  • bucket_find_contain() will search the bucket list for a dma_debug_entry.
    When the entry isn't found it needs to search other buckets too, since
    only the start address of a dma range is hashed (which might be in a
    different bucket).

    A copy of the dma_debug_entry is used to get the previous hash bucket
    but when its list is searched the original dma_debug_entry is to be used
    not its modified copy.

    This fixes false "device driver tries to sync DMA memory it has not allocated"
    warnings.

    Signed-off-by: Sebastian Ott
    Cc: Florian Fainelli
    Cc: Horia Geanta
    Cc: Jiri Kosina
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sebastian Ott
     

11 Dec, 2014

2 commits

  • dma_debug_init() is called by architecture specific code at different
    levels, but typically as a fs_initcall due to the debugfs initialization.
    Some platforms may have early callers of the DMA-API, running prior to the
    fs_initcall() level, which is not much of an issue unless
    CONFIG_DMA_API_DEBUG is set. When the DMA-API debugging facilities are
    turned on a caller will go through:

    debug_dma_map_{single,page}
    -> dma_mapping_error (inline function usually)
    -> debug_dma_mapping_error
    -> get_hash_bucket

    Calling get_hash_bucket() returns a valid hash value since we hash on high
    bits of the dma_addr cookie, but we will grab an unitialized spinlock,
    which typically won't crash but produce a warning, the real crash will
    however happen during the bucket list traversal because the list has not
    been initialized yet.

    An obvious solution is of course to move some of the offenders to run
    after the fs_initcall level, but since this might not always be an option,
    we add a flag "dma_debug_initialized" which is set to false by default,
    and set to true once dma_debug_init() has had a chance to run.

    The dma_debug_disabled() helper function previously introduced just needs
    to check for dma_debug_initialized to allow the caller to proceed or not.

    Signed-off-by: Florian Fainelli
    Cc: Dan Williams
    Cc: Jiri Kosina
    Cc: Horia Geanta
    Cc: Brian Norris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Florian Fainelli
     
  • Add a helper function which returns whether the DMA debugging API is
    disabled, right now we only check for global_disable, but in order to
    accommodate early callers of the DMA-API, we will check for more
    initialization flags in the next patch.

    Signed-off-by: Florian Fainelli
    Cc: Dan Williams
    Cc: Jiri Kosina
    Cc: Horia Geanta
    Cc: Brian Norris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Florian Fainelli
     

02 Sep, 2014

1 commit


04 Mar, 2014

1 commit

  • While debug_dma_assert_idle() checks if a given *page* is actively
    undergoing dma the valid granularity of a dma mapping is a *cacheline*.
    Sander's testing shows that the warning message "DMA-API: exceeded 7
    overlapping mappings of pfn..." is falsely triggering. The test is
    simply mapping multiple cachelines in a given page.

    Ultimately we want overlap tracking to be valid as it is a real api
    violation, so we need to track active mappings by cachelines. Update
    the active dma tracking to use the page-frame-relative cacheline of the
    mapping as the key, and update debug_dma_assert_idle() to check for all
    possible mapped cachelines for a given page.

    However, the need to track active mappings is only relevant when the
    dma-mapping is writable by the device. In fact it is fairly standard
    for read-only mappings to have hundreds or thousands of overlapping
    mappings at once. Limiting the overlap tracking to writable
    (!DMA_TO_DEVICE) eliminates this class of false-positive overlap
    reports.

    Note, the radix gang lookup is sub-optimal. It would be best if it
    stopped fetching entries once the search passed a page boundary.
    Nevertheless, this implementation does not perturb the original net_dma
    failing case. That is to say the extra overhead does not show up in
    terms of making the failing case pass due to a timing change.

    References:
    http://marc.info/?l=linux-netdev&m=139232263419315&w=2
    http://marc.info/?l=linux-netdev&m=139217088107122&w=2

    Signed-off-by: Dan Williams
    Reported-by: Sander Eikelenboom
    Reported-by: Dave Jones
    Tested-by: Dave Jones
    Tested-by: Sander Eikelenboom
    Cc: Konrad Rzeszutek Wilk
    Cc: Francois Romieu
    Cc: Eric Dumazet
    Cc: Wei Liu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Williams
     

30 Jan, 2014

1 commit

  • Commit 0abdd7a81b7e ("dma-debug: introduce debug_dma_assert_idle()") was
    reworked to expand the overlap counter to the full range expressable by
    3 tag bits, but it has a thinko in treating the overlap counter as a
    pure reference count for the entry.

    Instead of deleting when the reference-count drops to zero, we need to
    delete when the overlap-count drops below zero. Also, when detecting
    overflow we can just test the overlap-count > MAX rather than applying
    special meaning to 0.

    Regression report available here:
    http://marc.info/?l=linux-netdev&m=139073373932386&w=2

    This patch, now tested on the original net_dma case, sees the expected
    handful of reports before the eventual data corruption occurs.

    Signed-off-by: Dan Williams
    Reported-by: Sander Eikelenboom
    Cc: Francois Romieu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Williams
     

22 Jan, 2014

1 commit

  • Record actively mapped pages and provide an api for asserting a given
    page is dma inactive before execution proceeds. Placing
    debug_dma_assert_idle() in cow_user_page() flagged the violation of the
    dma-api in the NET_DMA implementation (see commit 77873803363c "net_dma:
    mark broken").

    The implementation includes the capability to count, in a limited way,
    repeat mappings of the same page that occur without an intervening
    unmap. This 'overlap' counter is limited to the few bits of tag space
    in a radix tree. This mechanism is added to mitigate false negative
    cases where, for example, a page is dma mapped twice and
    debug_dma_assert_idle() is called after the page is un-mapped once.

    Signed-off-by: Dan Williams
    Cc: Joerg Roedel
    Cc: Vinod Koul
    Cc: Russell King
    Cc: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Williams
     

23 Mar, 2013

2 commits

  • There were reports of the igb driver unmapping buffers without calling
    dma_mapping_error. On closer inspection issues were found in the DMA
    debug API and how it handled multiple mappings of the same buffer.

    The issue I found is the fact that the debug_dma_mapping_error would
    only set the map_err_type to MAP_ERR_CHECKED in the case that the was
    only one match for device and device address. However in the case of
    non-IOMMU, multiple addresses existed and as a result it was not setting
    this field once a second mapping was instantiated. I have resolved this
    by changing the search so that it instead will now set MAP_ERR_CHECKED
    on the first buffer that matches the device and DMA address that is
    currently in the state MAP_ERR_NOT_CHECKED.

    A secondary side effect of this patch is that in the case of multiple
    buffers using the same address only the last mapping will have a valid
    map_err_type. The previous mappings will all end up with map_err_type
    set to MAP_ERR_CHECKED because of the dma_mapping_error call in
    debug_dma_map_page. However this behavior may be preferable as it means
    you will likely only see one real error per multi-mapped buffer, versus
    the current behavior of multiple false errors mer multi-mapped buffer.

    Signed-off-by: Alexander Duyck
    Cc: Joerg Roedel
    Reviewed-by: Shuah Khan
    Tested-by: Shuah Khan
    Cc: Jakub Kicinski
    Cc: Konrad Rzeszutek Wilk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Duyck
     
  • In check_unmap() it is possible to get into a dead-locked state if
    dma_mapping_error is called. The problem is that the bucket is locked in
    check_unmap, and locked again by debug_dma_mapping_error which is called
    by dma_mapping_error. To resolve that we must release the lock on the
    bucket before making the call to dma_mapping_error.

    [akpm@linux-foundation.org: restore 80-col trickery to be consistent with the rest of the file]
    Signed-off-by: Alexander Duyck
    Cc: Joerg Roedel
    Reviewed-by: Shuah Khan
    Tested-by: Shuah Khan
    Cc: Jakub Kicinski
    Cc: Konrad Rzeszutek Wilk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Duyck
     

17 Nov, 2012

1 commit

  • dma-debug depends on get_dma_ops() interface. Several architectures
    do not define dma_ops and get_dma_ops(). When dma debug interfaces are
    used on an architecture (e.g: c6x) that doesn't define get_dmap_ops(),
    compilation fails. Changing dma-debug to call dma_mapping_error() instead
    of defining its own that calls get_dma_ops(), such that the internal use of
    dma_mapping_error() doesn't interfere with the debug_dma_mapping_error()
    interface's mapping error checks. Moving dma_mapping_error() checks in
    check_unmap() under the dma debug entry not found is sufficient to fix the
    problem.

    Reference: https://lkml.org/lkml/2012/10/26/367

    Signed-off-by: Shuah Khan
    Reported-by: Mark Salter
    Signed-off-by: Joerg Roedel

    Shuah Khan
     

24 Oct, 2012

1 commit

  • Add dma-debug interface debug_dma_mapping_error() to debug
    drivers that fail to check dma mapping errors on addresses
    returned by dma_map_single() and dma_map_page() interfaces.
    This interface clears a flag set by debug_dma_map_page() to
    indicate that dma_mapping_error() has been called by the
    driver. When driver does unmap, debug_dma_unmap() checks the
    flag and if this flag is still set, prints warning message
    that includes call trace that leads up to the unmap. This
    interface can be called from dma_mapping_error() routines to
    enable dma mapping error check debugging.

    Tested: Intel iommu and swiotlb (iommu=soft) on x86-64 with
    CONFIG_DMA_API_DEBUG enabled and disabled.

    Signed-off-by: Shuah Khan
    Reviewed-by: Konrad Rzeszutek Wilk
    Signed-off-by: Joerg Roedel

    Shuah Khan
     

20 Oct, 2012

1 commit

  • If there is only one match, the unique matched entry should be returned.

    Without the fix, the upcoming dma debug interfaces ("dma-debug: new
    interfaces to debug dma mapping errors") can't work reliably because
    only device and dma_addr are passed to dma_mapping_error().

    Signed-off-by: Ming Lei
    Reported-by: Wu Fengguang
    Cc: Joerg Roedel
    Tested-by: Shuah Khan
    Cc: Paul Gortmaker
    Cc: Jakub Kicinski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ming Lei
     

02 Oct, 2012

1 commit


02 Jul, 2012

1 commit

  • Even though it has "bool" in the name, you have pass a u32 pointer to
    debugfs_create_bool(). Otherwise you get memory corruption in
    write_file_bool(). Fortunately in this case the corruption happens in
    an alignment hole between variables so it doesn't cause any problems.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Joerg Roedel

    Dan Carpenter
     

12 Apr, 2012

1 commit


25 Jan, 2012

1 commit

  • As part of the removal of get_driver()/put_driver(), this patch
    (as1512) gets rid of various useless and unnecessary calls in several
    drivers. In some cases it may be desirable to pin the driver by
    calling try_module_get(), but that can be done later.

    Signed-off-by: Alan Stern
    CC: "David S. Miller"
    CC: Konrad Rzeszutek Wilk
    CC: Michael Buesch
    CC: Joerg Roedel
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

21 Nov, 2011

1 commit


01 Nov, 2011

1 commit


23 Aug, 2011

1 commit

  • Summary:
    Users of the pci_dma_sync_single_* api allow users to sync address ranges within
    the range of a mapped entry (i.e. you can dma map address X to dma_addr_t A and
    then pci_dma_sync_single on dma_addr_t A+1. The dma-debug library however
    assume dma syncs will always occur using the base address of a mapped region,
    and uses that assumption to find entries in its hash table. Since thats often
    (but not always the case), the dma debug library can give us false errors about
    missing entries, which are reported as syncing of memory not allocated by the
    driver. This was noted in the cxgb3 driver as this error:

    WARNING: at lib/dma-debug.c:902 check_sync+0xdd/0x48c()
    Hardware name: To be filled by O.E.M.
    cxgb3 0000:01:00.0: DMA-API: device driver tries to sync DMA memory it has not
    allocated [device address=0x00000000fff97800] [size=1984 bytes]
    Modules linked in: autofs4 sunrpc cpufreq_ondemand acpi_cpufreq freq_table
    mperf ip6t_REJECT nf_conntrack_ipv6 ip6table_filter ip6_tables ipv6 uinput
    snd_hda_codec_intelhdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec
    snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer e1000e snd soundcore r8169
    cxgb3 iTCO_wdt snd_page_alloc mii shpchp i2c_i801 iTCO_vendor_support mdio
    microcode firewire_ohci firewire_core crc_itu_t ata_generic pata_acpi i915
    drm_kms_helper drm i2c_algo_bit i2c_core video output [last unloaded:
    scsi_wait_scan]
    Pid: 1818, comm: ifconfig Not tainted 2.6.35-0.23.rc3.git6.fc14.x86_64 #1
    Call Trace:
    [] warn_slowpath_common+0x85/0x9d
    [] warn_slowpath_fmt+0x46/0x48
    [] ? check_sync+0x39/0x48c
    [] ? trace_hardirqs_on+0xd/0xf
    [] check_sync+0xdd/0x48c
    [] debug_dma_sync_single_for_device+0x3f/0x41
    [] ? pci_map_page+0x84/0x97 [cxgb3]
    [] pci_dma_sync_single_for_device.clone.0+0x65/0x6e [cxgb3]
    [] refill_fl+0x305/0x30a [cxgb3]
    [] t3_sge_alloc_qset+0x6a7/0x821 [cxgb3]
    [] cxgb_up+0x4d0/0xe62 [cxgb3]
    [] ? __module_text_address+0x12/0x58
    [] cxgb_open+0x3f/0x309 [cxgb3]
    [] __dev_open+0x8e/0xbc
    [] __dev_change_flags+0xbe/0x142
    [] dev_change_flags+0x21/0x57
    [] devinet_ioctl+0x29a/0x54b
    [] ? inode_has_perm+0xaa/0xce
    [] inet_ioctl+0x8f/0xa7
    [] sock_do_ioctl+0x29/0x48
    [] sock_ioctl+0x213/0x222
    [] vfs_ioctl+0x32/0xa6
    [] do_vfs_ioctl+0x47a/0x4b3
    [] sys_ioctl+0x56/0x79
    [] system_call_fastpath+0x16/0x1b
    ---[ end trace 69a4d4cc77b58004 ]---

    (some edits by Joerg Roedel)

    Signed-off-by: Neil Horman
    Reported-by: Jay Fenalson
    CC: Divy LeRay
    CC: Stanislaw Gruszka
    CC: Joerg Roedel
    CC: Arnd Bergmann
    Signed-off-by: Joerg Roedel

    Neil Horman
     

07 Apr, 2011

1 commit


15 Oct, 2010

1 commit

  • 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;
    @@
    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)
    {

    }

    @ 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)
    {

    }

    @ 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

    Arnd Bergmann
     

07 Apr, 2010

1 commit

  • Earlier in this function we set the last byte of "buf" to NULL so we
    always hit the break statement and "i" is never equal to NAME_MAX_LEN.
    This patch doesn't change how the driver works but it silences a Smatch
    warning and it makes it clearer that we don't write past the end of the
    array.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Joerg Roedel

    Dan Carpenter
     

23 Jan, 2010

2 commits


12 Jan, 2010

1 commit


31 Dec, 2009

1 commit

  • Stephen Rothwell reported the following build warning:

    lib/dma-debug.c: In function 'dma_debug_device_change':
    lib/dma-debug.c:680: warning: 'return' with no value, in function returning non-void

    Introduced by commit f797d9881b62c2ddb1d2e7bd80d87141949c84aa
    ("dma-debug: Do not add notifier when dma debugging is disabled").

    Return 0 [notify-done] when disabled. (this is standard bus notifier behavior.)

    Signed-off-by: Shaun Ruffell
    Signed-off-by: Joerg Roedel
    Cc: Linus Torvalds
    Cc:
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

21 Dec, 2009

1 commit

  • If CONFIG_HAVE_DMA_API_DEBUG is defined and "dma_debug=off" is
    specified on the kernel command line, when you detach a driver from a
    device you can cause the following NULL pointer dereference:

    BUG: unable to handle kernel NULL pointer dereference at (null)
    IP: [] dma_debug_device_change+0x5d/0x117

    The problem is that the dma_debug_device_change notifier function is
    added to the bus notifier chain even though the dma_entry_hash array
    was never initialized. If dma debugging is disabled, this patch both
    prevents dma_debug_device_change notifiers from being added to the
    chain, and additionally ensures that the dma_debug_device_change
    notifier function is a no-op.

    Cc: stable@kernel.org
    Signed-off-by: Shaun Ruffell
    Signed-off-by: Joerg Roedel

    Shaun Ruffell
     

04 Dec, 2009

1 commit

  • That is "success", "unknown", "through", "performance", "[re|un]mapping"
    , "access", "default", "reasonable", "[con]currently", "temperature"
    , "channel", "[un]used", "application", "example","hierarchy", "therefore"
    , "[over|under]flow", "contiguous", "threshold", "enough" and others.

    Signed-off-by: André Goddard Rosa
    Signed-off-by: Jiri Kosina

    André Goddard Rosa
     

29 Oct, 2009

1 commit

  • When PAE is enabled in the kernel configuration the size of
    phys_addr_t differs from the size of a void pointer. The gcc
    prints a warning about that in dma-debug code.
    This patch fixes the warning by converting the output to
    unsigned long long instead of a pointer.

    Signed-off-by: Joerg Roedel

    Joerg Roedel
     

21 Aug, 2009

1 commit

  • While it's debatable whether or not a NULL device argument to
    the DMA API functions is valid... since it certainly isn't
    valid on devices with an IOMMU... dma-debug really shouldn't be
    dereferencing null pointers either.

    Guard against that in err_printk and the driver_filter
    functions. A Fedora rawhide user was seeing this in one of the
    dvb drivers resulting in an oops on boot.

    [ A patch has been sent for testing to the driver, but I feel
    the dma debugging support should be fixed as well. (There's
    still a pile of legacy garbage in the kernel passing null
    pointers to dma_{alloc,free}_*. :( ]

    Signed-off-by: Kyle McMartin
    Cc: mchehab@infradead.org
    Cc: Joerg Roedel
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Kyle McMartin
     

11 Jul, 2009

1 commit

  • Linus noticed how unclean and buggy the overlap() function is:

    - It uses convoluted (and bug-causing) positive checks for
    range overlap - instead of using a more natural negative
    check.

    - Even the positive checks are buggy: a positive intersection
    check has four natural cases while we checked only for three,
    missing the (addr < start && addr2 == end) case for example.

    - The variables are mis-named, making it non-obvious how the
    check was done.

    - It needlessly uses u64 instead of unsigned long. Since these
    are kernel memory pointers and we explicitly exclude highmem
    ranges anyway we cannot ever overflow 32 bits, even if we
    could. (and on 64-bit it doesnt matter anyway)

    All in one, this function needs a total revamp. I used Linus's
    suggestions minus the paranoid checks (we cannot overflow really
    because if we get totally bad DMA ranges passed far more things
    break in the systems than just DMA debugging). I also fixed a
    few other small details i noticed.

    Reported-by: Linus Torvalds
    Cc: Joerg Roedel
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

17 Jun, 2009

1 commit

  • Alan Cox reported that lockdep runs out of its stack-trace entries
    with certain configs:

    BUG: MAX_STACK_TRACE_ENTRIES too low

    This happens because there are 1024 hash buckets, each with a
    separate lock. Lockdep puts each lock into a separate lock class and
    tracks them independently.

    But in reality we never take more than one of the buckets, so they
    really belong into a single lock-class. Annotate the has bucket lock
    init accordingly.

    [ Impact: reduce the lockdep footprint of dma-debug ]

    Reported-by: Alan Cox
    Signed-off-by: Ingo Molnar
    Signed-off-by: Joerg Roedel

    Ingo Molnar
     

16 Jun, 2009

1 commit


15 Jun, 2009

2 commits


08 Jun, 2009

4 commits