Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Paul Barker <paul@pbarker.dev>
To: Wenwen Fu <wenwfu@qti.qualcomm.com>,
	 openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] initramfs-framework: add opt-in root-only udev trigger
Date: Tue, 18 Aug 2026 09:47:01 +0100	[thread overview]
Message-ID: <501364c2da036830fd46896e7f8997e16d2848d2.camel@pbarker.dev> (raw)
In-Reply-To: <20260812092842.2060157-1-wenwfu@qti.qualcomm.com>

Hi,

Thanks for the patch, I have a couple of feedback comments.

On Wed, 2026-08-12 at 17:28 +0800, Wenwen Fu wrote:
> The initramfs udev module replays add events for the complete device tree
> and waits for every resulting event. An initramfs that only mounts a root
> partition does not need to coldplug unrelated devices.
> 
> Add an opt-in initramfs.udev-root-only kernel parameter. When root uses
> PARTLABEL or PARTUUID, trigger only the matching block device. For
> PARTLABEL roots, match the PARTNAME property exposed by udev. Keep the
> existing full trigger as the default so current users and other initramfs
> modules retain their existing behaviour.
> 
> If the requested root cannot be matched safely, or a targeted trigger
> fails, fall back to the original full coldplug.

This explains the mechanism, but not why we would want the option to
avoid the current behaviour. Does the current behaviour cause problems,
is it too slow, etc?

> 
> Signed-off-by: Wenwen Fu <wenwfu@qti.qualcomm.com>
> ---
>  .../initrdscripts/initramfs-framework/udev    | 30 ++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/udev b/meta/recipes-core/initrdscripts/initramfs-framework/udev
> index 4898b89246..7fa26ef807 100644
> --- a/meta/recipes-core/initrdscripts/initramfs-framework/udev
> +++ b/meta/recipes-core/initrdscripts/initramfs-framework/udev
> @@ -35,6 +35,29 @@ udev_enabled() {
>  	return 0
>  }
>  
> +udev_trigger_root_device() {
> +	case "${bootparam_root:-}" in
> +		PARTLABEL=?*)
> +			root_match="PARTNAME=${bootparam_root#PARTLABEL=}"
> +			;;
> +		PARTUUID=?*)
> +			root_match="PARTUUID=${bootparam_root#PARTUUID=}"
> +			;;
> +		*)
> +			return 1
> +			;;
> +	esac
> +
> +	root_devices=$(udevadm trigger --dry-run --verbose \
> +		--subsystem-match=block "--property-match=$root_match") || return 1
> +
> +	# udevadm succeeds even when no devices match, so check its dry-run output.
> +	[ -n "$root_devices" ] || return 1
> +
> +	udevadm trigger --subsystem-match=block \
> +		"--property-match=$root_match" --action=add

The commit message says that there is a fallback to the original full
coldplug if the targeted trigger fails, but the return status of this
command is ignored.

> +}
> +
>  udev_run() {
>  	add_module_pre_hook "udev_shutdown_hook_handler"
>  
> @@ -45,6 +68,11 @@ udev_run() {
>  	sh -c "exec 4< /dev/console" || { exec 0> /dev/null; exec 1> /dev/null; exec 2> /dev/null; }
>  
>  	$_UDEV_DAEMON --daemon
> -	udevadm trigger --action=add
> +	if [ "${bootparam_initramfs_udev_root_only:-}" = "1" ] &&

I don't think this enabling condition isn't explained clearly in the
commit message.

> +	   udev_trigger_root_device; then
> +		debug "Triggered udev for root partition only"
> +	else
> +		udevadm trigger --action=add
> +	fi
>  	udevadm settle
>  }

Best regards,

-- 
Paul Barker



  reply	other threads:[~2026-08-18  8:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12  9:28 [PATCH] initramfs-framework: add opt-in root-only udev trigger Wenwen Fu
2026-08-18  8:47 ` Paul Barker [this message]
2026-08-18 10:01   ` Wenwen Fu
2026-08-18 10:17 ` [PATCH v2] " Wenwen Fu

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=501364c2da036830fd46896e7f8997e16d2848d2.camel@pbarker.dev \
    --to=paul@pbarker.dev \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=wenwfu@qti.qualcomm.com \
    /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