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 577A2C36002 for ; Wed, 9 Apr 2025 19:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=s+ypfC1LCMLzWKwAdspPvxKLwMnokYa8j+XZWh63ChI=; b=WT5MzMMRAEHiogWMm/6aN/LQeB lx8rmE1tAFeEOg2UKnjQ9249sGr789EOBBSjYc3xuwhzfdZIqNpOOdgKeAKFVxyKHUNaE2cf7Gqtp AjMQIte1wrOZH5FOLmmSTBcQ/5ETv0HZhSH7dMboVujTANA65dRudmtxtWJD1Hch/EwcVKbsGXNgh Yh3jbf+Hmz+6qUSLEQTr6kqNIyYnaoLogMw9mA0yGCPuvjILcerB+pDzwXDNLljIjKRXAWG/m/9RO Io3HWuNvxDQBe0RSON5Dv2J8Wg1hWKTbLNIqV0AjkL/YdUIUxWuWSAVk39VEHE21r+ZXub3x7TZY3 +s4vSDxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u2bUe-00000008MNv-3a1u; Wed, 09 Apr 2025 19:53:52 +0000 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u2bUc-00000008MLL-0nTc for linux-riscv@lists.infradead.org; Wed, 09 Apr 2025 19:53:51 +0000 Received: by mail-pf1-x44a.google.com with SMTP id d2e1a72fcca58-72f3b4c0305so16830b3a.0 for ; Wed, 09 Apr 2025 12:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1744228429; x=1744833229; darn=lists.infradead.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=B/LBm3aV4zfAmxi92/BK6RmsqnpaBnCdXpzKq52/Foc=; b=M+8Po/r2eDHj9Ljj+9u17dyGObnKIIy7KWFCJHDd+UaMYJ4vXjpTIwZ1uWwtnCNftN JJa54fhDWhOXiq+eOuQRkbhLHYB26dqu0/kcb5cs8pMs3WskroxgrP00V/wxZsa6Xa0Y 4p6C0RQVDETRIuLw3kH7QfUhGLUlzGlPK8yrtZCCplghhBS8GRLpJb2CMinQGLN7HX7I s0ro7u1WDjIax2AFudZ5kHQgT3u5IRMxokmAz5wFQqwqONDtHDYW4uDxsL9I+LopQCTl mv+2fzmfGJfRX0SfUwdV9Ig88ciwaf4HQokenOSZSFERiilc71Pb8d7a+O5XdQ/dEf0T Gsjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744228429; x=1744833229; 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=B/LBm3aV4zfAmxi92/BK6RmsqnpaBnCdXpzKq52/Foc=; b=wrpJTACqyuDFjU6+gRsi2M2u7o9FQVN+rkvTPiMcy79oDKnO+srU3ApNbtp+UNZVf/ oQ4pIJSWgMywnKFkHEo6aYQmw4p0aYpupwn4hCBEh9PNj+UZDHlvHpunBZ0Ge3WUl8CS yY28aNMUHPARAEGi6YWq1Zs9uaSDuL7o5+5zPSnq1C+glkNqB8eV6ZOtvLouK06CetE+ mCrQKv+H+H5vFug+RdQnwJPF2xWqxoKqlmh8EFMrTYZQViWUA1BLA7o83U1KGk8YLc93 OfV4IywoXf+gJLkn4tt9JKA0cDlB9pdhf3hpzZ/RrZBuY1yXt8fGaD8sQqz9XTE0ssXi b/LA== X-Forwarded-Encrypted: i=1; AJvYcCV0LPEm+Tb23Q0XpATiWZMo9oWgeMOCyolyzq6MkxcJJaXvYwKWFNTEMS9YcXxW3T2RwwSIg1b6y0sOzQ==@lists.infradead.org X-Gm-Message-State: AOJu0YygmhxSdW6C4lj5cmHi/furypIGVhkWFQtdyjqIioHL42sAdfHa GGlIYKYxG+mgxOOCV9Pbm8Nd6LrLjo0CHMFGTi/Xx7AF2kgMGX/eFcEhZ1WOUnyaoyUabyXbhxy KEA== X-Google-Smtp-Source: AGHT+IEeESm/upruWypiAiAFjj3gqiD2FWPZpn5Oi58JT7YjI+D2LtDvdvxhwdzcKYcXLoDvWUFBt/R8XtU= X-Received: from pfkq6.prod.google.com ([2002:a05:6a00:846:b0:737:6e43:8e34]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:130c:b0:736:bfc4:ef2c with SMTP id d2e1a72fcca58-73bbec49ac8mr221785b3a.0.1744228428902; Wed, 09 Apr 2025 12:53:48 -0700 (PDT) Date: Wed, 9 Apr 2025 12:53:47 -0700 In-Reply-To: <20250409014136.2816971-1-mlevitsk@redhat.com> Mime-Version: 1.0 References: <20250409014136.2816971-1-mlevitsk@redhat.com> Message-ID: Subject: Re: [PATCH v2 0/4] KVM: extract lock_all_vcpus/unlock_all_vcpus From: Sean Christopherson To: Maxim Levitsky Cc: kvm@vger.kernel.org, Alexander Potapenko , "H. Peter Anvin" , Suzuki K Poulose , kvm-riscv@lists.infradead.org, Oliver Upton , Dave Hansen , Jing Zhang , Waiman Long , x86@kernel.org, Kunkun Jiang , Boqun Feng , Anup Patel , Albert Ou , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Zenghui Yu , Borislav Petkov , Alexandre Ghiti , Keisuke Nishimura , Sebastian Ott , Paolo Bonzini , Atish Patra , Paul Walmsley , Randy Dunlap , Will Deacon , Palmer Dabbelt , linux-riscv@lists.infradead.org, Marc Zyngier , linux-arm-kernel@lists.infradead.org, Joey Gouly , Peter Zijlstra , Ingo Molnar , Andre Przywara , Thomas Gleixner , Catalin Marinas , Bjorn Helgaas , Adrian Hunter X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250409_125350_242459_ED25EFCD X-CRM114-Status: GOOD ( 16.60 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org +Adrian On Tue, Apr 08, 2025, Maxim Levitsky wrote: > Implement Paolo's suggestion of reusing Ha! I *knew* this felt familiar when I suggested extracting (un)lock_all_vcpus() to common code in the context of the TDX series. https://lore.kernel.org/all/Z-V0qyTn2bXdrPF7@google.com > 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. > > V2: added trylock option to kvm_lock_all_vcpus to be better compatible > with the orginal code. > > Best regards, > Maxim Levitsky > > Maxim Levitsky (4): > locking/mutex: implement mutex_trylock_nested > 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 | 4 +- > arch/arm64/kvm/arm.c | 43 ---------------- > arch/arm64/kvm/vgic/vgic-init.c | 4 +- > arch/arm64/kvm/vgic/vgic-its.c | 8 +-- > arch/arm64/kvm/vgic/vgic-kvm-device.c | 12 ++--- > arch/riscv/kvm/aia_device.c | 34 +------------ > arch/x86/kvm/svm/sev.c | 65 ++---------------------- > include/linux/kvm_host.h | 6 +++ > include/linux/mutex.h | 8 +++ > kernel/locking/mutex.c | 14 ++++-- > virt/kvm/kvm_main.c | 71 +++++++++++++++++++++++++++ > 12 files changed, 116 insertions(+), 156 deletions(-) > > -- > 2.26.3 > > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv