All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests
@ 2017-03-22 13:59 Vitaly Kuznetsov
  2017-03-22 13:59 ` [PATCH v2 1/2] libxl: preserve console tty across soft reset Vitaly Kuznetsov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vitaly Kuznetsov @ 2017-03-22 13:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson

Hi,

I'm trying to make kexec/kdump work for PVHv2 guests too. PVHv2 guests are
almost HVM guests so no major changes to the soft reset procedures are
required. A few issues, however, arose during testing.

Changes since v1:
- PATCH1 was dropped from the series as it was merged [Wei Liu]
- Use libxl__xs_read_mandatory() instead of xs_read() [Wei Liu]
- Follow-up PATCH2 added to make do_domain_soft_reset () consistent.

Vitaly Kuznetsov (2):
  libxl: preserve console tty across soft reset
  libxl: use libxl__xs_read_checked() instead or raw xs_read() in
    do_domain_soft_reset()

 tools/libxl/libxl_console.c  |  5 ++++-
 tools/libxl/libxl_create.c   | 34 +++++++++++++++++++++++++---------
 tools/libxl/libxl_internal.h |  1 +
 3 files changed, 30 insertions(+), 10 deletions(-)

-- 
2.9.3


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

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

* [PATCH v2 1/2] libxl: preserve console tty across soft reset
  2017-03-22 13:59 [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests Vitaly Kuznetsov
@ 2017-03-22 13:59 ` Vitaly Kuznetsov
  2017-03-22 13:59 ` [PATCH v2 2/2] libxl: use libxl__xs_read_checked() instead or raw xs_read() in do_domain_soft_reset() Vitaly Kuznetsov
  2017-03-23 12:03 ` [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Vitaly Kuznetsov @ 2017-03-22 13:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson

On soft reset we remove the domain from xenstore and introduce it back to
have everything reconnected. Console, however, stays attached (as xenconsoled
checks if the domain is dying and our domain is not) but we lose the
information about tty:

before soft reset:
   console = ""
    ...
    type = "xenconsoled"
    output = "pty"
    tty = "/dev/pts/1"
    ...

after:
   console = ""
    ...
    type = "xenconsoled"
    output = "pty"
    tty = ""
    ...

The issue applies to both HVM and PVH but for HVM guests serial console
through QEMU is usually in use and for PVH we don't have it.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
Changes since v1:
  - Use libxl__xs_read_mandatory() instead of xs_read() [Wei Liu]

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 tools/libxl/libxl_console.c  |  5 ++++-
 tools/libxl/libxl_create.c   | 10 ++++++++++
 tools/libxl/libxl_internal.h |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c
index cbc70b7..446e766 100644
--- a/tools/libxl/libxl_console.c
+++ b/tools/libxl/libxl_console.c
@@ -316,7 +316,10 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "output");
     flexarray_append(ro_front, console->output);
     flexarray_append(ro_front, "tty");
