mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
drm/tegra: Add option for explicit syncpoint free
Add kernel module parameter to enable a mode where syncpoints must be freed explicitly (using the free IOCTL) or they will be left dangling. This ensures that, for particularly locked down configurations, a syncpoint will be forever left in an expected state even if the process owning it dies -- for example another process will not be able to allocate it. Change-Id: I2f350c710775a296c70910df21e95737a36c6a45 Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3284405 GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Santosh BS <santoshb@nvidia.com>
This commit is contained in:
committed by
Jon Hunter
parent
9feb2a4347
commit
48e383a1b9
@@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2020 NVIDIA Corporation */
|
||||
/* Copyright (c) 2020-2025 NVIDIA Corporation */
|
||||
|
||||
#include <linux/dma-buf.h>
|
||||
#include <linux/host1x-next.h>
|
||||
@@ -13,6 +13,10 @@
|
||||
#include "drm.h"
|
||||
#include "uapi.h"
|
||||
|
||||
static bool explicit_syncpt_free;
|
||||
module_param(explicit_syncpt_free, bool, 0644);
|
||||
MODULE_PARM_DESC(explicit_syncpt_free, "If enabled, syncpoints need to be explicitly freed via IOCTL or they will be left dangling when the fd is closed");
|
||||
|
||||
static void tegra_drm_mapping_release(struct kref *ref)
|
||||
{
|
||||
struct tegra_drm_mapping *mapping =
|
||||
@@ -60,8 +64,16 @@ void tegra_drm_uapi_close_file(struct tegra_drm_file *file)
|
||||
xa_for_each(&file->contexts, id, context)
|
||||
tegra_drm_channel_context_close(context);
|
||||
|
||||
xa_for_each(&file->syncpoints, id, sp)
|
||||
host1x_syncpt_put(sp);
|
||||
/*
|
||||
* If explicit_syncpt_free is enabled, users must free syncpoints
|
||||
* explicitly or they will be left dangling. This prevents syncpoints
|
||||
* from getting in an unexpected state if e.g. the application crashes.
|
||||
* Obviously only usable on particularly locked down configurations.
|
||||
*/
|
||||
if (!explicit_syncpt_free) {
|
||||
xa_for_each(&file->syncpoints, id, sp)
|
||||
host1x_syncpt_put(sp);
|
||||
}
|
||||
|
||||
xa_destroy(&file->contexts);
|
||||
xa_destroy(&file->syncpoints);
|
||||
|
||||
Reference in New Issue
Block a user