<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nvgpu.git/drivers/gpu/nvgpu/os/linux, branch gpu-paging</title>
<subtitle>Tegra GPU Driver. Originally from nv-tegra.nvidia.com/linux-nvgpu.git.</subtitle>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/'/>
<entry>
<title>gpu-paging: Allow for more than one buffer to be swapped at a time</title>
<updated>2022-06-03T19:41:42+00:00</updated>
<author>
<name>Joshua Bakita</name>
<email>jbakita@cs.unc.edu</email>
</author>
<published>2022-06-02T18:29:53+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=9296adcd450143f02faf32fbda5b77dba3f03bc7'/>
<id>9296adcd450143f02faf32fbda5b77dba3f03bc7</id>
<content type='text'>
This uses a very primitive linear disk sector allocation scheme.
Sectors are only reused when userspace resets assignment to 0 with
an NVGPU_AS_IOCTL_SWAP_RESET ioctl (which invalidates all current
swap buffers).

This sector assignment scheme is sufficient for use in a TimeWall-
like system, where all allocations are assumed to be static after
after task system release. This is not suitable for a system with
dynamic allocations, unless userspace manually resets swap state
regularly (benchmarks run a reset at start for example).

Support for dynamic allocations is on the backlog.

No significant speed impact.

Benchmarks, 100 iters, after:
gpu_paging_speed, write: 186.0ms +/- 3.51
gpu_paging_speed, read: 162.7ms +/- 2.58
gpu_paging_overhead_speed, write start: 35.4ms +/- 4.47
gpu_paging_overhead_speed, write finish: 3.3ms +/- 0.18
gpu_paging_overhead_speed, read start: 69.8ms +/- 6.42
gpu_paging_overhead_speed, read finish: 43.2ms +/- 0.91
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This uses a very primitive linear disk sector allocation scheme.
Sectors are only reused when userspace resets assignment to 0 with
an NVGPU_AS_IOCTL_SWAP_RESET ioctl (which invalidates all current
swap buffers).

This sector assignment scheme is sufficient for use in a TimeWall-
like system, where all allocations are assumed to be static after
after task system release. This is not suitable for a system with
dynamic allocations, unless userspace manually resets swap state
regularly (benchmarks run a reset at start for example).

Support for dynamic allocations is on the backlog.

No significant speed impact.

Benchmarks, 100 iters, after:
gpu_paging_speed, write: 186.0ms +/- 3.51
gpu_paging_speed, read: 162.7ms +/- 2.58
gpu_paging_overhead_speed, write start: 35.4ms +/- 4.47
gpu_paging_overhead_speed, write finish: 3.3ms +/- 0.18
gpu_paging_overhead_speed, read start: 69.8ms +/- 6.42
gpu_paging_overhead_speed, read finish: 43.2ms +/- 0.91
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu-paging: Support asynchronous paging</title>
<updated>2022-05-31T15:32:12+00:00</updated>
<author>
<name>Joshua Bakita</name>
<email>jbakita@cs.unc.edu</email>
</author>
<published>2022-05-30T16:20:48+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=745b3ef2ac4d7afa99202e6afc441e3f0b97f5b4'/>
<id>745b3ef2ac4d7afa99202e6afc441e3f0b97f5b4</id>
<content type='text'>
- Fully enables *_ASYNC API
- Allows page mapping to be overlapped with I/O, resulting in an 11% speedup
  to synchronous reads

Benchmarks, 1,000 iters, before:
gpu_paging_speed, write: 185.5ms +/- 3.58
gpu_paging_speed, read: 180.5ms +/- 1.42
gpu_paging_overhead_speed, write start: 183.3ms +/- 3.89
gpu_paging_overhead_speed, write finish: 3.4ms +/- 2.61
gpu_paging_overhead_speed, read start: 181.6ms +/- 3.34
gpu_paging_overhead_speed, read finish: 41.1ms +/- 2.69

Benchmarks, 1,000 iters, after:
gpu_paging_speed, write: 185.8ms +/- 3.70
gpu_paging_speed, read: 161.3ms +/- 0.97
gpu_paging_overhead_speed, write start: 38.9ms +/- 5.47
gpu_paging_overhead_speed, write finish: 3.1ms +/- 2.42
gpu_paging_overhead_speed, read start: 79.4 +/- 6.42
gpu_paging_overhead_speed, read finish: 44.3 +/- 1.53
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Fully enables *_ASYNC API
- Allows page mapping to be overlapped with I/O, resulting in an 11% speedup
  to synchronous reads

