From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751537AbdKVAhL (ORCPT ); Tue, 21 Nov 2017 19:37:11 -0500 Received: from mga11.intel.com ([192.55.52.93]:1607 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751408AbdKVAhK (ORCPT ); Tue, 21 Nov 2017 19:37:10 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,432,1505804400"; d="scan'208";a="179096619" Subject: Re: [PATCH 12/30] x86, kaiser: map GDT into user page tables To: Andy Lutomirski References: <20171110193058.BECA7D88@viggo.jf.intel.com> <20171110193125.EBF58596@viggo.jf.intel.com> <02e48e97-5842-6a19-1ea2-cee4ed5910f4@linux.intel.com> <62d71c5c-515e-c3be-e8f0-4f640251d20c@linux.intel.com> Cc: Thomas Gleixner , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , moritz.lipp@iaik.tugraz.at, Daniel Gruss , michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, Linus Torvalds , Kees Cook , Hugh Dickins , X86 ML From: Dave Hansen Message-ID: <138a0a86-8bba-b372-5e4a-923633514967@linux.intel.com> Date: Tue, 21 Nov 2017 16:37:07 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/2017 04:17 PM, Andy Lutomirski wrote: > On Tue, Nov 21, 2017 at 3:42 PM, Dave Hansen > unsigned long start = (unsigned long)get_cpu_entry_area(cpu); > for (unsigned long addr = start; addr < start + sizeof(struct > cpu_entry_area); addr += PAGE_SIZE) { > pte_t pte = *pte_offset_k(addr); /* or however you do this */ > kaiser_add_mapping(pte_pfn(pte), pte_prot(pte)); > } > > modulo the huge pile of typos in there that surely exist. That would work. I just need to find a suitable pte_offset_k() in the kernel and make sure it works for these purposes. We probably have one. > But I still prefer my approach of just sharing the cpu_entry_area pmd > entries between the user and kernel tables. That would be spiffy.