From: Keir Fraser <keir.fraser@eu.citrix.com>
To: "Shan, Haitao" <haitao.shan@intel.com>
Cc: "'xen-devel@lists.xensource.com'" <xen-devel@lists.xensource.com>
Subject: Re: [Question] Why code differs in construct_dom0?
Date: Thu, 20 Nov 2008 09:17:57 +0000 [thread overview]
Message-ID: <C54ADBC5.1F6E7%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <61563CE63B4F854986A895DA7AD3C17701F7E601@pdsmsx502.ccr.corp.intel.com>
By deliberately making dom0's p2m mapping discontiguous we can detect bugs
where dom0 is incorrectly assuming pseudophys contiguous memory is machine
contiguous. We had nasty bugs of this sort in dom0's block layer many years
ago.
-- Keir
On 20/11/08 09:07, "Shan, Haitao" <haitao.shan@intel.com> wrote:
> Hi, Keir,
>
> Please see the code shown below. I don't understand why pfn's definitions are
> different depending on whether NDEBUG is defined or not. Can you tell me why?
>
> while ( pfn < nr_pages )
> {
> if ( (page = alloc_chunk(d, nr_pages - d->tot_pages)) == NULL )
> panic("Not enough RAM for DOM0 reservation.\n");
> while ( pfn < d->tot_pages )
> {
> mfn = page_to_mfn(page);
> #ifndef NDEBUG
> #define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
> #endif
> if ( !is_pv_32on64_domain(d) )
> ((unsigned long *)vphysmap_start)[pfn] = mfn;
> else
> ((unsigned int *)vphysmap_start)[pfn] = mfn;
> set_gpfn_from_mfn(mfn, pfn);
> #undef pfn
> page++; pfn++;
> }
> }
>
> Best Regards
> Haitao Shan
next prev parent reply other threads:[~2008-11-20 9:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-20 9:07 [Question] Why code differs in construct_dom0? Shan, Haitao
2008-11-20 9:17 ` Keir Fraser [this message]
2008-11-20 9:41 ` Shan, Haitao
2008-11-20 9:50 ` Keir Fraser
2008-11-20 10:00 ` Shan, Haitao
2008-11-20 12:52 ` Shan, Haitao
2008-11-20 13:03 ` Keir Fraser
2008-11-20 13:14 ` Shan, Haitao
2008-11-20 13:12 ` Jan Beulich
2008-11-20 13:34 ` Shan, Haitao
[not found] ` <61563CE63B4F854986A895DA7AD3C17701F100E8@pdsmsx502.ccr.corp.intel.com>
2008-11-20 9:44 ` Shan, Haitao
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=C54ADBC5.1F6E7%keir.fraser@eu.citrix.com \
--to=keir.fraser@eu.citrix.com \
--cc=haitao.shan@intel.com \
--cc=xen-devel@lists.xensource.com \
/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.