From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DD08C369D9 for ; Wed, 30 Apr 2025 20:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Content-Type:Message-ID:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ueORBRSdk8dfevMNCiszlxJFROHE0iUZRTzx7EwVQFc=; b=MdW+Y00CLr+DlE19OIXjtGUIUR cDed6s05AnzKaICQbEIWYycqu46FVzpGJQvzrFGZPatvclmwCSVdbgarYY9pqLSp9at4jPIdrAH/l yh74Z5+iuz06dh/+1KjgE76Z1+GtHAqR589DUzw7dY5D7nHjS+hu3WSi/U/sBR5Y2AVEk/rPCU7ya 7Pn4vfH0Eg5qIgZi4F5Dw9n9kxw+vnq13mwBFBxG6g410fA4oNoGgDiqWGJOHQ9bruCHAMo1gS09B R3u11wq6/wlUYXhNORUaMA/Fc9Kuv/KLRoz5NhYqDPdsJmas04uA31kJoN6dFNo5qnFCDFxtSBcJW Qw8LxuNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uADzz-0000000DubF-27cQ; Wed, 30 Apr 2025 20:25:43 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uADy0-0000000Dtzb-3Xo7 for linux-arm-kernel@lists.infradead.org; Wed, 30 Apr 2025 20:23:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746044619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ueORBRSdk8dfevMNCiszlxJFROHE0iUZRTzx7EwVQFc=; b=e7rcmfj71/05qamlZb1tz8MT60ZonDe2jGQn6uf4CKE2uwPIZnWH1Oy3wOwkLkY9biJgKM 0aXy1ZO97qDMXJnXPJL4m9t0Qe6fg1px8L/las9456AMzS/tYxOUhl2KFN1gtmxWBX7Brb YLX2yf43t2KpKa2BDT+zkLkHf8EFPQg= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-Y91AxpyiOD2kIYc-u3Pg8Q-1; Wed, 30 Apr 2025 16:23:34 -0400 X-MC-Unique: Y91AxpyiOD2kIYc-u3Pg8Q-1 X-Mimecast-MFC-AGG-ID: Y91AxpyiOD2kIYc-u3Pg8Q_1746044610 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5EAD11955D77; Wed, 30 Apr 2025 20:23:22 +0000 (UTC) Received: from intellaptop.lan (unknown [10.22.80.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E1C381800365; Wed, 30 Apr 2025 20:23:11 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: "H. Peter Anvin" , x86@kernel.org, Maxim Levitsky , Randy Dunlap , Paolo Bonzini , Will Deacon , Oliver Upton , Kunkun Jiang , Jing Zhang , Albert Ou , Keisuke Nishimura , Anup Patel , Catalin Marinas , Atish Patra , kvmarm@lists.linux.dev, Waiman Long , Boqun Feng , linux-arm-kernel@lists.infradead.org, Peter Zijlstra , Dave Hansen , Paul Walmsley , Suzuki K Poulose , Zenghui Yu , Sebastian Ott , Andre Przywara , Ingo Molnar , Alexandre Ghiti , Bjorn Helgaas , Palmer Dabbelt , Joey Gouly , Borislav Petkov , Sean Christopherson , Marc Zyngier , Alexander Potapenko , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Shusen Li , kvm-riscv@lists.infradead.org Subject: [PATCH v3 0/4] KVM: lockdep improvements Date: Wed, 30 Apr 2025 16:23:07 -0400 Message-ID: <20250430202311.364641-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250430_132340_958267_20387BF8 X-CRM114-Status: GOOD ( 11.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a continuation of my 'extract lock_all_vcpus/unlock_all_vcpus'=0D patch series.=0D =0D Implement the suggestion of using lockdep's "nest_lock" feature=0D when locking all KVM vCPUs by adding mutex_trylock_nest_lock() and=0D mutex_lock_killable_nest_lock() and use these functions in the=0D implementation of the=0D kvm_trylock_all_vcpus()/kvm_lock_all_vcpus()/kvm_unlock_all_vcpus().=0D =0D Those changes allow removal of a custom workaround that was needed to=0D silence the lockdep warning in the SEV code and also stop lockdep from=0D complaining in case of ARM and RISC-V code which doesn't include the above= =0D mentioned workaround.=0D =0D Finally, it's worth noting that this patch series removes a fair=0D amount of duplicate code by implementing the logic in one place.=0D =0D Best regards,=0D Maxim Levitsky=0D =0D Maxim Levitsky (4):=0D arm64: KVM: use mutex_trylock_nest_lock when locking all vCPUs=0D RISC-V: KVM: switch to kvm_lock/unlock_all_vcpus=0D locking/mutex: implement mutex_lock_killable_nest_lock=0D x86: KVM: SEV: implement kvm_lock_all_vcpus and use it=0D =0D arch/arm64/include/asm/kvm_host.h | 3 --=0D arch/arm64/kvm/arch_timer.c | 4 +-=0D arch/arm64/kvm/arm.c | 43 ----------------=0D arch/arm64/kvm/vgic/vgic-init.c | 4 +-=0D arch/arm64/kvm/vgic/vgic-its.c | 8 +--=0D arch/arm64/kvm/vgic/vgic-kvm-device.c | 12 ++---=0D arch/riscv/kvm/aia_device.c | 34 +------------=0D arch/x86/kvm/svm/sev.c | 72 ++-------------------------=0D include/linux/kvm_host.h | 4 ++=0D include/linux/mutex.h | 17 +++++--=0D kernel/locking/mutex.c | 7 +--=0D virt/kvm/kvm_main.c | 59 ++++++++++++++++++++++=0D 12 files changed, 100 insertions(+), 167 deletions(-)=0D =0D -- =0D 2.46.0=0D =0D