From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756463AbdEUDXo (ORCPT ); Sat, 20 May 2017 23:23:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:43500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755659AbdEUDXl (ORCPT ); Sat, 20 May 2017 23:23:41 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AA8323960 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Subject: Re: [PATCH v3 08/10] x86/hyper-v: use hypercall for remote TLB flush To: Vitaly Kuznetsov , devel@linuxdriverproject.org Cc: Stephen Hemminger , Jork Loeser , Haiyang Zhang , x86@kernel.org, linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner References: <20170519140953.1167-1-vkuznets@redhat.com> <20170519140953.1167-9-vkuznets@redhat.com> From: Andy Lutomirski Message-ID: <95cc1a34-418a-a875-4848-7e297a8b48b7@kernel.org> Date: Sat, 20 May 2017 20:23:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170519140953.1167-9-vkuznets@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-MW Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/19/2017 07:09 AM, Vitaly Kuznetsov wrote: > Hyper-V host can suggest us to use hypercall for doing remote TLB flush, > this is supposed to work faster than IPIs. > > Implementation details: to do HvFlushVirtualAddress{Space,List} hypercalls > we need to put the input somewhere in memory and we don't really want to > have memory allocation on each call so we pre-allocate per cpu memory areas > on boot. These areas are of fixes size, limit them with an arbitrary number > of 16 (16 gvas are able to specify 16 * 4096 pages). > > pv_ops patching is happening very early so we need to separate > hyperv_setup_mmu_ops() and hyper_alloc_mmu(). > > It is possible and easy to implement local TLB flushing too and there is > even a hint for that. However, I don't see a room for optimization on the > host side as both hypercall and native tlb flush will result in vmexit. The > hint is also not set on modern Hyper-V versions. Why do local flushes exit? > +static void hyperv_flush_tlb_others(const struct cpumask *cpus, > + struct mm_struct *mm, unsigned long start, > + unsigned long end) > +{ What tree will this go through? I'm about to send a signature change for this function for tip:x86/mm. Also, how would this interact with PCID? I have PCID patches that I'm pretty happy with now, and I'm hoping to support PCID in 4.13.