WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] RE: xenpm fail

On Mon, 2010-11-01 at 12:26 +0000, Zhang, Yang Z wrote:
> "Xenpm get-cpuidle-states" works well with your patch, but "xenpm
> start" still get segment fault. And with following patch, I didn't see
> any segment fault when run xenpm or my test case. Maybe this problem
> will solved by this patch. Pls take a look at it.

Thanks, I came up with the same by looking for all the & used with these
macros.

Will submit a patch shortly.

Ian.

> 
> diff -r a1b39d2b9001 tools/libxc/xc_pm.c
> --- a/tools/libxc/xc_pm.c       Fri Oct 22 15:14:51 2010 +0100
> +++ b/tools/libxc/xc_pm.c       Tue Nov 02 04:06:10 2010 +0800
> @@ -46,8 +46,8 @@ int xc_pm_get_pxstat(xc_interface *xch,
>  {
>      DECLARE_SYSCTL;
>      /* Sizes unknown until xc_pm_get_max_px */
> -    DECLARE_NAMED_HYPERCALL_BOUNCE(trans, &pxpt->trans_pt, 0, 
> XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> -    DECLARE_NAMED_HYPERCALL_BOUNCE(pt, &pxpt->pt, 0, 
> XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> +    DECLARE_NAMED_HYPERCALL_BOUNCE(trans, pxpt->trans_pt, 0, 
> XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> +    DECLARE_NAMED_HYPERCALL_BOUNCE(pt, pxpt->pt, 0, 
> XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> 
>      int max_px, ret;
> 
> @@ -124,8 +124,8 @@ int xc_pm_get_cxstat(xc_interface *xch,
>  int xc_pm_get_cxstat(xc_interface *xch, int cpuid, struct xc_cx_stat *cxpt)
>  {
>      DECLARE_SYSCTL;
> -    DECLARE_NAMED_HYPERCALL_BOUNCE(triggers, &cxpt->triggers, 0, 
> XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> -    DECLARE_NAMED_HYPERCALL_BOUNCE(residencies, &cxpt->residencies, 0, 
> XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> +    DECLARE_NAMED_HYPERCALL_BOUNCE(triggers, cxpt->triggers, 0, 
> XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> +    DECLARE_NAMED_HYPERCALL_BOUNCE(residencies, cxpt->residencies, 0, 
> XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
>      int max_cx, ret;
> 
>      if( !cxpt || !(cxpt->triggers) || !(cxpt->residencies) )
> 
> best regards
> yang
> 
> > -----Original Message-----
> > From: Ian Campbell [mailto:Ian.Campbell@xxxxxxxxxxxxx]
> > Sent: Monday, November 01, 2010 7:24 PM
> > To: Zhang, Yang Z
> > Cc: xen-devel@xxxxxxxxxxxxxxxxxxx; Ian Jackson
> > Subject: RE: xenpm fail
> > 
> > Thanks for this...
> > 
> > On Mon, 2010-11-01 at 10:49 +0000, Zhang, Yang Z wrote:
> > [...]
> > > xc__hypercall_bounce_pre bounced 32 bytes from user buf 0x7fffffffe720 
> > > into
> > hcall buf 0x607004
> > > xc__hypercall_bounce_pre bounced 32 bytes from user buf 0x7fffffffe728 
> > > into
> > hcall buf 0x609004
> > > xc__hypercall_bounce_pre bounced 136 bytes from user buf 0x7fffffffe610
> > into hcall buf 0x60b004
> > > xc__hypercall_bounce_post bounced 136 bytes back from hcall buf 0x60b004
> > into user buf 0x7fffffffe610
> > > xc__hypercall_bounce_post bounced 32 bytes back from hcall buf 0x609004
> > into user buf 0x7fffffffe728
> > > xc__hypercall_bounce_post bounced 32 bytes back from hcall buf 0x607004
> > into user buf 0x7fffffffe720
> > 
> > This is the xc_pm_get_cxstat call, we can see it bounce max_cx(=4) *
> > sizeof(uint64_t)==32 bytes for both cxpt->triggers and cxpt->residencies
> > as well as 136 bytes for struct xensysctl.
> > 
> > However the ubuf values for triggers and residencies are suspicious,
> > they are only 8 bytes different, IOW they apparently overlap.
> > 
> > Can you try this patch which fixes a stupid thinko.
> > 
> > diff -r c3d7d2729410 tools/libxc/xc_pm.c
> > --- a/tools/libxc/xc_pm.c   Mon Nov 01 11:12:51 2010 +0000
> > +++ b/tools/libxc/xc_pm.c   Mon Nov 01 11:19:53 2010 +0000
> > @@ -124,8 +124,8 @@ int xc_pm_get_cxstat(xc_interface *xch,
> >  int xc_pm_get_cxstat(xc_interface *xch, int cpuid, struct xc_cx_stat *cxpt)
> >  {
> >      DECLARE_SYSCTL;
> > -    DECLARE_NAMED_HYPERCALL_BOUNCE(triggers, &cxpt->triggers, 0,
> > XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> > -    DECLARE_NAMED_HYPERCALL_BOUNCE(residencies,
> > &cxpt->residencies, 0, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> > +    DECLARE_NAMED_HYPERCALL_BOUNCE(triggers, cxpt->triggers, 0,
> > XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> > +    DECLARE_NAMED_HYPERCALL_BOUNCE(residencies, cxpt->residencies,
> > 0, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> >      int max_cx, ret;
> > 
> >      if( !cxpt || !(cxpt->triggers) || !(cxpt->residencies) )
> > 
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>