From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f70.google.com (mail-it0-f70.google.com [209.85.214.70]) by kanga.kvack.org (Postfix) with ESMTP id 6663F44043C for ; Wed, 8 Nov 2017 16:46:26 -0500 (EST) Received: by mail-it0-f70.google.com with SMTP id 72so6842678itl.1 for ; Wed, 08 Nov 2017 13:46:26 -0800 (PST) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id d93sor2417086ioj.39.2017.11.08.13.46.25 for (Google Transport Security); Wed, 08 Nov 2017 13:46:25 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <20171108211525.4kxwj5ygg3kvfl2a@pd.tnic> From: Linus Torvalds Date: Wed, 8 Nov 2017 13:46:24 -0800 Message-ID: Subject: Re: [PATCH] x86/mm: Unbreak modules that rely on external PAGE_KERNEL availability Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Borislav Petkov Cc: Thomas Gleixner , Jiri Kosina , Ingo Molnar , "H. Peter Anvin" , Tom Lendacky , LKML , linux-mm , the arch/x86 maintainers , Greg KH On Wed, Nov 8, 2017 at 1:23 PM, Linus Torvalds wrote: > > So _this_ is the underlying problem: > > #define _PAGE_ENC (_AT(pteval_t, sme_me_mask)) > > because that is simply not how the _PAGE_xyz macros should work! > > So it should have been a fixed bit to begin with, and the dynamic part > should have been elsewhere. Hmm. It's not an entirely new problem. We have that "cachemode2protval()" thing, which causes he exact same thing, except it accesses the __cachemode2pte_tbl[] array instead. Which we also EXPORT_SYMBOL(). So I guess _PAGE_ENC isn't any worse than what we already had. Of course, that at least doesn't trigger for the simple cases - only _PAGE_CACHE_WP and _PAGE_NOCACHE end up triggering that "cachemode2protval()" case. I do wonder if we could perhaps at least try to unify these things a bit, and export just one thing. And maybe avoid accessing two completely different memory locasions every time we use _PAGE_KERNEL or whatever. But it all looks rather nasty, so for 4.14 clearly I should just apply that trivial one-liner patch for now. Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org