SHA256
1
0
forked from pool/s390-tools
s390-tools/s390-tools-sles15sp1-04-zdev-Implement-no-settle.patch

158 lines
5.2 KiB
Diff
Raw Normal View History

Subject: zdev: Implement --no-settle
From: Peter Oberparleiter <oberpar@linux.ibm.com>
Summary: zdev: Add support for handling I/O configuration data
Description: LPARs that are running in IBM Dynamic Partition Manager (DPM) mode
can access a firmware-generated I/O configuration data file that
contains s390-specific information about available I/O devices
such as qeth device numbers and parameters, and FCP device IDs.
This data file is intended to remove the need for users to
manually enter the corresponding device data during installation.
Linux kernels with the corresponding support make the I/O
configuration data available at the following location:
/sys/firmware/sclp_sd/config/data
This patch set adds support for handling this data file using the
chzdev and lszdev tools:
- I/O configuration data can be applied using chzdev's --import
option
- Initial RAM-Disk scripts automatically apply the
I/O configuration data to the system configuration
- lszdev can be used to display the applied auto-configuration
data
- chzdev can be used to manually override the
auto-configuration data
Upstream-ID: f32bff96881a04bb68b895c23b13ae50daa9e7b4
Problem-ID: LS1604
Upstream-Description:
zdev: Implement --no-settle
There are some situations where running "udevadm settle" can result in
a deadlock, such as in the early stages of initial RAM-disk processing.
Introduce a new command-line option --no-settle that can be used to
suppress calling "udevadm settle" to allow chzdev to be run in such
situations.
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
---
zdev/include/udev.h | 1 +
zdev/man/chzdev.8 | 9 +++++++++
zdev/src/chzdev.c | 9 +++++++++
zdev/src/chzdev_usage.txt | 1 +
zdev/src/udev.c | 3 +++
5 files changed, 23 insertions(+)
--- a/zdev/include/udev.h
+++ b/zdev/include/udev.h
@@ -14,6 +14,7 @@
#include "exit_code.h"
extern int udev_need_settle;
+extern int udev_no_settle;
/* Single key-operator-value entry in a udev rule line.*/
struct udev_entry_node {
--- a/zdev/man/chzdev.8
+++ b/zdev/man/chzdev.8
@@ -528,6 +528,15 @@ device configuration persistent. Typical
initial RAM disk, or modifying the kernel command line.
.PP
.
+.OD no-settle "" ""
+Do not wait for udev processing to complete.
+
+Skips all calls to the udevadm tool that are intended to wait for udev to
+finish processing before continuing. There is typically no need to use this
+option unless chzdev is run in an environment where udev is not fully
+functional (such as in the early phase of an initial RAM disk).
+.PP
+.
.OD persistent "p" ""
Apply changes to persistent configuration only.
--- a/zdev/src/chzdev.c
+++ b/zdev/src/chzdev.c
@@ -95,6 +95,7 @@ struct options {
struct util_list *base; /* List of struct strlist_node */
unsigned int verbose:1;
unsigned int quiet:1;
+ unsigned int no_settle:1;
};
/* Makefile converts chzdev_usage.txt into C file which we include here. */
@@ -136,6 +137,7 @@ enum {
OPT_VERSION = 'v',
OPT_VERBOSE = 'V',
OPT_QUIET = 'q',
+ OPT_NO_SETTLE = (OPT_ANONYMOUS_BASE+__COUNTER__),
};
static struct opts_conflict conflict_list[] = {
@@ -217,6 +219,7 @@ static const struct option opt_list[] =
{ "base", required_argument, NULL, OPT_BASE },
{ "verbose", no_argument, NULL, OPT_VERBOSE },
{ "quiet", no_argument, NULL, OPT_QUIET },
+ { "no-settle", no_argument, NULL, OPT_NO_SETTLE },
{ NULL, no_argument, NULL, 0 },
};
@@ -937,6 +940,11 @@ static exit_code_t parse_options(struct
opts->quiet = 1;
break;
+ case OPT_NO_SETTLE:
+ /* --no-settle */
+ opts->no_settle = 1;
+ break;
+
case ':':
/* Missing option argument. */
syntax("Option '%s' requires an argument\n",
@@ -2904,6 +2912,7 @@ int main(int argc, char *argv[])
force = opts.force;
yes = opts.yes;
dryrun = opts.dryrun;
+ udev_no_settle = opts.no_settle;
path_set_base(opts.base);
if (dryrun)
--- a/zdev/src/chzdev_usage.txt
+++ b/zdev/src/chzdev_usage.txt
@@ -54,5 +54,6 @@ OPTIONS
--no-root-update Skip root device update
--dry-run Display changes without applying
--base PATH Use PATH as base for accessing files
+ --no-settle Do not wait for udev to settle
-V, --verbose Print additional run-time information
-q, --quiet Print only minimal run-time information
--- a/zdev/src/udev.c
+++ b/zdev/src/udev.c
@@ -24,6 +24,7 @@
#include "udev.h"
int udev_need_settle = 0;
+int udev_no_settle;
/* Create a newly allocated udev entry. */
static struct udev_entry_node *udev_entry_node_new(const char *key,
@@ -403,5 +404,7 @@ exit_code_t udev_remove_rule(const char
/* Wait for all current udev events to finish. */
void udev_settle(void)
{
+ if (udev_no_settle)
+ return;
misc_system(err_ignore, "%s settle", PATH_UDEVADM);
}