Benchmarks, 1,000 iters, before:
gpu_paging_speed, write: 185.5ms +/- 3.58
gpu_paging_speed, read: 180.5ms +/- 1.42
gpu_paging_overhead_speed, write start: 183.3ms +/- 3.89
gpu_paging_overhead_speed, write finish: 3.4ms +/- 2.61
gpu_paging_overhead_speed, read start: 181.6ms +/- 3.34
gpu_paging_overhead_speed, read finish: 41.1ms +/- 2.69

Benchmarks, 1,000 iters, after:
gpu_paging_speed, write: 185.8ms +/- 3.70
gpu_paging_speed, read: 161.3ms +/- 0.97
gpu_paging_overhead_speed, write start: 38.9ms +/- 5.47
gpu_paging_overhead_speed, write finish: 3.1ms +/- 2.42
gpu_paging_overhead_speed, read start: 79.4 +/- 6.42
gpu_paging_overhead_speed, read finish: 44.3 +/- 1.53
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu-paging: Split swap in/out to prepare for async support.</title>
<updated>2022-05-30T16:19:42+00:00</updated>
<author>
<name>Joshua Bakita</name>
<email>jbakita@cs.unc.edu</email>
</author>
<published>2022-05-26T02:01:24+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=ff66847a00ac27d8d94b3664ec156a195dbf3676'/>
<id>ff66847a00ac27d8d94b3664ec156a195dbf3676</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu-paging: Initial working implementation</title>
<updated>2022-05-25T01:11:59+00:00</updated>
<author>
<name>Joshua Bakita</name>
<email>jbakita@cs.unc.edu</email>
</author>
<published>2022-05-25T01:11:59+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=ee26a2842ca891d3ae8b1de1b066d29234fc0115'/>
<id>ee26a2842ca891d3ae8b1de1b066d29234fc0115</id>
<content type='text'>
Supports synchronous page out or in of a specific buffer.

Includes fast reverse struct mapped_buf lookup.

Requires initial set of changes to nvmap as well.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Supports synchronous page out or in of a specific buffer.

Includes fast reverse struct mapped_buf lookup.

Requires initial set of changes to nvmap as well.
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu: nvgpu: add support for disabling l3 via DT</title>
<updated>2022-02-02T20:10:51+00:00</updated>
<author>
<name>Debarshi Dutta</name>
<email>ddutta@nvidia.com</email>
</author>
<published>2022-01-31T02:43:19+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=46b43d2b2485233397f4f62b9bac6d35434b7aea'/>
<id>46b43d2b2485233397f4f62b9bac6d35434b7aea</id>
<content type='text'>
On volta the GPU determines whether to do L3 allocation for a mapping by
checking bit 36 of the physical address. So if a mapping should allocate lines
in the L3 this bit must be set.

However, when the physical addresses for 64GB of RAM uses the 36th bit
resulting in a conflict. Thus, add support for disabling l3 support
for SKUs having 64GB of physical memory.

Bug 3486025

Signed-off-by: Debarshi Dutta &lt;ddutta@nvidia.com&gt;
Change-Id: Ic540e754274cf1d9e6625493962699d21509e540
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2661548
Reviewed-by: Brad Griffis &lt;bgriffis@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Tested-by: Brad Griffis &lt;bgriffis@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On volta the GPU determines whether to do L3 allocation for a mapping by
checking bit 36 of the physical address. So if a mapping should allocate lines
in the L3 this bit must be set.

However, when the physical addresses for 64GB of RAM uses the 36th bit
resulting in a conflict. Thus, add support for disabling l3 support
for SKUs having 64GB of physical memory.

Bug 3486025

Signed-off-by: Debarshi Dutta &lt;ddutta@nvidia.com&gt;
Change-Id: Ic540e754274cf1d9e6625493962699d21509e540
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2661548
Reviewed-by: Brad Griffis &lt;bgriffis@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Tested-by: Brad Griffis &lt;bgriffis@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu: nvgpu: add check for is_railgated</title>
<updated>2021-10-21T14:10:24+00:00</updated>
<author>
<name>Alvin Park</name>
<email>apark@nvidia.com</email>
</author>
<published>2020-12-15T01:34:44+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=4d17d8b10431b1ba5775d35b34e76dbb8f9b448a'/>
<id>4d17d8b10431b1ba5775d35b34e76dbb8f9b448a</id>
<content type='text'>
When try to read '/sys/kernel/debug/gpu.0/railgate_residency'
debug fs node, NULL pointer access error can be happened if
is_railgated function is not assinged.
Add check for is_railgated before calling the function pointer.

Bug 200773027

