Re: [Xen-devel] [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram
On 17/01/17 17:29, Paul Durrant wrote: > The handle type passed to the underlying shadow and hap functions is > changed for compatibility with the new hypercall buffer. > > NOTE: This patch also modifies the type of the 'nr' parameter of > xc_hvm_track_dirty_vram() from uint64_t to uint32_t. In practice > the value passed was always truncated to 32 bits. > > Suggested-by: Jan Beulich> Signed-off-by: Paul Durrant Reviewed-by: Andrew Cooper ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram
> -Original Message- > From: Jan Beulich [mailto:jbeul...@suse.com] > Sent: 20 January 2017 16:21 > To: Paul Durrant> Cc: Andrew Cooper ; Ian Jackson > ; xen-de...@lists.xenproject.org; Daniel De Graaf > > Subject: Re: [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram > > >>> On 17.01.17 at 18:29, wrote: > > v4: > > - Knock-on changes from compat code in dm.c. Not adding Jan's R-b since > > the patch has fundamentally changed. > > I must be missing something, as I can't seem to spot any meaningful > compat handling related changes. Could you clarify? > Oh... I may have misunderstood. You are querying why the patch has fundamentally changed? If that's the case it's just that there was some restructuring required because of the compat op. If you are happy for me to add your R-b than I'll include it. Same goes for the patch #5. Paul > Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram
>>> On 20.01.17 at 17:32,wrote: >> -Original Message- >> From: Jan Beulich [mailto:jbeul...@suse.com] >> Sent: 20 January 2017 16:21 >> To: Paul Durrant >> Cc: Andrew Cooper ; Ian Jackson >> ; xen-de...@lists.xenproject.org; Daniel De Graaf >> >> Subject: Re: [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram >> >> >>> On 17.01.17 at 18:29, wrote: >> > v4: >> > - Knock-on changes from compat code in dm.c. Not adding Jan's R-b since >> > the patch has fundamentally changed. >> >> I must be missing something, as I can't seem to spot any meaningful >> compat handling related changes. Could you clarify? >> > > Oh... I may have misunderstood. You are querying why the patch has > fundamentally changed? If that's the case it's just that there was some > restructuring required because of the compat op. If you are happy for me to > add your R-b than I'll include it. Same goes for the patch #5. Yes, if that's it, then please do. Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram
> -Original Message- > From: Jan Beulich [mailto:jbeul...@suse.com] > Sent: 20 January 2017 16:21 > To: Paul Durrant> Cc: Andrew Cooper ; Ian Jackson > ; xen-de...@lists.xenproject.org; Daniel De Graaf > > Subject: Re: [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram > > >>> On 17.01.17 at 18:29, wrote: > > v4: > > - Knock-on changes from compat code in dm.c. Not adding Jan's R-b since > > the patch has fundamentally changed. > > I must be missing something, as I can't seem to spot any meaningful > compat handling related changes. Could you clarify? > The compat changes relate to the array only. None of the subops have changed. AIUI that's all that Andrew was requesting. Paul > Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram
>>> On 17.01.17 at 18:29,wrote: > v4: > - Knock-on changes from compat code in dm.c. Not adding Jan's R-b since > the patch has fundamentally changed. I must be missing something, as I can't seem to spot any meaningful compat handling related changes. Could you clarify? Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram
On 01/17/2017 12:29 PM, Paul Durrant wrote: The handle type passed to the underlying shadow and hap functions is changed for compatibility with the new hypercall buffer. NOTE: This patch also modifies the type of the 'nr' parameter of xc_hvm_track_dirty_vram() from uint64_t to uint32_t. In practice the value passed was always truncated to 32 bits. Suggested-by: Jan BeulichSigned-off-by: Paul Durrant Acked-by: Daniel De Graaf ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH v4 3/8] dm_op: convert HVMOP_track_dirty_vram
The handle type passed to the underlying shadow and hap functions is changed for compatibility with the new hypercall buffer. NOTE: This patch also modifies the type of the 'nr' parameter of xc_hvm_track_dirty_vram() from uint64_t to uint32_t. In practice the value passed was always truncated to 32 bits. Suggested-by: Jan BeulichSigned-off-by: Paul Durrant --- Cc: Jan Beulich Cc: Daniel De Graaf Cc: Ian Jackson Acked-by: Wei Liu Cc: Andrew Cooper Acked-by: George Dunlap Acked-by: Tim Deegan v4: - Knock-on changes from compat code in dm.c. Not adding Jan's R-b since the patch has fundamentally changed. v3: - Check d->max_vcpus rather than d->vcpu, as requested by Jan. - The handle type changes (from uint8 to void) are still necessary, hence omitting Jan's R-b until this is confirmed to be acceptable. v2: - Addressed several comments from Jan. --- tools/flask/policy/modules/xen.if | 4 ++-- tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_misc.c | 32 + xen/arch/x86/hvm/dm.c | 38 ++ xen/arch/x86/hvm/hvm.c | 41 - xen/arch/x86/mm/hap/hap.c | 2 +- xen/arch/x86/mm/shadow/common.c | 2 +- xen/include/asm-x86/hap.h | 2 +- xen/include/asm-x86/shadow.h| 2 +- xen/include/public/hvm/dm_op.h | 18 xen/include/public/hvm/hvm_op.h | 16 --- xen/xsm/flask/hooks.c | 3 --- xen/xsm/flask/policy/access_vectors | 2 -- 13 files changed, 73 insertions(+), 91 deletions(-) diff --git a/tools/flask/policy/modules/xen.if b/tools/flask/policy/modules/xen.if index f9254c2..45e5b5f 100644 --- a/tools/flask/policy/modules/xen.if +++ b/tools/flask/policy/modules/xen.if @@ -58,7 +58,7 @@ define(`create_domain_common', ` allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage mmuext_op updatemp }; allow $1 $2:grant setup; allow $1 $2:hvm { cacheattr getparam hvmctl irqlevel pciroute sethvmc - setparam pcilevel trackdirtyvram nested altp2mhvm altp2mhvm_op send_irq }; + setparam pcilevel nested altp2mhvm altp2mhvm_op send_irq }; ') # create_domain(priv, target) @@ -151,7 +151,7 @@ define(`device_model', ` allow $1 $2_target:domain { getdomaininfo shutdown }; allow $1 $2_target:mmu { map_read map_write adjust physmap target_hack }; - allow $1 $2_target:hvm { getparam setparam trackdirtyvram hvmctl irqlevel pciroute pcilevel cacheattr send_irq dm }; + allow $1 $2_target:hvm { getparam setparam hvmctl irqlevel pciroute pcilevel cacheattr send_irq dm }; ') # make_device_model(priv, dm_dom, hvm_dom) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 2ba46d7..c7ee412 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1620,7 +1620,7 @@ int xc_hvm_inject_msi( */ int xc_hvm_track_dirty_vram( xc_interface *xch, domid_t dom, -uint64_t first_pfn, uint64_t nr, +uint64_t first_pfn, uint32_t nr, unsigned long *bitmap); /* diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index 06e90de..4c41d41 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -581,34 +581,22 @@ int xc_hvm_inject_msi( int xc_hvm_track_dirty_vram( xc_interface *xch, domid_t dom, -uint64_t first_pfn, uint64_t nr, +uint64_t first_pfn, uint32_t nr, unsigned long *dirty_bitmap) { -DECLARE_HYPERCALL_BOUNCE(dirty_bitmap, (nr+7) / 8, XC_HYPERCALL_BUFFER_BOUNCE_OUT); -DECLARE_HYPERCALL_BUFFER(struct xen_hvm_track_dirty_vram, arg); -int rc; +struct xen_dm_op op; +struct xen_dm_op_track_dirty_vram *data; -arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); -if ( arg == NULL || xc_hypercall_bounce_pre(xch, dirty_bitmap) ) -{ -PERROR("Could not bounce memory for xc_hvm_track_dirty_vram hypercall"); -rc = -1; -goto out; -} +memset(, 0, sizeof(op)); -arg->domid = dom; -arg->first_pfn = first_pfn; -arg->nr= nr; -set_xen_guest_handle(arg->dirty_bitmap, dirty_bitmap); +op.op = XEN_DMOP_track_dirty_vram; +data = _dirty_vram; -rc = xencall2(xch->xcall, __HYPERVISOR_hvm_op, - HVMOP_track_dirty_vram, - HYPERCALL_BUFFER_AS_ARG(arg)); +data->first_pfn = first_pfn; +data->nr = nr; -out: -xc_hypercall_buffer_free(xch, arg); -xc_hypercall_bounce_post(xch, dirty_bitmap); -return rc; +return do_dm_op(xch, dom, 2, , sizeof(op), +dirty_bitmap, (nr + 7) / 8); } int xc_hvm_modified_memory( diff