diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2020-12-03 10:46:18 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2021-02-11 10:14:22 +1000 |
commit | f81069228d5d239854075dca1e4c0a7df54d3748 (patch) | |
tree | 14cea6659f52beebeeb67318b7a2cc7af35d9f73 /drivers | |
parent | a641936065d738837c24180135f139ef12d0122d (diff) | |
download | linux-stable-f81069228d5d239854075dca1e4c0a7df54d3748.tar.gz linux-stable-f81069228d5d239854075dca1e4c0a7df54d3748.tar.bz2 linux-stable-f81069228d5d239854075dca1e4c0a7df54d3748.zip |
drm/nouveau/perfmon: use private spinlock to control exclusive access to perfmon
nvkm_subdev.mutex is going away.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/engine/pm.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c | 19 |
2 files changed, 14 insertions, 10 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/pm.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/pm.h index 4d754e7650d9..005409052d38 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/pm.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/pm.h @@ -7,7 +7,10 @@ struct nvkm_pm { const struct nvkm_pm_func *func; struct nvkm_engine engine; - struct nvkm_object *perfmon; + struct { + spinlock_t lock; + struct nvkm_object *object; + } client; struct list_head domains; struct list_head sources; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c index b2785bee418e..f875fb74f131 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c @@ -628,10 +628,10 @@ nvkm_perfmon_dtor(struct nvkm_object *object) { struct nvkm_perfmon *perfmon = nvkm_perfmon(object); struct nvkm_pm *pm = perfmon->pm; - mutex_lock(&pm->engine.subdev.mutex); - if (pm->perfmon == &perfmon->object) - pm->perfmon = NULL; - mutex_unlock(&pm->engine.subdev.mutex); + spin_lock(&pm->client.lock); + if (pm->client.object == &perfmon->object) + pm->client.object = NULL; + spin_unlock(&pm->client.lock); return perfmon; } @@ -671,11 +671,11 @@ nvkm_pm_oclass_new(struct nvkm_device *device, const struct nvkm_oclass *oclass, if (ret) return ret; - mutex_lock(&pm->engine.subdev.mutex); - if (pm->perfmon == NULL) - pm->perfmon = *pobject; - ret = (pm->perfmon == *pobject) ? 0 : -EBUSY; - mutex_unlock(&pm->engine.subdev.mutex); + spin_lock(&pm->client.lock); + if (pm->client.object == NULL) + pm->client.object = *pobject; + ret = (pm->client.object == *pobject) ? 0 : -EBUSY; + spin_unlock(&pm->client.lock); return ret; } @@ -863,5 +863,6 @@ nvkm_pm_ctor(const struct nvkm_pm_func *func, struct nvkm_device *device, pm->func = func; INIT_LIST_HEAD(&pm->domains); INIT_LIST_HEAD(&pm->sources); + spin_lock_init(&pm->client.lock); return nvkm_engine_ctor(&nvkm_pm, device, index, true, &pm->engine); } |