Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3460607ybv; Tue, 25 Feb 2020 01:43:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwHEFBWM2dDgpfMHGHc7mfyUnuf/OW71HwWxVxzm+NNU0c5jGvUfIsos9AbYp4g/tWUlPqz X-Received: by 2002:a05:6830:1216:: with SMTP id r22mr1810674otp.323.1582623811145; Tue, 25 Feb 2020 01:43:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582623811; cv=none; d=google.com; s=arc-20160816; b=H6YIQvWpaynTXfkPLBfA6Bf8dwMjypjTGeVyrGM5omjzAepDiZZXxfyDa33qHn5W/u 2rkpHS8CUvbj48eHR1HjnPq6+8hM+Z2uhLMu6slDNCYPCrym0gA8v+92xQUMaeYDtsOc fZ/cxr/VMR5Ad3e53XlcFb5qYfn3McQKUw5bsSOfGzRj2f/KivX2Sn5jivaEKnqQJ+vg 7ssr4VMqPDzums+h4g3JVgmIJKAtNugUmVKXBf12mwhQn6sKrhHpA8diFPKTWJcfwT1Q JFFRdZsf5lnLAUteBKkoZnZRX6/idJMoP8nFaEDw8vCYlLTVaJkdSF64FCSWkSOdxXsM wvKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=X5XnPn/Dpq41GYqLp0djZdHae/rCXB7RNAixuh5LbBo=; b=Ul/Fhcj99GKbleM1A/l9bnemNSyurJG5CqkjA7rRS+rdkGCaDQQtnQdVMrQUd+e0lE PzVFZ/fVNoVvQKEJGq9saG/mwYayly3cxZgJ/2O5TF8sXOygEzbGzxtz/RlzcdwlGQMo UIc1AhSoi8HpRSrCNpNbbOVDvdEJVZ0H6VA7KAMuL9oKLbJXw9jOxVVoNSO/A6bzx+ip YkEf4CQuJd+wf5Zv/Y0VsaCSNHpzYQE+zK03S0aJOjyzh+nLwon+8IzWKeeDpOrMRriV aRcVc87OywSnFrfXPyt4DYHKH0iQ/hvNc0QAZRRlPYGYzAl7tX6yEukc5mxY9nQUJt86 mGTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16si6782091oic.66.2020.02.25.01.42.59; Tue, 25 Feb 2020 01:43:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729965AbgBYJ0M (ORCPT + 99 others); Tue, 25 Feb 2020 04:26:12 -0500 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:33164 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729024AbgBYJ0L (ORCPT ); Tue, 25 Feb 2020 04:26:11 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04428;MF=herongguang@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0TqtE5-e_1582622765; Received: from 30.39.240.211(mailfrom:herongguang@linux.alibaba.com fp:SMTPD_---0TqtE5-e_1582622765) by smtp.aliyun-inc.com(127.0.0.1); Tue, 25 Feb 2020 17:26:05 +0800 Subject: Re: [RFC] Question about async TLB flush and KVM pv tlb improvements To: Wanpeng Li , =?UTF-8?B?5L2V5a655YWJKOmCpumHhyk=?= Cc: namit , peterz , pbonzini , "dave.hansen" , mingo , tglx , x86 , linux-kernel , "dave.hansen" , bp , luto , kvm , =?UTF-8?B?5p6X5rC45ZCsKOa1t+aeqyk=?= , =?UTF-8?B?5ZC05ZCv57++KOWQr+e/vik=?= References: <07348bb2-c8a5-41d0-afca-26c1056570a5.bangcai.hrg@alibaba-inc.com> <660daad7-afb0-496d-9f40-a1162d5451e2.bangcai.hrg@alibaba-inc.com> From: He Rongguang Message-ID: <336cd7de-d4a9-29dd-1150-4f793a03cfa0@linux.alibaba.com> Date: Tue, 25 Feb 2020 17:26:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2020/2/25 16:41, Wanpeng Li 写道: > On Tue, 25 Feb 2020 at 15:53, 何容光(邦采) wrote: >>> On Tue, 25 Feb 2020 at 12:12, 何容光(邦采) wrote: >>>> Hi there, >>>> >>>> I saw this async TLB flush patch at https://lore.kernel.org/patchwork/patch/1082481/ , and I am wondering after one year, do you think if this patch is practical or there are functional flaws? >>>> From my POV, Nadav's patch seems has no obvious flaw. But I am not familiar about the relationship between CPU's speculation exec and stale TLB, since it's usually transparent from programing. In which condition would machine check occurs? Is there some reference I can learn? >>>> BTW, I am trying to improve kvm pv tlb flush that if a vCPU is preempted, as initiating CPU is not sending IPI to and waiting for the preempted vCPU, when the preempted vCPU is resuming, I want the VMM to inject an interrupt, perhaps NMI, to the vCPU and letting vCPU flush TLB instead of flush TLB for the vCPU, in case the vCPU is not in kernel mode or disabled interrupt, otherwise stick to VMM flush. Since VMM flush using INVVPID would flush all TLB of all PCID thus has some negative performance impacting on the preempted vCPU. So is there same problem as the async TLB flush patch? >>> PV TLB Shootdown is disabled in dedicated scenario, I believe there >>> are already heavy tlb misses in overcommit scenarios before this >>> feature, so flush all TLB associated with one specific VPID will not >>> worse that much. >> If vcpus running on one pcpu is limited to a few, from my test, there >> can still be some beneficial. Especially if we can move all the logic to > Unless the vCPU is preempted. Correct, in fact I am using a no-IPI-in-VM approch, that's why I am asking about the async approch. >> VMM eliminating waiting of IPI, however correctness of functionally >> is a concern. This is also why I found Nadav's patch, do you have >> any advice on this?