<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/gpu, branch v5.3.8</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>drm/amdgpu: user pages array memory leak fix</title>
<updated>2019-10-29T08:22:28+00:00</updated>
<author>
<name>Philip Yang</name>
<email>Philip.Yang@amd.com</email>
</author>
<published>2019-10-03T18:18:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=3e4b0b29cbdae9706eacccbf1be2964770b3022f'/>
<id>3e4b0b29cbdae9706eacccbf1be2964770b3022f</id>
<content type='text'>
commit 209620b422945ee03cebb03f726e706d537b692d upstream.

user_pages array should always be freed after validation regardless if
user pages are changed after bo is created because with HMM change parse
bo always allocate user pages array to get user pages for userptr bo.

v2: remove unused local variable and amend commit

v3: add back get user pages in gem_userptr_ioctl, to detect application
bug where an userptr VMA is not ananymous memory and reject it.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1844962

Signed-off-by: Philip Yang &lt;Philip.Yang@amd.com&gt;
Tested-by: Joe Barnett &lt;thejoe@gmail.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;Felix.Kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org # 5.3
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 209620b422945ee03cebb03f726e706d537b692d upstream.

user_pages array should always be freed after validation regardless if
user pages are changed after bo is created because with HMM change parse
bo always allocate user pages array to get user pages for userptr bo.

v2: remove unused local variable and amend commit

v3: add back get user pages in gem_userptr_ioctl, to detect application
bug where an userptr VMA is not ananymous memory and reject it.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1844962

Signed-off-by: Philip Yang &lt;Philip.Yang@amd.com&gt;
Tested-by: Joe Barnett &lt;thejoe@gmail.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;Felix.Kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org # 5.3
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdgpu/uvd7: fix allocation size in enc ring test (v2)</title>
<updated>2019-10-29T08:22:27+00:00</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2019-10-15T22:08:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ca8e0e7fdb88d806d2f4b4876769be43bbbdf75f'/>
<id>ca8e0e7fdb88d806d2f4b4876769be43bbbdf75f</id>
<content type='text'>
commit 5d230bc91f6c15e5d281f2851502918d98b9e770 upstream.

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

v2: - session info is 128K according to mesa
    - use the same session info for create and destroy

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: James Zhu &lt;James.Zhu@amd.com&gt;
Tested-by: James Zhu &lt;James.Zhu@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 5d230bc91f6c15e5d281f2851502918d98b9e770 upstream.

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

v2: - session info is 128K according to mesa
    - use the same session info for create and destroy

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: James Zhu &lt;James.Zhu@amd.com&gt;
Tested-by: James Zhu &lt;James.Zhu@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdgpu/uvd6: fix allocation size in enc ring test (v2)</title>
<updated>2019-10-29T08:22:27+00:00</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2019-10-15T22:07:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b2a79fb4e09026c52035bbed0b3e404e5a0abbf1'/>
<id>b2a79fb4e09026c52035bbed0b3e404e5a0abbf1</id>
<content type='text'>
commit ce584a8e2885c7b59dfacba42db39761243cacb2 upstream.

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

v2: - session info is 128K according to mesa
    - use the same session info for create and destroy

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: James Zhu &lt;James.Zhu@amd.com&gt;
Tested-by: James Zhu &lt;James.Zhu@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit ce584a8e2885c7b59dfacba42db39761243cacb2 upstream.

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

v2: - session info is 128K according to mesa
    - use the same session info for create and destroy

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: James Zhu &lt;James.Zhu@amd.com&gt;
Tested-by: James Zhu &lt;James.Zhu@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdgpu/vcn: fix allocation size in enc ring test</title>
<updated>2019-10-29T08:22:26+00:00</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2019-10-15T22:09:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ea387394bcf8cb79ea4313b652bd4d27de17f888'/>
<id>ea387394bcf8cb79ea4313b652bd4d27de17f888</id>
<content type='text'>
commit c81fffc2c9450750dd7a54a36a788a860ab0425d upstream.

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

