All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Subject: [RFC PATCH] tools/libxl: force running dm when device_model_args set
Date: Wed,  6 Mar 2024 16:48:29 +0000	[thread overview]
Message-ID: <20240306164829.3815555-1-alex.bennee@linaro.org> (raw)

When device_model_args is set we almost certainly want to spawn the
device model. This is most useful when debugging with QEMU and you
want to specify a new device type for testing without teaching libxl
about the device itself.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
This is very much an RFC, it's useful to me as a developer but I can
see an argument for being more cautious for production.
---
 tools/libs/light/libxl_dm.c      | 6 ++++++
 tools/libs/light/libxl_types.idl | 2 ++
 tools/xl/xl_parse.c              | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 620f381560..5774510aa0 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -3969,7 +3969,13 @@ int libxl__need_xenpv_qemu(libxl__gc *gc, libxl_domain_config *d_config)
         }
     }
 
+    /* finally if we've slurped extra args we almost certainly do */
+    if (d_config->need_ext_dm) {
+        ret = 1;
+    }
+
 out:
+    LOGD(INFO, domid, "need_qemu: %s", ret == 1 ? "yes":"no");
     return ret;
 }
 
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 2be194eb19..e7705bebe9 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -1113,6 +1113,8 @@ libxl_domain_config = Struct("domain_config", [
     ("on_watchdog", libxl_action_on_shutdown),
     ("on_crash", libxl_action_on_shutdown),
     ("on_soft_reset", libxl_action_on_shutdown),
+    # true when we need to launch dm to serve the guest
+    ("need_ext_dm", bool),
     ], dir=DIR_IN)
 
 libxl_diskinfo = Struct("diskinfo", [
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 52e20134a9..be0ea3e3dc 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -3083,6 +3083,8 @@ skip_usbdev:
     if (e && e != ESRCH) {                                                \
         fprintf(stderr,"xl: Unable to parse device_model_args"#type".\n");\
         exit(-ERROR_FAIL);                                                \
+    } else if (e) {                                                     \
+        d_config->need_ext_dm = true;                                   \
     }
 
     /* parse extra args for qemu, common to both pv, hvm */
-- 
2.39.2



                 reply	other threads:[~2024-03-06 16:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240306164829.3815555-1-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=xen-devel@lists.xenproject.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 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.