From patchwork Tue Feb 11 00:09:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 13969219 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27234524F for ; Tue, 11 Feb 2025 00:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739232580; cv=none; b=mbR62bn/ouc1RWE/d131/v3/JHTFRjyqfC+RrKSPXlXsIsPB9T/QmfjB6t8mfdLp/FrnJq6+1JK9i5HOw9ieG1DcFHep4UFQS7y8HOPdeE2AwKaynt3jtSWTbXqIKKDKqpudzRjehMy702E9tx1odnBalNYiu78xmUoW3SRqCJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739232580; c=relaxed/simple; bh=kbNjG86W9AzGPqRCEhKG6CUtamg2Jt2c0Ij/m45WACk=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=SGKZ64YB0bEJEb0Ezrx7RYSLvHSrzliVbsdLArvslc/0XjfleUuucXu+73eeFi/ec931/qMESAyECvvUn11ISLpmULrn8Pfh4X5Hr9QgHlhFOBFlWpwbuT6roW0Aru0ghUvs+f7MDwH0LPfq2xgC8UKtrG2L7JcGoY9bQ+xXStw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DIFBrd8V; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DIFBrd8V" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739232578; 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=jAgG5PbVpxfjPiUq1P9KoLaJMoVyaxTfP/N5PAh92BE=; b=DIFBrd8VCVe3PRLMA361fQe7g24Rg5pbHdrw7h6ewKAXCZZTMOs38eLSdJcYIsnBmp0aIE EQZ7fwqETKzfQIVQWF8/LS/CDm7gROKhChsnCB2o/bs66gs0hdFeUyIWG2NLjzp0vQS+G5 m0LdJEuHkFf3a3byN2n1YJ/Pm+FEJ/U= Received: from mx-prod-mc-05.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-450-4NLqzznmNha3XRZVRKy4uw-1; Mon, 10 Feb 2025 19:09:30 -0500 X-MC-Unique: 4NLqzznmNha3XRZVRKy4uw-1 X-Mimecast-MFC-AGG-ID: 4NLqzznmNha3XRZVRKy4uw Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BCD7B1956086; Tue, 11 Feb 2025 00:09:25 +0000 (UTC) Received: from starship.lan (unknown [10.22.65.174]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6AAFB19560A3; Tue, 11 Feb 2025 00:09:18 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Paolo Bonzini , Jing Zhang , Oliver Upton , linux-arm-kernel@lists.infradead.org, Marc Zyngier , linux-kernel@vger.kernel.org, Randy Dunlap , Suzuki K Poulose , Palmer Dabbelt , Zenghui Yu , kvm-riscv@lists.infradead.org, Ingo Molnar , linux-riscv@lists.infradead.org, Joey Gouly , Paul Walmsley , Maxim Levitsky , Thomas Gleixner , Bjorn Helgaas , Albert Ou , kvmarm@lists.linux.dev, Alexander Potapenko , x86@kernel.org, Sean Christopherson , Anup Patel , Kunkun Jiang , Atish Patra , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH 0/3] KVM: extract lock_all_vcpus/unlock_all_vcpus Date: Mon, 10 Feb 2025 19:09:14 -0500 Message-Id: <20250211000917.166856-1-mlevitsk@redhat.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Implement Paolo's suggestion of reusing sev_lock/unlock_vcpus_for_migration in arm and riscv code for the purpose of taking vcpu->mutex of all vcpus of a VM. Because sev_lock/unlock_vcpus_for_migration already have a workaround for lockdep max lock depth, this fixes the lockdep warnings on arm which were the inspiration for this refactoring. This patch series was only compile tested on all 3 architectures. Best regards, Maxim Levitsky Maxim Levitsky (3): KVM: x86: move sev_lock/unlock_vcpus_for_migration to kvm_main.c KVM: arm64: switch to using kvm_lock/unlock_all_vcpus RISC-V: KVM: switch to kvm_lock/unlock_all_vcpus arch/arm64/include/asm/kvm_host.h | 3 -- arch/arm64/kvm/arch_timer.c | 8 ++-- arch/arm64/kvm/arm.c | 32 ------------- arch/arm64/kvm/vgic/vgic-init.c | 11 +++-- arch/arm64/kvm/vgic/vgic-its.c | 18 +++---- arch/arm64/kvm/vgic/vgic-kvm-device.c | 21 ++++---- arch/riscv/kvm/aia_device.c | 36 ++------------ arch/x86/kvm/svm/sev.c | 65 ++----------------------- include/linux/kvm_host.h | 6 +++ virt/kvm/kvm_main.c | 69 +++++++++++++++++++++++++++ 10 files changed, 115 insertions(+), 154 deletions(-)