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 E1063C52D7C for ; Fri, 9 Aug 2024 18:06:53 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pz2evepGO64BL8beVTJ2lT3wejzMqrFi7TquISVjiq8=; b=yzoH+s0v1zg2NOeLUYyAQ+OfT7 cvGvAgIXV3U4FnLhxYTztJHQ4sTnzlxweZMQq3rKbcBuGDpJqM3Yl8HPQiw4hzptCCKnxboh/hBX/ utsg6i/F7QseMhryMp2oVofHdAY46Asnv4u9DtTDQ0SWJteEWP8sB56m8dsJXLvQzm/ZQQ/XnvZQ6 O4D3N6IYeDMk5XJtjDVEcjzhb+nl3vmmU8ZSjIlqfFFI75jPJ9mec2x1GIGWwH3c4YZSJ/5/lQpsU eQV1d9EpZYN+Ph5IvziAYPnA/GqFAWdinpqgfPJozSt7Ky1oxJPbxfVy8wKJ26Or1WehJDPXbta5f qo/aqtcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scU0b-0000000C9h8-1U9i; Fri, 09 Aug 2024 18:06:37 +0000 Received: from out-188.mta1.migadu.com ([95.215.58.188]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scU00-0000000C9YX-27MO for linux-arm-kernel@lists.infradead.org; Fri, 09 Aug 2024 18:06:02 +0000 Date: Fri, 9 Aug 2024 11:05:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723226754; 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: in-reply-to:in-reply-to:references:references; bh=pz2evepGO64BL8beVTJ2lT3wejzMqrFi7TquISVjiq8=; b=FMXJs3rOce+8GZCfDadeI/GvLRLkTHqGt5e63ZIf2YwlugietLLi9xMy49CG+s0/F2Z8k2 Sx2Mr6D4TZABXNuK4lzARakfklVZR7vnVC2ms+9YZ6PhJdA3eyRygSOjbtU3IHoAeoQWgX 2NDuA5kkMb0sbtzE10RUStj0pazoDPs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Sean Christopherson Cc: Marc Zyngier , Paolo Bonzini , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Steve Rutherford Subject: Re: [PATCH 2/2] KVM: Protect vCPU's "last run PID" with rwlock, not RCU Message-ID: References: <20240802200136.329973-1-seanjc@google.com> <20240802200136.329973-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240809_110600_709945_042F9471 X-CRM114-Status: GOOD ( 10.85 ) 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 On Tue, Aug 06, 2024 at 04:59:03PM -0700, Sean Christopherson wrote: > > Can you nest this lock inside of the vcpu->mutex acquisition in > > kvm_vm_ioctl_create_vcpu() so lockdep gets the picture? > > I don't think that's necessary. Commit 42a90008f890 ("KVM: Ensure lockdep knows > about kvm->lock vs. vcpu->mutex ordering rule") added the lock+unlock in > kvm_vm_ioctl_create_vcpu() purely because actually taking vcpu->mutex inside > kvm->lock is rare, i.e. lockdep would be unable to detect issues except for very > specific VM types hitting very specific flows. I don't think the perceived rarity matters at all w/ this. Beyond the lockdep benefits, it is a self-documenting way to describe lock ordering. Dunno about you, but I haven't kept up with locking.rst at all :) Having said that, an inversion would still be *very* obvious, as it would be trying to grab a mutex while holding a spinlock... -- Thanks, Oliver