All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] A few fixes related to oeqa runtime
@ 2018-07-31  7:13 Chen Qi
  2018-07-31  7:13 ` [PATCH 1/4] oe_syslog.py: fix settings in OEHasPackage decorator Chen Qi
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Chen Qi @ 2018-07-31  7:13 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 9c419271b5cf927924682c3200451979f02409bb:

  bitbake: codeparser: Track oe.utils.conditional usage (2018-07-30 12:45:15 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib ChenQi/oeqa_fixes
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/oeqa_fixes

Chen Qi (4):
  oe_syslog.py: fix settings in OEHasPackage decorator
  parselogs.py: ignore network interface name changing failure
  systemd: backport patch to allow setting dbus calls timeout
  systemd.py: increase default bus timeout

 meta/lib/oeqa/runtime/cases/oe_syslog.py           |   4 +-
 meta/lib/oeqa/runtime/cases/parselogs.py           |   3 +-
 meta/lib/oeqa/runtime/cases/systemd.py             |   6 +-
 ...bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch | 175 +++++++++++++++++++++
 meta/recipes-core/systemd/systemd_239.bb           |   1 +
 5 files changed, 183 insertions(+), 6 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch

-- 
1.9.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] oe_syslog.py: fix settings in OEHasPackage decorator
  2018-07-31  7:13 [PATCH 0/4] A few fixes related to oeqa runtime Chen Qi
@ 2018-07-31  7:13 ` Chen Qi
  2018-07-31  7:13 ` [PATCH 2/4] parselogs.py: ignore network interface name changing failure Chen Qi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2018-07-31  7:13 UTC (permalink / raw)
  To: openembedded-core

1. For test_syslog_running, we should not restrict it to run for
   only busybox-syslog and sysklogd. So extend it to all syslog
   providers in oe-core and meta-openembedded.

2. For test_syslog_startup_config, fix to make it depend on the
   existence of busybox-syslog. The previous condition "!sysklogd
   && busybox" is incorrect, because busybox may be compiled without
   syslog support, and sysklogd and busybox-syslog conflict with
   each other.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/lib/oeqa/runtime/cases/oe_syslog.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/oe_syslog.py b/meta/lib/oeqa/runtime/cases/oe_syslog.py
index 005b697..935f10f 100644
--- a/meta/lib/oeqa/runtime/cases/oe_syslog.py
+++ b/meta/lib/oeqa/runtime/cases/oe_syslog.py
@@ -8,7 +8,7 @@ class SyslogTest(OERuntimeTestCase):
 
     @OETestID(201)
     @OETestDepends(['ssh.SSHTest.test_ssh'])
-    @OEHasPackage(["busybox-syslog", "sysklogd"])
+    @OEHasPackage(["busybox-syslog", "sysklogd", "rsyslog", "syslog-ng"])
     def test_syslog_running(self):
         cmd = '%s  | grep -i [s]yslogd' % self.tc.target_cmds['ps']
         status, output = self.target.run(cmd)
@@ -45,7 +45,7 @@ class SyslogTestConfig(OERuntimeTestCase):
 
     @OETestID(202)
     @OETestDepends(['oe_syslog.SyslogTestConfig.test_syslog_logger'])
-    @OEHasPackage(["!sysklogd", "busybox"])
+    @OEHasPackage(["busybox-syslog"])
     @skipIfDataVar('VIRTUAL-RUNTIME_init_manager', 'systemd',
                    'Not appropiate for systemd image')
     def test_syslog_startup_config(self):
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] parselogs.py: ignore network interface name changing failure
  2018-07-31  7:13 [PATCH 0/4] A few fixes related to oeqa runtime Chen Qi
  2018-07-31  7:13 ` [PATCH 1/4] oe_syslog.py: fix settings in OEHasPackage decorator Chen Qi
