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


Groups > linux.kernel > #1616110

Re: [tip:x86/mm] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert

From Denys Vlasenko <dvlasenk@redhat.com>
Newsgroups linux.kernel
Subject Re: [tip:x86/mm] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert
Date 2017-04-04 17:40 +0200
Message-ID <tsyIO-6H1-11@gated-at.bofh.it> (permalink)
References <tqDjA-3gZ-13@gated-at.bofh.it> <tssal-2oD-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 04/04/2017 10:29 AM, tip-bot for Kirill A. Shutemov wrote:
> Commit-ID:  361b4b58ec4cf123e12a773909c6454dbd5e6dbc
> Gitweb:     http://git.kernel.org/tip/361b4b58ec4cf123e12a773909c6454dbd5e6dbc
> Author:     Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> AuthorDate: Thu, 30 Mar 2017 11:07:26 +0300
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Tue, 4 Apr 2017 08:22:33 +0200
>
> x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert
>
> We don't need the assert anymore, as:
>
>   17be0aec74fb ("x86/asm/entry/64: Implement better check for canonical addresses")
>
> made canonical address checks generic wrt. address width.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Brian Gerst <brgerst@gmail.com>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Cc: Denys Vlasenko <dvlasenk@redhat.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-arch@vger.kernel.org
> Cc: linux-mm@kvack.org
> Link: http://lkml.kernel.org/r/20170330080731.65421-3-kirill.shutemov@linux.intel.com
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
>  arch/x86/entry/entry_64.S | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 044d18e..f07b4ef 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -265,12 +265,9 @@ return_from_SYSCALL_64:
>  	 *
>  	 * If width of "canonical tail" ever becomes variable, this will need
>  	 * to be updated to remain correct on both old and new CPUs.
> +	 *
> +	 * Change top 16 bits to be the sign-extension of 47th bit

The comment above stops being correct: it's not necessary 16 top bits
we sign-extend now. With larger __VIRTUAL_MASK_SHIFT for 5-level translation,
it will become 7 bits (if I do the math right).

>  	 */
> -	.ifne __VIRTUAL_MASK_SHIFT - 47
> -	.error "virtual address width changed -- SYSRET checks need update"
> -	.endif
> -
> -	/* Change top 16 bits to be the sign-extension of 47th bit */
>  	shl	$(64 - (__VIRTUAL_MASK_SHIFT+1)), %rcx
>  	sar	$(64 - (__VIRTUAL_MASK_SHIFT+1)), %rcx

The bigger problem here would be the future boot-time choice of 4/5-level
page tables: __VIRTUAL_MASK_SHIFT will need to depend on that choice,
but in this location it is preferable to not use any variables
(memory references).

-- 
vda

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv3 0/7] x86: 5-level paging enabling for v4.12, Part 3 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-30 10:10 +0200
  [PATCHv3 2/7] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-30 10:10 +0200
    [tip:x86/mm] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-04-04 10:40 +0200
      Re: [tip:x86/mm] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert Denys Vlasenko <dvlasenk@redhat.com> - 2017-04-04 17:40 +0200
        Re: [tip:x86/mm] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-04-05 13:20 +0200
          Re: [tip:x86/mm] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert Denys Vlasenko <dvlasenk@redhat.com> - 2017-04-05 14:00 +0200
            Re: [tip:x86/mm] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-04-05 14:10 +0200
  [PATCHv3 3/7] x86/mm: Define virtual memory map for 5-level paging "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-30 10:10 +0200
    [tip:x86/mm] x86/mm: Define virtual memory map for 5-level paging "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-04-04 10:40 +0200
  [PATCHv3 5/7] x86/mm: Add basic defines/helpers for CONFIG_X86_5LEVEL "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-30 10:10 +0200
    [tip:x86/mm] x86/mm: Add basic defines/helpers for  CONFIG_X86_5LEVEL=y "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-04-04 10:40 +0200
  [PATCHv3 7/7] x86/espfix: Add support 5-level paging "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-30 10:20 +0200
    [tip:x86/mm] x86/espfix: Add support for 5-level paging "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-04-04 10:40 +0200
  [PATCHv3 6/7] x86/kasan: Extend to support 5-level paging "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-30 10:20 +0200
    [tip:x86/mm] x86/kasan: Extend KASAN to support 5-level paging "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-04-04 10:40 +0200

csiph-web