Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3C09C433E0 for ; Mon, 1 Feb 2021 12:10:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6DDD764E9B for ; Mon, 1 Feb 2021 12:10:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DDD764E9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9C1E6E523; Mon, 1 Feb 2021 12:10:49 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C3CC6E523 for ; Mon, 1 Feb 2021 12:10:48 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 7928C64E2C; Mon, 1 Feb 2021 12:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612181448; bh=VpXCDfyNDkFB6N2oS+yv9UYv1FFtVEhcO5B6o8eybU0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HaH7mujAr3wAdUU7Wbx8NZL1I+ehA6nkr8Ywa4kIYDvUwHUoZx2E28Pxr7ifUj0mt 7ljJAQsR2C8cmJAhCEfFz7WlBbFbcYk6h1CXB2Y9PzQv9yo4WszIpL5OHIbr+huud/ DTJ+YupZxs4692+MeXtltnemY6HxUucQSaELW53wykG+dmhx/UvhvmlITS+Idy3evG 6qzrY4zJuBmI9bQgKtqj9S8Vxz3ss0nQSNYmw9hIaMuF6P5GYtPl/DuUcSxMjQJcLy tT307SwHtzy9d8kG545Zqjsb+38DqN6yFxfRVMnwI9dVoBzO/0f1HxxpxD93Q+NZid 37O97iC4kLFKA== Date: Mon, 1 Feb 2021 13:10:37 +0100 From: Jessica Yu To: Miroslav Benes Subject: Re: [PATCH 04/13] module: use RCU to synchronize find_module Message-ID: References: <20210128181421.2279-1-hch@lst.de> <20210128181421.2279-5-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-OS: Linux gunter 5.10.9-1-default x86_64 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Petr Mladek , Joe Lawrence , Andrew Donnellan , linux-kbuild@vger.kernel.org, David Airlie , Masahiro Yamada , Jiri Kosina , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Michal Marek , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Josh Poimboeuf , Frederic Barrat , linuxppc-dev@lists.ozlabs.org, Christoph Hellwig Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" +++ Miroslav Benes [29/01/21 16:29 +0100]: >On Thu, 28 Jan 2021, Christoph Hellwig wrote: > >> Allow for a RCU-sched critical section around find_module, following >> the lower level find_module_all helper, and switch the two callers >> outside of module.c to use such a RCU-sched critical section instead >> of module_mutex. > >That's a nice idea. > >> @@ -57,7 +58,7 @@ static void klp_find_object_module(struct klp_object *obj) >> if (!klp_is_module(obj)) >> return; >> >> - 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. Same here :-) I had to double check the RCU documentation. For our modules list case I believe the rcu list API should take care of that for us. Worth noting is this snippet from Documentation/RCU/whatisRCU.txt: rcu_dereference() is typically used indirectly, via the _rcu list-manipulation primitives, such as list_for_each_entry_rcu() _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel