[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] xen: add update indicator to vcpu_runstate_info



On 20/05/16 18:16, Jan Beulich wrote:
>>>> On 20.05.16 at 17:54, <JGross@xxxxxxxx> wrote:
>> On 20/05/16 17:36, Jan Beulich wrote:
>>>>>> On 20.05.16 at 17:04, <JGross@xxxxxxxx> wrote:
>>>> On 20/05/16 16:49, Jan Beulich wrote:
>>>>>>>> On 20.05.16 at 15:22, <JGross@xxxxxxxx> wrote:
>>>>>>      if ( guest_handle_is_null(runstate_guest(v)) )
>>>>>>          return 1;
>>>>>>  
>>>>>> +    update_flag = VM_ASSIST(v->domain, runstate_update_flag);
>>>>>> +
>>>>>>      smap_policy = smap_policy_change(v, SMAP_CHECK_ENABLED);
>>>>>>  
>>>>>> +    if ( update_flag )
>>>>>> +    {
>>>>>> +        off = offsetof(struct vcpu_runstate_info, state_entry_time) + 7;
>>>>>
>>>>> How come this is outside the following if()? Also sizeof(...) - 1 please
>>>>> instead of the literal 7.
>>>>
>>>> I'm using off for the source address in __raw_copy_to_guest(), too.
>>>
>>> But the offset should, afaict, be different for 32-bit (x86) and
>>> 64-bit (or ARM).
>>
>> Why? The offset is applied to v->runstate which clearly is the same
>> for 32 and 64 bit domains, as it is the hypervisor private structure.
>> Different offsets have to be applied at the destination side only, and
>> this is done properly (at least I think so).
> 
> But as you say you use the offset for two purposes: The use on
> the guest handle is which is problematic; the use on the hypervisor
> internal structure is of course fine.

In the compat case I don't use it for the guest_handle:

+        if ( has_32bit_shinfo(v->domain) )
+        {
+            guest_handle = v->runstate_guest.compat.p;
+            guest_handle += offsetof(struct compat_vcpu_runstate_info,
+                                     state_entry_time) + 7;
+        }
+        else
+        {
+            guest_handle = v->runstate_guest.native.p;
+            guest_handle += off;
+        }


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.