- Session info is 128K according to mesa
- Use the same session info for create and destroy

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: James Zhu &lt;James.Zhu@amd.com&gt;
Tested-by: James Zhu &lt;James.Zhu@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit c81fffc2c9450750dd7a54a36a788a860ab0425d upstream.

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

- Session info is 128K according to mesa
- Use the same session info for create and destroy

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: James Zhu &lt;James.Zhu@amd.com&gt;
Tested-by: James Zhu &lt;James.Zhu@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdgpu/vce: fix allocation size in enc ring test</title>
<updated>2019-10-29T08:22:26+00:00</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2019-10-17T15:36:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6fb13498c9d971dbcf733d69ea92756e2c7f4764'/>
<id>6fb13498c9d971dbcf733d69ea92756e2c7f4764</id>
<content type='text'>
commit ee027828c40faa92a7ef4c2b0641bbb3f4be95d3 upstream.

We need to allocate a large enough buffer for the
feedback buffer, otherwise the IB test can overwrite
other memory.

Reviewed-by: James Zhu &lt;James.Zhu@amd.com&gt;
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit ee027828c40faa92a7ef4c2b0641bbb3f4be95d3 upstream.

We need to allocate a large enough buffer for the
feedback buffer, otherwise the IB test can overwrite
other memory.

Reviewed-by: James Zhu &lt;James.Zhu@amd.com&gt;
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/i915: Favor last VBT child device with conflicting AUX ch/DDC pin</title>
<updated>2019-10-29T08:22:25+00:00</updated>
<author>
<name>Ville Syrjälä</name>
<email>ville.syrjala@linux.intel.com</email>
</author>
<published>2019-10-11T20:20:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5e0b7f4811d296eea55626f349d1eceeb738cec5'/>
<id>5e0b7f4811d296eea55626f349d1eceeb738cec5</id>
<content type='text'>
commit 0336ab580878f4c5663dfa2b66095821fdc3e588 upstream.

The first come first served apporoach to handling the VBT
child device AUX ch conflicts has backfired. We have machines
in the wild where the VBT specifies both port A eDP and
port E DP (in that order) with port E being the real one.

So let's try to flip the preference around and let the last
child device win once again.

Cc: stable@vger.kernel.org
Cc: Jani Nikula &lt;jani.nikula@intel.com&gt;
Tested-by: Masami Ichikawa &lt;masami256@gmail.com&gt;
Tested-by: Torsten &lt;freedesktop201910@liggy.de&gt;
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111966
Fixes: 36a0f92020dc ("drm/i915/bios: make child device order the priority order")
Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191011202030.8829-1-ville.syrjala@linux.intel.com
Acked-by: Jani Nikula &lt;jani.nikula@intel.com&gt;
(cherry picked from commit 41e35ffb380bde1379e4030bb5b2ac824d5139cf)
Signed-off-by: Rodrigo Vivi &lt;rodrigo.vivi@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 0336ab580878f4c5663dfa2b66095821fdc3e588 upstream.

The first come first served apporoach to handling the VBT
child device AUX ch conflicts has backfired. We have machines
in the wild where the VBT specifies both port A eDP and
port E DP (in that order) with port E being the real one.

So let's try to flip the preference around and let the last
child device win once again.

Cc: stable@vger.kernel.org
Cc: Jani Nikula &lt;jani.nikula@intel.com&gt;
Tested-by: Masami Ichikawa &lt;masami256@gmail.com&gt;
Tested-by: Torsten &lt;freedesktop201910@liggy.de&gt;
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111966
Fixes: 36a0f92020dc ("drm/i915/bios: make child device order the priority order")
Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191011202030.8829-1-ville.syrjala@linux.intel.com
Acked-by: Jani Nikula &lt;jani.nikula@intel.com&gt;
(cherry picked from commit 41e35ffb380bde1379e4030bb5b2ac824d5139cf)
Signed-off-by: Rodrigo Vivi &lt;rodrigo.vivi@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/i915/userptr: Never allow userptr into the mappable GGTT</title>
<updated>2019-10-29T08:22:25+00:00</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2019-09-28T08:25:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7332164441a786daba25818c527df6b27324e276'/>
<id>7332164441a786daba25818c527df6b27324e276</id>
<content type='text'>
commit 4f2a572eda67aecb1e7e4fc26cc985fb8158f6e8 upstream.

