Skip to content

Commit fc70e13

Browse files
committed
Merge tag 'drm-msm-fixes-2023-01-16' of https://gitlab.freedesktop.org/drm/msm into drm-fixes
msm-fixes for v6.3-rc5 Two GPU fixes which were meant to be part of the previous pull request, but I'd forgotten to fetch from gitlab after the MR was merged so that git tag was applied to the wrong commit. - kexec shutdown fix - fix potential double free Signed-off-by: Dave Airlie <[email protected]> From: Rob Clark <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGskguoVsz2wqAK2k+f32LwcVY5JC6+e2RwLqZswz3RY2Q@mail.gmail.com
2 parents 5dc4c99 + a66f1ef commit fc70e13

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

drivers/gpu/drm/msm/adreno/adreno_device.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,14 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
551551
return 0;
552552
}
553553

554+
static int adreno_system_suspend(struct device *dev);
554555
static void adreno_unbind(struct device *dev, struct device *master,
555556
void *data)
556557
{
557558
struct msm_drm_private *priv = dev_get_drvdata(master);
558559
struct msm_gpu *gpu = dev_to_gpu(dev);
559560

560-
pm_runtime_force_suspend(dev);
561+
WARN_ON_ONCE(adreno_system_suspend(dev));
561562
gpu->funcs->destroy(gpu);
562563

563564
priv->gpu_pdev = NULL;
@@ -609,7 +610,7 @@ static int adreno_remove(struct platform_device *pdev)
609610

610611
static void adreno_shutdown(struct platform_device *pdev)
611612
{
612-
pm_runtime_force_suspend(&pdev->dev);
613+
WARN_ON_ONCE(adreno_system_suspend(&pdev->dev));
613614
}
614615

615616
static const struct of_device_id dt_match[] = {

drivers/gpu/drm/msm/adreno/adreno_gpu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ int adreno_set_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
352352
/* Ensure string is null terminated: */
353353
str[len] = '\0';
354354

355+
mutex_lock(&gpu->lock);
356+
355357
if (param == MSM_PARAM_COMM) {
356358
paramp = &ctx->comm;
357359
} else {
@@ -361,6 +363,8 @@ int adreno_set_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
361363
kfree(*paramp);
362364
*paramp = str;
363365

366+
mutex_unlock(&gpu->lock);
367+
364368
return 0;
365369
}
366370
case MSM_PARAM_SYSPROF:

drivers/gpu/drm/msm/msm_gpu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ static void get_comm_cmdline(struct msm_gem_submit *submit, char **comm, char **
335335
struct msm_file_private *ctx = submit->queue->ctx;
336336
struct task_struct *task;
337337

338+
WARN_ON(!mutex_is_locked(&submit->gpu->lock));
339+
338340
/* Note that kstrdup will return NULL if argument is NULL: */
339341
*comm = kstrdup(ctx->comm, GFP_KERNEL);
340342
*cmd = kstrdup(ctx->cmdline, GFP_KERNEL);

drivers/gpu/drm/msm/msm_gpu.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,18 @@ struct msm_file_private {
376376
*/
377377
int sysprof;
378378

379-
/** comm: Overridden task comm, see MSM_PARAM_COMM */
379+
/**
380+
* comm: Overridden task comm, see MSM_PARAM_COMM
381+
*
382+
* Accessed under msm_gpu::lock
383+
*/
380384
char *comm;
381385

382-
/** cmdline: Overridden task cmdline, see MSM_PARAM_CMDLINE */
386+
/**
387+
* cmdline: Overridden task cmdline, see MSM_PARAM_CMDLINE
388+
*
389+
* Accessed under msm_gpu::lock
390+
*/
383391
char *cmdline;
384392

385393
/**

0 commit comments

Comments
 (0)