@ 2018-07-31  7:13 ` Chen Qi
  2018-07-31  7:13 ` [PATCH 3/4] systemd: backport patch to allow setting dbus calls timeout Chen Qi
  2018-07-31  7:13 ` [PATCH 4/4] systemd.py: increase default bus timeout Chen Qi
  3 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2018-07-31  7:13 UTC (permalink / raw)
  To: openembedded-core

The following error from systemd-udevd is not harmful. It's just
because our qemu targets are using eth0.

  Error changing net interface name 'eth0' to 'enp0s3': Device or resource busy

Note that systemd is using a different network interface naming scheme
from traditional ethX naming scheme. To make this error message go away,
we could symlink /etc/udev/rules.d/80-net-setup-link.rules to /dev/null
to recover traditional naming scheme. But I'm not sure if this will
cause regression in user experience for systemd users of OE.

So just ignore this error message so that parselogs.py test case does not
fail.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/lib/oeqa/runtime/cases/parselogs.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/runtime/cases/parselogs.py b/meta/lib/oeqa/runtime/cases/parselogs.py
index f0bcd16..017b550 100644
--- a/meta/lib/oeqa/runtime/cases/parselogs.py
+++ b/meta/lib/oeqa/runtime/cases/parselogs.py
@@ -51,7 +51,8 @@ common_errors = [
     "Cannot set xattr user.Librepo.DownloadInProgress",
     "Failed to read /var/lib/nfs/statd/state: Success",
     "error retry time-out =",
-    "logind: cannot setup systemd-logind helper (-61), using legacy fallback"
+    "logind: cannot setup systemd-logind helper (-61), using legacy fallback",
+    "Error changing net interface name 'eth0' to "
     ]
 
 video_related = [
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] systemd: backport patch to allow setting dbus calls timeout
  2018-07-31  7:13 [PATCH 0/4] A few fixes related to oeqa runtime Chen Qi
  2018-07-31  7:13 ` [PATCH 1/4] oe_syslog.py: fix settings in OEHasPackage decorator Chen Qi
  2018-07-31  7:13 ` [PATCH 2/4] parselogs.py: ignore network interface name changing failure Chen Qi
@ 2018-07-31  7:13 ` Chen Qi
  2018-07-31  7:47   ` ChenQi
  2018-07-31  7:13 ` [PATCH 4/4] systemd.py: increase default bus timeout Chen Qi
  3 siblings, 1 reply; 6+ messages in thread
From: Chen Qi @ 2018-07-31  7:13 UTC (permalink / raw)
  To: openembedded-core

Backport 0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch
which allows setting dbus calls timeout via BUS_DEFAULT_TIMEOUT
environment variable.

This is needed as we are meeting timeout failures from the oeqa
runtime test case systemd.py.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 ...bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch | 175 +++++++++++++++++++++
 meta/recipes-core/systemd/systemd_239.bb           |   1 +
 2 files changed, 176 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch

