Hello community, here is the log from the commit of package powerpc-utils for openSUSE:Factory checked in at 2020-04-23 18:29:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/powerpc-utils (Old) and /work/SRC/openSUSE:Factory/.powerpc-utils.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "powerpc-utils" Thu Apr 23 18:29:24 2020 rev:101 rq:796058 version:1.3.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/powerpc-utils/powerpc-utils.changes 2020-02-29 21:20:19.634019312 +0100 +++ /work/SRC/openSUSE:Factory/.powerpc-utils.new.2738/powerpc-utils.changes 2020-04-23 18:29:31.115982243 +0200 @@ -1,0 +2,10 @@ +Fri Feb 28 09:41:54 UTC 2020 - Josef Möllers <[email protected]> + +- Reduce the number of searches of /sys by each invocation + of 'ofpathname' to at most one (1) by caching the content of a + single search into a file in /tmp, and using 'grep' to identify + the appropriate files for further examination. + [bsc#1164726, + 0002-Reduce-number-of-searches-of-sys-hierarchy.patch] + +------------------------------------------------------------------- New: ---- 0002-Reduce-number-of-searches-of-sys-hierarchy.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ powerpc-utils.spec ++++++ --- /var/tmp/diff_new_pack.CpHdfF/_old 2020-04-23 18:29:32.071984072 +0200 +++ /var/tmp/diff_new_pack.CpHdfF/_new 2020-04-23 18:29:32.075984079 +0200 @@ -1,7 +1,7 @@ # # spec file for package powerpc-utils # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -35,6 +35,7 @@ Patch5: Revert-lparstat-Show-available-physical-processors-i.patch Patch6: bug-1158312-parse-ibm-drc-info-property.patch Patch7: 0001-powerpc-utils-Suppress-errors-reading-kernel-files.patch +Patch8: 0002-Reduce-number-of-searches-of-sys-hierarchy.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: librtas-devel @@ -69,6 +70,7 @@ %endif %patch6 -p1 %patch7 -p1 +%patch8 -p1 %build autoreconf -fvi ++++++ 0002-Reduce-number-of-searches-of-sys-hierarchy.patch ++++++ This patch aims to reduce the overhead involved in searching the /sys hierarchy for device, classification, and connection information to improve the performance of the scripts on systems with very large /sys hierarchies. Previously, multiple searches of /sys might be performed by each invocation of 'ofpathname' as it attempts to extract the necessary data to match its arguments. When the /sys hierarchy is very deep and/or involves queries to networked devices, even a single search may take extended periods. This patch reduces the number of searches of /sys by each invocation of 'ofpathname' to at most one (1) by caching the content of a single search into a file in /tmp, and using 'grep' to identify the appropriate files for further examination. A number of other scripts may invoke 'ofpathname' multiple times to examine changes in the system configuration, so a step is added to their initialization to reset the cache of information about /sys stored in a file on /tmp. Signed-off-by: Michael W. Bringmann <[email protected]> --- Index: powerpc-utils-1.3.7/scripts/lsdevinfo =================================================================== --- powerpc-utils-1.3.7.orig/scripts/lsdevinfo +++ powerpc-utils-1.3.7/scripts/lsdevinfo @@ -162,6 +162,8 @@ if [[ $criteria =~ " AND " ]] ; then exit 1 fi +cache_reset + # Fill variables for the two display formats (regular and comma-separated) so # we can print the output in a single place. if [[ $comma_sep -eq 0 ]]; then Index: powerpc-utils-1.3.7/scripts/ofpathname =================================================================== --- powerpc-utils-1.3.7.orig/scripts/ofpathname +++ powerpc-utils-1.3.7/scripts/ofpathname @@ -79,6 +79,8 @@ err() { local emsg=$1 + cache_done + if [[ -n $be_quiet ]]; then exit 1 fi @@ -260,7 +262,7 @@ END # $1 starting directory to look for devpath file get_usb_storage_no() { - for dir in `$FIND /sys -name $1`; do + for dir in `grep "$1\$" $PLATFORM_FIND_CACHE_SYS`; do # Move up until we find one with a devpath link goto_dir $dir "devpath" 0 if [ $? -eq 0 ]; then @@ -425,7 +427,7 @@ is_net_interface() { local res - res=`$FIND /sys/class/net -name $1` + res=`grep "^/sys/class/net" $PLATFORM_FIND_CACHE_SYS | grep $1` if [[ ${#res} = 0 ]]; then echo "no" else @@ -559,7 +561,7 @@ l2of_vd() local found=0 # There may be many instances of DEVICE under /sys - for dir in `$FIND /sys -name $DEVICE`; do + for dir in `grep "$DEVICE\$" $PLATFORM_FIND_CACHE_SYS`; do # Move up until we find one with a device link goto_dir $dir "device" 0 if [ $? -eq 0 ]; then @@ -592,7 +594,7 @@ l2of_vd() # l2of_ethernet() { - for syspath in `$FIND /sys -name $DEVICE 2> /dev/null`; do + for syspath in `grep "$DEVICE\$" $PLATFORM_FIND_CACHE_SYS`; do if [[ -e $syspath/device/devspec ]]; then OF_PATH=`$CAT $syspath/device/devspec` break @@ -651,12 +653,12 @@ l2of_nvme() local dir local found=0 - for dir in `$FIND /sys/devices -name "$DEVICE"`; do + for dir in `grep "$DEVICE\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/devices"`; do cd $dir goto_dir $PWD "device/devspec" - devspec=`$CAT $PWD/device/devspec | tr -d '\000'` + devspec=`$CAT $PWD/device/devspec` if [[ -n $devspec ]]; then found=1 break @@ -681,7 +683,7 @@ l2of_nvme() # Device type is usually 'namespace'. # Get it from device-tree just in case. - devtype=`$CAT /proc/device-tree${devspec}/namespace/name | tr -d '\000'` 2> /dev/null + devtype=`$CAT /proc/device-tree${devspec}/namespace/name` if [[ -z $devtype ]]; then err $ERR_NO_OFPATH fi @@ -773,7 +775,7 @@ l2of_scsi() local devtype # There may be many instances of DEVICE under /sys - for dir in `$FIND /sys -name $DEVICE`; do + for dir in `grep "$DEVICE\$" $PLATFORM_FIND_CACHE_SYS`; do # Move up until we find one with a device link goto_dir $dir "device" 0 if [ $? -eq 0 ]; then @@ -1057,7 +1059,7 @@ of2l_ide() { local dir - for dir in `$FIND /sys/block -name 'hd*'`; do + for dir in `grep "hd*\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/block"`; do # get devno local devno=${DEVICE##*@} devno=${devno%%:*} @@ -1153,7 +1155,7 @@ of2l_usb() DEV_HBTL_NO=${DEVICE##*\@} local dir - for dir in `$FIND /sys/block -name 's[dr]*'`; do + for dir in `grep "s[dr]*\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/block"`; do # go up to find directory with 'device' link local devdir=`find_dir $dir device` if [[ -z $devdir ]]; then @@ -1197,7 +1199,7 @@ of2l_vscsi() DEV_HBTL_NO=${DEVICE##*\@} local dir - for dir in `$FIND /sys/block -name 's[dr]*'`; do + for dir in `grep "s[dr]*\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/block"`; do # go up to find directory with 'device' link local devdir=`find_dir $dir device` if [[ -z $devdir ]]; then @@ -1240,7 +1242,7 @@ of2l_scsi() DEV_LUN=${DEV_LUN%%:*} local dir - for dir in `$FIND /sys/block -name '[sv][dr]*'`; do + for dir in `grep "[sv][dr]*\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/block"`; do # go up to find directory with 'device' link local devdir=`find_dir $dir device` if [[ -z $devdir ]]; then @@ -1328,7 +1330,7 @@ of2l_sas() matchtype="ipr32" fi - for dir in `$FIND /sys/class/scsi_host -maxdepth 1 -name 'host*'`; do + for dir in `grep "^/sys/class/scsi_host/host*" $PLATFORM_FIND_CACHE_SYS`; do cd $dir local link=`get_link "device"` @@ -1350,7 +1352,7 @@ of2l_sas() fi done - for dir in `$FIND /sys/block -name 's[dr]*'`; do + for dir in `grep "s[dr]*\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/block"`; do # go up to find directory with 'device' link local devdir=`find_dir $dir device` if [[ -z $devdir ]]; then @@ -1457,7 +1459,7 @@ of2l_vfc() OF_LUN=`echo $OF_LUN | sed 's/^[0]*//'` local dir - for dir in `$FIND /sys/block -name 's[dr]*'`; do + for dir in `grep "s[dr]*\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/block"`; do # go up to find directory with 'device' link local devdir=`find_dir $dir device` if [[ -z $devdir ]]; then @@ -1520,7 +1522,7 @@ of2l_fc() lunint=`scsilun_to_int $OF_LUN` local dir - for dir in `$FIND /sys/block -name 's[dr]*'`; do + for dir in `grep "s[dr]*\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/block"`; do # go up to find directory with 'device' link local devdir=`find_dir $dir device` if [[ -z $devdir ]]; then @@ -1589,7 +1591,7 @@ of2l_nvme() local dir local link - for dir in `$FIND /sys/block -name "nvme*n$nsid"`; do + for dir in `grep "nvme$nsid\$" $PLATFORM_FIND_CACHE_SYS | grep "^/sys/block"`; do cd $dir link=`get_link "device"` # points to nvme[0-9]+ (non-namespace) @@ -1632,7 +1634,7 @@ of2l_nvme() . $PSERIES_PLATFORM if [[ $platform = $PLATFORM_POWERNV ]]; then echo "$OFPATHNAME: is not supported on the $platform_name platform" 1>&2 - exit 0 + exit 1 fi if [[ "$#" -eq 0 ]]; then @@ -1682,6 +1684,7 @@ if [[ ! -d "/sys" ]]; then exit 1 fi +cache_load if [[ $do_of2l = "0" ]]; then # logical devname => OF pathname @@ -1691,4 +1694,6 @@ else ofpathname_to_logical fi +cache_done + exit 0 Index: powerpc-utils-1.3.7/scripts/pseries_platform =================================================================== --- powerpc-utils-1.3.7.orig/scripts/pseries_platform +++ powerpc-utils-1.3.7/scripts/pseries_platform @@ -40,3 +40,30 @@ fi if [ $SOURCE_FILE = `basename $0` ]; then echo $platform_name fi + +FIND=/usr/bin/find +export PLATFORM_FIND_CACHE_SYS="/tmp/.platform_find_cache_sys.txt" +export PLATFORM_LOCK_CACHE_SYS="/tmp/.platform_find_cache_sys.lock" +cache_reset() +{ + ( + flock -x 999 || exit 1 + $FIND /sys -name "*" 1> $PLATFORM_FIND_CACHE_SYS 2> /dev/null + ) 999>$PLATFORM_LOCK_CACHE_SYS + flock -s $PLATFORM_LOCK_CACHE_SYS -c ls>&/dev/null +} +cache_load() +{ + ( + flock -x -n 999 + RC=$? + if [ "$RC" == 0 ]; then + $FIND /sys -name "*" 1> $PLATFORM_FIND_CACHE_SYS 2> /dev/null + fi + ) 999>$PLATFORM_LOCK_CACHE_SYS + flock -s $PLATFORM_LOCK_CACHE_SYS -c ls>&/dev/null +} +cache_done() +{ + flock -u $PLATFORM_LOCK_CACHE_SYS -c ls>&/dev/null +} Index: powerpc-utils-1.3.7/scripts/bootlist =================================================================== --- powerpc-utils-1.3.7.orig/scripts/bootlist +++ powerpc-utils-1.3.7/scripts/bootlist @@ -444,6 +444,8 @@ if [[ ${BOOTLIST_MODE} = "unknown" ]]; t exit -1 fi +cache_reset + # Now we need to convert all of the logical device names to # open firmware device paths. if [[ ${#LOGICAL_NAMES[*]} -ne 0 ]]; then Index: powerpc-utils-1.3.7/scripts/ls-veth =================================================================== --- powerpc-utils-1.3.7.orig/scripts/ls-veth +++ powerpc-utils-1.3.7/scripts/ls-veth @@ -65,6 +65,8 @@ while getopts ":Vh" flag ; do esac done +cache_reset + # Look at every ibmveth (Virtual Ethernet) device for dev in $($LS -d /proc/device-tree/vdevice/l-lan* 2> /dev/null); do # use ofpathname to get the device name (i.e. eth0)
