[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags f

From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag()
Date: Tue, 26 Jan 2016 09:11:48 +0000

On 26 January 2016 at 02:58, Chen Gang <address@hidden> wrote:
> The related comments for  "if (prot1 == 0)" code block is "no page was
> there, so we allocate one".
> So I guess this code block is not only allocate page for guest, but also
> for host. So prot1 is not only for the guest page, but also for host
> page.

The comment means specifically "allocate a host page".

> If we do not page_set_flags with PAGE_VALID, The next call
> in mmap_frag for the same area will let prot1 be 0, so still
> fall into "if (prot1 == 0)" code block.

But in what case will we call mmap_frag() again before we
call page_set_flags() at the bottom of target_mmap()?
That is what is not clear to me, and why I asked you to describe
what the case is that you're seeing problems with.

Reading the target_mmap() code, its intention seems to be:
 (a) if the whole allocation fits in one host page, call
     mmap_frag() once and then "goto the_end1"
 (b) otherwise, we'll call mmap_frag() once for the start
     of the guest mapping, and once for the end, which must
     be two different host pages

So if you're seeing mmap_frag() called twice for the same
host page then something is going wrong, but I'm not sure what.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]