<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/lib/dma-debug.c, branch v3.4.48</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.4.48</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.4.48'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2012-01-25T00:00:35Z</updated>
<entry>
<title>Remove useless get_driver()/put_driver() calls</title>
<updated>2012-01-25T00:00:35Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2012-01-24T18:35:24Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f3ff9247088a0af0c192a28908dab76ff3d8871f'/>
<id>urn:sha1:f3ff9247088a0af0c192a28908dab76ff3d8871f</id>
<content type='text'>
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 &lt;stern@rowland.harvard.edu&gt;
CC: "David S. Miller" &lt;davem@davemloft.net&gt;
CC: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
CC: Michael Buesch &lt;m@bues.ch&gt;
CC: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>Fix comparison using wrong pointer variable in dma debug code</title>
<updated>2011-11-21T10:35:37Z</updated>
<author>
<name>Thomas Jarosch</name>
<email>thomas.jarosch@intra2net.com</email>
</author>
<published>2011-11-17T19:31:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=91ec37cc1015220965e39bf342fb846810d19e79'/>
<id>urn:sha1:91ec37cc1015220965e39bf342fb846810d19e79</id>
<content type='text'>
cppcheck reported:
[lib/dma-debug.c:248] -&gt; [lib/dma-debug.c:248]: (style) Same expression on both sides of '=='.

Signed-off-by: Thomas Jarosch &lt;thomas.jarosch@intra2net.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
</content>
</entry>
<entry>
<title>lib: dma-debug needs export.h for EXPORT_SYMBOL</title>
<updated>2011-10-31T23:32:23Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2011-07-01T20:23:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=23a7bfae6e19cb428da75804e5c4dfd67cd9ae8f'/>
<id>urn:sha1:23a7bfae6e19cb428da75804e5c4dfd67cd9ae8f</id>
<content type='text'>
There are no modular calls here, so just the minimal header for
the EXPORT_SYMBOL macro will suffice.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>dma-debug: hash_bucket_find needs to allow for offsets within an entry</title>
<updated>2011-08-23T13:36:00Z</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2011-08-08T19:13:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c6a21d0b8d667f403bc6186ef215a504a26ab682'/>
<id>urn:sha1:c6a21d0b8d667f403bc6186ef215a504a26ab682</id>
<content type='text'>
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:
[&lt;ffffffff81050f71&gt;] warn_slowpath_common+0x85/0x9d
[&lt;ffffffff8105102c&gt;] warn_slowpath_fmt+0x46/0x48
[&lt;ffffffff8124658e&gt;] ? check_sync+0x39/0x48c
[&lt;ffffffff8107c470&gt;] ? trace_hardirqs_on+0xd/0xf
[&lt;ffffffff81246632&gt;] check_sync+0xdd/0x48c
[&lt;ffffffff81246ca6&gt;] debug_dma_sync_single_for_device+0x3f/0x41
[&lt;ffffffffa011615c&gt;] ? pci_map_page+0x84/0x97 [cxgb3]
[&lt;ffffffffa0117bc3&gt;] pci_dma_sync_single_for_device.clone.0+0x65/0x6e [cxgb3]
[&lt;ffffffffa0117ed1&gt;] refill_fl+0x305/0x30a [cxgb3]
[&lt;ffffffffa011857d&gt;] t3_sge_alloc_qset+0x6a7/0x821 [cxgb3]
[&lt;ffffffffa010a07b&gt;] cxgb_up+0x4d0/0xe62 [cxgb3]
[&lt;ffffffff81086037&gt;] ? __module_text_address+0x12/0x58
[&lt;ffffffffa010aa4c&gt;] cxgb_open+0x3f/0x309 [cxgb3]
[&lt;ffffffff813e9f6c&gt;] __dev_open+0x8e/0xbc
[&lt;ffffffff813e7ca5&gt;] __dev_change_flags+0xbe/0x142
[&lt;ffffffff813e9ea8&gt;] dev_change_flags+0x21/0x57
[&lt;ffffffff81445937&gt;] devinet_ioctl+0x29a/0x54b
[&lt;ffffffff811f9a87&gt;] ? inode_has_perm+0xaa/0xce
[&lt;ffffffff81446ed2&gt;] inet_ioctl+0x8f/0xa7
[&lt;ffffffff813d683a&gt;] sock_do_ioctl+0x29/0x48
[&lt;ffffffff813d6c83&gt;] sock_ioctl+0x213/0x222
[&lt;ffffffff81137f78&gt;] vfs_ioctl+0x32/0xa6
[&lt;ffffffff811384e2&gt;] do_vfs_ioctl+0x47a/0x4b3
[&lt;ffffffff81138571&gt;] sys_ioctl+0x56/0x79
[&lt;ffffffff81009c32&gt;] system_call_fastpath+0x16/0x1b
---[ end trace 69a4d4cc77b58004 ]---

