Yes, your explanation and patch solve the pain. Thanks very much!<div><br></div><div>Regards,</div><div>Jinghao<br><br><div class="gmail_quote">On Mon, May 21, 2012 at 9:11 PM, Simon Gerber <span dir="ltr"><<a href="mailto:simugerber@student.ethz.ch" target="_blank">simugerber@student.ethz.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jinghao,<br>
<br>
The problem seems to be in the x86_32 version of do_map (in<br>
lib/barrelfish/target/x86_32/pmap_target.c) on line 208, where the<br>
newly created vnode's offset is set to zero instead of i (see also the<br>
attached patch).<br>
<br>
Right now, if you modify the flags of the second four kB of a Frame<br>
capability, what you really do is unmap the second four kB and map the<br>
first four kB with the new flags.<br>
<br>
Hope this helps,<br>
-- Simon G.<br>
<br>
PS:<br>
<br>
2012/5/21 Shi Jinghao <<a href="mailto:jhshi@cs.hku.hk">jhshi@cs.hku.hk</a>>:<br>
<div class="HOEnZb"><div class="h5">> Hi Simon,<br>
><br>
> Yes, according to the output, it works correctly on X86_64. But do you have<br>
> any insights about why it would fail on X86_32? Here is my output here with<br>
> arch x86_32 on qemu.<br>
><br>
> pmaptest.0: begin monothelic_frame test...<br>
> kernel 0: user page fault in 'pmaptest': addr 60000000 IP 400548 error 7<br>
> kernel 0: user page fault in 'pmaptest': addr 60001000 IP 400548 error 7<br>
> pmaptest.0: array init done!<br>
> pmaptest.0: array check fail, a[0] = 1024<br>
> pmaptest.0: two page's content are identical<br>
> a[0] = 1024, a[1024] = 1024<br>
> a[1] = 1025, a[1025] = 1025<br>
> a[2] = 1026, a[1026] = 1026<br>
> a[3] = 1027, a[1027] = 1027<br>
> pmaptest.0: checking if the two virtual page share the same physical page...<br>
> no<br>
> pmaptest.0: begin one_page_one_frame test...<br>
> kernel 0: user page fault in 'pmaptest': addr 68000000 IP 4007b0 error 7<br>
> kernel 0: user page fault in 'pmaptest': addr 68001000 IP 4007b0 error 7<br>
> pmaptest.0: array init done<br>
> pmaptest.0: array check done!<br>
><br>
> During the porting, I've only changed find_ptable to get_ptable, Is it a<br>
> problem?<br>
><br>
> For you convenience, I attached a patch for<br>
> /lib/barrelfish/target/x86_32/pmap_target.c:modify_flags, in case you want<br>
> to test it by yourself.<br>
><br>
> Thanks for your concern!<br>
><br>
> Jinghao<br>
><br>
> On Mon, May 21, 2012 at 8:08 PM, Simon Peter <<a href="mailto:speter@inf.ethz.ch">speter@inf.ethz.ch</a>> wrote:<br>
>><br>
>> Hi Jinghao,<br>
>><br>
>> I've compiled your code for x86-64 and ran it on QEMU. Here's the output I<br>
>> get:<br>
>><br>
>> pmaptest.0: begin monothelic_frame test...<br>
>> kernel 0: user page fault in 'pmaptest': addr 60000000 IP 4003a0, error<br>
>> 0x7<br>
>> kernel 0: user page fault in 'pmaptest': addr 60001000 IP 4003a0, error<br>
>> 0x7<br>
>> pmaptest.0: array init done!<br>
>> pmaptest.0: begin one_page_one_frame test...<br>
>> kernel 0: user page fault in 'pmaptest': addr 68000000 IP 400560, error<br>
>> 0x7<br>
>> kernel 0: user page fault in 'pmaptest': addr 68001000 IP 400560, error<br>
>> 0x7<br>
>> pmaptest.0: array init done<br>
>> pmaptest.0: array check done!<br>
>><br>
>> This seems to be working?<br>
>><br>
>> Simon<br>
>><br>
>> On 20.05.2012 16:00, <a href="mailto:jhshi@cs.hku.hk">jhshi@cs.hku.hk</a> wrote:<br>
>>><br>
>>> Here is my previous email, FYI.<br>
>>><br>
>>> <a href="https://lists.inf.ethz.ch/pipermail/barrelfish-users/2012-May/000593.html" target="_blank">https://lists.inf.ethz.ch/pipermail/barrelfish-users/2012-May/000593.html</a><br>
>>><br>
>>> Quoting <a href="mailto:jhshi@cs.hku.hk">jhshi@cs.hku.hk</a>:<br>
>>><br>
>>>><br>
>>>> Hi,<br>
>>>><br>
>>>> For some reason, I need to work on x86_32 instead of x86_64. And I<br>
>>>> found that x86_32's pmap->f.modify_flags is NYI. So I ported it from<br>
>>>> x86_64, as described by my previous email (link). But then I found<br>
>>>> that the port won't work properly. Personally, I don't think the<br>
>>>> problem lies in the porting but in the modify_flags itself.<br>
>>>><br>
>>>> Here is my test case workflow:<br>
>>>><br>
>>>> First allocate two pages using frame_alloc and map them at some<br>
>>>> "safe" virtual address as read-only using pmap->f.map. Then fill<br>
>>>> the two pages with different content. Since they are read-only,<br>
>>>> page faults will occur when filling. I catch them and map the fault<br>
>>>> page as read-write using pmap->f.modify_flags in the fault handler.<br>
>>>> But then I found that the two page's content are identical, which<br>
>>>> is not supposed to be.<br>
>>>><br>
>>>> Then I found that if I allocate one frame for each page, instead of<br>
>>>> one monolithic frame, everything is fine.<br>
>>>><br>
>>>> I've summarized my test in the attached C file, which should be<br>
>>>> compiled and run under x86_32. Apology for not being able to test it<br>
>>>> under X86_64 since I encounter some weird errors when compiling<br>
>>>> arch x86_64. But if you substitute all the X86_32 to X86_64 in the<br>
>>>> test file, it should work under x86_64 as well.<br>
>>>><br>
>>>> However, if the test goes all fine under x86_64, then please give<br>
>>>> some hint about why its x86_32's port would fail.<br>
>>>><br>
>>>> Thanks in advance!<br>
>>>><br>
>>>> Regards,<br>
>>>> Jinghao<br>
>>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Barrelfish-users mailing list<br>
>>> <a href="mailto:Barrelfish-users@lists.inf.ethz.ch">Barrelfish-users@lists.inf.ethz.ch</a><br>
>>> <a href="https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users</a><br>
>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Barrelfish-users mailing list<br>
> <a href="mailto:Barrelfish-users@lists.inf.ethz.ch">Barrelfish-users@lists.inf.ethz.ch</a><br>
> <a href="https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users</a><br>
><br>
</div></div></blockquote></div><br></div>