Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1461861yba; Tue, 2 Apr 2019 09:16:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcxHgTBMmTNPigXIJ6Da7jVi17q0kOzkZb4eV+/atAx3NGEWFbZdGwK/wZ6LfphXKyZoPC X-Received: by 2002:a17:902:b715:: with SMTP id d21mr42644411pls.103.1554221789764; Tue, 02 Apr 2019 09:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554221789; cv=none; d=google.com; s=arc-20160816; b=nAjFpLw+4LcnwccEYOyz8q3k655vKldI0hMTvkgGBx5op5LRiBrV+j4xHUIW1opr3a 25wXFsToubweli4Btq1VOsdY0IMOHUbuhK3UGq8vQXgJObIsXLlUY0d9MhYceWUjB354 ykFdnDDpA77MWgNUVtHUBmZTVExRCWkuh0YmV6assHdGoJKvJCebG1cfn88W3boRyLP0 Vjmd/7bwXpA+/M/IbCYPgwpO0caxk0B3Ag9JpbrYPo1ERlqVsElM+WCiiLU+0cadFbw4 MdNBLh6L79EfTcZ7KHk6sZ80s96JpVdoYHDvj4m38iHhDGTWOY6GQydWEyvp2uMueVFl XV3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=1FwBWnVtp2A1UjavE6GDLjjZeFVpOsXxYVw4gzWiuzo=; b=ARFX6C5b+U8jo/wLYbcOzsU88cH0aZJKKDaNQaYL4kYaXE8UBzM5WvH7cjPZTFs8kD T3q5i6IbPJbZKcSALKB+KdD7zBoOmUr2HAEegA4aUOXTnJk0TBZ/3M7Py3IVEKFADdVO Js7hT0k/viHilD8Y/Zeccb2Kh551NHT/un5uZRwxv+88NMvEPQVqbiMIx9arxUU8oVt3 1M/vLwvEkfutASMg5Nbvlgl7GFQ2Dc94+FQIkm1lIiULOtYQVONHd2KVGVnKZX0R6Syo NIL2sD5w+GYTwnSuieR7IebdOKoZX4i9d8RRluWQJ87u+3qhS77yWKn0PWVU8WdcVShr zM3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=ZLtk758R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si12033277plw.390.2019.04.02.09.16.13; Tue, 02 Apr 2019 09:16:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=ZLtk758R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731207AbfDBQOe (ORCPT + 99 others); Tue, 2 Apr 2019 12:14:34 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:45530 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729546AbfDBQOd (ORCPT ); Tue, 2 Apr 2019 12:14:33 -0400 Received: by mail-ed1-f68.google.com with SMTP id m16so12157380edd.12 for ; Tue, 02 Apr 2019 09:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=1FwBWnVtp2A1UjavE6GDLjjZeFVpOsXxYVw4gzWiuzo=; b=ZLtk758R6+fqNBqGlySDep2Y6wKz//X4O3sRTaS2OgUOSA0IqDaRnjG1RnLLlJ5yRN qtZ87qs7F35qFa2HWV+RcF4f8kAI6UCvc7BCYdHnGHa7qZnqnfWVwaMOBCCkFd8r+gsh 9QIV0XYqE35Z1uAIFxpnYAsVxnmwMUIhTqx9Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=1FwBWnVtp2A1UjavE6GDLjjZeFVpOsXxYVw4gzWiuzo=; b=il5MUNA9yOUD2uC1W0I9AXDSg1CKv+z+AwybDfYeExrbs/66zD5VNhk03cWgDb5DiT jMZgA+gg2CUenMX0LTZIcSxaKsJxb/kUnuEi1NETelQKB5wW9iNOUI0vPkAr6aUlsGWc hYI4Yf4L90F07rHf0bDOClCkq00F/J0VeZO/cdGNM79H0Xb/+0e7hEXrVjLY6zGAtRjN dicn1G2Fh9d2rfL7HlZvTyE69iI9f9n/9umshJQwRmrhvsykGrqLrp3Kzdj0hNDAQtBB KYrIxa5Bq6ObRd7PosSkKWQYcrkXhdEySqbbhrOQKC5JMJgs8iA/AREAndgneec2hhWA sHIw== X-Gm-Message-State: APjAAAX6ZjGzayIYBnwn0BFMoRN72sJv5ohygowBAueWZOEAW9RodB32 oD1TOO3Fg5s/Lddfds4UAZrjRw== X-Received: by 2002:a50:cb4a:: with SMTP id h10mr47180168edi.134.1554221671203; Tue, 02 Apr 2019 09:14:31 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id k8sm4114064edr.85.2019.04.02.09.14.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Apr 2019 09:14:30 -0700 (PDT) Date: Tue, 2 Apr 2019 18:14:28 +0200 From: Daniel Vetter To: "Paul E. McKenney" Cc: rcu@vger.kernel.org, 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, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Tejun Heo , dri-devel@lists.freedesktop.org Subject: Re: [PATCH RFC tip/core/rcu 2/4] drivers/gpu/drm: Dynamically allocate drm_unplug_srcu Message-ID: <20190402161428.GM2665@phenom.ffwll.local> Mail-Followup-To: "Paul E. McKenney" , rcu@vger.kernel.org, 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, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Tejun Heo , dri-devel@lists.freedesktop.org References: <20190402142816.GA13084@linux.ibm.com> <20190402142933.14547-2-paulmck@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190402142933.14547-2-paulmck@linux.ibm.com> X-Operating-System: Linux phenom 4.19.0-1-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Paul E. McKenney > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: Sean Paul > Cc: David Airlie > Cc: Daniel Vetter > Cc: Tejun Heo > Cc: Seems reasonable (but I don't have the full patch series as context). Reviewed-by: Daniel Vetter 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