mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: domains as files for access control
Create device nodes for user-created scheduling domains. This helps leverage filesystem based access control: domains can be chosen to be available for a limited set of users on a system. The device nodes are dynamic: they can be removed while the driver is running normally. This is a bit different from the nodes that exist until the driver is unloaded, so the devno/domain mapping is stored in a separate list. The usual container_of pattern would suffer from an unavoidable race condition if a domain file was opened while the same domain would get removed. As usual, domain refcounting prevents a domain from being removed. Now the open device files hold refs and thus any open domain files prevent a domain from getting removed, in addition to the userspace-invisible ref that is taken when a TSG is bound to a domain. While at it, make the query ioctl guarded by the sched domain mutex, as domains might technically get added or removed during the querying code. Jira NVGPU-6788 Change-Id: Ief2a09a442c4e70f1f2be8a32359341071d74659 Signed-off-by: Konsta Hölttä <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2651164 Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
beed6d3c2b
commit
3a64fdefc4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -87,6 +87,14 @@ struct nvgpu_nvs_ioctl_create_domain {
|
||||
__u64 reserved1;
|
||||
};
|
||||
|
||||
/**
|
||||
* NVGPU_NVS_IOCTL_REMOVE_DOMAIN
|
||||
*
|
||||
* Remove a domain that has been previously created.
|
||||
*
|
||||
* The domain must be empty; it must have no TSGs bound to it. The domain's
|
||||
* device node must not be open by anyone.
|
||||
*/
|
||||
struct nvgpu_nvs_ioctl_remove_domain {
|
||||
/*
|
||||
* In: a domain_id to remove.
|
||||
|
||||
Reference in New Issue
Block a user