Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3344008imm; Mon, 8 Oct 2018 02:19:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV62AERQiaRcMQuSuSAZkBtKh5dAqce316P1sngpG9rY+XhFPZG36QJ93A9a2hJUqgps1a7NK X-Received: by 2002:a62:9586:: with SMTP id c6-v6mr23974832pfk.234.1538990376476; Mon, 08 Oct 2018 02:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538990376; cv=none; d=google.com; s=arc-20160816; b=Qr5r7W/YXMVTQo0SfejQD9f39AybQI4WaD+7q9O/N0cwBooaoLbPa39Q4keM/uk69u 0/cd+2EGA7QYq0sgc2VQkqYessJom68Wm2VfkKKyjP91gzOaOR6/fN+IeB4abNro8DBH eQBYOZPRxZRumXKRFVwZw08tOPvzylB/j1+Rdn1pI0/c7SyK2oGo2XTVMx8Rp2qBjZFZ VZDeuTO/SvuO3CMzoPYJpihMmVHr9Tmm+3vgGTJKgNn2X3KUerlsu3AVpBA+OqKoU5GW qgjGXHDsVR86zxoVirwdoCj8bgHYMMY14OzTWdCKlYlvtM3vU/8P85Y+l2Eg+ycy8ylx UTmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nvRdKkwK+I3lOz3MeYG+1PNEz6XD60qqpE1+d3IPDow=; b=VeqYb2jwp0BxIKx7ZxkIINTY/p6CcFpkLUEbV+Z+acJdoU+5fQ9ttur2BxmvPBj3kY frB0XcsnxpozW7WuTOYzV6jQPnJYBDOy9dHh75K5XNquNI25oS/S6FM3NMcAxAqipEUr bMYqGHKM/tCY6uAHqcWUkPZeqAk7qk709G/Xp+ZXrc6Fhl1KvTBrexlCF+F2o7V8/qqY YGmXZeUau/yM+LKJ7rsLTJLj3lg96UqrJB6GN4HvXP5h7bWHN3GDwWDAeEZptWkxUnRM 9SOBLL3W9PdSFvD5v22zVGbv8Ko0itv3zUzd+9nmAOjAADyu0PvnyRloXfg8qH6uqIho 0XJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mxbWSm59; 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 y1-v6si17218759pll.35.2018.10.08.02.19.21; Mon, 08 Oct 2018 02:19:36 -0700 (PDT) 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=mxbWSm59; 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 S1727447AbeJHQ2Y (ORCPT + 99 others); Mon, 8 Oct 2018 12:28:24 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42254 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbeJHQ2X (ORCPT ); Mon, 8 Oct 2018 12:28:23 -0400 Received: by mail-pf1-f193.google.com with SMTP id f26-v6so7924622pfn.9; Mon, 08 Oct 2018 02:17:39 -0700 (PDT) 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; bh=nvRdKkwK+I3lOz3MeYG+1PNEz6XD60qqpE1+d3IPDow=; b=mxbWSm59/Pw4GF+7n31cbXZAQrpY558z/dUc8XMeTCHWQsicw5EyIhsuzgiOk+OKHo DTsedc9KIeqdw3VpR7hPKyv/lrbgfJZN4HSKUVHAWp6z9MHNc7tD5miIyFrYMODhXm8Z McIT/d6u3kCowXAiBsl6lrpunnIyizA9qLmH5WuS8Xoj3WzilVUfgYJH321nAd+K/kvX 4c9MWHu0AuRlkrHvnKPwAKIEiB+uFKkOBkORpAmc6MMd06Mjso4MqQascPuaCiIBZb1e 4zfnpH1fSKRvl//hZMkoN429cHKPueqlJl2nN8tS0JldouFX7IcuSozUgEzLHZ521Y/K NsIw== 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; bh=nvRdKkwK+I3lOz3MeYG+1PNEz6XD60qqpE1+d3IPDow=; b=rk/wO6Ny6t8HoTjNinVfJSo4a+FLoCJ4msaj98rIW7At4J4yY/sSa0Hy5ZDnkqmjPF fOHz9VBDzDkkV6HgkXcVo37uIOUfRL6yrzZfNhqpCK/6dw4rrmXfmHOjiSODF30/WxQz t5zCnBFNJc2pz2Zj+lLSFJSWrdtDUgQD4frU84Y+8po9wmmSGlO8JekemSXWl3Bg7gYp 6MF86mQbxB2kJ9u3oowe8w7h/JpOCt4yxxo4R81gkz7niMhF9B31c6Nh2iTKuZyzxYZm /LMrjJVdC71Pp9WLCDPcfse37645lPsM66U6ajgaNMS8ZFi59/FzNduUYxUnC7RixY9v RSig== X-Gm-Message-State: ABuFfojWfAb8MbKnY0Gxf/1YibPFAuWIFsdMwzRjssz4DeyiH3BQzGXL MVp1H2EWQbUtl/b7fjE5krp1h4mEuc2WAc67Yic= X-Received: by 2002:a62:8910:: with SMTP id v16-v6mr24143896pfd.106.1538990259093; Mon, 08 Oct 2018 02:17:39 -0700 (PDT) MIME-Version: 1.0 References: <20180927034829.2230-1-Tianyu.Lan@microsoft.com> <20180927034829.2230-3-Tianyu.Lan@microsoft.com> <2ab49b6e-59d1-1b1f-b533-85e5bc49dd85@redhat.com> In-Reply-To: <2ab49b6e-59d1-1b1f-b533-85e5bc49dd85@redhat.com> From: Tianyu Lan Date: Mon, 8 Oct 2018 17:17:28 +0800 Message-ID: Subject: Re: [PATCH V3 2/13] KVM/MMU: Add tlb flush with range helper function To: Paolo Bonzini Cc: Tianyu Lan , kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "the arch/x86 maintainers" , Radim Krcmar , devel@linuxdriverproject.org, "linux-kernel@vger kernel org" , kvm , Michael.H.Kelley@microsoft.com, vkuznets@redhat.com, Jork.Loeser@microsoft.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paolo: Thanks for your review. Sorry for later response due to holiday. On Mon, Oct 1, 2018 at 11:26 PM Paolo Bonzini wrote: > > On 27/09/2018 05:48, Tianyu Lan wrote: > > + > > + if (range && kvm_x86_ops->tlb_remote_flush_with_range) { > > + /* > > + * Read tlbs_dirty before flushing tlbs in order > > + * to track dirty tlbs during flushing. > > + */ > > + long dirty_count = smp_load_acquire(&kvm->tlbs_dirty); > > + > > + ret = kvm_x86_ops->tlb_remote_flush_with_range(kvm, range); > > + cmpxchg(&kvm->tlbs_dirty, dirty_count, 0); > > This is wrong, because it's not the entire TLB that is flushed. So you > cannot do the cmpxchg here. Yes, nice catch. Will update in the next version. -- Best regards Tianyu Lan