From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
jiangshanlai@gmail.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
"Paul E. McKenney" <paulmck@linux.ibm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel@ffwll.ch>, Tejun Heo <tj@kernel.org>,
dri-devel@lists.freedesktop.org
Subject: [PATCH RFC tip/core/rcu 2/4] drivers/gpu/drm: Dynamically allocate drm_unplug_srcu
Date: Tue, 2 Apr 2019 07:29:31 -0700 [thread overview]
Message-ID: <20190402142933.14547-2-paulmck@linux.ibm.com> (raw)
In-Reply-To: <20190402142816.GA13084@linux.ibm.com>
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@intel.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Tejun Heo <tj@kernel.org>
Cc: <dri-devel@lists.freedesktop.org>
---
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
next prev parent reply other threads:[~2019-04-02 14:29 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 14:28 [PATCH RFC tip/core/rcu 0/4] Forbid static SRCU use in modules Paul E. McKenney
2019-04-02 14:29 ` Paul E. McKenney [this message]
2019-04-02 16:14 ` [PATCH RFC tip/core/rcu 2/4] drivers/gpu/drm: Dynamically allocate drm_unplug_srcu Daniel Vetter
2019-04-02 14:29 ` [PATCH RFC tip/core/rcu 3/4] drivers/gpu/drm/amd: Dynamically allocate kfd_processes_srcu Paul E. McKenney
2019-04-02 17:40 ` Kuehling, Felix
2019-04-04 21:16 ` Paul E. McKenney
2019-04-02 15:14 ` [PATCH RFC tip/core/rcu 0/4] Forbid static SRCU use in modules Mathieu Desnoyers
2019-04-02 15:23 ` Paul E. McKenney
[not found] ` <20190402152334.GC4102-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-04-02 15:34 ` Mathieu Desnoyers
2019-04-03 13:32 ` Paul E. McKenney
2019-04-03 14:27 ` Mathieu Desnoyers
[not found] ` <1028306587.504.1554301662374.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2019-04-03 16:20 ` Paul E. McKenney
2019-04-03 19:30 ` Joel Fernandes
[not found] ` <20190403162039.GA14111-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-04-05 23:28 ` Paul E. McKenney
2019-04-06 13:33 ` Joel Fernandes
2019-04-07 13:48 ` Paul E. McKenney
[not found] ` <20190405232835.GA24702-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-04-06 23:06 ` Joel Fernandes
2019-04-07 13:39 ` Paul E. McKenney
[not found] ` <20190407133941.GC14111-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-04-07 13:59 ` Paul E. McKenney
[not found] ` <20190407135937.GA30053-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-04-07 15:46 ` Joel Fernandes
2019-04-07 17:05 ` Paul E. McKenney
[not found] ` <20190407170514.GE14111-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-04-08 0:36 ` Joel Fernandes
2019-04-08 2:28 ` Paul E. McKenney
2019-04-07 19:26 ` Mathieu Desnoyers
[not found] ` <134026717.535.1554665176677.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2019-04-07 19:32 ` Joel Fernandes
2019-04-07 20:41 ` Mathieu Desnoyers
2019-04-07 21:07 ` Joel Fernandes
2019-04-08 2:27 ` Paul E. McKenney
2019-04-08 13:05 ` Mathieu Desnoyers
2019-04-08 14:22 ` Paul E. McKenney
2019-04-08 14:49 ` Mathieu Desnoyers
2019-04-08 15:46 ` Paul E. McKenney
2019-04-08 17:24 ` Mathieu Desnoyers
2019-04-09 15:40 ` Joel Fernandes
[not found] ` <20190409154012.GC248418-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2019-04-09 15:56 ` Mathieu Desnoyers
2019-04-09 16:18 ` Joel Fernandes
2019-04-09 16:40 ` Paul E. McKenney
[not found] ` <20190409164031.GE14111-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-04-09 16:45 ` Mathieu Desnoyers
2019-04-09 17:55 ` Paul E. McKenney
[not found] ` <20190409175549.GG14111-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-04-09 18:04 ` Mathieu Desnoyers
2019-04-09 19:14 ` Paul E. McKenney
2019-04-02 18:40 ` Joel Fernandes
2019-04-03 13:19 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190402142933.14547-2-paulmck@linux.ibm.com \
--to=paulmck@linux.ibm.com \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=daniel@ffwll.ch \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=maxime.ripard@bootlin.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=sean@poorly.run \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).