<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/gpu/drm/ttm/ttm_memory.c, branch linux-4.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.1.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.1.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2014-09-17T01:15:01Z</updated>
<entry>
<title>drm/ttm: make sure format string cannot leak in</title>
<updated>2014-09-17T01:15:01Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2014-09-11T20:53:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=109ab90974995a06aeabab1535b0ce00f26dd24a'/>
<id>urn:sha1:109ab90974995a06aeabab1535b0ce00f26dd24a</id>
<content type='text'>
While zone-&gt;name is currently hard coded, the call to kobject_init_and_add()
should follow the more defensive argument list usage (as already done in
other places in ttm_memory.c) where "%s" is used instead of directly passing
in a variable as a format string.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
</entry>
<entry>
<title>drm/ttm: remove ttm_mem_global-&gt;queue</title>
<updated>2012-11-20T06:06:22Z</updated>
<author>
<name>Marcin Slusarz</name>
<email>marcin.slusarz@gmail.com</email>
</author>
<published>2012-11-06T21:49:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=91926741ecd28dc246875a39a908c2f6aadb2542'/>
<id>urn:sha1:91926741ecd28dc246875a39a908c2f6aadb2542</id>
<content type='text'>
It's unused.

Signed-off-by: Marcin Slusarz &lt;marcin.slusarz@gmail.com&gt;
Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
</entry>
<entry>
<title>UAPI: (Scripted) Convert #include "..." to #include &lt;path/...&gt; in drivers/gpu/</title>
<updated>2012-10-02T17:01:07Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2012-10-02T17:01:07Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=760285e7e7ab282c25b5e90816f7c47000557f4f'/>
<id>urn:sha1:760285e7e7ab282c25b5e90816f7c47000557f4f</id>
<content type='text'>
Convert #include "..." to #include &lt;path/...&gt; in drivers/gpu/.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Dave Airlie &lt;airlied@redhat.com&gt;
Acked-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Acked-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Acked-by: Dave Jones &lt;davej@redhat.com&gt;
</content>
</entry>
<entry>
<title>drm/ttm: Use pr_fmt and pr_&lt;level&gt;</title>
<updated>2012-03-20T08:45:35Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2012-03-17T04:43:50Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=25d0479a5925562fbf999afb5a8daa3f501c729d'/>
<id>urn:sha1:25d0479a5925562fbf999afb5a8daa3f501c729d</id>
<content type='text'>
Use the more current logging style.

Add pr_fmt and remove the TTM_PFX uses.
Coalesce formats and align arguments.

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
</entry>
<entry>
<title>drm/ttm: provide dma aware ttm page pool code V9</title>
<updated>2011-12-06T10:39:33Z</updated>
<author>
<name>Konrad Rzeszutek Wilk</name>
<email>konrad.wilk@oracle.com</email>
</author>
<published>2011-11-03T20:46:34Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2334b75ffbef6b8932f09ec4418b65ddb764ae99'/>
<id>urn:sha1:2334b75ffbef6b8932f09ec4418b65ddb764ae99</id>
<content type='text'>
In TTM world the pages for the graphic drivers are kept in three different
pools: write combined, uncached, and cached (write-back). When the pages
are used by the graphic driver the graphic adapter via its built in MMU
(or AGP) programs these pages in. The programming requires the virtual address
(from the graphic adapter perspective) and the physical address (either System RAM
or the memory on the card) which is obtained using the pci_map_* calls (which does the
virtual to physical - or bus address translation). During the graphic application's
"life" those pages can be shuffled around, swapped out to disk, moved from the
VRAM to System RAM or vice-versa. This all works with the existing TTM pool code
- except when we want to use the software IOTLB (SWIOTLB) code to "map" the physical
addresses to the graphic adapter MMU. We end up programming the bounce buffer's
physical address instead of the TTM pool memory's and get a non-worky driver.
There are two solutions:
1) using the DMA API to allocate pages that are screened by the DMA API, or
2) using the pci_sync_* calls to copy the pages from the bounce-buffer and back.

