From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753362AbdHXP11 (ORCPT ); Thu, 24 Aug 2017 11:27:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59400 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbdHXP10 (ORCPT ); Thu, 24 Aug 2017 11:27:26 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 16C78C047B75 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=vkuznets@redhat.com From: Vitaly Kuznetsov To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Kirill A. Shutemov" , Linus Torvalds , Jork Loeser , KY Srinivasan , Stephen Hemminger , Steven Rostedt , Juergen Gross , Boris Ostrovsky , Andrew Cooper , Andy Lutomirski Subject: Re: [PATCH v2] x86: enable RCU based table free References: <20170824092258.12375-1-vkuznets@redhat.com> <20170824143434.r7v3bjm3f32yvfg7@hirez.programming.kicks-ass.net> Date: Thu, 24 Aug 2017 17:27:21 +0200 In-Reply-To: <20170824143434.r7v3bjm3f32yvfg7@hirez.programming.kicks-ass.net> (Peter Zijlstra's message of "Thu, 24 Aug 2017 16:34:34 +0200") Message-ID: <878ti9rnom.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 24 Aug 2017 15:27:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > On Thu, Aug 24, 2017 at 11:22:58AM +0200, Vitaly Kuznetsov wrote: > >> diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h >> index c7797307fc2b..d43a7fcafee9 100644 >> --- a/arch/x86/include/asm/tlb.h >> +++ b/arch/x86/include/asm/tlb.h >> @@ -15,4 +15,9 @@ >> >> #include >> >> +static inline void __tlb_remove_table(void *table) >> +{ >> + free_page_and_swap_cache(table); >> +} > > Most other archs have this in pgtable.h, only ARM* has it in tlb.h. > Sure, I can move it in v3 if nobody objects. > And should we put a comment on explaining _why_ we have RCU_TABLE_FREE > enabled? Do you think adding something like /* * While x86 architecture in general requires an IPI to perform TLB * shootdown, enablement code for several hypervisors overrides * .flush_tlb_others hook in pv_mmu_ops and implements it by issuing * a hypercall. To keep software pagetable walkers safe in this case we * switch to RCU based table free (HAVE_RCU_TABLE_FREE). See the comment * below 'ifdef CONFIG_HAVE_RCU_TABLE_FREE' in include/asm-generic/tlb.h * for more details. */ before __tlb_remove_table would suffice? Or do you see a better place for such comment? Actually, after enabling HAVE_RCU_TABLE_FREE on x86 we may consider switching to this mechanism globally: it seems to have negligible effect on performace (and all major arches will already have it). One step at a time, though. -- Vitaly