From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752129AbdK1HdC (ORCPT ); Tue, 28 Nov 2017 02:33:02 -0500 Received: from mga02.intel.com ([134.134.136.20]:27786 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750883AbdK1HdA (ORCPT ); Tue, 28 Nov 2017 02:33:00 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,467,1505804400"; d="scan'208";a="7071520" Subject: Re: [PATCH 15/24] x86/mm: Allow flushing for future ASID switches To: Andy Lutomirski , Ingo Molnar References: <20171127104923.14378-1-mingo@kernel.org> <20171127104923.14378-16-mingo@kernel.org> Cc: "linux-kernel@vger.kernel.org" , Thomas Gleixner , "H . Peter Anvin" , Peter Zijlstra , Borislav Petkov , Linus Torvalds From: Dave Hansen Message-ID: <5eae565e-758d-f78e-bcde-16a1f278db7e@linux.intel.com> Date: Mon, 27 Nov 2017 23:32:59 -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/27/2017 09:16 PM, Andy Lutomirski wrote: > We need to split up __flush_tlb_one() into __flush_tlb_one() and > __flush_tlb_one_kernel(). We've gotten away with having a single > function for both this long because we've never had PCID on and > nonglobal kernel mappings around. So we're busted starting with > "x86/mm/kaiser: Disable global pages by default with KAISER", which > means that we have a potential corruption issue affecting anyone who > tries to bisect the series. There's no way this thing works with CONFIG_KAISER=y in the middle of the series, that's why the Kconfig patch was stuck at the end. Is there breaking without the Kconfig option enabled? > Then we need to make the kernel variant do something sane (presumably > just call __flush_tlb_all if we have PCID && !PGE). Yes, auditing all the callers and figuring out what they're flushing is a good exercise. BTW, one reason I've avoided falling back to __flush_tlb_all() in the "single" invalidate cases is that it hides bugs. TLB invalidation bugs are hard enough to find as it stands, but silently turning every "little hammer" single flush into an implicit "big hammer" full flush shouldn't be something that we do lightly. > and, for the user > variant, we need a straightforward, clean, efficient way to mark a > given address space on a given CPU as needing a usermode PCID flush > when its usermode tables are next loaded. This patch isn't it. Right now, the kernel and user ASIDs are pretty joined at the hip. We always flush them together. We don't _need_ a mechanism to specifically mark a user ASID because it doesn't get managed separately. I assume you want to go this route so that we can eventually separate out the user and kernel flushing because we can get the kernel flushing for "free" at context switch time and then the user flushing for "free" at the return to userspace. That's all fine and good, but it *is* more complicated than what's there right now. Is there something that I'm missing here that it simplifies?