diff --git a/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch b/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch
new file mode 100644
index 0000000..45c9b5b
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch
@@ -0,0 +1,175 @@
+From 5b75a72ee968c9666b5f2ea313720b6c383cb4c2 Mon Sep 17 00:00:00 2001
+From: Yu Watanabe <watanabe.yu+github@gmail.com>
+Date: Fri, 13 Jul 2018 17:38:47 +0900
+Subject: [PATCH] sd-bus: make BUS_DEFAULT_TIMEOUT configurable
+
+This adds sd_bus_{get,set}_method_call_timeout().
+If the timeout is not set or set to 0, then the timeout value is
+parsed from $SYSTEMD_BUS_TIMEOUT= environment variable. If the
+environment variable is not set, then built-in timeout is used.
+---
+ doc/ENVIRONMENT.md                   |  5 +++++
+ src/libsystemd/libsystemd.sym        |  5 +++++
+ src/libsystemd/sd-bus/bus-internal.h |  9 ++++----
+ src/libsystemd/sd-bus/bus-message.c  |  7 +++++--
+ src/libsystemd/sd-bus/sd-bus.c       | 40 ++++++++++++++++++++++++++++++++++--
+ src/systemd/sd-bus.h                 |  3 +++
+ 6 files changed, 61 insertions(+), 8 deletions(-)
+
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+diff --git a/doc/ENVIRONMENT.md b/doc/ENVIRONMENT.md
+index 85d26fe28c..641a03d5d7 100644
+--- a/doc/ENVIRONMENT.md
++++ b/doc/ENVIRONMENT.md
+@@ -37,6 +37,11 @@ All tools:
+   useful for debugging, in order to test generators and other code against
+   specific kernel command lines.
+ 
++* `$SYSTEMD_BUS_TIMEOUT=SECS` — specifies the maximum time to wait for method call
++  completion. If no time unit is specified, assumes seconds. The usual other units
++  are understood, too (us, ms, s, min, h, d, w, month, y). If it is not set or set
++  to 0, then the built-in default is used.
++
+ systemctl:
+ 
+ * `$SYSTEMCTL_FORCE_BUS=1` — if set, do not connect to PID1's private D-Bus
+diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym
+index 1eec17db50..006dbc9c3f 100644
+--- a/src/libsystemd/libsystemd.sym
++++ b/src/libsystemd/libsystemd.sym
+@@ -570,3 +570,8 @@ global:
+         sd_event_source_set_destroy_callback;
+         sd_event_source_get_destroy_callback;
+ } LIBSYSTEMD_238;
++
++LIBSYSTEMD_240 {
++        sd_bus_set_method_call_timeout;
++        sd_bus_get_method_call_timeout;
++} LIBSYSTEMD_239;
+diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
+index 2087ef8eeb..4864b1e911 100644
+--- a/src/libsystemd/sd-bus/bus-internal.h
++++ b/src/libsystemd/sd-bus/bus-internal.h
+@@ -319,6 +319,9 @@ struct sd_bus {
+ 
+         int *inotify_watches;
+         size_t n_inotify_watches;
++
++        /* zero means use value specified by $SYSTEMD_BUS_TIMEOUT= environment variable or built-in default */
++        usec_t method_call_timeout;
+ };
+ 
+ /* For method calls we time-out at 25s, like in the D-Bus reference implementation */
+@@ -336,8 +339,7 @@ struct sd_bus {
+ 
+ #define BUS_CONTAINER_DEPTH 128
+ 
+-/* Defined by the specification as maximum size of an array in
+- * bytes */
++/* Defined by the specification as maximum size of an array in bytes */
+ #define BUS_ARRAY_MAX_SIZE 67108864
+ 
+ #define BUS_FDS_MAX 1024
+@@ -388,8 +390,7 @@ void bus_close_io_fds(sd_bus *b);
+              _slash = streq((prefix), "/") ? NULL : strrchr((prefix), '/'))
+ 
+ /* If we are invoking callbacks of a bus object, ensure unreffing the
+- * bus from the callback doesn't destroy the object we are working
+- * on */
++ * bus from the callback doesn't destroy the object we are working on */
+ #define BUS_DONT_DESTROY(bus) \
+         _cleanup_(sd_bus_unrefp) _unused_ sd_bus *_dont_destroy_##bus = sd_bus_ref(bus)
+ 
+diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
+index 8d92bc2002..dffe70a665 100644
+--- a/src/libsystemd/sd-bus/bus-message.c
++++ b/src/libsystemd/sd-bus/bus-message.c
+@@ -5809,8 +5809,11 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
+                 return r;
+ 
+         timeout = (*m)->timeout;
+-        if (timeout == 0 && !((*m)->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED))
+-                timeout = BUS_DEFAULT_TIMEOUT;
++        if (timeout == 0 && !((*m)->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)) {
++                r = sd_bus_get_method_call_timeout(bus, &timeout);
++                if (r < 0)
++                        return r;
++        }
+ 
+         r = sd_bus_message_seal(n, BUS_MESSAGE_COOKIE(*m), timeout);
+         if (r < 0)
+diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
+index 089b51a6d9..945490ebf7 100644
+--- a/src/libsystemd/sd-bus/sd-bus.c
++++ b/src/libsystemd/sd-bus/sd-bus.c
+@@ -1611,8 +1611,11 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m, usec_t timeout) {
+                 return 0;
+         }
+ 
+-        if (timeout == 0)
+-                timeout = BUS_DEFAULT_TIMEOUT;
++        if (timeout == 0) {
++                r = sd_bus_get_method_call_timeout(b, &timeout);
++                if (r < 0)
++                        return r;
++        }
+ 
+         if (!m->sender && b->patch_sender) {
+                 r = sd_bus_message_set_sender(m, b->patch_sender);
+@@ -4075,3 +4078,36 @@ _public_ int sd_bus_get_n_queued_write(sd_bus *bus, uint64_t *ret) {
+         *ret = bus->wqueue_size;
+         return 0;
+ }
++
++_public_ int sd_bus_set_method_call_timeout(sd_bus *bus, uint64_t usec) {
++        assert_return(bus, -EINVAL);
++        assert_return(bus = bus_resolve(bus), -ENOPKG);
++
++        bus->method_call_timeout = usec;
++        return 0;
++}
++
++_public_ int sd_bus_get_method_call_timeout(sd_bus *bus, uint64_t *ret) {
++        const char *e;
++        usec_t usec;
++
++        assert_return(bus, -EINVAL);
++        assert_return(bus = bus_resolve(bus), -ENOPKG);
++        assert_return(ret, -EINVAL);
++
++        if (bus->method_call_timeout != 0) {
++                *ret = bus->method_call_timeout;
++                return 0;
++        }
++
++        e = secure_getenv("SYSTEMD_BUS_TIMEOUT");
++        if (e && parse_sec(e, &usec) >= 0 && usec != 0) {
++                /* Save the parsed value to avoid multiple parsing. To change the timeout value,
++                 * use sd_bus_set_method_call_timeout() instead of setenv(). */
++                *ret = bus->method_call_timeout = usec;
++                return 0;
++        }
++
++        *ret = bus->method_call_timeout = BUS_DEFAULT_TIMEOUT;
++        return 0;
++}
+diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
+index 54c4b1ca83..c9fd254834 100644
+--- a/src/systemd/sd-bus.h
++++ b/src/systemd/sd-bus.h
+@@ -206,6 +206,9 @@ sd_event *sd_bus_get_event(sd_bus *bus);
+ int sd_bus_get_n_queued_read(sd_bus *bus, uint64_t *ret);
+ int sd_bus_get_n_queued_write(sd_bus *bus, uint64_t *ret);
+ 
++int sd_bus_set_method_call_timeout(sd_bus *bus, uint64_t usec);
++int sd_bus_get_method_call_timeout(sd_bus *bus, uint64_t *ret);
++
+ int sd_bus_add_filter(sd_bus *bus, sd_bus_slot **slot, sd_bus_message_handler_t callback, void *userdata);
+ int sd_bus_add_match(sd_bus *bus, sd_bus_slot **slot, const char *match, sd_bus_message_handler_t callback, void *userdata);
+ int sd_bus_add_match_async(sd_bus *bus, sd_bus_slot **slot, const char *match, sd_bus_message_handler_t callback, sd_bus_message_handler_t install_callback, void *userdata);
+-- 
+2.11.0
+
diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-core/systemd/systemd_239.bb
index dc1545a..001a363 100644
--- a/meta/recipes-core/systemd/systemd_239.bb
+++ b/meta/recipes-core/systemd/systemd_239.bb
@@ -27,6 +27,7 @@ SRC_URI += "file://touchscreen.rules \
            file://0008-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch \
            file://0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch \
            file://0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch \
+           file://0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch \
            "
 SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] systemd.py: increase default bus timeout
  2018-07-31  7:13 [PATCH 0/4] A few fixes related to oeqa runtime Chen Qi
                   ` (2 preceding siblings ...)
  2018-07-31  7:13 ` [PATCH 3/4] systemd: backport patch to allow setting dbus calls timeout Chen Qi
