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

Re: [Xen-devel] [PATCH v2 5/5] xen: replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when appropriate



>>> On 14.08.12 at 14:56, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> 
>>> wrote:
> On Tue, 14 Aug 2012, Jan Beulich wrote:
>> Perhaps we have a different understanding of embedded fields:
>> I'm thinking of structure field having XEN_GUEST_HANDLE() type.
>> An example would be struct mmuext_op's vcpumask field, which
>> is being passed to vcpumask_to_pcpumask(). This must remain to
>> be possible (and not just in x86-specific code, where it's mere luck
>> that both are really identical).
> 
> Thanks for the concrete example; glancing through the common code I
> didn't find any examples like this.
> As I wrote in the follow up email, guest_handle_cast is just what we
> need:
> 
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index 4d72700..70ffa58 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -3198,7 +3198,9 @@ int do_mmuext_op(
>          {
>              cpumask_t pmask;
>  
> -            if ( unlikely(vcpumask_to_pcpumask(d, op.arg2.vcpumask, &pmask)) 
> )
> +            if ( unlikely(vcpumask_to_pcpumask(d,
> +                            guest_handle_cast(op.arg2.vcpumask, const_void),

No, the conversion should explicitly _not_ require specification
of the type, i.e. this should not be a true cast. Type safety
(checked by the compiler) can only be achieved if no intermediate
cast is involved.

Jan

> +                            &pmask)) )
>              {
>                  okay = 0;
>                  break;



_______________________________________________
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®.