<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/mm/dmapool.c, branch v4.1.6</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.1.6</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.1.6'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2014-10-10T02:26:00Z</updated>
<entry>
<title>mm/dmapool.c: fixed a brace coding style issue</title>
<updated>2014-10-10T02:26:00Z</updated>
<author>
<name>Paul McQuade</name>
<email>paulmcquad@gmail.com</email>
</author>
<published>2014-10-09T22:29:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=baa2ef83981c71ceb00f68fbdac323253c2c3e42'/>
<id>urn:sha1:baa2ef83981c71ceb00f68fbdac323253c2c3e42</id>
<content type='text'>
Remove 3 brace coding style for any arm of this statement

Signed-off-by: Paul McQuade &lt;paulmcquad@gmail.com&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>
<entry>
<title>mm: dmapool: add/remove sysfs file outside of the pool lock lock</title>
<updated>2014-10-10T02:25:59Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2014-10-09T22:28:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=01c2965f0723a25209d5cf4cac630ed0f6d0edf4'/>
<id>urn:sha1:01c2965f0723a25209d5cf4cac630ed0f6d0edf4</id>
<content type='text'>
cat /sys/.../pools followed by removal the device leads to:

|======================================================
|[ INFO: possible circular locking dependency detected ]
|3.17.0-rc4+ #1498 Not tainted
|-------------------------------------------------------
|rmmod/2505 is trying to acquire lock:
| (s_active#28){++++.+}, at: [&lt;c017f754&gt;] kernfs_remove_by_name_ns+0x3c/0x88
|
|but task is already holding lock:
| (pools_lock){+.+.+.}, at: [&lt;c011494c&gt;] dma_pool_destroy+0x18/0x17c
|
|which lock already depends on the new lock.
|the existing dependency chain (in reverse order) is:
|
|-&gt; #1 (pools_lock){+.+.+.}:
|   [&lt;c0114ae8&gt;] show_pools+0x30/0xf8
|   [&lt;c0313210&gt;] dev_attr_show+0x1c/0x48
|   [&lt;c0180e84&gt;] sysfs_kf_seq_show+0x88/0x10c
|   [&lt;c017f960&gt;] kernfs_seq_show+0x24/0x28
|   [&lt;c013efc4&gt;] seq_read+0x1b8/0x480
|   [&lt;c011e820&gt;] vfs_read+0x8c/0x148
|   [&lt;c011ea10&gt;] SyS_read+0x40/0x8c
|   [&lt;c000e960&gt;] ret_fast_syscall+0x0/0x48
|
|-&gt; #0 (s_active#28){++++.+}:
|   [&lt;c017e9ac&gt;] __kernfs_remove+0x258/0x2ec
|   [&lt;c017f754&gt;] kernfs_remove_by_name_ns+0x3c/0x88
|   [&lt;c0114a7c&gt;] dma_pool_destroy+0x148/0x17c
|   [&lt;c03ad288&gt;] hcd_buffer_destroy+0x20/0x34
|   [&lt;c03a4780&gt;] usb_remove_hcd+0x110/0x1a4

The problem is the lock order of pools_lock and kernfs_mutex in
dma_pool_destroy() vs show_pools() call path.

This patch breaks out the creation of the sysfs file outside of the
pools_lock mutex.  The newly added pools_reg_lock ensures that there is no
race of create vs destroy code path in terms whether or not the sysfs file
has to be deleted (and was it deleted before we try to create a new one)
and what to do if device_create_file() failed.

Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&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>
<entry>
<title>Fix unbalanced mutex in dma_pool_create().</title>
<updated>2014-09-18T17:39:16Z</updated>
<author>
<name>Krzysztof Hałasa</name>
<email>khalasa@piap.pl</email>
</author>
<published>2014-09-18T13:12:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=153a9f131f50420b7ce008c94f1c6374cbc460d7'/>
<id>urn:sha1:153a9f131f50420b7ce008c94f1c6374cbc460d7</id>
<content type='text'>
dma_pool_create() needs to unlock the mutex in error case.  The bug was
introduced in the 3.16 by commit cc6b664aa26d ("mm/dmapool.c: remove
redundant NULL check for dev in dma_pool_create()")/

Signed-off-by: Krzysztof Hałasa &lt;khc@piap.pl&gt;
Cc: stable@vger.kernel.org  # v3.16
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm/dmapool.c: reuse devres_release() to free resources</title>
<updated>2014-06-04T23:54:08Z</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2014-06-04T23:10:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=172cb4b3d49a1339dd67ee05e3f47972a70f556f'/>
<id>urn:sha1:172cb4b3d49a1339dd67ee05e3f47972a70f556f</id>
<content type='text'>
Instead of calling an additional routine in dmam_pool_destroy() rely on
what dmam_pool_release() is doing.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&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>
<entry>
<title>mm/dmapool.c: remove redundant NULL check for dev in dma_pool_create()</title>
<updated>2014-06-04T23:54:04Z</updated>
<author>
<name>Daeseok Youn</name>
<email>daeseok.youn@gmail.com</email>
</author>
<published>2014-06-04T23:08:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cc6b664aa26de93d9a3f99d4021a8d88b434ed06'/>
<id>urn:sha1:cc6b664aa26de93d9a3f99d4021a8d88b434ed06</id>
<content type='text'>
"dev" cannot be NULL because it is already checked before calling
dma_pool_create().

If dev ever was NULL, the code would oops in dev_to_node() after enabling
CONFIG_NUMA.

It is possible that some driver is using dev==NULL and has never been run
on a NUMA machine.  Such a driver is probably outdated, possibly buggy and
will need some attention if it starts triggering NULL derefs.

Signed-off-by: Daeseok Youn &lt;daeseok.youn@gmail.com&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>
<entry>
<title>mm: Fix printk typo in dmapool.c</title>
<updated>2014-05-05T13:44:47Z</updated>
<author>
<name>Hiroshige Sato</name>
<email>sato.vintage@gmail.com</email>
</author>
<published>2014-04-16T12:28:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5835f25117ef6a56144bfc6be98b5a3cb188bf7a'/>
<id>urn:sha1:5835f25117ef6a56144bfc6be98b5a3cb188bf7a</id>
<content type='text'>
Fix printk typo in dmapool.c

Signed-off-by: Hiroshige Sato &lt;sato.vintage@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>dmapool: make DMAPOOL_DEBUG detect corruption of free marker</title>
<updated>2012-12-12T01:22:24Z</updated>
<author>
<name>Matthieu CASTET</name>
<email>matthieu.castet@parrot.com</email>
</author>
<published>2012-12-12T00:01:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5de55b265a13bc263c823bbe05d87d2c5e785f6f'/>
<id>urn:sha1:5de55b265a13bc263c823bbe05d87d2c5e785f6f</id>
<content type='text'>
This can help to catch the case where hardware is writing after dma free.

[akpm@linux-foundation.org: tidy code, fix comment, use sizeof(page-&gt;offset), use pr_err()]
Signed-off-by: Matthieu Castet &lt;matthieu.castet@parrot.com&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>
<entry>
<title>mm: dmapool: use provided gfp flags for all dma_alloc_coherent() calls</title>
<updated>2012-12-11T08:28:08Z</updated>
<author>
<name>Marek Szyprowski</name>
<email>m.szyprowski@samsung.com</email>
</author>
<published>2012-11-07T14:37:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=387870f2d6d679746020fa8e25ef786ff338dc98'/>
<id>urn:sha1:387870f2d6d679746020fa8e25ef786ff338dc98</id>
<content type='text'>
dmapool always calls dma_alloc_coherent() with GFP_ATOMIC flag,
regardless the flags provided by the caller. This causes excessive
pruning of emergency memory pools without any good reason. Additionaly,
on ARM architecture any driver which is using dmapools will sooner or
later  trigger the following error:
"ERROR: 256 KiB atomic DMA coherent pool is too small!
Please increase it with coherent_pool= kernel parameter!".
Increasing the coherent pool size usually doesn't help much and only
delays such error, because all GFP_ATOMIC DMA allocations are always
served from the special, very limited memory pool.

This patch changes the dmapool code to correctly use gfp flags provided
by the dmapool caller.

Reported-by: Soeren Moch &lt;smoch@web.de&gt;
Reported-by: Thomas Petazzoni &lt;thomas.petazzoni@free-electrons.com&gt;
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Tested-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Tested-by: Soeren Moch &lt;smoch@web.de&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>mm: fix implicit stat.h usage in dmapool.c</title>
<updated>2011-10-31T13:20:12Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2011-10-16T06:03:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7c77509c542927ee2a3c8812fad84957e51bf67d'/>
<id>urn:sha1:7c77509c542927ee2a3c8812fad84957e51bf67d</id>
<content type='text'>
The removal of the implicitly everywhere module.h and its child includes
will reveal this implicit stat.h usage:

mm/dmapool.c:108: error: ‘S_IRUGO’ undeclared here (not in a function)

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>mm: Map most files to use export.h instead of module.h</title>
<updated>2011-10-31T13:20:12Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2011-10-16T06:01:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b95f1b31b75588306e32b2afd32166cad48f670b'/>
<id>urn:sha1:b95f1b31b75588306e32b2afd32166cad48f670b</id>
<content type='text'>
The files changed within are only using the EXPORT_SYMBOL
macro variants.  They are not using core modular infrastructure
and hence don't need module.h but only the export.h header.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
</feed>