Change-Id: I914b5b0aa48ccb15affe79510b696ebc91129f67
Signed-off-by: Aditya Gupta &lt;adigupta@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2596320
(cherry picked from commit e649029c7bed3c7afbd454d7e94f9173377f4c64)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2614156
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Reviewed-by: Rohit Upadhyay &lt;rupadhyay@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When try to read '/sys/kernel/debug/gpu.0/railgate_residency'
debug fs node, NULL pointer access error can be happened if
is_railgated function is not assinged.
Add check for is_railgated before calling the function pointer.

Bug 200773027

Change-Id: I914b5b0aa48ccb15affe79510b696ebc91129f67
Signed-off-by: Aditya Gupta &lt;adigupta@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2596320
(cherry picked from commit e649029c7bed3c7afbd454d7e94f9173377f4c64)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2614156
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Reviewed-by: Rohit Upadhyay &lt;rupadhyay@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu: nvgpu: fix clk_arb completion file private data access race</title>
<updated>2021-08-03T18:39:44+00:00</updated>
<author>
<name>Sagar Kamble</name>
<email>skamble@nvidia.com</email>
</author>
<published>2021-08-03T03:41:33+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=ce8548ec056022c4feccacc9eb09a4e8619bdefa'/>
<id>ce8548ec056022c4feccacc9eb09a4e8619bdefa</id>
<content type='text'>
clk_arb completion file descriptor can get closed immediately after
poll finishes in the work item gp10b_clk_arb_run_arbiter_cb. In
that case, the refcount for nvgpu_clk_dev can become zero in
the work item and can lead to invalid access while removing
nvgpu_clk_dev from the lists.

Remove nvgpu_clk_dev from the list before dropping the reference to
it.

Also, delete the nvgpu_clk_dev in completion file release handler
within the session and requests spinlocks to avoid race with
gp10b_clk_arb_run_arbiter_cb using it.

bug 200757277

Change-Id: I054eee547f2a6fa633d7ef55df216ec36647a826
Signed-off-by: Sagar Kamble &lt;skamble@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2569522
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Reviewed-by: Debarshi Dutta &lt;ddutta@nvidia.com&gt;
Reviewed-by: Deepak Nibade &lt;dnibade@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
clk_arb completion file descriptor can get closed immediately after
poll finishes in the work item gp10b_clk_arb_run_arbiter_cb. In
that case, the refcount for nvgpu_clk_dev can become zero in
the work item and can lead to invalid access while removing
nvgpu_clk_dev from the lists.

Remove nvgpu_clk_dev from the list before dropping the reference to
it.

Also, delete the nvgpu_clk_dev in completion file release handler
within the session and requests spinlocks to avoid race with
gp10b_clk_arb_run_arbiter_cb using it.

bug 200757277

Change-Id: I054eee547f2a6fa633d7ef55df216ec36647a826
Signed-off-by: Sagar Kamble &lt;skamble@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2569522
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Reviewed-by: Debarshi Dutta &lt;ddutta@nvidia.com&gt;
Reviewed-by: Deepak Nibade &lt;dnibade@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu: nvgpu: keep usermode region flags on railgate</title>
<updated>2021-06-24T15:09:34+00:00</updated>
<author>
<name>Konsta Hölttä</name>
<email>kholtta@nvidia.com</email>
</author>
<published>2021-06-02T14:33:38+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=2c441a83d44857b71a599acfe76395942ea936bf'/>
<id>2c441a83d44857b71a599acfe76395942ea936bf</id>
<content type='text'>
When the gpu is railgated, the usermode region mappings must be cleared.
This is already done with zap_vma_ptes() but as an extra measure the vm
flags are also zeroed. That is an oversight, so delete that code; in
particular the VM_DONTCOPY flag is important so that the mapping does
not follow fork, as the design does not allow that.

Bug 200726443

Change-Id: I84ed4e38b7de1f0c8cbf4cca6276abfa2409ac3b
Signed-off-by: Konsta Hölttä &lt;kholtta@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2538481
(cherry picked from commit e44ece25ba405505b7fd537b41bd0ad52f1250ce)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2548631
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Debarshi Dutta &lt;ddutta@nvidia.com&gt;
Reviewed-by: Sagar Kamble &lt;skamble@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the gpu is railgated, the usermode region mappings must be cleared.
This is already done with zap_vma_ptes() but as an extra measure the vm
flags are also zeroed. That is an oversight, so delete that code; in
particular the VM_DONTCOPY flag is important so that the mapping does
not follow fork, as the design does not allow that.

Bug 200726443

