Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp658896lqt; Fri, 19 Apr 2024 06:58:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW9ZWAj+R7zcXP6XWmu7eQWyqEXsxYYAnWmaE0pmNQKPi46LczwQKJb7D2F1Dy2kqVO8Fwy0K1y674qLnOYhn2e+h45Pax7CJkiR6j9jg== X-Google-Smtp-Source: AGHT+IGfYw18Hy+4SIITJuARsBSm8sAFK4njYkfLJPtNDfovixyfrwvSTRCp2/9k+BeNuRgaVt/6 X-Received: by 2002:a05:6e02:13aa:b0:36b:2b56:12 with SMTP id h10-20020a056e0213aa00b0036b2b560012mr2897509ilo.7.1713535129701; Fri, 19 Apr 2024 06:58:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713535129; cv=pass; d=google.com; s=arc-20160816; b=YYXdnAZd+6k5svTTp6YNh4/BDb9w7MIw7ROLiHB2eHma+58WdddgcUhDPW+n2pGQeN RtUEjX2SFe6MzTpeLEe0ir0NG45syYKvUFUtrGnEFB8qpQ8/CRC/gfhs2BQM7T9Sx5E7 ZgdNxiB39PANH8cb/4iRuAQCtG89yYfZd3+20oMoR0u6tDmBcEVjcrFFQNcWecy5lLjq tHMTUEeyJUcF5chLAqzVjgbVLOAGUixN0NI4E/RY8HqXBlrRw/wd94L28IygfmNuUcvD NRwJ071heCm5L+R3elkYXIzxWYynK2VgxgChvEQFdzhf7FWpomk1Ux/D5bSgrtCrTWJN FaRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=KgrnEQ6mmP0jFk5Zb1SZY9boKJybsIIVble8n571sqI=; fh=an0oAfJFiBzrdFLOMvmSbjZH8rTiEArtg1+G/MG2bP8=; b=TgVYKGf01gYcUjscWBYjWqaa1DMACbYcwUoeZiSW0ZW67lR/mmV5QbBIilpLz53UKD RLtMVAFjZY8oIydPxKxs6cLjrEmHermRccy8qvvDlMewZDKuXnqoXdEe+f+LqT5aUJEE /ZKrFPdtzWLzgvJ8+arTb/suUzNzXF44Ty4NborDIJPZ5FV7GMwXMjtH+TXn/bOOCIGi zRmupnBohLl7OUNJR5ozO+hKs2RIk6AUE3CBqJglALnux27xwLEkP9xkJsIg0UF5N7tb yuwRJpsSdJ6R0QzUKC8Xi5l1OwGbaJmjmhMCJqP1A8chrW0lIg09zWbtruteYdEXvvBt 9VcQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mRlK2Ozk; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-151511-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151511-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t3-20020a654083000000b005e8428f4a51si3365481pgp.56.2024.04.19.06.58.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:58:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151511-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mRlK2Ozk; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-151511-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151511-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 27058284A7B for ; Fri, 19 Apr 2024 13:58:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A967212DD93; Fri, 19 Apr 2024 13:58:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mRlK2Ozk" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 717FA1272DC for ; Fri, 19 Apr 2024 13:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713535091; cv=none; b=WVGbbYiDZ0NG4jVFs1Os5vz/R+4lecXW8/nPeqg+UcyHm9xWlTdHPWnN8I3EWJDF2/2ChP9SNRsMIURKcIjkGzHCGwj2FsRcOGc0CyPH5NdiTreDcCj/hCHbirZ5HdbM+yueuV4DX/10uSUuLciwF7ma3kzjErRAWXVsI6sLlso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713535091; c=relaxed/simple; bh=gKtJtEltb2GnPLMyuxs+G7n5EiHdmrtpBSJFJerWnT0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Pt/+tg0vD0iMYAsmVekgBSV2oXR++VrttKfrpPrwu7amIc0CKUMKiPhhpOVcKB4QPPDCEBAlAKMyKF0zL8nS04qu0z3Nl7A0GSeMJh7/wJEoLmHjdjGr+E0EQlT49pmwwSz5cjDQGe3Gwa4C7vSxgsN4J7capsaHAQnBrHDiWBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=mRlK2Ozk; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dbe9e13775aso3836033276.1 for ; Fri, 19 Apr 2024 06:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713535088; x=1714139888; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KgrnEQ6mmP0jFk5Zb1SZY9boKJybsIIVble8n571sqI=; b=mRlK2OzkuCq05+LZ6E5NEHj0g7bbqBqXyiw5zvOi0650htfNDK/xcglrJEONnshNq3 RAXI+oelN0PRLcdYSG+4zJWj5Qj5CBp+/AvPbL75WEDb28f1b/vBFJESveRYjsBtonuV 6Drn/gFl76UCFwd+THW35DDFtxg1LLTDK/EVb8+cNedWfQ1aT7E0h0ehChwzJ1qGeyLd aoL+6WmsQoGrsbAxulbqCHsC4T8xOmamYs02X28bpDHbyssO1+2CK/YcMMqi+VgS4S3h WoqIHzO4si2L4Bt0bXtdA6Y+u6dKFOPx0RoNMfULHtspL7n2dg+IMQeWze1L3oa4iL3m G2VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713535088; x=1714139888; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KgrnEQ6mmP0jFk5Zb1SZY9boKJybsIIVble8n571sqI=; b=rO4/rRAap0Ts+E9OQtzn2HOBQ3CnyigBrtVhJVDs0XDZ5hjvANBqs0+jhhgVxA+Ao0 pSINtD8JKjZrRDWq3vMON0QZDjGEIwSUY4WD205LtK/ubxm5B+p3lTktgr+g1pgTZlhm kD2ooGT5GnIFYu0nqkCxM+8j71W5udWUWBAf1dkkP7xrzibsELD6oTYlsgVHAPeQxeWt ZdayjYIGNgaqv9vVoXmg2HqtIrcQf7b4cJfxICLEgVirNvhP5xM8kYJ2xq9wmjnxRSpi hGBwHYl0cvPre/+Aul0XI5yHVgfNl3F58N6EfE9wDino57cxcwETLxGWID4PhFMdTrP9 9sgw== X-Forwarded-Encrypted: i=1; AJvYcCVu1gNFgynJ7Db/cFh+gtX5J5r115ZqNZrWqy2x/MIAV4vgixy6/2ro8SPCQXLEhbyAquxzndANsGJ0b4laiUpgp3K3mYdDQ6Ud8W0p X-Gm-Message-State: AOJu0YzM2EjpyotBN7MYpHmsPwg4UROC+PqehFXxXoS3RgvjYIdYF2ui pQKryMBXY9liHvT+0MqatFHAFD76yLn3GgHt4hUaeOzVvqlHwns9gXpFbhX0YmLKKJgq0RhgaB5 gnQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:ad8d:0:b0:dc6:e5d3:5f03 with SMTP id z13-20020a25ad8d000000b00dc6e5d35f03mr543024ybi.4.1713535088599; Fri, 19 Apr 2024 06:58:08 -0700 (PDT) Date: Fri, 19 Apr 2024 06:58:06 -0700 In-Reply-To: <20240419112432.GB2972@willie-the-truck> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240405115815.3226315-1-pbonzini@redhat.com> <20240405115815.3226315-2-pbonzini@redhat.com> <20240412104408.GA27645@willie-the-truck> <86jzl2sovz.wl-maz@kernel.org> <86h6g5si0m.wl-maz@kernel.org> <20240418141932.GA1855@willie-the-truck> <20240419112432.GB2972@willie-the-truck> Message-ID: Subject: Re: [PATCH 1/4] KVM: delete .change_pte MMU notifier callback From: Sean Christopherson To: Will Deacon Cc: Marc Zyngier , Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Oliver Upton , Tianrui Zhao , Bibo Mao , Thomas Bogendoerfer , Nicholas Piggin , Anup Patel , Atish Patra , Andrew Morton , David Hildenbrand , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Fri, Apr 19, 2024, Will Deacon wrote: > > @@ -663,10 +669,22 @@ static __always_inline kvm_mn_ret_t __kvm_handle_hva_range(struct kvm *kvm, > > break; > > } > > r.ret |= range->handler(kvm, &gfn_range); > > + > > + /* > > + * Use a precise gfn-based TLB flush when possible, as > > + * most mmu_notifier events affect a small-ish range. > > + * Fall back to a full TLB flush if the gfn-based flush > > + * fails, and don't bother trying the gfn-based flush > > + * if a full flush is already pending. > > + */ > > + if (range->flush_on_ret && !need_flush && r.ret && > > + kvm_arch_flush_remote_tlbs_range(kvm, gfn_range.start, > > + gfn_range.end - gfn_range.start + 1)) > > What's that '+ 1' needed for here? (a) To see if you're paying attention. (b) Because more is always better. (c) Because math is hard. (d) Because I haven't tested this. (e) Both (c) and (d).