Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1433113 > unrolled thread
| Started by | Vitaly Kuznetsov <vkuznets@redhat.com> |
|---|---|
| First post | 2016-06-28 18:50 +0200 |
| Last post | 2016-06-29 14:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH linux 3/8] x86/xen: use xen_vcpu_id mapping for HYPERVISOR_vcpu_op Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-28 18:50 +0200
Re: [Xen-devel] [PATCH linux 3/8] x86/xen: use xen_vcpu_id mapping for HYPERVISOR_vcpu_op David Vrabel <david.vrabel@citrix.com> - 2016-06-29 14:30 +0200
| From | Vitaly Kuznetsov <vkuznets@redhat.com> |
|---|---|
| Date | 2016-06-28 18:50 +0200 |
| Subject | [PATCH linux 3/8] x86/xen: use xen_vcpu_id mapping for HYPERVISOR_vcpu_op |
| Message-ID | <rP4n0-157-19@gated-at.bofh.it> |
HYPERVISOR_vcpu_op passes Linux's idea of vCPU id as a parameter while
Xen's idea is expected. In some cases these ideas diverge so we need to
do remapping.
There is an issue, however. PV guests do VCPUOP_is_up very early
(see xen_fill_possible_map() and xen_filter_cpu_maps()) when we don't have
perpu areas initialized. While it could be solved with switching to
early_percpu for xen_vcpu_id I think it's not worth it: PV guests will
probably never get to the point where their idea of vCPU id diverges from
Xen's.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/include/asm/xen/hypercall.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index a12a047..20750c8 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -49,6 +49,7 @@
#include <xen/interface/physdev.h>
#include <xen/interface/platform.h>
#include <xen/interface/xen-mca.h>
+#include <xen/xen-ops.h>
/*
* The hypercall asms have to meet several constraints:
@@ -422,7 +423,15 @@ HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
static inline int
HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
{
- return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
+ /*
+ * PV guests call HYPERVISOR_vcpu_op before percpu areas are
+ * initialized. As we always use direct mapping for vCPU ids
+ * for them we can simply use Linux vcpuid here.
+ */
+ return _hypercall3(int, vcpu_op, cmd,
+ per_cpu(xen_vcpu_id, vcpuid) != -1 ?
+ per_cpu(xen_vcpu_id, vcpuid) : vcpuid,
+ extra_args);
}
#ifdef CONFIG_X86_64
--
2.5.5
[toc] | [next] | [standalone]
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2016-06-29 14:30 +0200 |
| Subject | Re: [Xen-devel] [PATCH linux 3/8] x86/xen: use xen_vcpu_id mapping for HYPERVISOR_vcpu_op |
| Message-ID | <rPmMV-47V-17@gated-at.bofh.it> |
| In reply to | #1433113 |
On 28/06/16 17:47, Vitaly Kuznetsov wrote:
> HYPERVISOR_vcpu_op passes Linux's idea of vCPU id as a parameter while
> Xen's idea is expected. In some cases these ideas diverge so we need to
> do remapping.
>
> There is an issue, however. PV guests do VCPUOP_is_up very early
> (see xen_fill_possible_map() and xen_filter_cpu_maps()) when we don't have
> perpu areas initialized. While it could be solved with switching to
> early_percpu for xen_vcpu_id I think it's not worth it: PV guests will
> probably never get to the point where their idea of vCPU id diverges from
> Xen's.
[...]
> static inline int
> HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
> {
> - return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
> + /*
> + * PV guests call HYPERVISOR_vcpu_op before percpu areas are
> + * initialized. As we always use direct mapping for vCPU ids
> + * for them we can simply use Linux vcpuid here.
> + */
> + return _hypercall3(int, vcpu_op, cmd,
> + per_cpu(xen_vcpu_id, vcpuid) != -1 ?
> + per_cpu(xen_vcpu_id, vcpuid) : vcpuid,
> + extra_args);
> }
HYPERVISOR_vcpu_op() should take Xen VCPUs, with the callers doing the
mapping.
David
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web