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

Re: [PATCH 06/22] x86: map/unmap pages in restore_all_guests


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 22 Dec 2022 12:12:26 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I9tNx9krcrbSUoLjDoEo73RJwG9MuDYhjgjM74lhgOw=; b=EekVo9LY5JF3HJA5Sz1DXB4hiTzPgjZnxxATUfgAH48OOtDazWbvYB9FDxYGXeLwH4/alZ5sWlBdjfN5dBcFu/faepHH3bQsbO5NU6r7a0n0ffNJQ739KHS6yBS/cLNrOZTjZnUtdUAUSVw293ACbHejIaAtOpwX05UoMqqVb5khRM8KrXvjoszBsHn7ySkGEToe2jAjIOi/1K7STOd69rlWJL86vWS+wH144L8diSKBeCVzOILvcO7GdqOdieBoqNFFXMBiCusNyBBaB36IXM1GPB6Z5jPkVTryOWEcBxYLI1Yt24wEBk7NYjDpykQjKzI6NgSUa2CPkpr6z7be+A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oz6Etr+C1gixNJbnfm2+5GNG3nUlaNzaTUT38C7oS48yUOmwFzX5Uu/PKp6apTaFd7qHsEiLMwuN9z9rVaxCBjK9+1e1ZN+Lr/828VW6O2hYhXwnqsydDqyOTsSPHmX0mZZVFdDdaULYz5CUKRy6An6goOGSebcjEvydovZjDeuboh53ApNLr/pxHRPs9fuqbnCWr83cY+nBD6G3ufRf0Nz+BC96HKkXNJdMUoeCyoYVsluAEC5ZpB/Dpm/CYdK4LL8pjSw742Oz3fCfspV8io76c1LthQkOzscbwXy8O8L1zMwfkxOa7U3iako+yMfu1kUxssBMDQYWBOc5ntvBqg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Hongyan Xia <hongyxia@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 22 Dec 2022 11:12:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.12.2022 12:48, Julien Grall wrote:
> --- a/xen/arch/x86/x86_64/entry.S
> +++ b/xen/arch/x86/x86_64/entry.S
> @@ -165,7 +165,24 @@ restore_all_guest:
>          and   %rsi, %rdi
>          and   %r9, %rsi
>          add   %rcx, %rdi
> -        add   %rcx, %rsi
> +
> +         /*
> +          * Without a direct map, we have to map first before copying. We 
> only
> +          * need to map the guest root table but not the per-CPU root_pgt,
> +          * because the latter is still a xenheap page.
> +          */
> +        pushq %r9
> +        pushq %rdx
> +        pushq %rax
> +        pushq %rdi
> +        mov   %rsi, %rdi
> +        shr   $PAGE_SHIFT, %rdi
> +        callq map_domain_page
> +        mov   %rax, %rsi
> +        popq  %rdi
> +        /* Stash the pointer for unmapping later. */
> +        pushq %rax
> +
>          mov   $ROOT_PAGETABLE_FIRST_XEN_SLOT, %ecx
>          mov   root_table_offset(SH_LINEAR_PT_VIRT_START)*8(%rsi), %r8
>          mov   %r8, root_table_offset(SH_LINEAR_PT_VIRT_START)*8(%rdi)
> @@ -177,6 +194,14 @@ restore_all_guest:
>          sub   $(ROOT_PAGETABLE_FIRST_XEN_SLOT - \
>                  ROOT_PAGETABLE_LAST_XEN_SLOT - 1) * 8, %rdi
>          rep movsq
> +
> +        /* Unmap the page. */
> +        popq  %rdi
> +        callq unmap_domain_page
> +        popq  %rax
> +        popq  %rdx
> +        popq  %r9

While the PUSH/POP are part of what I dislike here, I think this wants
doing differently: Establish a mapping when putting in place a new guest
page table, and use the pointer here. This could be a new per-domain
mapping, to limit its visibility.

Jan



 


Rackspace

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