[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221019173254.3361334-5-tvrtko.ursulin@linux.intel.com>
Date: Wed, 19 Oct 2022 18:32:41 +0100
From: Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>
To: Intel-gfx@...ts.freedesktop.org
Cc: cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
Tejun Heo <tj@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
Zefan Li <lizefan.x@...edance.com>,
Dave Airlie <airlied@...hat.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Rob Clark <robdclark@...omium.org>,
Stéphane Marchesin <marcheu@...omium.org>,
"T . J . Mercier" <tjmercier@...gle.com>, Kenny.Ho@....com,
Christian König <christian.koenig@....com>,
Brian Welty <brian.welty@...el.com>,
Tvrtko Ursulin <tvrtko.ursulin@...el.com>
Subject: [RFC 04/17] drm/cgroup: Allow safe external access to file_priv
From: Tvrtko Ursulin <tvrtko.ursulin@...el.com>
Entry points from the cgroup subsystem into the drm cgroup controller will
need to walk the file_priv structures associated with registered clients
and since those are not RCU protected lets add a hack for now to make this
safe.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@...el.com>
---
drivers/gpu/drm/drm_cgroup.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/drm_cgroup.c b/drivers/gpu/drm/drm_cgroup.c
index a31ff1d593ab..9e9caeb0aa87 100644
--- a/drivers/gpu/drm/drm_cgroup.c
+++ b/drivers/gpu/drm/drm_cgroup.c
@@ -21,6 +21,13 @@ void drm_clients_close(struct drm_file *file_priv)
if (atomic_dec_and_test(&clients->num)) {
xa_erase(&drm_pid_clients, pid);
kfree_rcu(clients, rcu);
+
+ /*
+ * FIXME: file_priv is not RCU protected so we add this hack
+ * to avoid any races with code which walks clients->file_list
+ * and accesses file_priv.
+ */
+ synchronize_rcu();
}
}
--
2.34.1
Powered by blists - more mailing lists