-    flexarray_append(ro_front, "");
+    if (state && state->console_tty)
+        flexarray_append(ro_front, state->console_tty);
+    else
+        flexarray_append(ro_front, "");
 
     if (state) {
         flexarray_append(ro_front, "port");
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 95fd96b..46b80b2 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1697,6 +1697,7 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
     libxl__domain_build_state *state;
     libxl__domain_save_state *dss;
     char *dom_path, *xs_store_mfn, *xs_console_mfn;
+    const char *console_tty;
     uint32_t domid_out;
     int rc;
 
@@ -1737,6 +1738,15 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
     state->console_mfn = xs_console_mfn ? atol(xs_console_mfn): 0;
     free(xs_console_mfn);
 
+    rc = libxl__xs_read_mandatory(gc, XBT_NULL,
+                                  GCSPRINTF("%s/console/tty", dom_path),
+                                  &console_tty);
+    if (rc) {
+        LOGD(ERROR, domid_soft_reset, "failed to read console/tty.");
+        goto out;
+    }
+    state->console_tty = libxl__strdup(gc, console_tty);
+
     dss->ao = ao;
     dss->domid = dss->dsps.domid = domid_soft_reset;
     dss->dsps.dm_savefile = GCSPRINTF(LIBXL_DEVICE_MODEL_SAVE_FILE".%d",
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 7722665..88fca8e 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1123,6 +1123,7 @@ typedef struct {
     uint32_t console_port;
     uint32_t console_domid;
     unsigned long console_mfn;
+    char *console_tty;
 
     char *saved_state;
 
-- 
2.9.3


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

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

* [PATCH v2 2/2] libxl: use libxl__xs_read_checked() instead or raw xs_read() in do_domain_soft_reset()
  2017-03-22 13:59 [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests Vitaly Kuznetsov
  2017-03-22 13:59 ` [PATCH v2 1/2] libxl: preserve console tty across soft reset Vitaly Kuznetsov
@ 2017-03-22 13:59 ` Vitaly Kuznetsov
  2017-03-23 12:03 ` [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Vitaly Kuznetsov @ 2017-03-22 13:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson

Replace raw xs_read() calls with libxl__xs_read_checked() and bail on error.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 tools/libxl/libxl_create.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 46b80b2..b65c971 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1696,8 +1696,8 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
     libxl__domain_create_state *dcs;
     libxl__domain_build_state *state;
     libxl__domain_save_state *dss;
-    char *dom_path, *xs_store_mfn, *xs_console_mfn;
-    const char *console_tty;
+    const char *console_tty, *xs_store_mfn, *xs_console_mfn;
+    char *dom_path;
     uint32_t domid_out;
     int rc;
 
@@ -1726,17 +1726,23 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
         goto out;
     }
 
-    xs_store_mfn = xs_read(ctx->xsh, XBT_NULL,
-                           GCSPRINTF("%s/store/ring-ref", dom_path),
-                           NULL);
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/store/ring-ref", dom_path),
+                                &xs_store_mfn);
+    if (rc) {
+        LOGD(ERROR, domid_soft_reset, "failed to read store/ring-ref.");
+        goto out;
+    }
     state->store_mfn = xs_store_mfn ? atol(xs_store_mfn): 0;
-    free(xs_store_mfn);
 
-    xs_console_mfn = xs_read(ctx->xsh, XBT_NULL,
-                             GCSPRINTF("%s/console/ring-ref", dom_path),
-                             NULL);
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/console/ring-ref", dom_path),
+                                &xs_console_mfn);
+    if (rc) {
+        LOGD(ERROR, domid_soft_reset, "failed to read console/ring-ref.");
+        goto out;
+    }
     state->console_mfn = xs_console_mfn ? atol(xs_console_mfn): 0;
-    free(xs_console_mfn);
 
     rc = libxl__xs_read_mandatory(gc, XBT_NULL,
                                   GCSPRINTF("%s/console/tty", dom_path),
-- 
2.9.3


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

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

* Re: [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests
  2017-03-22 13:59 [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests Vitaly Kuznetsov
  2017-03-22 13:59 ` [PATCH v2 1/2] libxl: preserve console tty across soft reset Vitaly Kuznetsov
  2017-03-22 13:59 ` [PATCH v2 2/2] libxl: use libxl__xs_read_checked() instead or raw xs_read() in do_domain_soft_reset() Vitaly Kuznetsov
@ 2017-03-23 12:03 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2017-03-23 12:03 UTC (permalink / raw)
  To: Vitaly Kuznetsov; +Cc: Wei Liu, Ian Jackson, xen-devel

On Wed, Mar 22, 2017 at 02:59:43PM +0100, Vitaly Kuznetsov wrote:
> Hi,
> 
> I'm trying to make kexec/kdump work for PVHv2 guests too. PVHv2 guests are
> almost HVM guests so no major changes to the soft reset procedures are
> required. A few issues, however, arose during testing.
> 
> Changes since v1:
> - PATCH1 was dropped from the series as it was merged [Wei Liu]
> - Use libxl__xs_read_mandatory() instead of xs_read() [Wei Liu]
> - Follow-up PATCH2 added to make do_domain_soft_reset () consistent.
> 
> Vitaly Kuznetsov (2):
>   libxl: preserve console tty across soft reset
>   libxl: use libxl__xs_read_checked() instead or raw xs_read() in
>     do_domain_soft_reset()

Acked-by: Wei Liu <wei.liu2@citrix.com>

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

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

end of thread, other threads:[~2017-03-23 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-22 13:59 [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests Vitaly Kuznetsov
2017-03-22 13:59 ` [PATCH v2 1/2] libxl: preserve console tty across soft reset Vitaly Kuznetsov
2017-03-22 13:59 ` [PATCH v2 2/2] libxl: use libxl__xs_read_checked() instead or raw xs_read() in do_domain_soft_reset() Vitaly Kuznetsov
2017-03-23 12:03 ` [PATCH v2 0/2] libxl: fix soft reset for PVHv2 guests Wei Liu

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.