Change-Id: I84ed4e38b7de1f0c8cbf4cca6276abfa2409ac3b
Signed-off-by: Konsta Hölttä &lt;kholtta@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2538481
(cherry picked from commit e44ece25ba405505b7fd537b41bd0ad52f1250ce)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2548631
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Debarshi Dutta &lt;ddutta@nvidia.com&gt;
Reviewed-by: Sagar Kamble &lt;skamble@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu: nvgpu: fix the usermode mappings deadlock during railgate and munmap</title>
<updated>2021-06-07T13:40:08+00:00</updated>
<author>
<name>Sagar Kamble</name>
<email>skamble@nvidia.com</email>
</author>
<published>2021-05-24T09:06:01+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=12e89c21dec793269a0c0f1f3f2160bb7cdf5ebd'/>
<id>12e89c21dec793269a0c0f1f3f2160bb7cdf5ebd</id>
<content type='text'>
Following locking sequence leads to deadlock:

1. gk20a_pm_prepare_poweroff (alter_usermode_mappings):
   ctrl_privs_lock -&gt; mmap_lock
2. __do_munmap (usermode_vma_close):
   mmap_lock -&gt; ctrl_privs_lock

This lock contention can be resolved by retrying the usermode mapping
alteration after a while releasing the ctrl_priv_lock for munmap to
proceed.

Below is the kernel panic log with deadlock.

[] INFO: task kworker/1:1:116 blocked for more than 120 seconds.
[]       Tainted: G        W         5.10.17-tegra #1
[] "echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[] task:kworker/1:1     state:D stack:    0 pid:  116 ppid:     2 flags:0x00000028
[] Workqueue: pm pm_runtime_work
[] Call trace:
[]  __switch_to+0x104/0x160
[]  __schedule+0x3d4/0x900
[]  schedule+0x74/0x100
[]  rwsem_down_write_slowpath+0x250/0x4b0
[]  down_write+0x6c/0x80
[]  alter_usermode_mappings+0xb4/0x160 [nvgpu]
[]  nvgpu_hide_usermode_for_poweroff+0x24/0x30 [nvgpu]
[]  gk20a_pm_prepare_poweroff+0xe8/0x140 [nvgpu]
[]  gk20a_pm_runtime_suspend+0x78/0xf0 [nvgpu]
[]  pm_generic_runtime_suspend+0x3c/0x60
[]  genpd_runtime_suspend+0xb0/0x2c0
[]  __rpm_callback+0x90/0x150
[]  rpm_callback+0x34/0xa0
[]  rpm_suspend+0xe0/0x5e0
[]  pm_runtime_work+0xbc/0xc0
[]  process_one_work+0x1c0/0x4a0
[]  worker_thread+0x11c/0x430
[]  kthread+0x148/0x170
[]  ret_from_fork+0x10/0x18

[] INFO: task nvrm_gpu_tests:1273 blocked for more than 121 seconds.
[]       Tainted: G        W         5.10.17-tegra #1
[] "echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[] task:nvrm_gpu_tests  state:D stack:    0 pid: 1273 ppid:  1245 flags:0x00000000
[] Call trace:
[]  __switch_to+0x104/0x160
[]  __schedule+0x3d4/0x900
[]  schedule+0x74/0x100
[]  schedule_preempt_disabled+0x28/0x40
[]  __mutex_lock.isra.0+0x184/0x5c0
[]  __mutex_lock_slowpath+0x24/0x30
[]  mutex_lock+0x5c/0x70
[]  usermode_vma_close+0x30/0x50 [nvgpu]
[]  remove_vma+0x34/0x60
[]  __do_munmap+0x1f4/0x4a0
[]  __vm_munmap+0x74/0xd0
[]  __arm64_sys_munmap+0x3c/0x50
[]  el0_svc_common.constprop.0+0x7c/0x1a0
[]  do_el0_svc+0x34/0xa0
[]  el0_svc+0x1c/0x30
[]  el0_sync_handler+0xa8/0xb0
[]  el0_sync+0x160/0x180
[] ---[ end Kernel panic - not syncing: hung_task: blocked tasks ]---

Bug 200703921

Change-Id: Ie7f017c92f20061d3bf891079f7fc7fe390f7cf7
Signed-off-by: Sagar Kamble &lt;skamble@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2533853
(cherry picked from commit 1dd3e0761c1995c88e9f8e1a26cf5eaf197510be)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2540111
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Following locking sequence leads to deadlock:

1. gk20a_pm_prepare_poweroff (alter_usermode_mappings):
   ctrl_privs_lock -&gt; mmap_lock
2. __do_munmap (usermode_vma_close):
   mmap_lock -&gt; ctrl_privs_lock

This lock contention can be resolved by retrying the usermode mapping
alteration after a while releasing the ctrl_priv_lock for munmap to
proceed.

Below is the kernel panic log with deadlock.

