Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740572 > unrolled thread

Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page tables mapping

Started byJuergen Gross <jgross@suse.com>
First post2017-09-27 11:50 +0200
Last post2017-09-27 22:10 +0200
Articles 8 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page  tables mapping Juergen Gross <jgross@suse.com> - 2017-09-27 11:50 +0200
    Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page  tables mapping Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-27 15:40 +0200
      Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page  tables mapping Juergen Gross <jgross@suse.com> - 2017-09-27 16:40 +0200
        Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page  tables mapping Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-27 16:50 +0200
          Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page  tables mapping Juergen Gross <jgross@suse.com> - 2017-09-27 17:00 +0200
            Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page  tables mapping Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-27 17:10 +0200
            Re: [Xen-devel] [PATCH v2] Call xen_cleanhighmap() with 4MB aligned  for page tables mapping Andrew Cooper <andrew.cooper3@citrix.com> - 2017-09-27 17:30 +0200
    Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page  tables mapping Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-27 22:10 +0200

#1740572 — Re: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page tables mapping

FromJuergen Gross <jgross@suse.com>
Date2017-09-27 11:50 +0200
SubjectRe: [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page tables mapping
Message-ID<uuh8C-B0-13@gated-at.bofh.it>
On 27/09/17 11:41, Zhenzhong Duan wrote:
> When bootup a PVM guest with large memory(Ex.240GB), XEN provided initial
> mapping overlaps with kernel module virtual space. When mapping in this space
> is cleared by xen_cleanhighmap(), in certain case there could be an 2MB mapping
> left. This is due to XEN initialize 4MB aligned mapping but xen_cleanhighmap()
> finish at 2MB boundary.
> 
> When module loading is just on top of the 2MB space, got below warning:
> 
> WARNING: at mm/vmalloc.c:106 vmap_pte_range+0x14e/0x190()
> Call Trace:
>  [<ffffffff81117083>] warn_alloc_failed+0xf3/0x160
>  [<ffffffff81146022>] __vmalloc_area_node+0x182/0x1c0
>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>  [<ffffffff81145df7>] __vmalloc_node_range+0xa7/0x110
>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>  [<ffffffff8103ca54>] module_alloc+0x64/0x70
>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>  [<ffffffff810ac91e>] module_alloc_update_bounds+0x1e/0x80
>  [<ffffffff810ac9a7>] move_module+0x27/0x150
>  [<ffffffff810aefa0>] layout_and_allocate+0x120/0x1b0
>  [<ffffffff810af0a8>] load_module+0x78/0x640
>  [<ffffffff811ff90b>] ? security_file_permission+0x8b/0x90
>  [<ffffffff810af6d2>] sys_init_module+0x62/0x1e0
>  [<ffffffff815154c2>] system_call_fastpath+0x16/0x1b
> 
> Then the mapping of 2MB is cleared, finally oops when the page in that space is
> accessed.
> 
> BUG: unable to handle kernel paging request at ffff880022600000
> IP: [<ffffffff81260877>] clear_page_c_e+0x7/0x10
> PGD 1788067 PUD 178c067 PMD 22434067 PTE 0
> Oops: 0002 [#1] SMP
> Call Trace:
>  [<ffffffff81116ef7>] ? prep_new_page+0x127/0x1c0
>  [<ffffffff81117d42>] get_page_from_freelist+0x1e2/0x550
>  [<ffffffff81133010>] ? ii_iovec_copy_to_user+0x90/0x140
>  [<ffffffff81119c9d>] __alloc_pages_nodemask+0x12d/0x230
>  [<ffffffff81155516>] alloc_pages_vma+0xc6/0x1a0
>  [<ffffffff81006ffd>] ? pte_mfn_to_pfn+0x7d/0x100
>  [<ffffffff81134cfb>] do_anonymous_page+0x16b/0x350
>  [<ffffffff81139c34>] handle_pte_fault+0x1e4/0x200
>  [<ffffffff8100712e>] ? xen_pmd_val+0xe/0x10
>  [<ffffffff810052c9>] ? __raw_callee_save_xen_pmd_val+0x11/0x1e
>  [<ffffffff81139dab>] handle_mm_fault+0x15b/0x270
>  [<ffffffff81510c10>] do_page_fault+0x140/0x470
>  [<ffffffff8150d7d5>] page_fault+0x25/0x30
> 
> Call xen_cleanhighmap() with 4MB aligned for page tables mapping to fix it.
> The unnecessory call of xen_cleanhighmap() in DEBUG mode is also removed.
> 
> -v2: add comment about XEN alignment from Juergen.
> 
> References: https://lists.xen.org/archives/html/xen-devel/2012-07/msg01562.html
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

[toc] | [next] | [standalone]


#1740732

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2017-09-27 15:40 +0200
Message-ID<uukJb-3qZ-11@gated-at.bofh.it>
In reply to#1740572
On 09/27/2017 05:43 AM, Juergen Gross wrote:
> On 27/09/17 11:41, Zhenzhong Duan wrote:
>> When bootup a PVM guest with large memory(Ex.240GB), XEN provided initial
>> mapping overlaps with kernel module virtual space. When mapping in this space
>> is cleared by xen_cleanhighmap(), in certain case there could be an 2MB mapping
>> left. This is due to XEN initialize 4MB aligned mapping but xen_cleanhighmap()
>> finish at 2MB boundary.

Does this mapping need to be 4MB-aligned?

(I also think this should go to stable trees)

-boris

>>
>> When module loading is just on top of the 2MB space, got below warning:
>>
>> WARNING: at mm/vmalloc.c:106 vmap_pte_range+0x14e/0x190()
>> Call Trace:
>>  [<ffffffff81117083>] warn_alloc_failed+0xf3/0x160
>>  [<ffffffff81146022>] __vmalloc_area_node+0x182/0x1c0
>>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>>  [<ffffffff81145df7>] __vmalloc_node_range+0xa7/0x110
>>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>>  [<ffffffff8103ca54>] module_alloc+0x64/0x70
>>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>>  [<ffffffff810ac91e>] module_alloc_update_bounds+0x1e/0x80
>>  [<ffffffff810ac9a7>] move_module+0x27/0x150
>>  [<ffffffff810aefa0>] layout_and_allocate+0x120/0x1b0
>>  [<ffffffff810af0a8>] load_module+0x78/0x640
>>  [<ffffffff811ff90b>] ? security_file_permission+0x8b/0x90
>>  [<ffffffff810af6d2>] sys_init_module+0x62/0x1e0
>>  [<ffffffff815154c2>] system_call_fastpath+0x16/0x1b
>>
>> Then the mapping of 2MB is cleared, finally oops when the page in that space is
>> accessed.
>>
>> BUG: unable to handle kernel paging request at ffff880022600000
>> IP: [<ffffffff81260877>] clear_page_c_e+0x7/0x10
>> PGD 1788067 PUD 178c067 PMD 22434067 PTE 0
>> Oops: 0002 [#1] SMP
>> Call Trace:
>>  [<ffffffff81116ef7>] ? prep_new_page+0x127/0x1c0
>>  [<ffffffff81117d42>] get_page_from_freelist+0x1e2/0x550
>>  [<ffffffff81133010>] ? ii_iovec_copy_to_user+0x90/0x140
>>  [<ffffffff81119c9d>] __alloc_pages_nodemask+0x12d/0x230
>>  [<ffffffff81155516>] alloc_pages_vma+0xc6/0x1a0
>>  [<ffffffff81006ffd>] ? pte_mfn_to_pfn+0x7d/0x100
>>  [<ffffffff81134cfb>] do_anonymous_page+0x16b/0x350
>>  [<ffffffff81139c34>] handle_pte_fault+0x1e4/0x200
>>  [<ffffffff8100712e>] ? xen_pmd_val+0xe/0x10
>>  [<ffffffff810052c9>] ? __raw_callee_save_xen_pmd_val+0x11/0x1e
>>  [<ffffffff81139dab>] handle_mm_fault+0x15b/0x270
>>  [<ffffffff81510c10>] do_page_fault+0x140/0x470
>>  [<ffffffff8150d7d5>] page_fault+0x25/0x30
>>
>> Call xen_cleanhighmap() with 4MB aligned for page tables mapping to fix it.
>> The unnecessory call of xen_cleanhighmap() in DEBUG mode is also removed.
>>
>> -v2: add comment about XEN alignment from Juergen.
>>
>> References: https://lists.xen.org/archives/html/xen-devel/2012-07/msg01562.html
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>
>
>
> Juergen

[toc] | [prev] | [next] | [standalone]


#1740796

FromJuergen Gross <jgross@suse.com>
Date2017-09-27 16:40 +0200
Message-ID<uulFg-4nX-23@gated-at.bofh.it>
In reply to#1740732
On 27/09/17 15:38, Boris Ostrovsky wrote:
> On 09/27/2017 05:43 AM, Juergen Gross wrote:
>> On 27/09/17 11:41, Zhenzhong Duan wrote:
>>> When bootup a PVM guest with large memory(Ex.240GB), XEN provided initial
>>> mapping overlaps with kernel module virtual space. When mapping in this space
>>> is cleared by xen_cleanhighmap(), in certain case there could be an 2MB mapping
>>> left. This is due to XEN initialize 4MB aligned mapping but xen_cleanhighmap()
>>> finish at 2MB boundary.
> 
> Does this mapping need to be 4MB-aligned?

I guess you are questioning the alignment of addr to be 4MB?
In this case you are right: the end of the mapping is 4MB aligned, as
correctly stated in the comment added.

> (I also think this should go to stable trees)

Indeed.


Juergen

[toc] | [prev] | [next] | [standalone]


#1740797

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2017-09-27 16:50 +0200
Message-ID<uulOV-4rv-9@gated-at.bofh.it>
In reply to#1740796
On 09/27/2017 10:33 AM, Juergen Gross wrote:
> On 27/09/17 15:38, Boris Ostrovsky wrote:
>> On 09/27/2017 05:43 AM, Juergen Gross wrote:
>>> On 27/09/17 11:41, Zhenzhong Duan wrote:
>>>> When bootup a PVM guest with large memory(Ex.240GB), XEN provided initial
>>>> mapping overlaps with kernel module virtual space. When mapping in this space
>>>> is cleared by xen_cleanhighmap(), in certain case there could be an 2MB mapping
>>>> left. This is due to XEN initialize 4MB aligned mapping but xen_cleanhighmap()
>>>> finish at 2MB boundary.
>> Does this mapping need to be 4MB-aligned?
> I guess you are questioning the alignment of addr to be 4MB?
> In this case you are right: the end of the mapping is 4MB aligned, as
> correctly stated in the comment added.

Yes, and my question is why does it need to be aligned on 4MB. Doesn't
2MB alignment suffice?

-boris

[toc] | [prev] | [next] | [standalone]


#1740804

FromJuergen Gross <jgross@suse.com>
Date2017-09-27 17:00 +0200
Message-ID<uulYC-4wg-1@gated-at.bofh.it>
In reply to#1740797
On 27/09/17 16:48, Boris Ostrovsky wrote:
> On 09/27/2017 10:33 AM, Juergen Gross wrote:
>> On 27/09/17 15:38, Boris Ostrovsky wrote:
>>> On 09/27/2017 05:43 AM, Juergen Gross wrote:
>>>> On 27/09/17 11:41, Zhenzhong Duan wrote:
>>>>> When bootup a PVM guest with large memory(Ex.240GB), XEN provided initial
>>>>> mapping overlaps with kernel module virtual space. When mapping in this space
>>>>> is cleared by xen_cleanhighmap(), in certain case there could be an 2MB mapping
>>>>> left. This is due to XEN initialize 4MB aligned mapping but xen_cleanhighmap()
>>>>> finish at 2MB boundary.
>>> Does this mapping need to be 4MB-aligned?
>> I guess you are questioning the alignment of addr to be 4MB?
>> In this case you are right: the end of the mapping is 4MB aligned, as
>> correctly stated in the comment added.
> 
> Yes, and my question is why does it need to be aligned on 4MB. Doesn't
> 2MB alignment suffice?

I believe this has historical reasons. :-)

For this patch the answer doesn't matter, as Xen does it this way and
the kernel has to cope with the situation.

This interface is specified in include/xen/interface/xen.h in the
comment section just before struct start_info:

/*
 * Start-of-day memory layout
 *
 *  1. The domain is started within contiguous virtual-memory region.
 *  2. The contiguous region begins and ends on an aligned 4MB boundary.
...


Juergen

[toc] | [prev] | [next] | [standalone]


#1740816

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2017-09-27 17:10 +0200
Message-ID<uum8k-4P4-75@gated-at.bofh.it>
In reply to#1740804
On 09/27/2017 10:56 AM, Juergen Gross wrote:
> On 27/09/17 16:48, Boris Ostrovsky wrote:
>> On 09/27/2017 10:33 AM, Juergen Gross wrote:
>>> On 27/09/17 15:38, Boris Ostrovsky wrote:
>>>> On 09/27/2017 05:43 AM, Juergen Gross wrote:
>>>>> On 27/09/17 11:41, Zhenzhong Duan wrote:
>>>>>> When bootup a PVM guest with large memory(Ex.240GB), XEN provided initial
>>>>>> mapping overlaps with kernel module virtual space. When mapping in this space
>>>>>> is cleared by xen_cleanhighmap(), in certain case there could be an 2MB mapping
>>>>>> left. This is due to XEN initialize 4MB aligned mapping but xen_cleanhighmap()
>>>>>> finish at 2MB boundary.
>>>> Does this mapping need to be 4MB-aligned?
>>> I guess you are questioning the alignment of addr to be 4MB?
>>> In this case you are right: the end of the mapping is 4MB aligned, as
>>> correctly stated in the comment added.
>> Yes, and my question is why does it need to be aligned on 4MB. Doesn't
>> 2MB alignment suffice?
> I believe this has historical reasons. :-)
>
> For this patch the answer doesn't matter, as Xen does it this way and
> the kernel has to cope with the situation.
>
> This interface is specified in include/xen/interface/xen.h in the
> comment section just before struct start_info:
>
> /*
>  * Start-of-day memory layout
>  *
>  *  1. The domain is started within contiguous virtual-memory region.
>  *  2. The contiguous region begins and ends on an aligned 4MB boundary.

Ah, this is what I was really looking for --- that 4MB alignment is part
of the ABI.

-boris

[toc] | [prev] | [next] | [standalone]


#1740830 — Re: [Xen-devel] [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page tables mapping

FromAndrew Cooper <andrew.cooper3@citrix.com>
Date2017-09-27 17:30 +0200
SubjectRe: [Xen-devel] [PATCH v2] Call xen_cleanhighmap() with 4MB aligned for page tables mapping
Message-ID<uumrD-4VK-5@gated-at.bofh.it>
In reply to#1740804
On 27/09/17 15:56, Juergen Gross wrote:
> On 27/09/17 16:48, Boris Ostrovsky wrote:
>> On 09/27/2017 10:33 AM, Juergen Gross wrote:
>>> On 27/09/17 15:38, Boris Ostrovsky wrote:
>>>> On 09/27/2017 05:43 AM, Juergen Gross wrote:
>>>>> On 27/09/17 11:41, Zhenzhong Duan wrote:
>>>>>> When bootup a PVM guest with large memory(Ex.240GB), XEN provided initial
>>>>>> mapping overlaps with kernel module virtual space. When mapping in this space
>>>>>> is cleared by xen_cleanhighmap(), in certain case there could be an 2MB mapping
>>>>>> left. This is due to XEN initialize 4MB aligned mapping but xen_cleanhighmap()
>>>>>> finish at 2MB boundary.
>>>> Does this mapping need to be 4MB-aligned?
>>> I guess you are questioning the alignment of addr to be 4MB?
>>> In this case you are right: the end of the mapping is 4MB aligned, as
>>> correctly stated in the comment added.
>> Yes, and my question is why does it need to be aligned on 4MB. Doesn't
>> 2MB alignment suffice?
> I believe this has historical reasons. :-)

Back in the day, superpages had 4M alignment.

~Andrew

[toc] | [prev] | [next] | [standalone]


#1740989

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2017-09-27 22:10 +0200
Message-ID<uuqOB-7GD-3@gated-at.bofh.it>
In reply to#1740572
On 09/27/2017 05:43 AM, Juergen Gross wrote:
> On 27/09/17 11:41, Zhenzhong Duan wrote:
>> When bootup a PVM guest with large memory(Ex.240GB), XEN provided initial
>> mapping overlaps with kernel module virtual space. When mapping in this space
>> is cleared by xen_cleanhighmap(), in certain case there could be an 2MB mapping
>> left. This is due to XEN initialize 4MB aligned mapping but xen_cleanhighmap()
>> finish at 2MB boundary.
>>
>> When module loading is just on top of the 2MB space, got below warning:
>>
>> WARNING: at mm/vmalloc.c:106 vmap_pte_range+0x14e/0x190()
>> Call Trace:
>>  [<ffffffff81117083>] warn_alloc_failed+0xf3/0x160
>>  [<ffffffff81146022>] __vmalloc_area_node+0x182/0x1c0
>>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>>  [<ffffffff81145df7>] __vmalloc_node_range+0xa7/0x110
>>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>>  [<ffffffff8103ca54>] module_alloc+0x64/0x70
>>  [<ffffffff810ac91e>] ? module_alloc_update_bounds+0x1e/0x80
>>  [<ffffffff810ac91e>] module_alloc_update_bounds+0x1e/0x80
>>  [<ffffffff810ac9a7>] move_module+0x27/0x150
>>  [<ffffffff810aefa0>] layout_and_allocate+0x120/0x1b0
>>  [<ffffffff810af0a8>] load_module+0x78/0x640
>>  [<ffffffff811ff90b>] ? security_file_permission+0x8b/0x90
>>  [<ffffffff810af6d2>] sys_init_module+0x62/0x1e0
>>  [<ffffffff815154c2>] system_call_fastpath+0x16/0x1b
>>
>> Then the mapping of 2MB is cleared, finally oops when the page in that space is
>> accessed.
>>
>> BUG: unable to handle kernel paging request at ffff880022600000
>> IP: [<ffffffff81260877>] clear_page_c_e+0x7/0x10
>> PGD 1788067 PUD 178c067 PMD 22434067 PTE 0
>> Oops: 0002 [#1] SMP
>> Call Trace:
>>  [<ffffffff81116ef7>] ? prep_new_page+0x127/0x1c0
>>  [<ffffffff81117d42>] get_page_from_freelist+0x1e2/0x550
>>  [<ffffffff81133010>] ? ii_iovec_copy_to_user+0x90/0x140
>>  [<ffffffff81119c9d>] __alloc_pages_nodemask+0x12d/0x230
>>  [<ffffffff81155516>] alloc_pages_vma+0xc6/0x1a0
>>  [<ffffffff81006ffd>] ? pte_mfn_to_pfn+0x7d/0x100
>>  [<ffffffff81134cfb>] do_anonymous_page+0x16b/0x350
>>  [<ffffffff81139c34>] handle_pte_fault+0x1e4/0x200
>>  [<ffffffff8100712e>] ? xen_pmd_val+0xe/0x10
>>  [<ffffffff810052c9>] ? __raw_callee_save_xen_pmd_val+0x11/0x1e
>>  [<ffffffff81139dab>] handle_mm_fault+0x15b/0x270
>>  [<ffffffff81510c10>] do_page_fault+0x140/0x470
>>  [<ffffffff8150d7d5>] page_fault+0x25/0x30
>>
>> Call xen_cleanhighmap() with 4MB aligned for page tables mapping to fix it.
>> The unnecessory call of xen_cleanhighmap() in DEBUG mode is also removed.
>>
>> -v2: add comment about XEN alignment from Juergen.
>>
>> References: https://lists.xen.org/archives/html/xen-devel/2012-07/msg01562.html
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>


Applied to for-linus-14b

-boris

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web