Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3416057ybv; Tue, 25 Feb 2020 00:53:32 -0800 (PST) X-Google-Smtp-Source: APXvYqyTDebdPno5eYlLZ35qsUSY7yoEHhLBe0KpzPnochGBC3kZ83bYO+WP/sxr1ylnvn9mX3XX X-Received: by 2002:a05:6808:315:: with SMTP id i21mr2490492oie.139.1582620812375; Tue, 25 Feb 2020 00:53:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582620812; cv=none; d=google.com; s=arc-20160816; b=bXIejpiCdvCK3AVxvH+jJBCsZbpBdvEVLEtjRtN9p3lji4EbMu5dBJlEVCEDfboCaw n+RAoVE9fxRDabGSZ62SlUY14kJqS4qz6uIovuB1TDpTDedPq2DXP3Z5Q+SiKY5CKgXd S7s5+qnq+DFsL/ttwMhoa+lwQKuumfpVddlSVTm5XwZeO+4GmaI0ezg1xmu+rCLznX2A IriyEzYtxZOqP+7axf57VwPtXmeVlayOcT/XcfaSMwAWthbX614mR5BAoSAWuPZm9yrx iyNWuQ01GrB8Xyx2d1e1+Hgi6Z8oOAXt/H4tuEcWjh9PlS8rHd+Mk8zNU03vo2gPrcMl J6PQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Q0vy786giS+lfp9bUB7XCIUFz0pQEN7EOGsmAN4eRm4=; b=IoHWc6MbySKVQOGilEIgf8fJdQUJC3BzGIy0X8tQjlyi7sfoFEXePlg4N0vS1YkckS 8rb9fZPY+E+wMd72+CGEySP2DM0z5mgZF3f3zIT7M1Z1x8i5+NLDMCJqxyK5Qx2iNglK XumUkP6ffZRvcmLGWoVNny1cL0EAlFDjX+jJBBt71cIAVoAkYDfTYdiuJDGcrICUa9cC Tsrc57VFlLC3sKACdYcgCgq3AeKbFGAN/VWHc7n/KEAYBR6TUT/ZI2vtQ4BGcQ7IXd1v xiPRss6eWFC7gfAaH3cRbq5fDA0VwQKvMcMroCFyY+N49hp23VhCxuyLdLj2q6VKsrKM U5fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nKhOPmQ1; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b126si6215874oii.72.2020.02.25.00.53.20; Tue, 25 Feb 2020 00:53:32 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nKhOPmQ1; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729790AbgBYIlP (ORCPT + 99 others); Tue, 25 Feb 2020 03:41:15 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:42176 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726867AbgBYIlP (ORCPT ); Tue, 25 Feb 2020 03:41:15 -0500 Received: by mail-ot1-f65.google.com with SMTP id 66so11357640otd.9; Tue, 25 Feb 2020 00:41:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Q0vy786giS+lfp9bUB7XCIUFz0pQEN7EOGsmAN4eRm4=; b=nKhOPmQ12wJJY6QSzkKm4CK+u010U9hKN8hfKFhUBkr97meisT8QguznR33/Z4Kl7z Ub8spInGXBKTZE5yO2/VfS1vd4WJR/Xbf/TthA/OP/McjtwnLL2Av2EeM4VrrRjGaYwI pI3xKVxC6wqvftu25MA08OL3HhAfyJhxCJbwDl+0T7LN7u5ckm0QfkuLmfxv1K6AVNkd lLv5o4VeZBvi0BBtF6Fb4l+ppbV4hs994DBkXPaY/dq76RkBvW335kqEZH60kswOPAiL u3YETeq6nnY6U3lt5CL6ACiqoQFZllNSrxS8eJnlCkhbNH/gwMGfR14B1mybcHBVckEa eaxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Q0vy786giS+lfp9bUB7XCIUFz0pQEN7EOGsmAN4eRm4=; b=Hiq8lOr7j2o3kt3zma0UU2V70bF1zzYvuiNbWVy/ZAUt5LqcvI90OM4OuCdDp+LOWQ ynfdLdveMeuKvgNOeFdv/+ORcnbBYm/rfeNsFLfFNGkkV34MRo0g6sr7YMOXiXT5azmM 0wovHjTgxCq2v+/zDuja/HYKpqa9hky76dN3ZwYXeGuwX9SZdz9iJRZqL+SFlthsdp6V 09IqMALS/VxNGO+21bJxfRI0UV9y5k8LP1rXuQev9kWxuZ9xgIAdUsuAbUdS8h8GEOFS pQajJ918eBjsZzkTFYWANbtYIU+lEzjeyUTJvMbUBkeyQ7FcOdoQQM52d6F1RjSTMkrP v+lw== X-Gm-Message-State: APjAAAVwNO/xcFWt5Tq3wub1N2eGwp8aKnOlD8QlYUC/AKWBWYMOiu2O BsOflYVPlbSv9DMFMN/mzvxBWqJkWCUJ9rfV9+M= X-Received: by 2002:a9d:7ccd:: with SMTP id r13mr42256692otn.56.1582620074234; Tue, 25 Feb 2020 00:41:14 -0800 (PST) MIME-Version: 1.0 References: <07348bb2-c8a5-41d0-afca-26c1056570a5.bangcai.hrg@alibaba-inc.com> <660daad7-afb0-496d-9f40-a1162d5451e2.bangcai.hrg@alibaba-inc.com> In-Reply-To: <660daad7-afb0-496d-9f40-a1162d5451e2.bangcai.hrg@alibaba-inc.com> From: Wanpeng Li Date: Tue, 25 Feb 2020 16:41:02 +0800 Message-ID: Subject: Re: [RFC] Question about async TLB flush and KVM pv tlb improvements To: =?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=?= , herongguang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Feb 2020 at 15:53, =E4=BD=95=E5=AE=B9=E5=85=89(=E9=82=A6=E9=87= =87) wrote: > > > On Tue, 25 Feb 2020 at 12:12, =E4=BD=95=E5=AE=B9=E5=85=89(=E9=82=A6=E9= =87=87) 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 pa= tch is practical or there are functional flaws? > >> From my POV, Nadav's patch seems has no obvious flaw. But I am not fam= iliar about the relationship between CPU's speculation exec and stale TLB, = since it's usually transparent from programing. In which condition would ma= chine check occurs? Is there some reference I can learn? > >> BTW, I am trying to improve kvm pv tlb flush that if a vCPU is preempt= ed, as initiating CPU is not sending IPI to and waiting for the preempted v= CPU, when the preempted vCPU is resuming, I want the VMM to inject an inter= rupt, 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 interr= upt, otherwise stick to VMM flush. Since VMM flush using INVVPID would flus= h all TLB of all PCID thus has some negative performance impacting on the p= reempted 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. > 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?