Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754213AbdLDO6A (ORCPT ); Mon, 4 Dec 2017 09:58:00 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:46010 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752842AbdLDO56 (ORCPT ); Mon, 4 Dec 2017 09:57:58 -0500 X-Google-Smtp-Source: AGs4zMYgDOeqaZTkZwvOrPLaAs+JPLQfIWftQiiA/vxnbUvtv0aStl3cLVkw7rT+cpUrKtLZcv9nVA== Date: Mon, 4 Dec 2017 17:57:55 +0300 From: "Kirill A. Shutemov" To: Tom Lendacky Cc: "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Borislav Petkov , Brijesh Singh , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/mm: Rewrite sme_populate_pgd() in a more sensible way Message-ID: <20171204145755.6xu2w6a6og56rq5v@node.shutemov.name> References: <20171204112323.47019-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1375 Lines: 36 On Mon, Dec 04, 2017 at 08:19:11AM -0600, Tom Lendacky wrote: > On 12/4/2017 5:23 AM, Kirill A. Shutemov wrote: > > sme_populate_pgd() open-codes a lot of things that are not needed to be > > open-coded. > > > > Let's rewrite it in a more stream-lined way. > > > > This would also buy us boot-time switching between support between > > paging modes, when rest of the pieces will be upstream. > > Hi Kirill, > > Unfortunately, some of these can't be changed. The use of p4d_offset(), > pud_offset(), etc., use non-identity mapped virtual addresses which cause > failures at this point of the boot process. Wat? Virtual address is virtual address. p?d_offset() doesn't care about what mapping you're using. > Also, calls such as __p4d(), __pud(), etc., are part of the paravirt > support and can't be used yet, either. Yeah, I missed this. native_make_p?d() has to be used instead. > I can take a closer look at some of the others (p*d_none() and > p*d_large()) which make use of the native_ macros, but my worry would be > that these get changed in the future to the non-native calls and then > boot failures occur. If you want to avoid paravirt altogher for whole compilation unit, one more option would be to put #undef CONFIG_PARAVIRT before all includes. That's hack, but it works. We already use this in arch/x86/boot/compressed code. -- Kirill A. Shutemov