xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: xen-devel <xen-devel@lists.xen.org>
Subject: libxl - avoid calling block script
Date: Fri, 9 Feb 2018 02:02:42 +0100	[thread overview]
Message-ID: <20180209010242.GA2297@mail-itl> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 3173 bytes --]

Hi,

I'd like to avoid calling block script to speed up domain startup a
little (there may be multiple disks, all already being block devices).
Right now I have restored setting physical-device xenstore entry in
libxl (by reverting [1]), then applying the patch below (it's on 4.8).
This works well for my case, but maybe there is some option to have it
in vanilla Xen? Right now, this require explicit "script=block" to call
the script (for example to setup loop device).

Alternative idea I have is setting disk->script="block" early
(in libxl_device_disk_init()?), so default do not change, but it's still
possible to change it to NULL and avoid calling the script. The problem
is libxl_device_disk_init() is a generated and I don't see how it could
be modified... Any hints?

Yet another idea is having some specific value for disk->script,
that would avoid calling it, but I find this much less elegant solution.

[1] http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=e885362

From: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Subject: [PATCH] libxl: do not call default block script

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/libxl/libxl.c       | 8 +++++---
 tools/libxl/libxl_linux.c | 5 ++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 11d94ff..74a2421 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2093,9 +2093,11 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
                 flexarray_append(back, "params");
                 flexarray_append(back, dev);
 
-                script = libxl__abs_path(gc, disk->script?: "block",
-                                         libxl__xen_script_dir_path());
-                flexarray_append_pair(back, "script", script);
+                if (disk->script || disk->backend_domid != LIBXL_TOOLSTACK_DOMID) {
+                    script = libxl__abs_path(gc, disk->script?: "block",
+                            libxl__xen_script_dir_path());
+                    flexarray_append_pair(back, "script", script);
+                }
 
                 /* If the user did not supply a block script then we
                  * write the physical-device node ourselves.
diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c
index 115332a..923a1d0 100644
--- a/tools/libxl/libxl_linux.c
+++ b/tools/libxl/libxl_linux.c
@@ -334,9 +334,8 @@ static int libxl__hotplug_disk(libxl__gc *gc, libxl__device *dev,
     script = libxl__xs_read(gc, XBT_NULL,
                             GCSPRINTF("%s/%s", be_path, "script"));
     if (!script) {
-        LOGEV(ERROR, errno, "unable to read script from %s", be_path);
-        rc = ERROR_FAIL;
-        goto error;
+        LOG(INFO, "no script for %s", be_path);
+        return 0;
     }
 
     *env = get_hotplug_env(gc, script, dev);
-- 
1.8.1.4


-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2018-02-09  1:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09  1:02 Marek Marczykowski-Górecki [this message]
2018-02-09 10:55 ` libxl - avoid calling block script Roger Pau Monné
2018-02-09 11:03   ` Roger Pau Monné
2018-02-09 11:35     ` Marek Marczykowski-Górecki
2018-02-23 18:28       ` Wei Liu
2018-02-23 20:14         ` Marek Marczykowski-Górecki
2018-02-26 10:11           ` Roger Pau Monné
2018-02-26 11:58       ` Ian Jackson

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=20180209010242.GA2297@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).