From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>, jbeulich@suse.com
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH] xen: x86: copy back tsc info, not pointer to tsc info in domctl
Date: Tue, 26 May 2015 11:13:53 +0100 [thread overview]
Message-ID: <55644761.5050706@citrix.com> (raw)
In-Reply-To: <1432634651-15921-1-git-send-email-ian.campbell@citrix.com>
On 26/05/15 11:04, Ian Campbell wrote:
> In 38b37ed82705 "x86/domctl: cleanup", XEN_DOMCTL_gettscinfo was
> changed to use the standard copyback mechanism.
>
> However the output TSC Info is a guerst handle, i.e. a pointer to the
> location for the information, copyback just copies the unchanged
> pointer back.
>
> Switch back to fetching the details into a local struct and explicitly
> copying it back.
>
> This caused test failures in the Cambridge instance of osstest, but
> not for some reason in the production instance.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Oops - I feel very silly for not noticing that. My testing also didn't
notice this.
> ---
> xen/arch/x86/domctl.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
> index 684259b..e7da735 100644
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -703,13 +703,16 @@ long arch_do_domctl(
> ret = -EINVAL;
> else
> {
> + xen_guest_tsc_info_t info = { 0 };
> +
> domain_pause(d);
> - tsc_get_info(d, &domctl->u.tsc_info.info.tsc_mode,
> - &domctl->u.tsc_info.info.elapsed_nsec,
> - &domctl->u.tsc_info.info.gtsc_khz,
> - &domctl->u.tsc_info.info.incarnation);
> + tsc_get_info(d, &info.tsc_mode,
> + &info.elapsed_nsec,
> + &info.gtsc_khz,
> + &info.incarnation);
> + if ( copy_to_guest(domctl->u.tsc_info.out_info, &info, 1) )
> + ret = -EFAULT;
> domain_unpause(d);
The copy_to_guest() can be after the domain_unpause().
Alternatively, being a domctl, we can change tsc_info to not be a guest
handle. There is plenty of space inside the union, and it saves a
further memory access.
~Andrew
next prev parent reply other threads:[~2015-05-26 10:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 10:04 [PATCH] xen: x86: copy back tsc info, not pointer to tsc info in domctl Ian Campbell
2015-05-26 10:13 ` Andrew Cooper [this message]
2015-05-26 10:18 ` Ian Campbell
2015-05-26 10:20 ` Andrew Cooper
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=55644761.5050706@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xen.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.