Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp918780lqb; Wed, 29 May 2024 14:56:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWGNMuknvmzmFf+SXwMqWyzGIJUx3/mh7tBuTFxbddOaEMnY2Tijp1WfH82SOrTliEUUmzrPsgvqvISjBWCW8uKFzGPceeiie5+yan8jA== X-Google-Smtp-Source: AGHT+IFlnHr/JvrP2gmLOyi3K+V0TOZFVi5dzMsax6UUV6SRJFVhmO38SKrVWdOH3ltdcp1a1nl2 X-Received: by 2002:a05:6359:4c8d:b0:192:9d45:7921 with SMTP id e5c5f4694b2df-199b93ac546mr24572255d.4.1717019762457; Wed, 29 May 2024 14:56:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717019762; cv=pass; d=google.com; s=arc-20160816; b=OOU9F7fQTmLauSnJd8ekopUutcZKl5N3E4uhuS33/7yvnpR18tBUxC8u7Aky3mb9su maKngNccgSE+hD4XORjuUdnihdkqmOreuHgexbkv3DCKr5zWvOc7v0Ogheo8JIxGGVRI VcvLFbqcmPhn58sW359n09QEzkZF3kSoRqEjf6YR27qCyfOjoT4TWM088fFIT4j5Fnl5 NL1pP37CpNBGgPudRfqLefxO3myVdssrMdZogsjpLZa5Ah5ykOoI4XVpejlmIemjdPgu U88t8lfy1AgjorAb4uy38ancnMPPv8Tx0magf8DYRote9Tybdw0WhjFJK5tnPK0Qdc9R U6+Q== 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=R0O8RdWVLc2UjPDSDGViR160MauFo82inRxl7GpP6bk=; fh=5TTwpBD3yxgrTXLGq7hVksVFVYpkE9EOVE9Urf4GQ6Y=; b=vFiL02AtLoox5eZ+8AJCL72wTAF9rlDs97NjVizgGshHvEksv6izMUsKqO0M5xK3Yy MvkEc5CQyJrXoxMVD7LuRSToCf1zeAi+9nmjmvvU4KpqArytcCbK0Z8pSfW56w2Kjx2c CzbaHgKgv3+hkDfFFEJNhqB8qu08cL7xs1m/DBoeMkdJLCMCja1YGhoH/jBZfkLtN4ka CTp0OSmEbZZAjruMGQ7cdb1HOK7MNQecSzmFdjBiLBohd/XPyFP4Tzm0l3PeUgCWuZAn p98DJr9DASDhGGWzPk0jnnYCQJ7sZyfT4Mo0dXbXG4FH25e/gnCY9URdUCw9Uz8JQXHP xsfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="FI/Vb4UP"; 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-194716-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194716-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 41be03b00d2f7-682288e7779si10853630a12.520.2024.05.29.14.56.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 14:56:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194716-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="FI/Vb4UP"; 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-194716-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194716-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 E4BF2284841 for ; Wed, 29 May 2024 21:56:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 867BD1C9ED5; Wed, 29 May 2024 21:55:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FI/Vb4UP" 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 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-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; }