All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wen Congyang <wency@cn.fujitsu.com>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen devel <xen-devel@lists.xen.org>
Subject: Re: Problem about dump-core
Date: Wed, 17 Sep 2014 14:56:10 +0800	[thread overview]
Message-ID: <5419308A.5020204@cn.fujitsu.com> (raw)
In-Reply-To: <1410916272.23505.39.camel@citrix.com>

On 09/17/2014 09:11 AM, Ian Campbell wrote:
> On Wed, 2014-09-17 at 08:50 +0800, Wen Congyang wrote:
> 
>> Yes, we can check it more earlier. If the 4 error bits are set, is it a valid
>> mfn?
> 
> It doesn't really matter, since valid or not you can't pass such an mfn
> to this interface because of the error handling behaviour.

No, the user may pass more than one mfn, and part of them are ~0UL:
==============================================
    for ( i = 0; i < j; i++ )
    {
        unsigned long pfn, pagetype;
        pfn      = pagebuf->pfn_types[i + curbatch] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
        pagetype = pagebuf->pfn_types[i + curbatch] &  XEN_DOMCTL_PFINFO_LTAB_MASK;

        if ( pagetype != XEN_DOMCTL_PFINFO_XTAB
             && ctx->p2m[pfn] == (INVALID_P2M_ENTRY-1) )
        {
            /* We just allocated a new mfn above; update p2m */
            ctx->p2m[pfn] = ctx->p2m_batch[nr_mfns++]; 
            ctx->nr_pfns++; 
        }

        /* setup region_mfn[] for batch map, if necessary.
         * For HVM guests, this interface takes PFNs, not MFNs */
        if ( pagetype == XEN_DOMCTL_PFINFO_XTAB
             || pagetype == XEN_DOMCTL_PFINFO_XALLOC )
            region_mfn[i] = ~0UL; /* map will fail but we don't care */
        else
            region_mfn[i] = ctx->hvm ? pfn : ctx->p2m[pfn];
    }

    /* Map relevant mfns */
    pfn_err = calloc(j, sizeof(*pfn_err));
    if ( pfn_err == NULL )
    {
        PERROR("allocation for pfn_err failed");
        return -1;
    }
    region_base = xc_map_foreign_bulk(
        xch, dom, PROT_WRITE, region_mfn, pfn_err, j);
==============================================
The above codes are the function apply_batch(). In this case, we cannot
return NULL.

I think we should check the mfn, and if it is large mfn, and some error bits
are set, pass ~0UL to ioctl(), and mark this mfn is mapped failed in err[].

Thanks
Wen Congyang

> 
> Ian.
> 
> .
> 

      parent reply	other threads:[~2014-09-17  6:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16  2:35 Problem about dump-core Wen Congyang
2014-09-16  7:23 ` Wen Congyang
2014-09-16 16:38   ` Ian Campbell
2014-09-17  0:50     ` Wen Congyang
2014-09-17  1:11       ` Ian Campbell
2014-09-17  1:14         ` Wen Congyang
2014-09-17  6:56         ` Wen Congyang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5419308A.5020204@cn.fujitsu.com \
    --to=wency@cn.fujitsu.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.