This patch fixes the issue by allocating pages using the DMA API. The second
is a viable option - but it has performance drawbacks and potential correctness
issues - think of the write cache page being bounced (SWIOTLB-&gt;TTM), the
WC is set on the TTM page and the copy from SWIOTLB not making it to the TTM
page until the page has been recycled in the pool (and used by another application).

The bounce buffer does not get activated often - only in cases where we have
a 32-bit capable card and we want to use a page that is allocated above the
4GB limit. The bounce buffer offers the solution of copying the contents
of that 4GB page to an location below 4GB and then back when the operation has been
completed (or vice-versa). This is done by using the 'pci_sync_*' calls.
Note: If you look carefully enough in the existing TTM page pool code you will
notice the GFP_DMA32 flag is used  - which should guarantee that the provided page
is under 4GB. It certainly is the case, except this gets ignored in two cases:
 - If user specifies 'swiotlb=force' which bounces _every_ page.
 - If user is using a Xen's PV Linux guest (which uses the SWIOTLB and the
   underlaying PFN's aren't necessarily under 4GB).

To not have this extra copying done the other option is to allocate the pages
using the DMA API so that there is not need to map the page and perform the
expensive 'pci_sync_*' calls.

This DMA API capable TTM pool requires for this the 'struct device' to
properly call the DMA API. It also has to track the virtual and bus address of
the page being handed out in case it ends up being swapped out or de-allocated -
to make sure it is de-allocated using the proper's 'struct device'.

Implementation wise the code keeps two lists: one that is attached to the
'struct device' (via the dev-&gt;dma_pools list) and a global one to be used when
the 'struct device' is unavailable (think shrinker code). The global list can
iterate over all of the 'struct device' and its associated dma_pool. The list
in dev-&gt;dma_pools can only iterate the device's dma_pool.
                                                            /[struct device_pool]\
        /---------------------------------------------------| dev                |
       /                                            +-------| dma_pool           |
 /-----+------\                                    /        \--------------------/
 |struct device|     /--&gt;[struct dma_pool for WC]&lt;/         /[struct device_pool]\
 | dma_pools   +----+                                     /-| dev                |
 |  ...        |    \---&gt;[struct dma_pool for uncached]&lt;-/--| dma_pool           |
 \-----+------/                                         /   \--------------------/
        \----------------------------------------------/
[Two pools associated with the device (WC and UC), and the parallel list
containing the 'struct dev' and 'struct dma_pool' entries]

The maximum amount of dma pools a device can have is six: write-combined,
uncached, and cached; then there are the DMA32 variants which are:
write-combined dma32, uncached dma32, and cached dma32.

Currently this code only gets activated when any variant of the SWIOTLB IOMMU
code is running (Intel without VT-d, AMD without GART, IBM Calgary and Xen PV
with PCI devices).

Tested-by: Michel Dänzer &lt;michel@daenzer.net&gt;
[v1: Using swiotlb_nr_tbl instead of swiotlb_enabled]
[v2: Major overhaul - added 'inuse_list' to seperate used from inuse and reorder
the order of lists to get better performance.]
[v3: Added comments/and some logic based on review, Added Jerome tag]
[v4: rebase on top of ttm_tt &amp; ttm_backend merge]
[v5: rebase on top of ttm memory accounting overhaul]
[v6: New rebase on top of more memory accouting changes]
[v7: well rebase on top of no memory accounting changes]
[v8: make sure pages list is initialized empty]
[v9: calll ttm_mem_global_free_page in unpopulate for accurate accountg]
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Reviewed-by: Jerome Glisse &lt;jglisse@redhat.com&gt;
Acked-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'drm-ttm-pool' into drm-core-next</title>
<updated>2010-04-20T03:12:28Z</updated>
<author>
<name>Dave Airlie</name>
<email>airlied@redhat.com</email>
</author>
<published>2010-04-20T03:12:28Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c2b41276da65481d36311a13d69020d150861c43'/>
<id>urn:sha1:c2b41276da65481d36311a13d69020d150861c43</id>
<content type='text'>
* drm-ttm-pool:
  drm/ttm: using kmalloc/kfree requires including slab.h
  drm/ttm: include linux/seq_file.h for seq_printf
  drm/ttm: Add sysfs interface to control pool allocator.
  drm/ttm: Use set_pages_array_wc instead of set_memory_wc.
  arch/x86: Add array variants for setting memory to wc caching.
  drm/nouveau: Add ttm page pool debugfs file.
  drm/radeon/kms: Add ttm page pool debugfs file.
  drm/ttm: Add debugfs output entry to pool allocator.
  drm/ttm: add pool wc/uc page allocator V3
