From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754241AbcGVULN (ORCPT ); Fri, 22 Jul 2016 16:11:13 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36116 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753864AbcGVULK (ORCPT ); Fri, 22 Jul 2016 16:11:10 -0400 Date: Fri, 22 Jul 2016 22:11:05 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: Andy Lutomirski , Valdis Kletnieks , "kernel-hardening@lists.openwall.com" , X86 ML , "linux-kernel@vger.kernel.org" , linux-arch , Borislav Petkov , Nadav Amit , Kees Cook , Brian Gerst , Linus Torvalds , Josh Poimboeuf , Jann Horn , Heiko Carstens , Thomas Gleixner , "H. Peter Anvin" Subject: Re: [kernel-hardening] [PATCH v5 03/32] x86/cpa: In populate_pgd, don't set the pgd entry until it's populated Message-ID: <20160722201104.GA6613@gmail.com> References: <5741.1469162592@turing-police.cc.vt.edu> <4b028b92-81f3-362f-c5be-b7a35cedf5ee@kernel.org> <20160722102105.GA20771@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > This garbage (as evidenced by my bug and my failed attempt to fix it) > only works if you never have a low-level page table that isn't linked > into a higher-level page table, and it mostly requires you to do > everything exactly the way it was originally done so all the horrible > inline helpers don't get confused. > > And AFAICT all of this was done to manually unroll a loop, and I bet > it never sped anything up measurably even on 386 or PPro. > > Whenever some vendor releases a 5 level page table CPU, can we > *please* clean this up first? We should have a type that points to a > table, a different type that points to an entry (or maybe not have > pointers to entries at all), and the levels should be referred to by > *number*. When you need to traverse all the way down, you write a > *loop* instead of four bloody helper functions, some of which are > incomprehensibly no-ops on some kernels. And if this means that, on > Intel, we have a silly branch in the inner loop because the bottom > level entry format is special, who cares? > I'd welcome (and help out!) any effort to clean it up gradually. Thanks, Ingo