From: Ian Campbell <Ian.Campbell@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: [Xen-devel] [PATCH 2/4] xen/vcpu: Document the xen_vcpu_info and xen_vcpu
Date: Tue, 7 May 2013 10:30:47 +0100 [thread overview]
Message-ID: <1367919047.26321.47.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <1367845498-14290-3-git-send-email-konrad.wilk@oracle.com>
On Mon, 2013-05-06 at 14:04 +0100, Konrad Rzeszutek Wilk wrote:
> They are important structures and it is not clear at first
> look what they are for.
>
> The xen_vcpu is a pointer. By default it points to the shared_info
> structure (at the CPU offset location). However if the
> VCPUOP_register_vcpu_info hypercall is implemented we can make the
> xen_vcpu pointer point to a per-CPU location.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> arch/x86/xen/enlighten.c | 21 ++++++++++++++++++++-
> 1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 94a81f4..9b34475 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -85,7 +85,21 @@
>
> EXPORT_SYMBOL_GPL(hypercall_page);
>
> +/*
> + * Pointer to the xen_vcpu_info structure or
> + * &HYPERVISOR_shared_info->vcpu_info[cpu]. See xen_hvm_init_shared_info
> + * and xen_vcpu_setup for details. By default it points to share_info->vcpu_info
> + * but if the hypervisor supports VCPUOP_register_vcpu_info then it can point
> + * to xen_vcpu_info. The pointer is used in __xen_evtchn_do_upcall to
> + * acknowledge pending events.
Also more subtly it is used by the patched version of irq enable/disable
e.g. xen_irq_enable_direct and xen_iret.
The desire to be able to do those mask/unmask operations as a single
instruction by using the per-cpu offset held in %gs is the real reason
vcpu info is in a per-cpu pointer and for the whole register_vcpu_info
thing IIRC.
> + */
> DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
> +
> +/*
> + * Per CPU pages used if hypervisor supports VCPUOP_register_vcpu_info
> + * hypercall. This can be used both in PV and PVHVM mode. The structure
> + * overrides the default per_cpu(xen_vcpu, cpu) value.
> + */
> DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);
>
> enum xen_domain_type xen_domain_type = XEN_NATIVE;
> @@ -187,7 +201,12 @@ static void xen_vcpu_setup(int cpu)
>
> /* Check to see if the hypervisor will put the vcpu_info
> structure where we want it, which allows direct access via
> - a percpu-variable. */
> + a percpu-variable.
> + N.B. This hypercall can _only_ be called once per CPU. Subsequent
> + calls will error out with -EINVAL. This is due to the fact that
> + hypervisor has no unregister variant and this hypercall does not
> + allow to over-write info.mfn and info.offset.
> + */
> err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info);
>
> if (err) {
next prev parent reply other threads:[~2013-05-07 9:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 13:04 [PATCH] Patches to make PVHVM VCPU hotplug work with VCPUOP_register_info (v1) Konrad Rzeszutek Wilk
2013-05-06 13:04 ` [PATCH 1/4] xen/vcpu/pvhvm: Fix vcpu hotplugging hanging Konrad Rzeszutek Wilk
2013-05-06 15:08 ` Stefano Stabellini
2013-05-06 13:04 ` [PATCH 2/4] xen/vcpu: Document the xen_vcpu_info and xen_vcpu Konrad Rzeszutek Wilk
2013-05-06 14:58 ` Stefano Stabellini
2013-05-07 9:30 ` Ian Campbell [this message]
2013-05-07 14:06 ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-05-06 13:04 ` [PATCH 3/4] xen/smp/pvhvm: Don't point per_cpu(xen_vpcu, 33 and larger) to shared_info Konrad Rzeszutek Wilk
2013-05-06 15:00 ` Stefano Stabellini
2013-05-06 13:04 ` [PATCH 4/4] xen/spinlock: Fix check from greater than to be also be greater or equal to Konrad Rzeszutek Wilk
2013-05-06 14:57 ` Stefano Stabellini
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=1367919047.26321.47.camel@zakaz.uk.xensource.com \
--to=ian.campbell@citrix.com \
--cc=Stefano.Stabellini@eu.citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.com \
/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
all inboxes | Powered by JetHome®