[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: |
Chen Gang |
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 18:19:53 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
On 2016年01月26日 17:11, Peter Maydell wrote:
> 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".
>
OK, thanks.
>> 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.
>
When I run WeChat.exe with i386 wine with qemu-i386 under sw_64 arch.
- The related command:
"./i386-linux-user/qemu-i386 -strace -L /upstream/i386_wine
/upstream/i386_wine/usr/local/bin/wine "C:\\Program
Files\\Tencent\\WeChat\\WeChat.exe" > ana/try/info-strace.log 2>&1"
- The related output (no any munmap, 135168 = 128KB + 4KB):
4600
mmap2(0x00340000,135168,PROT_READ,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) =
0x00340000
4600 mmap2(0x00340000,135168,PROT_READ,MAP_SHARED|MAP_FIXED,8,0) = 0x00340000
4600 rt_sigprocmask(SIG_SETMASK,0x0033f574,NULL) = 0
4600 rt_sigprocmask(SIG_BLOCK,0x7bced7e0,0x0033f5d0) = 0
4600 write(3,0x33f6cc,64) = 64
4600 read(4,0x33f6cc,64) = 1
4600 rt_sigprocmask(SIG_SETMASK,0x0033f5d0,NULL) = 0
4600 close(8) = 0
4600 rt_sigprocmask(SIG_BLOCK,0x7bced7e0,0x0033f674) = 0
4600 mprotect(0x00160000,65536,PROT_READ|PROT_WRITE) = 0
4600 rt_sigprocmask(SIG_SETMASK,0x0033f674,NULL) = 0
4600 rt_sigprocmask(SIG_BLOCK,0x7bced7e0,0x0033f990) = 0
4600
mmap2(0x00340000,135168,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED|MAP_NORESERVE,-1,0)
= 0x00340000
wine often does like above, map the same position multiple times.
> 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"
Also yes to me.
> (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
>
Also yes to me.
> 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.
>
For the case I provide above, it can call mmap_frag() twice for the same
host page.
By the way, after have a full test again, all related issues are OK, it
seems we need not this patch to fix current issues, it is really very
strange to me!(maybe it is fixed by my other patches? I don't know)
At present, our sw_64 qemu-i386 status:
- Can run notepad.exe correctly, can run acdsee5.0.exe setup program
successfully.
- The performance is acceptable, after optimize the wine code (simply
use 32 split times instead of 2 for reserve_area recursion), the
initialization speed is really quick enough. :-)
- When run WeChat.exe, it can popup connection GUI box, but will quit
under sw_64. But for x86_64 qemu-i386, it can run WeChat.exe
correctly (although after enter main gui, it is not stable enough).
Thanks.
--
Chen Gang (陈刚)
Open, share, and attitude like air, water, and life which God blessed
- [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(), chengang, 2016/01/11
- [Qemu-devel] [PATCH v2 2/3] linux-user/mmap.c: Remove useless variable p for mmap_frag, chengang, 2016/01/11
- [Qemu-devel] [PATCH v2 3/3] linux-user/mmap.c: Use TARGET_PAGE_SIZE as the increasing step, chengang, 2016/01/11
- Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(), Peter Maydell, 2016/01/25
- Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(), Chen Gang, 2016/01/25
- Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(), Peter Maydell, 2016/01/26
- Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(),
Chen Gang <=
- Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(), Peter Maydell, 2016/01/26
- Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(), Chen Gang, 2016/01/26
- Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(), Peter Maydell, 2016/01/28
- Re: [Qemu-devel] [PATCH v2 1/3] linux-user/mmap.c: Set prot page flags for the correct region in mmap_frag(), Chen Gang, 2016/01/28