Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 12/16] udev: improve udev-cache robustness
Date: Wed, 04 Jan 2012 17:14:12 +0000	[thread overview]
Message-ID: <1325697252.20759.39.camel@ted> (raw)
In-Reply-To: <434061cd08c919cbabd78bf875d5f3e24233ef84.1325101674.git.otavio@ossystems.com.br>

On Wed, 2011-12-28 at 19:55 +0000, Otavio Salvador wrote:
> * allow udev-cache to be disabled at runtime (using
>    /etc/default/udev-cache);
> 
>  * make cache invalidated if kernel, bootparams or device list
>    changes;
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  meta/recipes-core/udev/udev.inc                |   11 ++++++++++-
>  meta/recipes-core/udev/udev/init               |   18 +++++++++++++++---
>  meta/recipes-core/udev/udev/udev-cache         |   20 +++++++++++++++++---
>  meta/recipes-core/udev/udev/udev-cache.default |    4 ++++
>  meta/recipes-core/udev/udev_164.bb             |    2 +-
>  5 files changed, 47 insertions(+), 8 deletions(-)
>  create mode 100644 meta/recipes-core/udev/udev/udev-cache.default
> 
> diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
> index 198336b..a228e5f 100644
> --- a/meta/recipes-core/udev/udev.inc
> +++ b/meta/recipes-core/udev/udev.inc
> @@ -25,6 +25,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
>             file://network.sh \
>             file://local.rules \
>             file://udev-cache \
> +           file://udev-cache.default \
>             file://init"
>  
>  inherit autotools pkgconfig update-rc.d
> @@ -56,7 +57,7 @@ FILES_libgudev = "${base_libdir}/libgudev*.so.* ${libdir}/libgudev*.so.*"
>  FILES_libgudev-dbg = "${base_libdir}/.debug/libgudev*.so.* ${libdir}/.debug/libgudev*.so.*"
>  FILES_libgudev-dev = "${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libgudev*.la \
>                       ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc"
> -FILES_udev-cache = "${sysconfdir}/init.d/udev-cache"
> +FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
>  
>  FILES_udev-acl = "${base_libdir}/udev/udev-acl ${base_libdir}/udev/rules.d/70-acl.rules"
>  
> @@ -68,6 +69,14 @@ do_install_append () {
>  	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
>  	install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
>  
> +	install -d ${D}${sysconfdir}/default
> +	install -m 0755 ${WORKDIR}/udev-cache.default ${D}${sysconfdir}/default/udev-cache
> +
> +	touch ${D}${sysconfdir}/udev/saved.uname
> +	touch ${D}${sysconfdir}/udev/saved.cmdline
> +	touch ${D}${sysconfdir}/udev/saved.devices
> +	touch ${D}${sysconfdir}/udev/saved.atags
> +
>  	install -d ${D}${sysconfdir}/udev/rules.d/
>  
>  	install -m 0644 ${WORKDIR}/local.rules         ${D}${sysconfdir}/udev/rules.d/local.rules
> diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
> index c2b491e..5468bd9 100644
> --- a/meta/recipes-core/udev/udev/init
> +++ b/meta/recipes-core/udev/udev/init
> @@ -14,6 +14,7 @@ export TZ=/etc/localtime
>  [ -d /sys/class ] || exit 1
>  [ -r /proc/mounts ] || exit 1
>  [ -x /sbin/udevd ] || exit 1
> +[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
>  [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
>  
>  kill_udevd() {
> @@ -35,9 +36,20 @@ mkdir -p -m 0755 /dev/pts
>  mkdir -p -m 1777 /dev/shm
>  
> 
> -if [ -e /etc/dev.tar ]; then
> -	(cd /; tar xf /etc/dev.tar 2>&1 | grep -v 'time stamp' || true)
> -	not_first_boot=1
> +if [ "$DEVCACHE" != "" ]; then
> +	# Invalidate udev cache if the kernel or its bootargs/cmdline have changed
> +	[ -x /bin/uname ] && /bin/uname -mrspv > /dev/shm/uname || touch /dev/shm/uname
> +	[ -r /proc/cmdline ] && cat /proc/cmdline > /dev/shm/cmdline || touch /dev/shm/cmdline
> +	[ -r /proc/devices ] && cat /proc/devices > /dev/shm/devices || touch /dev/shm/devices
> +	[ -r /proc/atags ] && cat /proc/atags > /dev/shm/atags || touch /dev/shm/atags
> +	if [ -e $DEVCACHE ] && \
> +		cmp -s /dev/shm/uname /etc/udev/saved.uname && \
> +		cmp -s /dev/shm/cmdline /etc/udev/saved.cmdline && \
> +		cmp -s /dev/shm/devices /etc/udev/saved.devices && \
> +		cmp -s /dev/shm/atags /etc/udev/saved.atags; then
> +		(cd /; tar xf $DEVCACHE > /dev/null 2>&1)
> +		not_first_boot=1
> +	fi
>  fi

You're adding a ton of exec calls into the boot process here :(

Please can we find some better way to do this without all the exec()
calls?

Cheers,

Richard

 






  reply	other threads:[~2012-01-04 17:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28 19:55 [PATCH 00/16] Misc Qt4 and udev changes pending from O.S. Systems Otavio Salvador
2011-12-28 19:55 ` [PATCH 01/16] qt4-graphics-system: add Otavio Salvador
2012-01-02 18:23   ` Saul Wold
2012-01-02 18:38     ` Martin Jansa
2012-01-04  0:49       ` Otavio Salvador
2011-12-28 19:55 ` [PATCH 02/16] qt4e.bbclass: add QT_BASE_NAME for use in recipes Otavio Salvador
2011-12-28 19:55 ` [PATCH 03/16] qt4x11.bbclass: " Otavio Salvador
2011-12-28 19:55 ` [PATCH 04/16] qt4-embedded.inc: use QT_BASE_NAME from qt4e.bbclass Otavio Salvador
2011-12-28 19:55 ` [PATCH 05/16] qt4-x11-free.inc: use QT_BASE_NAME from qt4x11.bbclass Otavio Salvador
2011-12-28 19:55 ` [PATCH 06/16] udev: drop 145 version Otavio Salvador
2011-12-28 19:55 ` [PATCH 07/16] udev-extraconf: move mount.blacklist to udev-extraconf dir Otavio Salvador
2011-12-28 19:55 ` [PATCH 08/16] udev: reorganize files of 164 version Otavio Salvador
2011-12-28 19:55 ` [PATCH 09/16] udev: use tabs for init script (no code changes) Otavio Salvador
2011-12-28 19:55 ` [PATCH 10/16] udev: skip mounting /dev on tmpfs if it is on devtmpfs Otavio Salvador
2011-12-28 19:55 ` [PATCH 11/16] udev: ensure /dev/pts and /dev/shm does exists Otavio Salvador
2012-01-04 17:12   ` Richard Purdie
2012-01-05 16:59     ` Otavio Salvador
2011-12-28 19:55 ` [PATCH 12/16] udev: improve udev-cache robustness Otavio Salvador
2012-01-04 17:14   ` Richard Purdie [this message]
2012-01-05 17:06     ` Otavio Salvador
2011-12-28 19:55 ` [PATCH 13/16] udev: use 'echo' instead of 'echo -n' in init script Otavio Salvador
2011-12-28 19:55 ` [PATCH 14/16] udev: run depmod if modules.dep doesn't exist Otavio Salvador
2012-01-04 17:15   ` Richard Purdie
2012-01-04 18:51     ` Koen Kooi
2012-01-04 23:04       ` Richard Purdie
2011-12-28 19:55 ` [PATCH 15/16] udev: split utilities onto udev-utils Otavio Salvador
2011-12-28 19:55 ` [PATCH 16/16] udev: remove commented code from init script (no code changes) Otavio Salvador
2012-01-04  0:24 ` [PATCH 00/16] Misc Qt4 and udev changes pending from O.S. Systems Saul Wold
2012-01-05 20:25   ` Saul Wold

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=1325697252.20759.39.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /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