Daniel Vetter uncovered a nasty cycle in using the mmu-notifiers to
invalidate userptr objects which also happen to be pulled into GGTT
mmaps. That is when we unbind the userptr object (on mmu invalidation),
we revoke all CPU mmaps, which may then recurse into mmu invalidation.

We looked for ways of breaking the cycle, but the revocation on
invalidation is required and cannot be avoided. The only solution we
could see was to not allow such GGTT bindings of userptr objects in the
first place. In practice, no one really wants to use a GGTT mmapping of
a CPU pointer...

Just before Daniel's explosive lockdep patches land in v5.4-rc1, we got
a genuine blip from CI:

&lt;4&gt;[  246.793958] ======================================================
&lt;4&gt;[  246.793972] WARNING: possible circular locking dependency detected
&lt;4&gt;[  246.793989] 5.3.0-gbd6c56f50d15-drmtip_372+ #1 Tainted: G     U
&lt;4&gt;[  246.794003] ------------------------------------------------------
&lt;4&gt;[  246.794017] kswapd0/145 is trying to acquire lock:
&lt;4&gt;[  246.794030] 000000003f565be6 (&amp;dev-&gt;struct_mutex/1){+.+.}, at: userptr_mn_invalidate_range_start+0x18f/0x220 [i915]
&lt;4&gt;[  246.794250]
                  but task is already holding lock:
&lt;4&gt;[  246.794263] 000000001799cef9 (&amp;anon_vma-&gt;rwsem){++++}, at: page_lock_anon_vma_read+0xe6/0x2a0
&lt;4&gt;[  246.794291]
                  which lock already depends on the new lock.

&lt;4&gt;[  246.794307]
                  the existing dependency chain (in reverse order) is:
&lt;4&gt;[  246.794322]
                  -&gt; #3 (&amp;anon_vma-&gt;rwsem){++++}:
&lt;4&gt;[  246.794344]        down_write+0x33/0x70
&lt;4&gt;[  246.794357]        __vma_adjust+0x3d9/0x7b0
&lt;4&gt;[  246.794370]        __split_vma+0x16a/0x180
&lt;4&gt;[  246.794385]        mprotect_fixup+0x2a5/0x320
&lt;4&gt;[  246.794399]        do_mprotect_pkey+0x208/0x2e0
&lt;4&gt;[  246.794413]        __x64_sys_mprotect+0x16/0x20
&lt;4&gt;[  246.794429]        do_syscall_64+0x55/0x1c0
&lt;4&gt;[  246.794443]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
&lt;4&gt;[  246.794456]
                  -&gt; #2 (&amp;mapping-&gt;i_mmap_rwsem){++++}:
