Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4090203pxb; Tue, 26 Jan 2021 12:07:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJy16LqfkjC+rgWea7tRe+k0AS6T5KMAI9f+PoiNCs/J8IuWvCDjvVj27Y1DI90RdIsCWj71 X-Received: by 2002:a50:bf4a:: with SMTP id g10mr5697033edk.201.1611691626139; Tue, 26 Jan 2021 12:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611691626; cv=none; d=google.com; s=arc-20160816; b=KRvmoRtvcvFTKOEAqtpQx7M+oiZut1Q+liM343Frxke1Z8iUIxdRpO5wim3E6aksi9 iduAHjPqyLV7buS7xC4zLpmP+oht2bg3KjgLLXn4CiBejJHEFOncDBUNdE3PYIUz8Kos 9upwFTckKjFaW5pbRD0aVUTpTEq0aOPNoK2yuXGEBb/LU0dAvuO+kTCN3slIzULp/ORR IukgT0wWLTMGKkUYsP7V7hehNQ0ErjS+HitxOLNkY/6KL8U3Xbt9jDkVdTE7YIB73m1L cNoQGptvl4lKkpDgHiuSiRIisQfWYmQogsOchrCyWKebVcqenU2uekiHa3vYpeVBGK6C QKWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MuwuMM1E8EDH+ukP+fboaIDTRxHiGHEVLbQM3XUxmow=; b=eSaqdJOXJZQ92J0EJ2UpvAdVK6wgpi8FkUJKhvuwGopWktiYpNyhsrs871YPQDKrDb 8eP4ahAErKv4cT3NGt+lSOFYi+MqMbXewby4738q9ejjmCfTGG0sDcBQQt2cFpYqpEY5 5U22snhT4BKsd+gWeYcTQZQnVz0wBkFN4E93pWdGaWde0yB7ZrNqS99efsz6tk0oi4c1 qFowdXXZ/YxCqcztHFaW8FnoFZck62Knw7KOC0AfECbuUftQtu/pLPxo5Tg5U8yBLyN6 xHsUhcCEuBU5r6+1Lfbr5ZoIuRzt82JfoGOpQD0DqJUp9ioVxMnyD1yVQJoJMUqCHSnW BL9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="cd/IZ7dT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si8562912edz.361.2021.01.26.12.06.40; Tue, 26 Jan 2021 12:07:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="cd/IZ7dT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392267AbhAZRfq (ORCPT + 99 others); Tue, 26 Jan 2021 12:35:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389465AbhAZHlf (ORCPT ); Tue, 26 Jan 2021 02:41:35 -0500 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09B15C061573 for ; Mon, 25 Jan 2021 23:39:28 -0800 (PST) Received: by mail-qv1-xf2a.google.com with SMTP id w11so1492354qvz.12 for ; Mon, 25 Jan 2021 23:39:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MuwuMM1E8EDH+ukP+fboaIDTRxHiGHEVLbQM3XUxmow=; b=cd/IZ7dTUOKWb4uxlB9z6AelujYZfyEijwkUXr6NM5yTwl+513pkERu6h0dMWkhdaU At23qG9KTayL3QvCcZJZDYJC33EhuLzzs10LzS4N9jM5ieLQ/Zc8wxRKCfQZLpi2+OSZ DvpfPKJ6icTje8vFQO9dFH07mj4NftWxu8Rmw= 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=MuwuMM1E8EDH+ukP+fboaIDTRxHiGHEVLbQM3XUxmow=; b=dHymJ8eBfxubEtp59rRza+jyGR/C62r8zqrQSIs6UYZ2+kty0fiLTwVvDzrk3/SL5J QDSe9s25bAVYxjoDcCKJLnXAz94JZwDOCjYPU3VIfMHDOveSLXkAwGCYUXwpYKd0sjUl 8VnwuK13qi1opf8cGKSOTSTinXt+BflXo3vTedQO2me2Z5K5ZZRDjbOMnmfdlVO3a/cA 30vC3ThcXW4oFgYiVOQMCQxLlNoINdugdk7CFOSEmkWolfQzjwuP4VayS3vzHMUPZzye HiiSPEtgNelIlT3xNC8Q/IDfX4iCeiv2IPfvjldv6NlIiI4sAcn4uV4RL5+p5bGi744S F7/Q== X-Gm-Message-State: AOAM532gETThgwteb8uwhqtO4jpWB44tgoxbH0/MdUGu2M9QVGILvQRC FabDHmu5S+pgaZVMnjjhQYk6jGa+YBt2d5elM7+5Kw== X-Received: by 2002:a0c:a905:: with SMTP id y5mr4391981qva.55.1611646767316; Mon, 25 Jan 2021 23:39:27 -0800 (PST) MIME-Version: 1.0 References: <20210125064234.2078146-1-stevensd@google.com> In-Reply-To: From: David Stevens Date: Tue, 26 Jan 2021 16:39:16 +0900 Message-ID: Subject: Re: [PATCH] KVM: x86/mmu: consider the hva in mmu_notifer retry To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, open list , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Huacai Chen , Aleksandar Markovic , linux-mips@vger.kernel.org, Paul Mackerras , kvm-ppc@vger.kernel.org, Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Claudio Imbrenda Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > This has the secondary effect of greatly reducing the likelihood of extreme > > Out of curiosity, is this really the _secondary_ effect? I would expect this > change to primarily benefit scenarios where the invalidation has gotten > waylaid for whatever reason. Yeah, this is the primary benefit. I was thinking about it as the reduction in page fault retries is the direct effect, and that in turn leads to a secondary effect of a reduction in the chance of extreme latency. But I guess that's not a particularly important distinction to make. I'll reword this. > > This needs a comment to explicitly state that 'count > 1' cannot be done at > this time. My initial thought is that it would be more intuitive to check for > 'count > 1' here, but that would potentially check the wrong wrange when count > goes from 2->1. The comment about persistence in invalidate_range_start() is a > good hint, but I think it's worth being explicit to avoid bad "cleanup" in the > future. > > > + if (unlikely(kvm->mmu_notifier_count)) { > > + if (kvm->mmu_notifier_range_start <= hva && > > + hva < kvm->mmu_notifier_range_end) I'm not sure I understand what you're suggesting here. How exactly would 'count > 1' be used incorrectly here? I'm fine with adding a comment, but I'm not sure what the comment needs to clarify. -David