</content>
</entry>
<entry>
<title>drm/ttm: Add sysfs interface to control pool allocator.</title>
<updated>2010-04-06T01:36:18Z</updated>
<author>
<name>Pauli Nieminen</name>
<email>suokkos@gmail.com</email>
</author>
<published>2010-04-01T12:45:03Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c96af79e3463d5d3f865625baa8bb8aa4c0944a0'/>
<id>urn:sha1:c96af79e3463d5d3f865625baa8bb8aa4c0944a0</id>
<content type='text'>
Sysfs interface allows user to configure pool allocator functionality and
change limits for the size of pool.

Signed-off-by: Pauli Nieminen &lt;suokkos@gmail.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
</entry>
<entry>
<title>drm/ttm: add pool wc/uc page allocator V3</title>
<updated>2010-04-06T01:35:26Z</updated>
<author>
<name>Pauli Nieminen</name>
<email>suokkos@gmail.com</email>
</author>
<published>2010-04-01T12:44:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=1403b1a38e8b19a4cc17e2c158e278628943a436'/>
<id>urn:sha1:1403b1a38e8b19a4cc17e2c158e278628943a436</id>
<content type='text'>
On AGP system we might allocate/free routinely uncached or wc memory,
changing page from cached (wb) to uc or wc is very expensive and involves
a lot of flushing. To improve performance this allocator use a pool
of uc,wc pages.

Pools are protected with spinlocks to allow multiple threads to allocate pages
simultanously. Expensive operations are done outside of spinlock to maximize
concurrency.

Pools are linked lists of pages that were recently freed. mm shrink callback
allows kernel to claim back pages when they are required for something else.

Fixes:
* set_pages_array_wb handles highmem pages so we don't have to remove them
  from pool.
* Add count parameter to ttm_put_pages to avoid looping in free code.
* Change looping from _safe to normal in pool fill error path.
* Initialize sum variable and make the loop prettier in get_num_unused_pages.

* Moved pages_freed reseting inside the loop in ttm_page_pool_free.
* Add warning comment about spinlock context in ttm_page_pool_free.

Based on Jerome Glisse's and Dave Airlie's pool allocator.

Signed-off-by: Jerome Glisse &lt;jglisse@redhat.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
Signed-off-by: Pauli Nieminen &lt;suokkos@gmail.com&gt;
Reviewed-by: Jerome Glisse &lt;jglisse@redhat.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'master' into export-slabh</title>
<updated>2010-04-05T02:37:28Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-04-05T02:37:28Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=336f5899d287f06d8329e208fc14ce50f7ec9698'/>
<id>urn:sha1:336f5899d287f06d8329e208fc14ce50f7ec9698</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge branch 'v2.6.34-rc2' into drm-linus</title>
<updated>2010-03-31T04:55:14Z</updated>
<author>
<name>Dave Airlie</name>
<email>airlied@redhat.com</email>
</author>
<published>2010-03-31T04:55:14Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3595be778d8cb887f0e0575ef0a0c1a094d120bb'/>
<id>urn:sha1:3595be778d8cb887f0e0575ef0a0c1a094d120bb</id>
<content type='text'>
</content>
</entry>
</feed>
