Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3748785pxb; Mon, 1 Feb 2021 03:49:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRlsjWQGNX0L8N5rHN1nj6M7D51yendo51dpI7fGn/9CTH7ix1ylSgUlf/zM+LY3+70Qj6 X-Received: by 2002:a17:906:11d3:: with SMTP id o19mr17781736eja.256.1612180143355; Mon, 01 Feb 2021 03:49:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612180143; cv=none; d=google.com; s=arc-20160816; b=LJeJzUynSmQEt+abccS0rtKbsfJAxRuNicAvfVvwFKA6CNeHshyefBn73Cn4kRYZab XQZlHVjTEyqXD6vudoUOXFzL5SE8O919yUtb1ZEKXtPrf+pY9DtKgdn25xbqAA9UVuT9 OPbC4GRvpR1W/UFBxjVE9cxqOLCjKoR5KA1naQiHDSRxS0TIhmaMt7WoY+XURIgSLG1z L8n3vo8uUTkHwndz9uSL/P/2B/LpxHUA7aS3zcSwwfYPnlwBJWhrfQAaSWO1pI61kkDu 0B3UIw7bRoxMu2GM07mG3+T9ITCWlTY8giz7Vx7jGil/ebZBfnk97YNG4W5furuYHIWE aucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=bpxwWeG0HWSsK5/a1TVeT75AhjSho87a2ViEbg+Qvic=; b=Kt/w7j/a9cTV562P/wBKn7wk4q6xEKJYMeJ2xp3HkyN9MN5p3+UQx1+E/kn+Q5wKVP jA0FuTHFTEfATufaMPRS6cDHmo0/urkpR1pc98tg3b/vXwRrFSRMBGeC1Kq7GF93YoNN j4pW4IuHHeHFWwg3UGtGhQ/PQWu2JEZR+a4osJ16050OOXTdXEN1JBsrzqiQdq9Qi+MU 1i5ZrRNek2zuxQrVsAAnU4PLfbKkPu0+YRmgK1hEJY02UtNKhs+PSp8S2vvdeKv/cic4 oB70OQnHWMm/cSDd3yYZ7+Ctp7YRJyXFu4nq8vWhXj9r5nGz7v0ZIcRc3EohR+9RKRlO OJXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si2967415ejf.739.2021.02.01.03.48.37; Mon, 01 Feb 2021 03:49:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbhBALrg (ORCPT + 99 others); Mon, 1 Feb 2021 06:47:36 -0500 Received: from verein.lst.de ([213.95.11.211]:40808 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbhBALre (ORCPT ); Mon, 1 Feb 2021 06:47:34 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 56C7C6736F; Mon, 1 Feb 2021 12:46:49 +0100 (CET) Date: Mon, 1 Feb 2021 12:46:49 +0100 From: Christoph Hellwig To: Miroslav Benes Cc: Christoph Hellwig , Frederic Barrat , Andrew Donnellan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Jessica Yu , Josh Poimboeuf , Jiri Kosina , Petr Mladek , Joe Lawrence , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, dri-devel@lists.freedesktop.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: Re: [PATCH 04/13] module: use RCU to synchronize find_module Message-ID: <20210201114649.GA19696@lst.de> References: <20210128181421.2279-1-hch@lst.de> <20210128181421.2279-5-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 29, 2021 at 04:29:02PM +0100, Miroslav Benes wrote: > > > > - mutex_lock(&module_mutex); > > + rcu_read_lock_sched(); > > /* > > * We do not want to block removal of patched modules and therefore > > * we do not take a reference here. The patches are removed by > > @@ -74,7 +75,7 @@ static void klp_find_object_module(struct klp_object *obj) > > if (mod && mod->klp_alive) > > RCU always baffles me a bit, so I'll ask. Don't we need > rcu_dereference_sched() here? "mod" comes from a RCU-protected list, so I > wonder. rcu_dereference* is only used for dereferencing points where that reference itself is RCU protected, that is the lookup of mod itself down in find_module_all in this case.