Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp820283pxp; Wed, 16 Mar 2022 18:07:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZcxuvwlJ0Lh9cHZapf/aG3APLLAvKw8R8oOp1Xf/c68tjafXpLwmPd8KX/LBrGdlzoMN5 X-Received: by 2002:a17:903:2303:b0:151:d3dc:42b3 with SMTP id d3-20020a170903230300b00151d3dc42b3mr2581742plh.85.1647479219864; Wed, 16 Mar 2022 18:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647479219; cv=none; d=google.com; s=arc-20160816; b=Q8hQfNLRrXKD2WkzjTXaU0/VHU96druvHu1RWOh0eEuim1Yk1A5g4j0sV86prQT1xW ahnxPbes/wtTeacWJgCMgPituMfQURQpOBHh9kAyA8/o0vg5IJF5yAknKEA3jvJoVkQJ AGIRwcsmacduz/eNKjDrwT2mMHOXUyMF2IBFyWuunprI3154+9NF67kFMgfa978LiM3Z o0ISas/8qCu4OvoFsB5fTWfOf0qmCztfFHLdomqrUtyn6Hwmv+XMH6prvE2uspIa1B4x UfW6dd5BSAA8BdhbL28PvtCh2wcCGoCD32IiT2WtFleDF9/M2lynSYPSh6Hg03/jVzDg wsKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6zqmSaU2i0N91cisXnU2OuscLbRCfl4vlkwZBWSUukQ=; b=IWnw+3dvV1zf85GyrFREiNzGRPBTG9l+IbgrBbRk7Bkyp08NAge0IYkAJ8cAQc3GUq O9QPml8NFuIKj1WLYZCvlXyBSiZdSmPNDc2+9Y1O1uuuWuYZMBroeU0H9Ht8pdK8DFto 2vqHTLOj78NqkQ6ef7PscitkaxXgkS6vYfsAxo9WIdkofEX+0MsEVf9wyxZdn3/3yth/ ZJrBcwQOW7b4IKKFuIwbricY2+opp6Hx5XrZRovxuOadZOZpsHNNFdpQQY/NxQWztdpY d5N+m5CZKSrmCP7qEMDzRwYcFoi9SX8DbU6tHlPfhtGlaDXqencaDa/Hrjk8abMg4rJ6 eteQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zq1rmjIZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a170903120c00b001534723bb26si3772264plh.286.2022.03.16.18.06.45; Wed, 16 Mar 2022 18:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zq1rmjIZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242075AbiCNMSo (ORCPT + 99 others); Mon, 14 Mar 2022 08:18:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242366AbiCNMJy (ORCPT ); Mon, 14 Mar 2022 08:09:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE0312AE8; Mon, 14 Mar 2022 05:07:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D5F5B80DEC; Mon, 14 Mar 2022 12:07:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9F5CC340E9; Mon, 14 Mar 2022 12:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259642; bh=PCVEu3eBNh+zp+MeS63pTC8Ozt4hBZwD3A1YpjUvigg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zq1rmjIZ0gH7AA75eoSVYS3BrOrOFlYRwHn9gMGQD2FyXjxmGkR6thgTm8XnLStPh XqtXPZkZZhHACDcH5QZagBRydeePNrmXwIIa8GZREsETdxlKgwjlp3FQeKn8ZjQbte 0Ppizt+dUvTUjyMIaO3ggM21Bb2fpKlfmQ+LVy1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wanpeng Li , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 056/110] KVM: Fix lockdep false negative during host resume Date: Mon, 14 Mar 2022 12:53:58 +0100 Message-Id: <20220314112744.599617078@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112743.029192918@linuxfoundation.org> References: <20220314112743.029192918@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wanpeng Li [ Upstream commit 4cb9a998b1ce25fad74a82f5a5c45a4ef40de337 ] I saw the below splatting after the host suspended and resumed. WARNING: CPU: 0 PID: 2943 at kvm/arch/x86/kvm/../../../virt/kvm/kvm_main.c:5531 kvm_resume+0x2c/0x30 [kvm] CPU: 0 PID: 2943 Comm: step_after_susp Tainted: G W IOE 5.17.0-rc3+ #4 RIP: 0010:kvm_resume+0x2c/0x30 [kvm] Call Trace: syscore_resume+0x90/0x340 suspend_devices_and_enter+0xaee/0xe90 pm_suspend.cold+0x36b/0x3c2 state_store+0x82/0xf0 kernfs_fop_write_iter+0x1b6/0x260 new_sync_write+0x258/0x370 vfs_write+0x33f/0x510 ksys_write+0xc9/0x160 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae lockdep_is_held() can return -1 when lockdep is disabled which triggers this warning. Let's use lockdep_assert_not_held() which can detect incorrect calls while holding a lock and it also avoids false negatives when lockdep is disabled. Signed-off-by: Wanpeng Li Message-Id: <1644920142-81249-1-git-send-email-wanpengli@tencent.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- virt/kvm/kvm_main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index f8b42e19bc77..fcceb8443aa9 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -5417,9 +5417,7 @@ static int kvm_suspend(void) static void kvm_resume(void) { if (kvm_usage_count) { -#ifdef CONFIG_LOCKDEP - WARN_ON(lockdep_is_held(&kvm_count_lock)); -#endif + lockdep_assert_not_held(&kvm_count_lock); hardware_enable_nolock(NULL); } } -- 2.34.1