[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190402161428.GM2665@phenom.ffwll.local>
Date: Tue, 2 Apr 2019 18:14:28 +0200
From: Daniel Vetter <daniel@...ll.ch>
To: "Paul E. McKenney" <paulmck@...ux.ibm.com>
Cc: rcu@...r.kernel.org, linux-kernel@...r.kernel.org,
mingo@...nel.org, jiangshanlai@...il.com, dipankar@...ibm.com,
akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
josh@...htriplett.org, tglx@...utronix.de, peterz@...radead.org,
rostedt@...dmis.org, dhowells@...hat.com, edumazet@...gle.com,
fweisbec@...il.com, oleg@...hat.com, joel@...lfernandes.org,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, Tejun Heo <tj@...nel.org>,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH RFC tip/core/rcu 2/4] drivers/gpu/drm: Dynamically
allocate drm_unplug_srcu
On Tue, Apr 02, 2019 at 07:29:31AM -0700, Paul E. McKenney wrote:
> Having DEFINE_SRCU() or DEFINE_STATIC_SRCU() in a loadable module
> requires that the size of the reserved region be increased, which is not
> something we really want to be doing. This commit therefore removes
> the DEFINE_STATIC_SRCU() from drivers/gpu/drm/drm_drv.c in favor of
> defining drm_unplug_srcu as a simple srcu_struct, initializing it in
> drm_core_init(), and cleaning it up in drm_core_exit().
>
> In this particular case, drm_unplug_srcu is statically allocated and thus
> guaranteed to be initially zero. Unfortunately, cleanup_srcu_struct()
> cannot rely on this in the general case (which includes dynamically
> allocated srcu_struct structures), and therefore cannot tell whether it
> is being called on something that has been passed to init_srcu_struct().
> Thus the code added to drm_core_init() is a bit non-standard.
>
> Reported-by: kbuild test robot <lkp@...el.com>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.ibm.com>
> 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: Tejun Heo <tj@...nel.org>
> Cc: <dri-devel@...ts.freedesktop.org>
Seems reasonable (but I don't have the full patch series as context).
Reviewed-by: Daniel Vetter <daniel.vetter@...ll.ch>
Any preferences as to how this should be merged? Upfront ack for merging
through rcu trees if that helps you.
-Daniel
> ---
> drivers/gpu/drm/drm_drv.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 381581b01d48..ce4582af814d 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -77,7 +77,7 @@ static bool drm_core_init_complete = false;
>
> static struct dentry *drm_debugfs_root;
>
> -DEFINE_STATIC_SRCU(drm_unplug_srcu);
> +static struct srcu_struct drm_unplug_srcu;
>
> /*
> * DRM Minors
> @@ -958,12 +958,18 @@ static void drm_core_exit(void)
> drm_sysfs_destroy();
> idr_destroy(&drm_minors_idr);
> drm_connector_ida_destroy();
> + cleanup_srcu_struct(&drm_unplug_srcu);
> }
>
> static int __init drm_core_init(void)
> {
> int ret;
>
> + ret = init_srcu_struct(&drm_unplug_srcu);
> + if (ret) {
> + DRM_ERROR("Cannot create DRM class: %d\n", ret);
> + return ret; /* cannot cleanup after failed srcu_struct init. */
> + }
> drm_connector_ida_init();
> idr_init(&drm_minors_idr);
>
> --
> 2.17.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Powered by blists - more mailing lists