From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752875AbdHXJtt (ORCPT ); Thu, 24 Aug 2017 05:49:49 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:38232 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752714AbdHXJtj (ORCPT ); Thu, 24 Aug 2017 05:49:39 -0400 Date: Thu, 24 Aug 2017 12:49:36 +0300 From: "Kirill A. Shutemov" To: Vitaly Kuznetsov Cc: x86@kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Kirill A. Shutemov" , Peter Zijlstra , 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 Message-ID: <20170824094936.muh4elezjemvl3bm@node.shutemov.name> References: <20170824092258.12375-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170824092258.12375-1-vkuznets@redhat.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 Thu, Aug 24, 2017 at 11:22:58AM +0200, Vitaly Kuznetsov wrote: > On x86 software page-table walkers depend on the fact that remote TLB flush > does an IPI: walk is performed lockless but with interrupts disabled and in > case the pagetable is freed the freeing CPU will get blocked as remote TLB > flush is required. On other architecture which don't require an IPI to do > remote TLB flush we have an RCU-based mechanism (see > include/asm-generic/tlb.h for more details). > > In virtualized environments we may want to override .flush_tlb_others hook > in pv_mmu_ops and use a hypercall asking the hypervisor to do remote TLB > flush for us. This breaks the assumption about IPI. Xen PV does this for > years and the upcoming remote TLB flush for Hyper-V will do it too. This > is not safe, software pagetable walkers may step on an already freed page. > > Solve the issue by enabling RCU-based table free mechanism. Testing with > kernbench and mmap/munmap microbenchmars didn't show any notable > performance impact. > > Suggested-by: Peter Zijlstra > Signed-off-by: Vitaly Kuznetsov > Acked-by: Juergen Gross > --- > Changes since v1: > - Enable HAVE_RCU_TABLE_FREE unconditionally to avoid different code pathes > for no reason [Linus Torvalds] Acked-by: Kirill A. Shutemov -- Kirill A. Shutemov