&lt;4&gt;[  246.794478]        down_write+0x33/0x70
&lt;4&gt;[  246.794493]        unmap_mapping_pages+0x48/0x130
&lt;4&gt;[  246.794519]        i915_vma_revoke_mmap+0x81/0x1b0 [i915]
&lt;4&gt;[  246.794519]        i915_vma_unbind+0x11d/0x4a0 [i915]
&lt;4&gt;[  246.794519]        i915_vma_destroy+0x31/0x300 [i915]
&lt;4&gt;[  246.794519]        __i915_gem_free_objects+0xb8/0x4b0 [i915]
&lt;4&gt;[  246.794519]        drm_file_free.part.0+0x1e6/0x290
&lt;4&gt;[  246.794519]        drm_release+0xa6/0xe0
&lt;4&gt;[  246.794519]        __fput+0xc2/0x250
&lt;4&gt;[  246.794519]        task_work_run+0x82/0xb0
&lt;4&gt;[  246.794519]        do_exit+0x35b/0xdb0
&lt;4&gt;[  246.794519]        do_group_exit+0x34/0xb0
&lt;4&gt;[  246.794519]        __x64_sys_exit_group+0xf/0x10
&lt;4&gt;[  246.794519]        do_syscall_64+0x55/0x1c0
&lt;4&gt;[  246.794519]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
&lt;4&gt;[  246.794519]
                  -&gt; #1 (&amp;vm-&gt;mutex){+.+.}:
&lt;4&gt;[  246.794519]        i915_gem_shrinker_taints_mutex+0x6d/0xe0 [i915]
&lt;4&gt;[  246.794519]        i915_address_space_init+0x9f/0x160 [i915]
&lt;4&gt;[  246.794519]        i915_ggtt_init_hw+0x55/0x170 [i915]
&lt;4&gt;[  246.794519]        i915_driver_probe+0xc9f/0x1620 [i915]
&lt;4&gt;[  246.794519]        i915_pci_probe+0x43/0x1b0 [i915]
&lt;4&gt;[  246.794519]        pci_device_probe+0x9e/0x120
&lt;4&gt;[  246.794519]        really_probe+0xea/0x3d0
&lt;4&gt;[  246.794519]        driver_probe_device+0x10b/0x120
&lt;4&gt;[  246.794519]        device_driver_attach+0x4a/0x50
&lt;4&gt;[  246.794519]        __driver_attach+0x97/0x130
&lt;4&gt;[  246.794519]        bus_for_each_dev+0x74/0xc0
&lt;4&gt;[  246.794519]        bus_add_driver+0x13f/0x210
&lt;4&gt;[  246.794519]        driver_register+0x56/0xe0
&lt;4&gt;[  246.794519]        do_one_initcall+0x58/0x300
&lt;4&gt;[  246.794519]        do_init_module+0x56/0x1f6
&lt;4&gt;[  246.794519]        load_module+0x25bd/0x2a40
&lt;4&gt;[  246.794519]        __se_sys_finit_module+0xd3/0xf0
&lt;4&gt;[  246.794519]        do_syscall_64+0x55/0x1c0
&lt;4&gt;[  246.794519]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
&lt;4&gt;[  246.794519]
                  -&gt; #0 (&amp;dev-&gt;struct_mutex/1){+.+.}:
&lt;4&gt;[  246.794519]        __lock_acquire+0x15d8/0x1e90
&lt;4&gt;[  246.794519]        lock_acquire+0xa6/0x1c0
&lt;4&gt;[  246.794519]        __mutex_lock+0x9d/0x9b0
&lt;4&gt;[  246.794519]        userptr_mn_invalidate_range_start+0x18f/0x220 [i915]
&lt;4&gt;[  246.794519]        __mmu_notifier_invalidate_range_start+0x85/0x110
&lt;4&gt;[  246.794519]        try_to_unmap_one+0x76b/0x860
&lt;4&gt;[  246.794519]        rmap_walk_anon+0x104/0x280
&lt;4&gt;[  246.794519]        try_to_unmap+0xc0/0xf0
&lt;4&gt;[  246.794519]        shrink_page_list+0x561/0xc10
&lt;4&gt;[  246.794519]        shrink_inactive_list+0x220/0x440
&lt;4&gt;[  246.794519]        shrink_node_memcg+0x36e/0x740
&lt;4&gt;[  246.794519]        shrink_node+0xcb/0x490
&lt;4&gt;[  246.794519]        balance_pgdat+0x241/0x580
&lt;4&gt;[  246.794519]        kswapd+0x16c/0x530
&lt;4&gt;[  246.794519]        kthread+0x119/0x130
&lt;4&gt;[  246.794519]        ret_from_fork+0x24/0x50
&lt;4&gt;[  246.794519]
                  other info that might help us debug this:

&lt;4&gt;[  246.794519] Chain exists of:
                    &amp;dev-&gt;struct_mutex/1 --&gt; &amp;mapping-&gt;i_mmap_rwsem --&gt; &amp;anon_vma-&gt;rwsem

&lt;4&gt;[  246.794519]  Possible unsafe locking scenario:

&lt;4&gt;[  246.794519]        CPU0                    CPU1
&lt;4&gt;[  246.794519]        ----                    ----
&lt;4&gt;[  246.794519]   lock(&amp;anon_vma-&gt;rwsem);
&lt;4&gt;[  246.794519]                                lock(&amp;mapping-&gt;i_mmap_rwsem);
&lt;4&gt;[  246.794519]                                lock(&amp;anon_vma-&gt;rwsem);
&lt;4&gt;[  246.794519]   lock(&amp;dev-&gt;struct_mutex/1);
&lt;4&gt;[  246.794519]
                   *** DEADLOCK ***

v2: Say no to mmap_ioctl

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111744
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111870
Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Tvrtko Ursulin &lt;tvrtko.ursulin@intel.com&gt;
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Cc: stable@vger.kernel.org
Reviewed-by: Tvrtko Ursulin &lt;tvrtko.ursulin@intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190928082546.3473-1-chris@chris-wilson.co.uk
(cherry picked from commit a4311745bba9763e3c965643d4531bd5765b0513)
Signed-off-by: Rodrigo Vivi &lt;rodrigo.vivi@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 4f2a572eda67aecb1e7e4fc26cc985fb8158f6e8 upstream.

Daniel Vetter uncovered a nasty cycle in using the mmu-notifiers to
invalidate userptr objects which also happen to be pulled into GGTT
mmaps. That is when we unbind the userptr object (on mmu invalidation),
we revoke all CPU mmaps, which may then recurse into mmu invalidation.

We looked for ways of breaking the cycle, but the revocation on
invalidation is required and cannot be avoided. The only solution we
could see was to not allow such GGTT bindings of userptr objects in the
first place. In practice, no one really wants to use a GGTT mmapping of
a CPU pointer...

Just before Daniel's explosive lockdep patches land in v5.4-rc1, we got
a genuine blip from CI:

&lt;4&gt;[  246.793958] ======================================================
&lt;4&gt;[  246.793972] WARNING: possible circular locking dependency detected
&lt;4&gt;[  246.793989] 5.3.0-gbd6c56f50d15-drmtip_372+ #1 Tainted: G     U
&lt;4&gt;[  246.794003] ------------------------------------------------------
&lt;4&gt;[  246.794017] kswapd0/145 is trying to acquire lock:
&lt;4&gt;[  246.794030] 000000003f565be6 (&amp;dev-&gt;struct_mutex/1){+.+.}, at: userptr_mn_invalidate_range_start+0x18f/0x220 [i915]
&lt;4&gt;[  246.794250]
                  but task is already holding lock:
&lt;4&gt;[  246.794263] 000000001799cef9 (&amp;anon_vma-&gt;rwsem){++++}, at: page_lock_anon_vma_read+0xe6/0x2a0
&lt;4&gt;[  246.794291]
                  which lock already depends on the new lock.

&lt;4&gt;[  246.794307]
                  the existing dependency chain (in reverse order) is:
&lt;4&gt;[  246.794322]
                  -&gt; #3 (&amp;anon_vma-&gt;rwsem){++++}:
&lt;4&gt;[  246.794344]        down_write+0x33/0x70
&lt;4&gt;[  246.794357]        __vma_adjust+0x3d9/0x7b0
&lt;4&gt;[  246.794370]        __split_vma+0x16a/0x180
&lt;4&gt;[  246.794385]        mprotect_fixup+0x2a5/0x320
&lt;4&gt;[  246.794399]        do_mprotect_pkey+0x208/0x2e0
&lt;4&gt;[  246.794413]        __x64_sys_mprotect+0x16/0x20
&lt;4&gt;[  246.794429]        do_syscall_64+0x55/0x1c0
&lt;4&gt;[  246.794443]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
&lt;4&gt;[  246.794456]
                  -&gt; #2 (&amp;mapping-&gt;i_mmap_rwsem){++++}:
&lt;4&gt;[  246.794478]        down_write+0x33/0x70
&lt;4&gt;[  246.794493]        unmap_mapping_pages+0x48/0x130
&lt;4&gt;[  246.794519]        i915_vma_revoke_mmap+0x81/0x1b0 [i915]
&lt;4&gt;[  246.794519]        i915_vma_unbind+0x11d/0x4a0 [i915]
&lt;4&gt;[  246.794519]        i915_vma_destroy+0x31/0x300 [i915]
&lt;4&gt;[  246.794519]        __i915_gem_free_objects+0xb8/0x4b0 [i915]
&lt;4&gt;[  246.794519]        drm_file_free.part.0+0x1e6/0x290
&lt;4&gt;[  246.794519]        drm_release+0xa6/0xe0
&lt;4&gt;[  246.794519]        __fput+0xc2/0x250
&lt;4&gt;[  246.794519]        task_work_run+0x82/0xb0
&lt;4&gt;[  246.794519]        do_exit+0x35b/0xdb0
&lt;4&gt;[  246.794519]        do_group_exit+0x34/0xb0
&lt;4&gt;[  246.794519]        __x64_sys_exit_group+0xf/0x10
&lt;4&gt;[  246.794519]        do_syscall_64+0x55/0x1c0
&lt;4&gt;[  246.794519]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
&lt;4&gt;[  246.794519]
                  -&gt; #1 (&amp;vm-&gt;mutex){+.+.}:
&lt;4&gt;[  246.794519]        i915_gem_shrinker_taints_mutex+0x6d/0xe0 [i915]
&lt;4&gt;[  246.794519]        i915_address_space_init+0x9f/0x160 [i915]
&lt;4&gt;[  246.794519]        i915_ggtt_init_hw+0x55/0x170 [i915]
&lt;4&gt;[  246.794519]        i915_driver_probe+0xc9f/0x1620 [i915]
&lt;4&gt;[  246.794519]        i915_pci_probe+0x43/0x1b0 [i915]
&lt;4&gt;[  246.794519]        pci_device_probe+0x9e/0x120
&lt;4&gt;[  246.794519]        really_probe+0xea/0x3d0
&lt;4&gt;[  246.794519]        driver_probe_device+0x10b/0x120
&lt;4&gt;[  246.794519]        device_driver_attach+0x4a/0x50
&lt;4&gt;[  246.794519]        __driver_attach+0x97/0x130
&lt;4&gt;[  246.794519]        bus_for_each_dev+0x74/0xc0
&lt;4&gt;[  246.794519]        bus_add_driver+0x13f/0x210
&lt;4&gt;[  246.794519]        driver_register+0x56/0xe0
&lt;4&gt;[  246.794519]        do_one_initcall+0x58/0x300
&lt;4&gt;[  246.794519]        do_init_module+0x56/0x1f6
&lt;4&gt;[  246.794519]        load_module+0x25bd/0x2a40
&lt;4&gt;[  246.794519]        __se_sys_finit_module+0xd3/0xf0
&lt;4&gt;[  246.794519]        do_syscall_64+0x55/0x1c0
&lt;4&gt;[  246.794519]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
&lt;4&gt;[  246.794519]
                  -&gt; #0 (&amp;dev-&gt;struct_mutex/1){+.+.}:
&lt;4&gt;[  246.794519]        __lock_acquire+0x15d8/0x1e90
&lt;4&gt;[  246.794519]        lock_acquire+0xa6/0x1c0
&lt;4&gt;[  246.794519]        __mutex_lock+0x9d/0x9b0
&lt;4&gt;[  246.794519]        userptr_mn_invalidate_range_start+0x18f/0x220 [i915]
&lt;4&gt;[  246.794519]        __mmu_notifier_invalidate_range_start+0x85/0x110
&lt;4&gt;[  246.794519]        try_to_unmap_one+0x76b/0x860
&lt;4&gt;[  246.794519]        rmap_walk_anon+0x104/0x280
&lt;4&gt;[  246.794519]        try_to_unmap+0xc0/0xf0
&lt;4&gt;[  246.794519]        shrink_page_list+0x561/0xc10
&lt;4&gt;[  246.794519]        shrink_inactive_list+0x220/0x440
&lt;4&gt;[  246.794519]        shrink_node_memcg+0x36e/0x740
&lt;4&gt;[  246.794519]        shrink_node+0xcb/0x490
&lt;4&gt;[  246.794519]        balance_pgdat+0x241/0x580
&lt;4&gt;[  246.794519]        kswapd+0x16c/0x530
&lt;4&gt;[  246.794519]        kthread+0x119/0x130
&lt;4&gt;[  246.794519]        ret_from_fork+0x24/0x50
&lt;4&gt;[  246.794519]
                  other info that might help us debug this:

&lt;4&gt;[  246.794519] Chain exists of:
                    &amp;dev-&gt;struct_mutex/1 --&gt; &amp;mapping-&gt;i_mmap_rwsem --&gt; &amp;anon_vma-&gt;rwsem

&lt;4&gt;[  246.794519]  Possible unsafe locking scenario:

&lt;4&gt;[  246.794519]        CPU0                    CPU1
&lt;4&gt;[  246.794519]        ----                    ----
&lt;4&gt;[  246.794519]   lock(&amp;anon_vma-&gt;rwsem);
&lt;4&gt;[  246.794519]                                lock(&amp;mapping-&gt;i_mmap_rwsem);
&lt;4&gt;[  246.794519]                                lock(&amp;anon_vma-&gt;rwsem);
&lt;4&gt;[  246.794519]   lock(&amp;dev-&gt;struct_mutex/1);
&lt;4&gt;[  246.794519]
                   *** DEADLOCK ***

v2: Say no to mmap_ioctl

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111744
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111870
Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Tvrtko Ursulin &lt;tvrtko.ursulin@intel.com&gt;
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Cc: stable@vger.kernel.org
Reviewed-by: Tvrtko Ursulin &lt;tvrtko.ursulin@intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190928082546.3473-1-chris@chris-wilson.co.uk
(cherry picked from commit a4311745bba9763e3c965643d4531bd5765b0513)
Signed-off-by: Rodrigo Vivi &lt;rodrigo.vivi@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdgpu/sdma5: fix mask value of POLL_REGMEM packet for pipe sync</title>
<updated>2019-10-29T08:22:24+00:00</updated>
<author>
<name>Xiaojie Yuan</name>
<email>xiaojie.yuan@amd.com</email>
</author>
<published>2019-10-09T17:01:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ace574d8c1d7be0ee03f9fd13ff65b4d36157e9f'/>
<id>ace574d8c1d7be0ee03f9fd13ff65b4d36157e9f</id>
<content type='text'>
commit d12c50857c6edc1d18aa7a60c5a4d6d943137bc0 upstream.

sdma will hang once sequence number to be polled reaches 0x1000_0000

Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Xiaojie Yuan &lt;xiaojie.yuan@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit d12c50857c6edc1d18aa7a60c5a4d6d943137bc0 upstream.