(some edits by Joerg Roedel)

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Reported-by: Jay Fenalson &lt;fenlason@redhat.com&gt;
CC: Divy LeRay &lt;divy@chelsio.com&gt;
CC: Stanislaw Gruszka &lt;sgruszka@redhat.com&gt;
CC: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
CC: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
</content>
</entry>
<entry>
<title>dma-debug: print information about leaked entry</title>
<updated>2011-04-07T14:31:19Z</updated>
<author>
<name>Stanislaw Gruszka</name>
<email>sgruszka@redhat.com</email>
</author>
<published>2011-03-31T12:08:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ba4b87ad5497cba555954885db99c99627f93748'/>
<id>urn:sha1:ba4b87ad5497cba555954885db99c99627f93748</id>
<content type='text'>
When driver leak dma mapping, print additional information about one of
leaked entries, to to help investigate problem. Patch should be useful
for debugging drivers, which maps many different class of buffers.

Signed-off-by: Stanislaw Gruszka &lt;sgruszka@redhat.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
</content>
</entry>
<entry>
<title>llseek: automatically add .llseek fop</title>
<updated>2010-10-15T13:53:27Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2010-08-15T16:52:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6038f373a3dc1f1c26496e60b6c40b164716f07e'/>
<id>urn:sha1:6038f373a3dc1f1c26496e60b6c40b164716f07e</id>
<content type='text'>
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(...)
{
&lt;+...
nonseekable_open(...)
...+&gt;
}

@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
&lt;+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+&gt;
}

@ 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)
{
&lt;+...
(
   *off = E
|
   *off += E
|
   func(..., off, ...)
|
   E = *off
)
...+&gt;
}

@ 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)
{
&lt;+...
(
  *off = E
|
  *off += E
|
  func(..., off, ...)
|
  E = *off
)
...+&gt;
}

@ 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 &amp;&amp; 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 &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !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 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !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 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !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 &amp;&amp; !fops2 &amp;&amp; !fops3 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !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 &amp;&amp; !has_read &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !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 &amp;&amp; !has_write &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !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 &amp;&amp; !has_write &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Julia Lawall &lt;julia@diku.dk&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
</content>
</entry>
<entry>
<title>dma-debug: Cleanup for copy-loop in filter_write()</title>
<updated>2010-04-07T12:36:27Z</updated>
<author>
<name>Dan Carpenter</name>
<email>error27@gmail.com</email>
</author>
<published>2010-04-06T16:45:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=39a37ce1cc5eef420604fa68b776ff5dab400340'/>
<id>urn:sha1:39a37ce1cc5eef420604fa68b776ff5dab400340</id>
<content type='text'>
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 &lt;error27@gmail.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
</content>
</entry>
<entry>
<title>Merge branches 'amd-iommu/fixes' and 'dma-debug/fixes' into iommu/fixes</title>
<updated>2010-01-22T17:00:41Z</updated>
<author>
<name>Joerg Roedel</name>
<email>joerg.roedel@amd.com</email>
</author>
<published>2010-01-22T17:00:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a02b11937a6e1079fdf386833129cd86a3576196'/>
<id>urn:sha1:a02b11937a6e1079fdf386833129cd86a3576196</id>
<content type='text'>
</content>
</entry>
<entry>
<title>lib/dma-debug.c: mark file-local struct symbol static.</title>
<updated>2010-01-22T16:59:51Z</updated>
<author>
<name>Thiago Farina</name>
<email>tfransosi@gmail.com</email>
</author>
<published>2010-01-18T23:57:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=aeb583d08172e038552bdefe0a79a9aa9e2ecd7c'/>
<id>urn:sha1:aeb583d08172e038552bdefe0a79a9aa9e2ecd7c</id>
<content type='text'>
warning: symbol 'filter_fops' was not declared. Should it be static?

Signed-off-by: Thiago Farina &lt;tfransosi@gmail.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
</content>
</entry>
<entry>
<title>dma-debug: allow DMA_BIDIRECTIONAL mappings to be synced with DMA_FROM_DEVICE and</title>
<updated>2010-01-11T17:34:04Z</updated>
<author>
<name>Krzysztof Halasa</name>
<email>khc@pm.waw.pl</email>
</author>
<published>2010-01-08T22:42:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=42d53b4ff7d61487d18274ebdf1f70c1aef6f122'/>
<id>urn:sha1:42d53b4ff7d61487d18274ebdf1f70c1aef6f122</id>
<content type='text'>
There is no need to perform full BIDIR sync (copying the buffers in case
of swiotlb and similar schemes) if we know that the owner (CPU or device)
hasn't altered the data.

Addresses the false-positive reported at
http://bugzilla.kernel.org/show_bug.cgi?id=14169

Signed-off-by: Krzysztof Halasa &lt;khc@pm.waw.pl&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Cc: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Cc: &lt;stable@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
