xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Jones <drjones@redhat.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	David Vrabel <david.vrabel@citrix.com>
Subject: [PATCH RFC 1/1] Introduce VCPUOP_reset_vcpu_info
Date: Wed,  6 Aug 2014 15:08:22 +0200	[thread overview]
Message-ID: <1407330502-18768-2-git-send-email-vkuznets@redhat.com> (raw)
In-Reply-To: <1407330502-18768-1-git-send-email-vkuznets@redhat.com>

From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

When an SMP guest performs kexec/kdump it tries issuing VCPUOP_register_vcpu_info.
This fails due to vcpu_info already being registered. Introduce new vcpu operation
to reset vcpu_info to its default state.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 xen/arch/x86/hvm/hvm.c    |  1 +
 xen/common/domain.c       | 22 +++++++++++++++++++---
 xen/include/public/vcpu.h |  6 ++++++
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 216c3f2..7917272 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3332,6 +3332,7 @@ static long hvm_vcpu_op(
     case VCPUOP_set_singleshot_timer:
     case VCPUOP_stop_singleshot_timer:
     case VCPUOP_register_vcpu_info:
+    case VCPUOP_reset_vcpu_info:
     case VCPUOP_register_vcpu_time_memory_area:
         rc = do_vcpu_op(cmd, vcpuid, arg);
         break;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index ac444ba..024f366 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -961,9 +961,9 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
 }
 
 /*
- * Unmap the vcpu info page if the guest decided to place it somewhere
- * else.  This is only used from arch_domain_destroy, so there's no
- * need to do anything clever.
+ * Unmap the vcpu info page if the guest decided to place it somewhere else.
+ * This is used from arch_domain_destroy and from VCPUOP_reset_vcpu_info
+ * handler.
  */
 void unmap_vcpu_info(struct vcpu *v)
 {
@@ -1121,6 +1121,22 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
         break;
     }
 
+    case VCPUOP_reset_vcpu_info:
+    {
+        struct domain *d = v->domain;
+
+        if ( !test_bit(_VPF_down, &v->pause_flags) )
+            return -EFAULT;
+
+        domain_lock(d);
+        unmap_vcpu_info(v);
+        if ( vcpuid < XEN_LEGACY_MAX_VCPUS )
+            v->vcpu_info = (vcpu_info_t *)&shared_info(d, vcpu_info[vcpuid]);
+        domain_unlock(d);
+        rc = 0;
+        break;
+    }
+
     case VCPUOP_register_runstate_memory_area:
     {
         struct vcpu_register_runstate_memory_area area;
diff --git a/xen/include/public/vcpu.h b/xen/include/public/vcpu.h
index e888daf..c0283bc 100644
--- a/xen/include/public/vcpu.h
+++ b/xen/include/public/vcpu.h
@@ -227,6 +227,12 @@ struct vcpu_register_time_memory_area {
 typedef struct vcpu_register_time_memory_area vcpu_register_time_memory_area_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_register_time_memory_area_t);
 
+/*
+ * Reset all of the vcpu_info information from their previous location
+ * to the default one used at bootup.
+ */
+#define VCPUOP_reset_vcpu_info   14
+
 #endif /* __XEN_PUBLIC_VCPU_H__ */
 
 /*
-- 
1.9.3

  reply	other threads:[~2014-08-06 13:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06 13:08 [PATCH RFC 0/1] Introduce VCPUOP_reset_vcpu_info Vitaly Kuznetsov
2014-08-06 13:08 ` Vitaly Kuznetsov [this message]
2014-08-06 14:36   ` [PATCH RFC 1/1] " Jan Beulich
2014-08-06 14:09 ` [PATCH RFC 0/1] " Jan Beulich
2014-08-06 14:49   ` Konrad Rzeszutek Wilk
2014-08-06 14:54     ` Jan Beulich
2014-08-06 15:03       ` Konrad Rzeszutek Wilk
2014-08-06 14:51   ` Konrad Rzeszutek Wilk
2014-08-06 15:00     ` Jan Beulich
2014-08-06 15:02       ` Konrad Rzeszutek Wilk
2014-08-06 15:38         ` Jan Beulich
2014-08-06 15:03   ` Vitaly Kuznetsov
2014-08-06 15:43     ` Jan Beulich
2014-08-07 11:41       ` Vitaly Kuznetsov
2014-08-07 11:48         ` Jan Beulich
2014-08-07 11:54           ` Vitaly Kuznetsov

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=1407330502-18768-2-git-send-email-vkuznets@redhat.com \
    --to=vkuznets@redhat.com \
    --cc=david.vrabel@citrix.com \
    --cc=drjones@redhat.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --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 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).