lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ccd98cd9-f8c1-d4df-3849-3844e8b82e89@linaro.org>
Date:   Thu, 16 Dec 2021 05:12:37 +0300
From:   Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To:     Rob Clark <robdclark@...il.com>, dri-devel@...ts.freedesktop.org
Cc:     freedreno@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org,
        Stephen Boyd <swboyd@...omium.org>,
        Doug Anderson <dianders@...omium.org>,
        Rob Clark <robdclark@...omium.org>,
        Sean Paul <sean@...rly.run>,
        Abhinav Kumar <quic_abhinavk@...cinc.com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Guo Zhengkui <guozhengkui@...o.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/3] drm/msm/disp: Export helper for capturing snapshot

On 15/12/2021 20:45, Rob Clark wrote:
> From: Rob Clark <robdclark@...omium.org>
> 
> We'll re-use this for debugfs.
> 
> Signed-off-by: Rob Clark <robdclark@...omium.org>
> ---
>   drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 28 +++++++++++++++-----
>   drivers/gpu/drm/msm/disp/msm_disp_snapshot.h | 10 +++++++
>   2 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c
> index a4a7cb06bc87..580ea01b13ab 100644
> --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c
> +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c
> @@ -28,29 +28,43 @@ static ssize_t __maybe_unused disp_devcoredump_read(char *buffer, loff_t offset,
>   	return count - iter.remain;
>   }
>   
> -static void _msm_disp_snapshot_work(struct kthread_work *work)
> +struct msm_disp_state *
> +msm_disp_snapshot_state_sync(struct msm_kms *kms)
>   {
> -	struct msm_kms *kms = container_of(work, struct msm_kms, dump_work);
>   	struct drm_device *drm_dev = kms->dev;
>   	struct msm_disp_state *disp_state;
> -	struct drm_printer p;
> +
> +	WARN_ON(!mutex_is_locked(&kms->dump_mutex));
>   
>   	disp_state = kzalloc(sizeof(struct msm_disp_state), GFP_KERNEL);
>   	if (!disp_state)
> -		return;
> +		return ERR_PTR(-ENOMEM);
>   
>   	disp_state->dev = drm_dev->dev;
>   	disp_state->drm_dev = drm_dev;
>   
>   	INIT_LIST_HEAD(&disp_state->blocks);
>   
> -	/* Serialize dumping here */
> -	mutex_lock(&kms->dump_mutex);
> -
>   	msm_disp_snapshot_capture_state(disp_state);
>   
> +	return disp_state;
> +}
> +
> +static void _msm_disp_snapshot_work(struct kthread_work *work)
> +{
> +	struct msm_kms *kms = container_of(work, struct msm_kms, dump_work);
> +	struct drm_device *drm_dev = kms->dev;

drivers/gpu/drm/msm/disp/msm_disp_snapshot.c:56:28: warning: unused 
variable ‘drm_dev’ [-Wunused-variable]
    56 |         struct drm_device *drm_dev = kms->dev;

I will apply the fixup locally.

> +	struct msm_disp_state *disp_state;
> +	struct drm_printer p;
> +
> +	/* Serialize dumping here */
> +	mutex_lock(&kms->dump_mutex);
> +	disp_state = msm_disp_snapshot_state_sync(kms);
>   	mutex_unlock(&kms->dump_mutex);
>   
> +	if (IS_ERR(disp_state))
> +		return;
> +
>   	if (MSM_DISP_SNAPSHOT_DUMP_IN_CONSOLE) {
>   		p = drm_info_printer(disp_state->drm_dev->dev);
>   		msm_disp_state_print(disp_state, &p);
> diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h
> index 31ad68be3391..b5f452bd7ada 100644
> --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h
> +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h
> @@ -84,6 +84,16 @@ int msm_disp_snapshot_init(struct drm_device *drm_dev);
>    */
>   void msm_disp_snapshot_destroy(struct drm_device *drm_dev);
>   
> +/**
> + * msm_disp_snapshot_state_sync - synchronously snapshot display state
> + * @kms:  the kms object
> + *
> + * Returns state or error
> + *
> + * Must be called with &kms->dump_mutex held
> + */
> +struct msm_disp_state *msm_disp_snapshot_state_sync(struct msm_kms *kms);
> +
>   /**
>    * msm_disp_snapshot_state - trigger to dump the display snapshot
>    * @drm_dev:	handle to drm device
> 


-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