From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751965AbdLKTrG (ORCPT ); Mon, 11 Dec 2017 14:47:06 -0500 Received: from mga04.intel.com ([192.55.52.120]:40515 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234AbdLKTrC (ORCPT ); Mon, 11 Dec 2017 14:47:02 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,392,1508828400"; d="scan'208";a="11462233" Subject: Re: [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on To: Andy Lutomirski References: <90c99eb32b56ea1767472d8b48a524545a551dc6.1512974667.git.luto@kernel.org> <75ec7277-9106-8d61-a75e-bdd1bd640f0b@intel.com> <57f0c2d6-4006-f882-e444-e39903f573ec@intel.com> Cc: X86 ML , "linux-kernel@vger.kernel.org" , Borislav Petkov , Brian Gerst , David Laight , Kees Cook , Peter Zijlstra , "Kirill A. Shutemov" From: Dave Hansen Message-ID: <468bd12c-7b10-0710-7f75-9527c8953b73@intel.com> Date: Mon, 11 Dec 2017 11:47:00 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.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 12/11/2017 11:39 AM, Andy Lutomirski wrote: >> I thought there would be a "fast path" where we just use the normal >> clear_LDT() LDT from the cpu_entry_area and don't have to do any of >> this, but I'm missing where that happens. Do we need a check in >> (un)map_ldt_struct() for !mm->context.ldt? > I'm confused. > > if (unlikely(ldt)) { > do something slowish; > } else { > clear_LD(); > } I was looking at the map/unmap paths. It looks to me like the cases where there is map/unmap overhead, we *are* doing checking against mm->context.ldt. It just wasn't visible from the patch context. In any case, it would be really nice to call that out if you revise these in the patch description: none of these LDT acrobatics are used in the common case. Virtually every process uses the !ldt paths which don't do any of this.