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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 18 Jan 2019 17:15:33 +0200
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Sam Ravnborg <sam@...nborg.org>
Cc:     Alex Deucher <alexander.deucher@....com>,
        Alexey Brodkin <abrodkin@...opsys.com>,
        Andrzej Hajda <a.hajda@...sung.com>,
        Benjamin Gaignard <benjamin.gaignard@...aro.org>,
        Chen Feng <puck.chen@...ilicon.com>,
        Christian Konig <christian.koenig@....com>,
        Daniel Vetter <daniel@...ll.ch>,
        David Airlie <airlied@...ux.ie>,
        David Zhou <David1.Zhou@....com>,
        Eric Anholt <eric@...olt.net>,
        Gerd Hoffmann <kraxel@...hat.com>,
        Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Philippe Cornu <philippe.cornu@...com>,
        Rob Clark <robdclark@...il.com>,
        Rongrong Zou <zourongrong@...il.com>,
        Sean Paul <sean@...rly.run>,
        Tomi Valkeinen <tomi.valkeinen@...com>,
        Vincent Abriou <vincent.abriou@...com>,
        Xinliang Liu <z.liuxinliang@...ilicon.com>,
        Xinwei Kong <kong.kongxinwei@...ilicon.com>,
        Yannick Fertre <yannick.fertre@...com>,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH v4 1/8] drm: move drm_can_sleep() to drm_util.h

Hi Sam,

Thank you for the patch.

On Sat, Jan 12, 2019 at 08:32:44PM +0100, Sam Ravnborg wrote:
> Move drm_can_sleep() out of drmP.h to allow users
> to get rid of the drmP.h include.
> 
> There was no header file that was a good match for this helper function.
> So add this to drm_util with the relevant includes.
> 
> Add include of drm_util.h to all users.
> 
> v2:
> - Update comments to use kernel-doc style (Daniel)
> - Add FIXME to drm_can_sleep and add note that this
>   function should not be used in new code (Daniel)
> 
> v3:
> - Fix kernel-doc syntax (Daniel)
> - Plug drm_util.h into drm-internels.rst (Daniel)
> 
> Signed-off-by: Sam Ravnborg <sam@...nborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@...tlin.com>
> Cc: Sean Paul <sean@...rly.run>
> Cc: David Airlie <airlied@...ux.ie>
> Cc: Daniel Vetter <daniel@...ll.ch>
> Cc: Alex Deucher <alexander.deucher@....com>
> Cc: "Christian König" <christian.koenig@....com>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@....com>
> Cc: Gerd Hoffmann <kraxel@...hat.com>
> Cc: Rob Clark <robdclark@...il.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@...com>
> Cc: Eric Anholt <eric@...olt.net>
> ---
>  Documentation/gpu/drm-internals.rst             |  9 ++++++
>  drivers/gpu/drm/amd/amdgpu/atom.c               |  2 ++
>  drivers/gpu/drm/ast/ast_fb.c                    |  2 ++
>  drivers/gpu/drm/cirrus/cirrus_fbdev.c           |  1 +
>  drivers/gpu/drm/drm_flip_work.c                 |  1 +
>  drivers/gpu/drm/mgag200/mgag200_fb.c            |  1 +
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c        |  1 +
>  drivers/gpu/drm/omapdrm/omap_fbdev.c            |  1 +
>  drivers/gpu/drm/qxl/qxl_cmd.c                   |  2 ++
>  drivers/gpu/drm/radeon/atom.c                   |  2 ++
>  drivers/gpu/drm/radeon/radeon_legacy_encoders.c |  1 +
>  drivers/gpu/drm/vc4/vc4_drv.h                   |  1 +
>  include/drm/drmP.h                              |  8 -----
>  include/drm/drm_util.h                          | 43 ++++++++++++++++++++++++-
>  14 files changed, 66 insertions(+), 9 deletions(-)
> 
> diff --git a/Documentation/gpu/drm-internals.rst b/Documentation/gpu/drm-internals.rst
> index 9090fabf3f7a..2caf21effd28 100644
> --- a/Documentation/gpu/drm-internals.rst
> +++ b/Documentation/gpu/drm-internals.rst
> @@ -233,6 +233,15 @@ Printer
>  .. kernel-doc:: drivers/gpu/drm/drm_print.c
>     :export:
>  
> +Utilities
> +---------
> +
> +.. kernel-doc:: include/drm/drm_util.h
> +   :doc: drm utils
> +
> +.. kernel-doc:: include/drm/drm_util.h
> +   :internal:

Why do we need it twice ?

> +
>  
>  Legacy Support Code
>  ===================

[snip]

> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index aee99194499f..851c59f07eb1 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -16,6 +16,7 @@
>   */
>  
>  #include <drm/drm_crtc.h>
> +#include <drm/drm_util.h>
>  #include <drm/drm_fb_helper.h>

Please keep headers alphabetically sorted, here and everywhere else in
this patch. This helps locating and avoiding duplicated headers.

>  #include "omap_drv.h"

[snip]

> diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
> index 88abdca89baa..f776a55e5508 100644
> --- a/include/drm/drm_util.h
> +++ b/include/drm/drm_util.h
> @@ -26,7 +26,48 @@
>  #ifndef _DRM_UTIL_H_
>  #define _DRM_UTIL_H_
>  
> -/* helper for handling conditionals in various for_each macros */
> +/**
> + * DOC: drm utils
> + *
> + * Macros and inline functions that does not naturally belong in other places

s/does/do/

> + */
> +
> +#include <linux/irqflags.h>
> +#include <linux/preempt.h>
> +#include <linux/kgdb.h>
> +#include <linux/smp.h>

Four headers needed to use three functions, impressive :-)

Alphabetical sorted here too please (and actually everywhere in this
patch series :-)).

> +/**
> + * for_each_if - helper for handling conditionals in various for_each macros
> + * @condition: The condition to check
> + *
> + * Typical use::
> + *
> + *	#define for_each_foo_bar(x, y) \'
> + *		list_for_each_entry(x, y->list, head) \'
> + *			for_each_if(x->something == SOMETHING)
> + *
> + * The for_each_if() macro makes the use of for_each_foo_bar() less error
> + * prone.
> + */
>  #define for_each_if(condition) if (!(condition)) {} else
>  
> +/**
> + * drm_can_sleep - returns true if currently okay to sleep
> + *
> + * This function shall not be used in new code.
> + * The check for running in atomic context may not work - see linux/preempt.h.
> + *
> + * FIXME: All users of drm_can_sleep should be removed (see todo.rst)
> + *
> + * Returns:
> + * True if kgdb is active or we are in an atomic context or irqs are disabled

Did you mean False ?

With these fixed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>

> + */
> +static inline bool drm_can_sleep(void)
> +{
> +	if (in_atomic() || in_dbg_master() || irqs_disabled())
> +		return false;
> +	return true;
> +}
> +
>  #endif

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