From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752675AbdKJMZQ (ORCPT ); Fri, 10 Nov 2017 07:25:16 -0500 Received: from merlin.infradead.org ([205.233.59.134]:50708 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356AbdKJMZM (ORCPT ); Fri, 10 Nov 2017 07:25:12 -0500 Date: Fri, 10 Nov 2017 13:25:02 +0100 From: Peter Zijlstra To: Dave Hansen Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, moritz.lipp@iaik.tugraz.at, daniel.gruss@iaik.tugraz.at, michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, hughd@google.com, x86@kernel.org Subject: Re: [PATCH 22/30] x86, pcid, kaiser: allow flushing for future ASID switches Message-ID: <20171110122502.s2i6od7lx4uooyyu@hirez.programming.kicks-ass.net> References: <20171108194646.907A1942@viggo.jf.intel.com> <20171108194728.4D8F87B6@viggo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171108194728.4D8F87B6@viggo.jf.intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 08, 2017 at 11:47:28AM -0800, Dave Hansen wrote: > +/* > + * We get here when we do something requiring a TLB invalidation > + * but could not go invalidate all of the contexts. We do the > + * necessary invalidation by clearing out the 'ctx_id' which > + * forces a TLB flush when the context is loaded. > + */ > +void clear_non_loaded_ctxs(void) > +{ > + u16 asid; > + > + /* > + * This is only expected to be set if we have disabled > + * kernel _PAGE_GLOBAL pages. > + */ > + if (IS_ENABLED(CONFIG_X86_GLOBAL_PAGES)) { > + WARN_ON_ONCE(1); > + return; > + } Whitespace damage.. > + > + for (asid = 0; asid < TLB_NR_DYN_ASIDS; asid++) { > + /* Do not need to flush the current asid */ > + if (asid == this_cpu_read(cpu_tlbstate.loaded_mm_asid)) > + continue; > + /* > + * Make sure the next time we go to switch to > + * this asid, we do a flush: > + */ > + this_cpu_write(cpu_tlbstate.ctxs[asid].ctx_id, 0); > + } > + this_cpu_write(cpu_tlbstate.all_other_ctxs_invalid, false); > +}