@ 2018-07-31  7:13 ` Chen Qi
  3 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2018-07-31  7:13 UTC (permalink / raw)
  To: openembedded-core

Use SYSTEMD_BUS_TIMEOUT to set default timeout to 240s to avoid
timeout problem on slow qemu machines.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/lib/oeqa/runtime/cases/systemd.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/systemd.py b/meta/lib/oeqa/runtime/cases/systemd.py
index db69384..460b8fc 100644
--- a/meta/lib/oeqa/runtime/cases/systemd.py
+++ b/meta/lib/oeqa/runtime/cases/systemd.py
@@ -11,11 +11,11 @@ from oeqa.core.decorator.data import skipIfNotFeature
 class SystemdTest(OERuntimeTestCase):
 
     def systemctl(self, action='', target='', expected=0, verbose=False):
-        command = 'systemctl %s %s' % (action, target)
+        command = 'SYSTEMD_BUS_TIMEOUT=240s systemctl %s %s' % (action, target)
         status, output = self.target.run(command)
         message = '\n'.join([command, output])
         if status != expected and verbose:
-            cmd = 'systemctl status --full %s' % target
+            cmd = 'SYSTEMD_BUS_TIMEOUT=240s systemctl status --full %s' % target
             message += self.target.run(cmd)[1]
         self.assertEqual(status, expected, message)
         return output
@@ -63,7 +63,7 @@ class SystemdBasicTests(SystemdTest):
         """
         endtime = time.time() + (60 * 2)
         while True:
-            status, output = self.target.run('systemctl --state=activating')
+            status, output = self.target.run('SYSTEMD_BUS_TIMEOUT=240s systemctl --state=activating')
             if "0 loaded units listed" in output:
                 return (True, '')
             if time.time() >= endtime:
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4] systemd: backport patch to allow setting dbus calls timeout
  2018-07-31  7:13 ` [PATCH 3/4] systemd: backport patch to allow setting dbus calls timeout Chen Qi
