From: Juergen Gross <jgross@suse.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: tim@xen.org, sstabellini@kernel.org, wei.liu2@citrix.com,
George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, xen-devel@lists.xen.org,
julien.grall@arm.com
Subject: Re: [PATCH v2 2/2] xen: add update indicator to vcpu_runstate_info
Date: Thu, 16 Jun 2016 16:36:30 +0200 [thread overview]
Message-ID: <5762B96E.8010704@suse.com> (raw)
In-Reply-To: <5762B96102000078000F5ADE@suse.com>
On 16/06/16 14:36, Jan Beulich wrote:
>>>> On 16.06.16 at 14:11, <JGross@suse.com> wrote:
>> On 16/06/16 13:15, Jan Beulich wrote:
>>>>>> On 15.06.16 at 13:34, <JGross@suse.com> wrote:
>>>> + if ( VM_ASSIST(v->domain, runstate_update_flag) )
>>>> + {
>>>> + off = offsetof(struct vcpu_runstate_info, state_entry_time) +
>>>> + sizeof(v->runstate.state_entry_time) - 1;
>>>> + if ( has_32bit_shinfo(v->domain) )
>>>> + {
>>>> + guest_handle = v->runstate_guest.compat.p;
>>>> + guest_handle +=
>>>> + offsetof(struct compat_vcpu_runstate_info, state_entry_time) +
>>>> + sizeof(v->runstate.state_entry_time) - 1;
>>>
>>> The sizes of the native and compat fields happen to be the same,
>>> but it would be nice if the right field/type could be used here.
>>
>> Hmm, this will require some ugly type casting, but it is probably
>> cleaner.
>
> Type casting? I would expect you to be able to use
> v->runstate_guest.compat.p->state_entry_time. In fact I think
> you also could get rid of the offsetof() if you used
> &v->runstate_guest.compat.p->state_entry_time for initializing
> guest_handle.
Aah, of course. This can then be simplified even more:
if ( VM_ASSIST(v->domain, runstate_update_flag) )
{
guest_handle = has_32bit_shinfo(v->domain)
? &v->runstate_guest.compat.p->state_entry_time + 1
: &v->runstate_guest.native.p->state_entry_time + 1;
guest_handle--;
v->runstate.state_entry_time |= XEN_RUNSTATE_UPDATE;
__raw_copy_to_guest(guest_handle,
(void *)(&v->runstate.state_entry_time + 1) - 1, 1);
smp_wmb();
}
This will reduce code size by 25 bytes. :-)
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
prev parent reply other threads:[~2016-06-16 14:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-15 11:34 [PATCH v2 0/2] Support consistent reads of mapped vcpu_runstate_info Juergen Gross
2016-06-15 11:34 ` [PATCH v2 1/2] xen/arm: add support for vm_assist hypercall Juergen Gross
2016-06-15 11:34 ` [PATCH v2 2/2] xen: add update indicator to vcpu_runstate_info Juergen Gross
2016-06-16 11:15 ` Jan Beulich
[not found] ` <5762A66A02000078000F5A39@suse.com>
2016-06-16 12:11 ` Juergen Gross
2016-06-16 12:36 ` Jan Beulich
[not found] ` <5762B96102000078000F5ADE@suse.com>
2016-06-16 14:36 ` Juergen Gross [this message]
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=5762B96E.8010704@suse.com \
--to=jgross@suse.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.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.