From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 1/3] x86: streamline hypercall_create_continuation()
Date: Thu, 8 Jan 2015 16:01:18 +0000 [thread overview]
Message-ID: <54AEA9CE.9020606@citrix.com> (raw)
In-Reply-To: <54AEAEC10200007800052B79@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 2983 bytes --]
On 08/01/15 15:22, Jan Beulich wrote:
> - drop clearing of excessive multicall arguments in compat case (no
> longer needed now that hypercall_xlat_continuation() only checks the
> actual arguments)
> - latch current into a local variable
> - use the cached value of hvm_guest_x86_mode() instead of re-executing
> it
> - scope restrict "regs"
> - while at it, convert the remaining two argument checking BUG_ON()s in
> hypercall_xlat_continuation() to ASSERT()s
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
There appear to other many other places which could benifit from a
caching of guest_x86_mode() (especially in the nested virt case). Is it
worth considering unconditionally calculating on vmexit and removing the
function?
>
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -1675,7 +1675,6 @@ unsigned long hypercall_create_continuat
> unsigned int op, const char *format, ...)
> {
> struct mc_state *mcs = ¤t->mc_state;
> - struct cpu_user_regs *regs;
> const char *p = format;
> unsigned long arg;
> unsigned int i;
> @@ -1689,26 +1688,23 @@ unsigned long hypercall_create_continuat
>
> for ( i = 0; *p != '\0'; i++ )
> mcs->call.args[i] = next_arg(p, args);
> - if ( is_pv_32on64_domain(current->domain) )
> - {
> - for ( ; i < 6; i++ )
> - mcs->call.args[i] = 0;
> - }
> }
> else
> {
> - regs = guest_cpu_user_regs();
> - regs->eax = op;
> + struct cpu_user_regs *regs = guest_cpu_user_regs();
> + struct vcpu *curr = current;
> +
> + regs->eax = op;
>
> /* Ensure the hypercall trap instruction is re-executed. */
> - if ( is_pv_vcpu(current) )
> + if ( is_pv_vcpu(curr) )
> regs->eip -= 2; /* re-execute 'syscall' / 'int $xx' */
> else
> - current->arch.hvm_vcpu.hcall_preempted = 1;
> + curr->arch.hvm_vcpu.hcall_preempted = 1;
>
> - if ( is_pv_vcpu(current) ?
> - !is_pv_32on64_vcpu(current) :
> - (hvm_guest_x86_mode(current) == 8) )
> + if ( is_pv_vcpu(curr) ?
> + !is_pv_32on64_vcpu(curr) :
> + curr->arch.hvm_vcpu.hcall_64bit )
> {
> for ( i = 0; *p != '\0'; i++ )
> {
> @@ -1759,9 +1755,8 @@ int hypercall_xlat_continuation(unsigned
>
> ASSERT(nr <= ARRAY_SIZE(mcs->call.args));
> ASSERT(!(mask >> nr));
> -
> - BUG_ON(id && *id >= nr);
> - BUG_ON(id && (mask & (1U << *id)));
> + ASSERT(!id || *id < nr);
> + ASSERT(!id || !(mask & (1U << *id)));
>
> va_start(args, mask);
>
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 3901 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-01-08 16:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-08 15:15 [PATCH 0/3] x86: XSA-111 follow-ups Jan Beulich
2015-01-08 15:22 ` [PATCH 1/3] x86: streamline hypercall_create_continuation() Jan Beulich
2015-01-08 16:01 ` Andrew Cooper [this message]
2015-01-08 16:11 ` Jan Beulich
2015-01-08 15:22 ` [PATCH 2/3] x86/HVM: clobber hypercall arguments just like for PV Jan Beulich
2015-01-08 17:20 ` Andrew Cooper
2015-01-08 15:23 ` [PATCH 3/3] x86/HVM: make hvm_efer_valid() honor guest features Jan Beulich
2015-01-08 15:56 ` Tim Deegan
2015-01-08 16:04 ` Jan Beulich
2015-01-08 18:57 ` Andrew Cooper
2015-01-08 18:49 ` Andrew Cooper
2015-01-09 11:20 ` Jan Beulich
2015-01-09 15:09 ` Andrew Cooper
2015-01-09 15:33 ` Jan Beulich
2015-01-09 15:36 ` Andrew Cooper
2015-01-08 15:53 ` [PATCH 0/3] x86: XSA-111 follow-ups Tim Deegan
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=54AEA9CE.9020606@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.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.