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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, 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 C619AC433B4 for ; Sat, 8 May 2021 22:54:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A449F6142D for ; Sat, 8 May 2021 22:54:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229522AbhEHWzd (ORCPT ); Sat, 8 May 2021 18:55:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:43774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbhEHWzc (ORCPT ); Sat, 8 May 2021 18:55:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C052610FA; Sat, 8 May 2021 22:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1620514470; bh=ooSrzkzwKer8KTaTDaOQzQInIm1jkdITqHXSXXtW4mY=; h=Date:From:To:Subject:From; b=cscIqh34uR2UytKriW8FR7s13YpI6ttU9no+0+HgzUgKEFxZ1+K/lwnp3LVLKoimA bDA2fQIxL1JX6YUJWhSkMedIiR91jM++XIxhTY8R12LOHTEOOdjDeGsj3DfTEV3Izw i0xFzCJSQMJmZqd/peQa5nE7/Y9M9ZD7dqFg3JxI= Date: Sat, 08 May 2021 15:54:29 -0700 From: akpm@linux-foundation.org To: bp@alien8.de, corbet@lwn.net, gregkh@linuxfoundation.org, jeyu@kernel.org, linux@rasmusvillemoes.dk, mcgrof@kernel.org, mm-commits@vger.kernel.org, ndesaulniers@google.com, tiwai@suse.de Subject: [merged] modules-add-config_modprobe_path.patch removed from -mm tree Message-ID: <20210508225429.EB9syQwOu%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: modules: add CONFIG_MODPROBE_PATH has been removed from the -mm tree. Its filename was modules-add-config_modprobe_path.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Rasmus Villemoes Subject: modules: add CONFIG_MODPROBE_PATH Allow the developer to specifiy the initial value of the modprobe_path[] string. This can be used to set it to the empty string initially, thus effectively disabling request_module() during early boot until userspace writes a new value via the /proc/sys/kernel/modprobe interface. [1] When building a custom kernel (often for an embedded target), it's normal to build everything into the kernel that is needed for booting, and indeed the initramfs often contains no modules at all, so every such request_module() done before userspace init has mounted the real rootfs is a waste of time. This is particularly useful when combined with the previous patch, which made the initramfs unpacking asynchronous - for that to work, it had to make any usermodehelper call wait for the unpacking to finish before attempting to invoke the userspace helper. By eliminating all such (known-to-be-futile) calls of usermodehelper, the initramfs unpacking and the {device,late}_initcalls can proceed in parallel for much longer. For a relatively slow ppc board I'm working on, the two patches combined lead to 0.2s faster boot - but more importantly, the fact that the initramfs unpacking proceeds completely in the background while devices get probed means I get to handle the gpio watchdog in time without getting reset. [1] __request_module() already has an early -ENOENT return when modprobe_path is the empty string. Link: https://lkml.kernel.org/r/20210313212528.2956377-3-linux@rasmusvillemoes.dk Signed-off-by: Rasmus Villemoes Reviewed-by: Greg Kroah-Hartman Acked-by: Jessica Yu Acked-by: Luis Chamberlain Cc: Borislav Petkov Cc: Jonathan Corbet Cc: Nick Desaulniers Cc: Takashi Iwai Signed-off-by: Andrew Morton --- init/Kconfig | 12 ++++++++++++ kernel/kmod.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) --- a/init/Kconfig~modules-add-config_modprobe_path +++ a/init/Kconfig @@ -2299,6 +2299,18 @@ config MODULE_ALLOW_MISSING_NAMESPACE_IM If unsure, say N. +config MODPROBE_PATH + string "Path to modprobe binary" + default "/sbin/modprobe" + help + When kernel code requests a module, it does so by calling + the "modprobe" userspace utility. This option allows you to + set the path where that binary is found. This can be changed + at runtime via the sysctl file + /proc/sys/kernel/modprobe. Setting this to the empty string + removes the kernel's ability to request modules (but + userspace can still load modules explicitly). + config TRIM_UNUSED_KSYMS bool "Trim unused exported kernel symbols" if EXPERT depends on !COMPILE_TEST --- a/kernel/kmod.c~modules-add-config_modprobe_path +++ a/kernel/kmod.c @@ -58,7 +58,7 @@ static DECLARE_WAIT_QUEUE_HEAD(kmod_wq); /* modprobe_path is set via /proc/sys. */ -char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe"; +char modprobe_path[KMOD_PATH_LEN] = CONFIG_MODPROBE_PATH; static void free_modprobe_argv(struct subprocess_info *info) { _ Patches currently in -mm which might be from linux@rasmusvillemoes.dk are