From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (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 4C1431C9EBA for ; Wed, 29 May 2024 21:55:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717019750; cv=none; b=FJsvRKvBgUOypuwq8iwT8cnUJR591gMjMGkxwbM6J/cxMgU3EQWc5ullMyOIDPjlq08/bbszHexAWN4Dl5nS1BpQv0dIDDpxudnFMGnvYH6L9eh81lbJrG5fL2Qdb8ky807rRJzOCPp1CQyKAhoBBolbOIzXMd4zu0e8hEVRSuQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717019750; c=relaxed/simple; bh=UNxJLMGZl1gnRZO6sW+znZ/L8AD9EkiPEE3WJ3MdUgk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Spz1CJMydRLAbREuG8QYLGXF5EBASqSmF8HKi3A65cKp2VSbWhkajb2xGDZPmLCvl0mubv7+jsnGVttoKwkXzLvWO0Zx6AhcBiVzh7Nu9ZU5IuTwLl8htJa/a+jpLU3QW0hYtmazGe8cIHEcbvVtVehkKDo+d/VtPv+xCLlNuL0= 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=FI/Vb4UP; arc=none smtp.client-ip=209.85.215.201 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FI/Vb4UP" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-68194ee2242so215978a12.2 for ; Wed, 29 May 2024 14:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717019749; x=1717624549; 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=R0O8RdWVLc2UjPDSDGViR160MauFo82inRxl7GpP6bk=; b=FI/Vb4UP86exDz3dIJiCXtaFMKxh27cM2trVsP7atzrPcumEz2F1G+FtFyry7U4D8A Fha8DDVcjugcrgjcCCbBoSJg8lTTb4RTwiNB+UpkBZNonB21vGIDLzXn6PcALb8RdUBx tTUlteIUJBV1wmlGDcPckPc0+s7vGdz5tEtgwVkgEx+xxErqaYorw9uYtXUTppjmMsmX Y0GrTT/ftr6abfC7IihASGMF9Nvo0ilZbPvakLP55DLlqhvB8Diir+zBLEtvTB/MAnID F1zv+ZRBTEPoaeH7AFLEMy88nBRzK84vyfOtTxv/l8nI3e00iamT0iCxXAhQECepprKG WGVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717019749; x=1717624549; 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=R0O8RdWVLc2UjPDSDGViR160MauFo82inRxl7GpP6bk=; b=j+GqIZHSHpgyu+iolbdZGhNmC53Z6wx2wP+uoJyC6ewAKa9jY/Vg5DjWy9lblLpE6k HKHA3v7B6DL+bEmZ4GCn/ldUCXqkChwa3VrhHlHy+VqVaFkyMOjHdvTtJDuBDW5sJYQL 4acj8VSbJav7WigSdW8hc8NejSwYs8cMOCb3OfyUrIE6Kh5EC1g/U4C86IOC7dvFhXbe Pw7cFCsve78WKDmlLTW6UroBj5PLV3PxKumGA37m2eeHsX8fz6sQVPCgAIf5lYzy62Js +nqhdOsL8/kazmne8tCnjI48mQ3GlilyA03s0abpr25E0Xc+GcObOmc9q8BGjBqApdzj Adtg== X-Forwarded-Encrypted: i=1; AJvYcCWqbKXGlGhJq9XDRZHh7waHd/wNdVsZQ68tqAh8J8ZFTDheILW+PNeOrixR00/1CBN/PS2r4FWio+WsMLMR+Zsu2DI4EHXtPF2FrFjo X-Gm-Message-State: AOJu0Yzt8Fk/8pBK9rsiIQ5wPn8t3norG4gpD9JzbQeS3TgzGxgJiwly TK0gYe9r1YeYV+rMS46vrofS3cBsAKmSb3kJx9oSO2flBB25/dMb0ao2+QxVUqbo/dHccd/VSXl OoQ== X-Google-Smtp-Source: AGHT+IGx3SrykKCWRo4963j21qgI5u7l1D5l4vFz5cSTor42JO4rQICXW/WPSO9JICYG6TRZvTrpM8pyR8k= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a02:308:b0:65c:f515:1590 with SMTP id 41be03b00d2f7-6bfdaf2b2f6mr480a12.11.1717019747924; Wed, 29 May 2024 14:55:47 -0700 (PDT) Date: Wed, 29 May 2024 14:55:46 -0700 In-Reply-To: <20240529180510.2295118-5-jthoughton@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240529180510.2295118-1-jthoughton@google.com> <20240529180510.2295118-5-jthoughton@google.com> Message-ID: Subject: Re: [PATCH v4 4/7] KVM: Move MMU lock acquisition for test/clear_young to architecture From: Sean Christopherson To: James Houghton Cc: Andrew Morton , Paolo Bonzini , Albert Ou , Ankit Agrawal , Anup Patel , Atish Patra , Axel Rasmussen , Bibo Mao , Catalin Marinas , David Matlack , David Rientjes , Huacai Chen , James Morse , Jonathan Corbet , Marc Zyngier , Michael Ellerman , Nicholas Piggin , Oliver Upton , Palmer Dabbelt , Paul Walmsley , Raghavendra Rao Ananta , Ryan Roberts , Shaoqin Huang , Shuah Khan , Suzuki K Poulose , Tianrui Zhao , Will Deacon , Yu Zhao , Zenghui Yu , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev Content-Type: text/plain; charset="us-ascii" On Wed, May 29, 2024, James Houghton wrote: > For implementation mmu_notifier_{test,clear}_young, the KVM memslot > walker used to take the MMU lock for us. Now make the architectures > take it themselves. Hmm, *forcing* architectures to take mmu_lock is a step backwards. Rather than add all of this churn, what about adding CONFIG_KVM_MMU_NOTIFIER_LOCKLESS, e.g. static __always_inline int kvm_handle_hva_range_no_flush(struct mmu_notifier *mn, unsigned long start, unsigned long end, gfn_handler_t handler) { struct kvm *kvm = mmu_notifier_to_kvm(mn); const struct kvm_mmu_notifier_range range = { .start = start, .end = end, .handler = handler, .on_lock = (void *)kvm_null_fn, .flush_on_ret = false, .may_block = false, .lockless = IS_ENABLED(CONFIG_KVM_MMU_NOTIFIER_LOCKLESS), }; return __kvm_handle_hva_range(kvm, &range).ret; }