summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSagar Kamble <skamble@nvidia.com>2020-07-09 06:41:26 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2020-08-15 00:39:25 -0400
commit363b183756728908448497b440dde96f96fce387 (patch)
tree034510a08beed55c236babed7be44bf56dfbcf14
parent1bb8314ca7e0be97a14aee56d793892a57ae2182 (diff)
gpu: nvgpu: advertise RESCHEDULE_RUNLIST capability only for realtime processes
Below change added capability check in the ioctl. nvgpu is advertising the support for RESCHEDULE_RUNLIST for all processes even though it fails the ioctl for non-realtime processes. Clear the ioctl flag for RESCHEDULE_RUNLIST for non-realtime processes. commit 838ba0a14d61f ("gpu: nvgpu: check capability for reschedule runlist submit flag") Author: David Li <davli@nvidia.com> Date: Tue Sep 12 18:37:00 2017 -0700 NVGPU_SUBMIT_GPFIFO_FLAGS_RESCHEDULE_RUNLIST is only used by realtime priority EGL context, which checks for CAP_SYS_NICE during context creation in userspace, so it wasn't secure against unprivileged program spoofing submit ioctl with this flag to stall GPU progress of others. This flag does increase duration of submit by approx 16us, mostly due to register accesses and PMU FIFO mutex. Bug 2823941 Change-Id: Iecee3989e5af035264b1ed5c1aa9a8576dd90883 Signed-off-by: Sagar Kamble <skamble@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2372957 (cherry picked from commit 864213ae55b009b0a026ac380b26276332f79177) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2392714 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
index 954b08b5..ee141ff8 100644
--- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
@@ -239,6 +239,10 @@ static u64 nvgpu_ctrl_ioctl_gpu_characteristics_flags(struct gk20a *g)
239 ioctl_flags |= flags_mapping[i].ioctl_flag; 239 ioctl_flags |= flags_mapping[i].ioctl_flag;
240 } 240 }
241 241
242 if (!capable(CAP_SYS_NICE)) {
243 ioctl_flags &= ~NVGPU_GPU_FLAGS_SUPPORT_RESCHEDULE_RUNLIST;
244 }
245
242 return ioctl_flags; 246 return ioctl_flags;
243} 247}
244 248