sdma will hang once sequence number to be polled reaches 0x1000_0000

Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Xiaojie Yuan &lt;xiaojie.yuan@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdgpu: Bail earlier when amdgpu.cik_/si_support is not set to 1</title>
<updated>2019-10-29T08:22:24+00:00</updated>
<author>
<name>Hans de Goede</name>
<email>hdegoede@redhat.com</email>
</author>
<published>2019-10-10T16:28:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c4e8f715f835390b383397716234deea98841f0e'/>
<id>c4e8f715f835390b383397716234deea98841f0e</id>
<content type='text'>
commit 984d7a929ad68b7be9990fc9c5cfa5d5c9fc7942 upstream.

Bail from the pci_driver probe function instead of from the drm_driver
load function.

This avoid /dev/dri/card0 temporarily getting registered and then
unregistered again, sending unwanted add / remove udev events to
userspace.

Specifically this avoids triggering the (userspace) bug fixed by this
plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Note that despite that being a userspace bug, not sending unnecessary
udev events is a good idea in general.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1490490
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 984d7a929ad68b7be9990fc9c5cfa5d5c9fc7942 upstream.

Bail from the pci_driver probe function instead of from the drm_driver
load function.

This avoid /dev/dri/card0 temporarily getting registered and then
unregistered again, sending unwanted add / remove udev events to
userspace.

Specifically this avoids triggering the (userspace) bug fixed by this
plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Note that despite that being a userspace bug, not sending unnecessary
udev events is a good idea in general.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1490490
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/panfrost: Handle resetting on timeout better</title>
<updated>2019-10-29T08:22:23+00:00</updated>
<author>
<name>Steven Price</name>
<email>steven.price@arm.com</email>
</author>
<published>2019-10-09T09:44:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1e1c0d54c9ee561ec42f79e7c6e695be6fe23c60'/>
<id>1e1c0d54c9ee561ec42f79e7c6e695be6fe23c60</id>
<content type='text'>
commit 5b3ec8134f5f9fa1ed0a538441a495521078bbee upstream.

Panfrost uses multiple schedulers (one for each slot, so 2 in reality),
and on a timeout has to stop all the schedulers to safely perform a
reset. However more than one scheduler can trigger a timeout at the same
time. This race condition results in jobs being freed while they are
still in use.

When stopping other slots use cancel_delayed_work_sync() to ensure that
any timeout started for that slot has completed. Also use
mutex_trylock() to obtain reset_lock. This means that only one thread
attempts the reset, the other threads will simply complete without doing
anything (the first thread will wait for this in the call to
cancel_delayed_work_sync()).

While we're here and since the function is already dependent on
sched_job not being NULL, let's remove the unnecessary checks.

Fixes: aa20236784ab ("drm/panfrost: Prevent concurrent resets")
Tested-by: Neil Armstrong &lt;narmstrong@baylibre.com&gt;
Signed-off-by: Steven Price &lt;steven.price@arm.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191009094456.9704-1-steven.price@arm.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 5b3ec8134f5f9fa1ed0a538441a495521078bbee upstream.

Panfrost uses multiple schedulers (one for each slot, so 2 in reality),
and on a timeout has to stop all the schedulers to safely perform a
reset. However more than one scheduler can trigger a timeout at the same
time. This race condition results in jobs being freed while they are
still in use.

When stopping other slots use cancel_delayed_work_sync() to ensure that
any timeout started for that slot has completed. Also use
mutex_trylock() to obtain reset_lock. This means that only one thread
attempts the reset, the other threads will simply complete without doing
anything (the first thread will wait for this in the call to
cancel_delayed_work_sync()).

While we're here and since the function is already dependent on
sched_job not being NULL, let's remove the unnecessary checks.

Fixes: aa20236784ab ("drm/panfrost: Prevent concurrent resets")
Tested-by: Neil Armstrong &lt;narmstrong@baylibre.com&gt;
Signed-off-by: Steven Price &lt;steven.price@arm.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191009094456.9704-1-steven.price@arm.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
