From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751394AbdFBPFA (ORCPT ); Fri, 2 Jun 2017 11:05:00 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36031 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751293AbdFBPEz (ORCPT ); Fri, 2 Jun 2017 11:04:55 -0400 Date: Fri, 2 Jun 2017 18:04:51 +0300 From: "Kirill A. Shutemov" To: Andrey Ryabinin Cc: "Kirill A. Shutemov" , x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andi Kleen , Dave Hansen , Andy Lutomirski , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv6 06/10] x86/mm: Add sync_global_pgds() for configuration with 5-level paging Message-ID: <20170602150451.nspo54dzp7y54wdk@node.shutemov.name> References: <20170524095419.14281-1-kirill.shutemov@linux.intel.com> <20170524095419.14281-7-kirill.shutemov@linux.intel.com> <86bddb33-4f07-2949-256b-caf931df98d8@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86bddb33-4f07-2949-256b-caf931df98d8@virtuozzo.com> User-Agent: NeoMutt/20170428 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 02, 2017 at 05:50:34PM +0300, Andrey Ryabinin wrote: > On 05/24/2017 12:54 PM, Kirill A. Shutemov wrote: > > This basically restores slightly modified version of original > > sync_global_pgds() which we had before folded p4d was introduced. > > > > The only modification is protection against 'addr' overflow. > > > > Signed-off-by: Kirill A. Shutemov > > --- > > arch/x86/mm/init_64.c | 39 +++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 39 insertions(+) > > > > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c > > index 95651dc58e09..ce410c05d68d 100644 > > --- a/arch/x86/mm/init_64.c > > +++ b/arch/x86/mm/init_64.c > > @@ -92,6 +92,44 @@ __setup("noexec32=", nonx32_setup); > > * When memory was added make sure all the processes MM have > > * suitable PGD entries in the local PGD level page. > > */ > > +#ifdef CONFIG_X86_5LEVEL > > +void sync_global_pgds(unsigned long start, unsigned long end) > > +{ > > + unsigned long addr; > > + > > + for (addr = start; addr <= end; addr += ALIGN(addr + 1, PGDIR_SIZE)) { > > addr = ALIGN(addr + 1, PGDIR_SIZE) Ouch. Thanks for noticing this. Strange that it haven't crashed anywhere in my tests. -- Kirill A. Shutemov