Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754649AbdDDPgk (ORCPT ); Tue, 4 Apr 2017 11:36:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48142 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754581AbdDDPgh (ORCPT ); Tue, 4 Apr 2017 11:36:37 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0C2122BA6E0 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dvlasenk@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0C2122BA6E0 Subject: Re: [tip:x86/mm] x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert To: kirill.shutemov@linux.intel.com, brgerst@gmail.com, torvalds@linux-foundation.org, akpm@linux-foundation.org, luto@amacapital.net, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, luto@kernel.org, peterz@infradead.org, bp@alien8.de, hpa@zytor.com, dave.hansen@intel.com, tglx@linutronix.de, mingo@kernel.org, linux-tip-commits@vger.kernel.org References: <20170330080731.65421-3-kirill.shutemov@linux.intel.com> From: Denys Vlasenko Message-ID: <53f40ad7-2775-517f-91d1-bde811697045@redhat.com> Date: Tue, 4 Apr 2017 17:36:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 04 Apr 2017 15:36:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2682 Lines: 68 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 > AuthorDate: Thu, 30 Mar 2017 11:07:26 +0300 > Committer: Ingo Molnar > 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 > Cc: Andrew Morton > Cc: Andy Lutomirski > Cc: Andy Lutomirski > Cc: Borislav Petkov > Cc: Brian Gerst > Cc: Dave Hansen > Cc: Denys Vlasenko > Cc: H. Peter Anvin > Cc: Josh Poimboeuf > Cc: Linus Torvalds > Cc: Peter Zijlstra > Cc: Thomas Gleixner > 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 > --- > 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