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

Re: [Xen-devel] [PATCH v8 17/20] xenctx: Allow output for offline vcpu when specified.



On Thu, 2014-03-27 at 15:05 -0400, Don Slutz wrote:
> xc_domain_hvm_getcontext_partial() will fail to get data for an
> offline cpu.  Switch back to PV mode of calculating ctxt_word_size
> and guest_word_size in the case.
> 
> Do this change to xc_translate_foreign_address() also.  In order to
> handle 32bit PAE mode, use the hvm way not the pv way to do the
> cr3 handling.
> 
> Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
> ---
> v8:  Also change xc_translate_foreign_address() to work.
> 
>  tools/libxc/xc_pagetab.c | 46 +++++++++++++++++++++++++++++++++++++++-------
>  tools/xentrace/xenctx.c  |  6 ++++++
>  2 files changed, 45 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/libxc/xc_pagetab.c b/tools/libxc/xc_pagetab.c
> index 8525967..9d3349f 100644
> --- a/tools/libxc/xc_pagetab.c
> +++ b/tools/libxc/xc_pagetab.c

This is not xenctx like $subject promised.

What does it even mean to translate addresses for a processor which is
offline? It's all a bit tree falling the woods for my tastes.

In fact, what use is dumping state for an offline CPU at all? I was
willing to gloss over a two line change to xenctx.c but this is now
adding a whole bunch of complexity for reasons that haven't really been
explained.

Is it guaranteed that xc_vcpu_getcontext returns something sane for an
offline CPU? It seems like it could just as easily return memset or
garbage or EINVAL and the hypervisor would be quite at liberty to do so
since an offline cpu does not logically have any state so it might throw
it away, the fact that the implementation is currently such that the
last known state is returned doesn't seem reliable to me.

But maybe one of the x86 guys wants to contradict this and say its all
fine?

> @@ -41,15 +41,47 @@ unsigned long xc_translate_foreign_address(xc_interface 
> *xch, uint32_t dom,
> +            /*
> +             * Offline CPU, use xc_vcpu_getcontext() if possible
> +             */
> +            if ( xc_vcpu_getcontext(xch, dom, vcpu, &ctx) != 0 )
> +                return 0;
> +            if ( xc_domain_get_guest_width(xch, dom, &gwidth) != 0 )
> +                return 0;
> +            if ( gwidth == 8 )
> +            {
> +                if ( !(ctx.x64.ctrlreg[0] & CR0_PG) )
> +                    return virt >> PAGE_SHIFT;

Another one for the x86 guys -- can a 64-bit processor have paging
disabled?

Ian.


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