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

Re: [Xen-devel] [PATCH 1/3] xen: remove tests for pvh mode in pure pv paths



On 06/01/18 06:55, HW42 wrote:
> Juergen Gross:
>> Remove the last tests for XENFEAT_auto_translated_physmap in pure
>> PV-domain specific paths. PVH V1 is gone and the feature will always
>> be "false" in PV guests.
> [...]
>> diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
>> index 276da636dd39..6083ba462f35 100644
>> --- a/arch/x86/xen/p2m.c
>> +++ b/arch/x86/xen/p2m.c
> [...]
>> @@ -711,9 +694,6 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref 
>> *map_ops,
>>      int i, ret = 0;
>>      pte_t *pte;
>>  
>> -    if (xen_feature(XENFEAT_auto_translated_physmap))
>> -            return 0;
>> -
>>      if (kmap_ops) {
>>              ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
>>                                              kmap_ops, count);
>> @@ -756,9 +736,6 @@ int clear_foreign_p2m_mapping(struct 
>> gnttab_unmap_grant_ref *unmap_ops,
>>  {
>>      int i, ret = 0;
>>  
>> -    if (xen_feature(XENFEAT_auto_translated_physmap))
>> -            return 0;
>> -
>>      for (i = 0; i < count; i++) {
>>              unsigned long mfn = __pfn_to_mfn(page_to_pfn(pages[i]));
>>              unsigned long pfn = page_to_pfn(pages[i]);
> 
> This removes the check for autotranslation in {set,clear}_foreign_p2m_mapping.
> But those are called by the grant-table code also on PVH/HVM guest. So
> since 4.14 I see crashes similar to this one (ignore the kernel version,
> it's in the middle of a bisect): 
> 
> [   33.778854] page must be ballooned
> [   33.778860] ------------[ cut here ]------------
> [   33.778887] WARNING: CPU: 1 PID: 1581 at arch/x86/xen/p2m.c:720 
> set_foreign_p2m_mapping+0x13b/0x370
> [   33.778903] Modules linked in: xen_gntdev xen_gntalloc xen_blkback xenfs 
> xen_privcmd xen_evtchn dm_snapshot dm_bufio xen_blkfront
> [   33.778931] CPU: 1 PID: 1581 Comm: qubesdb-daemon Not tainted 4.13.0-lt-37 
> #1
> [   33.778946] task: ffff8800f4251b80 task.stack: ffffc90000818000
> [   33.778960] RIP: 0010:set_foreign_p2m_mapping+0x13b/0x370
> [   33.778970] RSP: 0018:ffffc9000081bc90 EFLAGS: 00010286
> [   33.778981] RAX: 0000000000000016 RBX: 0000000000000001 RCX: 
> ffffffff81e4a898
> [   33.778994] RDX: 0000000000000001 RSI: 0000000000000092 RDI: 
> 0000000000000247
> [   33.779016] RBP: ffffc9000081bce0 R08: 0000000000000143 R09: 
> ffffffff820d1660
> [   33.779026] R10: 000000000000002a R11: 0000000000000000 R12: 
> ffff8800f0c2c320
> [   33.779037] R13: ffff8800f4b6a3c8 R14: 8000000000000000 R15: 
> 0000000000000000
> [   33.779047] FS:  00007fbfd5739f80(0000) GS:ffff8800f9d00000(0000) 
> knlGS:0000000000000000
> [   33.779056] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   33.779064] CR2: 00007ff25daca0c0 CR3: 00000000f2faa005 CR4: 
> 00000000001606e0
> [   33.779074] Call Trace:
> [   33.779082]  ? x86_configure_nx+0x50/0x50
> [   33.779091]  gnttab_map_refs+0xc2/0x160
> [   33.779097]  ? decrease_reservation+0x256/0x2e0
> [   33.779105]  gntdev_mmap+0x358/0x5c0 [xen_gntdev]
> [   33.779113]  mmap_region+0x392/0x5e0
> [   33.779119]  do_mmap+0x2ae/0x480
> [   33.779125]  vm_mmap_pgoff+0xa1/0xe0
> [   33.779132]  SyS_mmap_pgoff+0x1ba/0x260
> [   33.787439] systemd-journald[1548]: Received request to flush runtime 
> journal from PID 1
> [   33.931963]  SyS_mmap+0x16/0x20
> [   33.931966]  do_syscall_64+0x53/0xf0
> [   33.931980]  entry_SYSCALL64_slow_path+0x25/0x25
> [   33.931981] RIP: 0033:0x7fbfd50ebdda
> [   33.931982] RSP: 002b:00007fff2bae9238 EFLAGS: 00000246 ORIG_RAX: 
> 0000000000000009
> [   33.931984] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 
> 00007fbfd50ebdda
> [   33.931984] RDX: 0000000000000003 RSI: 0000000000001000 RDI: 
> 0000000000000000
> [   33.931985] RBP: 0000000000000007 R08: 0000000000000007 R09: 
> 0000000000000000
> [   33.931986] R10: 0000000000000001 R11: 0000000000000246 R12: 
> 0000000000000000
> [   33.931986] R13: 0000000000001000 R14: 0000000000000001 R15: 
> 0000000000000000
> [   33.931987] Code: 83 b4 00 00 00 48 8b 05 9c 5c f2 00 48 83 3c d0 ff 0f 84 
> 50 01 00 00 48 c7 c7 d7 20 bd 81 48 89 55 c8 48 89 75 d0 e8 f1 70 09 00 <0f> 
> ff 48 8b 75 d0 48 8b 55 c8 4c 09 f6 48 89 d7 e8 70 fe ff ff 
> [   33.932007] ---[ end trace 858dec3c813fa284 ]---
> [   33.932011] ------------[ cut here ]------------
> [   33.932011] kernel BUG at arch/x86/xen/p2m.c:651!
> [   33.932014] invalid opcode: 0000 [#1] SMP
> [   33.932014] Modules linked in: xen_gntdev xen_gntalloc xen_blkback xenfs 
> xen_privcmd xen_evtchn dm_snapshot dm_bufio xen_blkfront
> [   33.932022] CPU: 1 PID: 1581 Comm: qubesdb-daemon Tainted: G        W      
>  4.13.0-lt-37 #1
> [   33.932601] task: ffff8800f4251b80 task.stack: ffffc90000818000
> [   33.932605] RIP: 0010:__set_phys_to_machine+0x36/0x130
> [   33.932606] RSP: 0018:ffffc9000081bc68 EFLAGS: 00010287
> [   33.932609] RAX: 0000000000000016 RBX: 00000000000f3cf3 RCX: 
> ffffffff81e4a898
> [   33.932609] RDX: 00000000000f3cf3 RSI: 800000000012daef RDI: 
> 00000000000f3cf3
> [   33.932610] RBP: ffffc9000081bc80 R08: 0000000000000143 R09: 
> ffffffff820d1660
> [   33.932611] R10: 000000000000002a R11: 0000000000000000 R12: 
> 800000000012daef
> [   33.932611] R13: ffff8800f4b6a3c8 R14: 8000000000000000 R15: 
> 0000000000000000
> [   33.932613] FS:  00007fbfd5739f80(0000) GS:ffff8800f9d00000(0000) 
> knlGS:0000000000000000
> [   33.932613] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   33.932614] CR2: 00007ff25daca0c0 CR3: 00000000f2faa005 CR4: 
> 00000000001606e0
> [   33.932617] Call Trace:
> [   33.932619]  ? set_phys_to_machine+0x12/0x40
> [   33.932621]  set_foreign_p2m_mapping+0x150/0x370
> [   33.932624]  ? x86_configure_nx+0x50/0x50
> [   33.932627]  gnttab_map_refs+0xc2/0x160
> [   33.932628]  ? decrease_reservation+0x256/0x2e0
> [   33.932631]  gntdev_mmap+0x358/0x5c0 [xen_gntdev]
> [   33.932634]  mmap_region+0x392/0x5e0
> [   33.932635]  do_mmap+0x2ae/0x480
> [   33.932637]  vm_mmap_pgoff+0xa1/0xe0
> [   33.932640]  SyS_mmap_pgoff+0x1ba/0x260
> [   33.932641]  SyS_mmap+0x16/0x20
> [   33.932643]  do_syscall_64+0x53/0xf0
> [   33.932645]  entry_SYSCALL64_slow_path+0x25/0x25
> [   33.932647] RIP: 0033:0x7fbfd50ebdda
> [   33.932647] RSP: 002b:00007fff2bae9238 EFLAGS: 00000246 ORIG_RAX: 
> 0000000000000009
> [   33.932648] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 
> 00007fbfd50ebdda
> [   33.932649] RDX: 0000000000000003 RSI: 0000000000001000 RDI: 
> 0000000000000000
> [   33.932650] RBP: 0000000000000007 R08: 0000000000000007 R09: 
> 0000000000000000
> [   33.932650] R10: 0000000000000001 R11: 0000000000000246 R12: 
> 0000000000000000
> [   33.932651] R13: 0000000000001000 R14: 0000000000000001 R15: 
> 0000000000000000
> [   33.932652] Code: 0d 18 5f f2 00 48 8d 14 fd 00 00 00 00 48 01 d1 0f 1f 00 
> 31 c0 48 89 31 0f 1f 00 85 c0 75 0e b8 01 00 00 00 c3 48 83 fe ff 74 f4 <0f> 
> 0b 55 48 89 e5 41 54 53 49 89 f4 48 8d 75 ec 48 89 fb 48 83 
> [   33.932673] RIP: __set_phys_to_machine+0x36/0x130 RSP: ffffc9000081bc68
> [   33.932688] ---[ end trace 858dec3c813fa285 ]---
> 
> Not sure if you prefer to change the grant-table code or to revert this
> part of the commit. The patch bellow works for me:

The patch looks fine.

> 
> From: Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx>
> Date: Sat, 6 Jan 2018 06:40:32 +0100
> Subject: [PATCH] xen: Fix {set,clear}_foreign_p2m_mapping on autotranslating
>  guests
> 
> Commit 82616f9599a7 ("xen: remove tests for pvh mode in pure pv paths")
> removed the check for autotranslation from {set,clear}_foreign_p2m_mapping
> but those are called by grant-table.c also on PVH/HVM guests.
> 
> Cc: <stable@xxxxxxxxxxxxxxx> # 4.14
> Fixes: 82616f9599a7 ("xen: remove tests for pvh mode in pure pv paths")
> Signed-off-by: Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx>

Reviewed-by: Juergen Gross <jgross@xxxxxxxx>

Thanks for catching this,


Juergen

> ---
>  arch/x86/xen/p2m.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
> index 6083ba462f35..15812e553b95 100644
> --- a/arch/x86/xen/p2m.c
> +++ b/arch/x86/xen/p2m.c
> @@ -694,6 +694,9 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref 
> *map_ops,
>       int i, ret = 0;
>       pte_t *pte;
>  
> +     if (xen_feature(XENFEAT_auto_translated_physmap))
> +             return 0;
> +
>       if (kmap_ops) {
>               ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
>                                               kmap_ops, count);
> @@ -736,6 +739,9 @@ int clear_foreign_p2m_mapping(struct 
> gnttab_unmap_grant_ref *unmap_ops,
>  {
>       int i, ret = 0;
>  
> +     if (xen_feature(XENFEAT_auto_translated_physmap))
> +             return 0;
> +
>       for (i = 0; i < count; i++) {
>               unsigned long mfn = __pfn_to_mfn(page_to_pfn(pages[i]));
>               unsigned long pfn = page_to_pfn(pages[i]);
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.