[] INFO: task kworker/1:1:116 blocked for more than 120 seconds.
[]       Tainted: G        W         5.10.17-tegra #1
[] "echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[] task:kworker/1:1     state:D stack:    0 pid:  116 ppid:     2 flags:0x00000028
[] Workqueue: pm pm_runtime_work
[] Call trace:
[]  __switch_to+0x104/0x160
[]  __schedule+0x3d4/0x900
[]  schedule+0x74/0x100
[]  rwsem_down_write_slowpath+0x250/0x4b0
[]  down_write+0x6c/0x80
[]  alter_usermode_mappings+0xb4/0x160 [nvgpu]
[]  nvgpu_hide_usermode_for_poweroff+0x24/0x30 [nvgpu]
[]  gk20a_pm_prepare_poweroff+0xe8/0x140 [nvgpu]
[]  gk20a_pm_runtime_suspend+0x78/0xf0 [nvgpu]
[]  pm_generic_runtime_suspend+0x3c/0x60
[]  genpd_runtime_suspend+0xb0/0x2c0
[]  __rpm_callback+0x90/0x150
[]  rpm_callback+0x34/0xa0
[]  rpm_suspend+0xe0/0x5e0
[]  pm_runtime_work+0xbc/0xc0
[]  process_one_work+0x1c0/0x4a0
[]  worker_thread+0x11c/0x430
[]  kthread+0x148/0x170
[]  ret_from_fork+0x10/0x18

[] INFO: task nvrm_gpu_tests:1273 blocked for more than 121 seconds.
[]       Tainted: G        W         5.10.17-tegra #1
[] "echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[] task:nvrm_gpu_tests  state:D stack:    0 pid: 1273 ppid:  1245 flags:0x00000000
[] Call trace:
[]  __switch_to+0x104/0x160
[]  __schedule+0x3d4/0x900
[]  schedule+0x74/0x100
[]  schedule_preempt_disabled+0x28/0x40
[]  __mutex_lock.isra.0+0x184/0x5c0
[]  __mutex_lock_slowpath+0x24/0x30
[]  mutex_lock+0x5c/0x70
[]  usermode_vma_close+0x30/0x50 [nvgpu]
[]  remove_vma+0x34/0x60
[]  __do_munmap+0x1f4/0x4a0
[]  __vm_munmap+0x74/0xd0
[]  __arm64_sys_munmap+0x3c/0x50
[]  el0_svc_common.constprop.0+0x7c/0x1a0
[]  do_el0_svc+0x34/0xa0
[]  el0_svc+0x1c/0x30
[]  el0_sync_handler+0xa8/0xb0
[]  el0_sync+0x160/0x180
[] ---[ end Kernel panic - not syncing: hung_task: blocked tasks ]---

Bug 200703921

Change-Id: Ie7f017c92f20061d3bf891079f7fc7fe390f7cf7
Signed-off-by: Sagar Kamble &lt;skamble@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2533853
(cherry picked from commit 1dd3e0761c1995c88e9f8e1a26cf5eaf197510be)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2540111
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu: nvgpu: set file private data before installing fd</title>
<updated>2021-06-04T07:08:57+00:00</updated>
<author>
<name>Deepak Nibade</name>
<email>dnibade@nvidia.com</email>
</author>
<published>2021-04-26T09:27:32+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvgpu.git/commit/?id=cbad9503a78c23336a32172dd701b73760969ff0'/>
<id>cbad9503a78c23336a32172dd701b73760969ff0</id>
<content type='text'>
Make sure file-&gt;private_data is set before installing file into file
descriptor with fd_install().

Bug 200724607
Bug 200725718

Change-Id: I03e79a3f8981f959ab5f75f442911253d166aa87
Signed-off-by: Deepak Nibade &lt;dnibade@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2520465
(cherry picked from commit c78efae5e721287a3c7e9c9ca045220d6e433a30)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2535099
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Harsh Sinha &lt;hsinha@nvidia.com&gt;
Reviewed-by: Thomas Steinle &lt;tsteinle@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: Byungkuk Seo &lt;bseo@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make sure file-&gt;private_data is set before installing file into file
descriptor with fd_install().

Bug 200724607
Bug 200725718

Change-Id: I03e79a3f8981f959ab5f75f442911253d166aa87
Signed-off-by: Deepak Nibade &lt;dnibade@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2520465
(cherry picked from commit c78efae5e721287a3c7e9c9ca045220d6e433a30)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2535099
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Harsh Sinha &lt;hsinha@nvidia.com&gt;
Reviewed-by: Thomas Steinle &lt;tsteinle@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: Byungkuk Seo &lt;bseo@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