@ 2018-07-31  7:47   ` ChenQi
  0 siblings, 0 replies; 6+ messages in thread
From: ChenQi @ 2018-07-31  7:47 UTC (permalink / raw)
  To: openembedded-core

On 07/31/2018 03:13 PM, Chen Qi wrote:
> Backport 0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch
> which allows setting dbus calls timeout via BUS_DEFAULT_TIMEOUT
> environment variable.

The environment variable's name is actually SYSTEMD_BUS_TIMEOUT.
I've fixed the commit message and updated the remote repo.

>
> This is needed as we are meeting timeout failures from the oeqa
> runtime test case systemd.py.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>   ...bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch | 175 +++++++++++++++++++++
>   meta/recipes-core/systemd/systemd_239.bb           |   1 +
>   2 files changed, 176 insertions(+)
>   create mode 100644 meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch
>
> diff --git a/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch b/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch
> new file mode 100644
> index 0000000..45c9b5b
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch
> @@ -0,0 +1,175 @@
> +From 5b75a72ee968c9666b5f2ea313720b6c383cb4c2 Mon Sep 17 00:00:00 2001
> +From: Yu Watanabe <watanabe.yu+github@gmail.com>
> +Date: Fri, 13 Jul 2018 17:38:47 +0900
> +Subject: [PATCH] sd-bus: make BUS_DEFAULT_TIMEOUT configurable
> +
> +This adds sd_bus_{get,set}_method_call_timeout().
> +If the timeout is not set or set to 0, then the timeout value is
> +parsed from $SYSTEMD_BUS_TIMEOUT= environment variable. If the
> +environment variable is not set, then built-in timeout is used.
> +---
> + doc/ENVIRONMENT.md                   |  5 +++++
> + src/libsystemd/libsystemd.sym        |  5 +++++
> + src/libsystemd/sd-bus/bus-internal.h |  9 ++++----
> + src/libsystemd/sd-bus/bus-message.c  |  7 +++++--
> + src/libsystemd/sd-bus/sd-bus.c       | 40 ++++++++++++++++++++++++++++++++++--
> + src/systemd/sd-bus.h                 |  3 +++
> + 6 files changed, 61 insertions(+), 8 deletions(-)
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> +
> +diff --git a/doc/ENVIRONMENT.md b/doc/ENVIRONMENT.md
> +index 85d26fe28c..641a03d5d7 100644
> +--- a/doc/ENVIRONMENT.md
> ++++ b/doc/ENVIRONMENT.md
> +@@ -37,6 +37,11 @@ All tools:
> +   useful for debugging, in order to test generators and other code against
> +   specific kernel command lines.
> +
> ++* `$SYSTEMD_BUS_TIMEOUT=SECS` — specifies the maximum time to wait for method call
> ++  completion. If no time unit is specified, assumes seconds. The usual other units
> ++  are understood, too (us, ms, s, min, h, d, w, month, y). If it is not set or set
> ++  to 0, then the built-in default is used.
> ++
> + systemctl:
> +
> + * `$SYSTEMCTL_FORCE_BUS=1` — if set, do not connect to PID1's private D-Bus
> +diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym
> +index 1eec17db50..006dbc9c3f 100644
> +--- a/src/libsystemd/libsystemd.sym
> ++++ b/src/libsystemd/libsystemd.sym
> +@@ -570,3 +570,8 @@ global:
> +         sd_event_source_set_destroy_callback;
> +         sd_event_source_get_destroy_callback;
> + } LIBSYSTEMD_238;
> ++
> ++LIBSYSTEMD_240 {
> ++        sd_bus_set_method_call_timeout;
> ++        sd_bus_get_method_call_timeout;
> ++} LIBSYSTEMD_239;
> +diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
> +index 2087ef8eeb..4864b1e911 100644
> +--- a/src/libsystemd/sd-bus/bus-internal.h
> ++++ b/src/libsystemd/sd-bus/bus-internal.h
> +@@ -319,6 +319,9 @@ struct sd_bus {
> +
> +         int *inotify_watches;
> +         size_t n_inotify_watches;
> ++
> ++        /* zero means use value specified by $SYSTEMD_BUS_TIMEOUT= environment variable or built-in default */
> ++        usec_t method_call_timeout;
> + };
> +
> + /* For method calls we time-out at 25s, like in the D-Bus reference implementation */
> +@@ -336,8 +339,7 @@ struct sd_bus {
> +
> + #define BUS_CONTAINER_DEPTH 128
> +
> +-/* Defined by the specification as maximum size of an array in
> +- * bytes */
> ++/* Defined by the specification as maximum size of an array in bytes */
> + #define BUS_ARRAY_MAX_SIZE 67108864
> +
> + #define BUS_FDS_MAX 1024
> +@@ -388,8 +390,7 @@ void bus_close_io_fds(sd_bus *b);
> +              _slash = streq((prefix), "/") ? NULL : strrchr((prefix), '/'))
> +
> + /* If we are invoking callbacks of a bus object, ensure unreffing the
> +- * bus from the callback doesn't destroy the object we are working
> +- * on */
> ++ * bus from the callback doesn't destroy the object we are working on */
> + #define BUS_DONT_DESTROY(bus) \
> +         _cleanup_(sd_bus_unrefp) _unused_ sd_bus *_dont_destroy_##bus = sd_bus_ref(bus)
> +
> +diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
> +index 8d92bc2002..dffe70a665 100644
> +--- a/src/libsystemd/sd-bus/bus-message.c
> ++++ b/src/libsystemd/sd-bus/bus-message.c
> +@@ -5809,8 +5809,11 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
> +                 return r;
> +
> +         timeout = (*m)->timeout;
> +-        if (timeout == 0 && !((*m)->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED))
> +-                timeout = BUS_DEFAULT_TIMEOUT;
> ++        if (timeout == 0 && !((*m)->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)) {
> ++                r = sd_bus_get_method_call_timeout(bus, &timeout);
> ++                if (r < 0)
> ++                        return r;
> ++        }
> +
> +         r = sd_bus_message_seal(n, BUS_MESSAGE_COOKIE(*m), timeout);
> +         if (r < 0)
> +diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
> +index 089b51a6d9..945490ebf7 100644
> +--- a/src/libsystemd/sd-bus/sd-bus.c
> ++++ b/src/libsystemd/sd-bus/sd-bus.c
> +@@ -1611,8 +1611,11 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m, usec_t timeout) {
> +                 return 0;
> +         }
> +
> +-        if (timeout == 0)
> +-                timeout = BUS_DEFAULT_TIMEOUT;
> ++        if (timeout == 0) {
> ++                r = sd_bus_get_method_call_timeout(b, &timeout);
> ++                if (r < 0)
> ++                        return r;
> ++        }
> +
> +         if (!m->sender && b->patch_sender) {
> +                 r = sd_bus_message_set_sender(m, b->patch_sender);
> +@@ -4075,3 +4078,36 @@ _public_ int sd_bus_get_n_queued_write(sd_bus *bus, uint64_t *ret) {
> +         *ret = bus->wqueue_size;
> +         return 0;
> + }
> ++
> ++_public_ int sd_bus_set_method_call_timeout(sd_bus *bus, uint64_t usec) {
> ++        assert_return(bus, -EINVAL);
> ++        assert_return(bus = bus_resolve(bus), -ENOPKG);
> ++
> ++        bus->method_call_timeout = usec;
> ++        return 0;
> ++}
> ++
> ++_public_ int sd_bus_get_method_call_timeout(sd_bus *bus, uint64_t *ret) {
> ++        const char *e;
> ++        usec_t usec;
> ++
> ++        assert_return(bus, -EINVAL);
> ++        assert_return(bus = bus_resolve(bus), -ENOPKG);
> ++        assert_return(ret, -EINVAL);
> ++
> ++        if (bus->method_call_timeout != 0) {
> ++                *ret = bus->method_call_timeout;
> ++                return 0;
> ++        }
> ++
> ++        e = secure_getenv("SYSTEMD_BUS_TIMEOUT");
> ++        if (e && parse_sec(e, &usec) >= 0 && usec != 0) {
> ++                /* Save the parsed value to avoid multiple parsing. To change the timeout value,
> ++                 * use sd_bus_set_method_call_timeout() instead of setenv(). */
> ++                *ret = bus->method_call_timeout = usec;
> ++                return 0;
> ++        }
> ++
> ++        *ret = bus->method_call_timeout = BUS_DEFAULT_TIMEOUT;
> ++        return 0;
> ++}
> +diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
> +index 54c4b1ca83..c9fd254834 100644
> +--- a/src/systemd/sd-bus.h
> ++++ b/src/systemd/sd-bus.h
> +@@ -206,6 +206,9 @@ sd_event *sd_bus_get_event(sd_bus *bus);
> + int sd_bus_get_n_queued_read(sd_bus *bus, uint64_t *ret);
> + int sd_bus_get_n_queued_write(sd_bus *bus, uint64_t *ret);
> +
> ++int sd_bus_set_method_call_timeout(sd_bus *bus, uint64_t usec);
> ++int sd_bus_get_method_call_timeout(sd_bus *bus, uint64_t *ret);
> ++
> + int sd_bus_add_filter(sd_bus *bus, sd_bus_slot **slot, sd_bus_message_handler_t callback, void *userdata);
> + int sd_bus_add_match(sd_bus *bus, sd_bus_slot **slot, const char *match, sd_bus_message_handler_t callback, void *userdata);
> + int sd_bus_add_match_async(sd_bus *bus, sd_bus_slot **slot, const char *match, sd_bus_message_handler_t callback, sd_bus_message_handler_t install_callback, void *userdata);
> +--
> +2.11.0
> +
> diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-core/systemd/systemd_239.bb
> index dc1545a..001a363 100644
> --- a/meta/recipes-core/systemd/systemd_239.bb
> +++ b/meta/recipes-core/systemd/systemd_239.bb
> @@ -27,6 +27,7 @@ SRC_URI += "file://touchscreen.rules \
>              file://0008-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch \
>              file://0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch \
>              file://0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch \
> +           file://0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch \
>              "
>   SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
>   




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-31  7:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31  7:13 [PATCH 0/4] A few fixes related to oeqa runtime Chen Qi
2018-07-31  7:13 ` [PATCH 1/4] oe_syslog.py: fix settings in OEHasPackage decorator Chen Qi
2018-07-31  7:13 ` [PATCH 2/4] parselogs.py: ignore network interface name changing failure Chen Qi
2018-07-31  7:13 ` [PATCH 3/4] systemd: backport patch to allow setting dbus calls timeout Chen Qi
2018-07-31  7:47   ` ChenQi
2018-07-31  7:13 ` [PATCH 4/4] systemd.py: increase default bus timeout Chen Qi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.