From patchwork Fri Jan 13 12:46:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 3984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp255687wrt; Fri, 13 Jan 2023 05:03:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXtUw0PCpYqOePycCF0edBVa1/1NfODwjdFdYJHpW5mWvSXcLlaRMjGrxA/JpsIbTrF1CHsu X-Received: by 2002:a17:902:c497:b0:193:3845:de53 with SMTP id n23-20020a170902c49700b001933845de53mr18797246plx.39.1673615009930; Fri, 13 Jan 2023 05:03:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673615009; cv=none; d=google.com; s=arc-20160816; b=Bs+4zt0FkNiji847Lh9qFee+oBm4XdyVRtKYmRPpplFkzHtjRd/QkhXvdEnG3AOwaJ N7oG76glWtCZUkPQ5AOa4TLmjGfHC5Q6Sr8ylJvbCkOs2LdW66O+4eAyhYSZ25gIcxJW +8DOzBF8mPgCefSUOXQ59O+tWsdx26acrGwue/FY0GDdaqmyy/BDD2waVTE3vSMxiIAL IeDXMamF/1agt0QDpanmRVyaAV5cf11z7lZSyyja8qxiIt8HNlKZpmkdyFTL5QyLxvX7 ocFbrCZPmXxv4Qf0/2j1PXeIHA9gH+TjRm/gwyILMuwTHDk7GVkffdXrLMBxx7JsVuNO Y25g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C0qkmIIYhEbiaW9/bOLbh+d/v5T/bpSDifdQxL7LFD8=; b=p7p7EAlwQQwsoqcu7GLxsGGIxyu3JchC9LUq7NjwsRGsoTOh1w7NmRH5OVSTzHFO8I VDiqtuzEnVDbGyW5lpT334BSfOuTFklOpZ7ey9mf0P6jzKQrFIPcJ7rCbxu9L/9oaEXQ 5WW56fhuSO+wDxw/2SOxgo6XqOjBxGXviosxReZM3DF4vXaJEofroPl6Wn5kwOsT2L2u X7n+CL/0Liimi/GGPUN9t5x4PrPSeKma5DMYpzEOrcyb7wUNIGq2fz6hnfdTcAoyAFsd QyDehskfpKGzh+HN62Ne9jDlBDtimBQXv6lKPNFeZy92vudlF0d6jWaVTYKjfMlqdHwB 2M1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=jX9nDGqf; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c14-20020a170903234e00b0017a0e7aaf6bsi21768018plh.128.2023.01.13.05.03.13; Fri, 13 Jan 2023 05:03:29 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=jX9nDGqf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238700AbjAMNBL (ORCPT + 99 others); Fri, 13 Jan 2023 08:01:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233153AbjAMNAZ (ORCPT ); Fri, 13 Jan 2023 08:00:25 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2144E87906; Fri, 13 Jan 2023 04:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=C0qkmIIYhEbiaW9/bOLbh+d/v5T/bpSDifdQxL7LFD8=; b=jX9nDGqf5PZ/nbe/w10V/E4iWF m0IGq/C+6Aow/l3c0NQi/iYOqr9QT18u/TzIJpjIPiXobaOVk5GJjQIIVsA5G6vBxSQUSZqXC5mWU gT+sTwOXvUmyMn9CEMnxNJlygno+m7C8tmzXsSEUgzcPcWbp+RBD+leGGqUoPJih7dSpredPYdY2N T04xhwPbrUYYmLyzzEmkOlbURgT1anPGPDe2c3eolRztUT+RfVUOzXUIsM/2mnXGNTj1/Y4HhBPr8 LXHUSY5w4DGmpZsd5quhb8rK2axOoNSyMYicRy8oRflEwXnn1MUEoyFpgwNDNm7qG8gGXu/0/KFjG 7MqhlK7A==; Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGJRy-0065y2-TV; Fri, 13 Jan 2023 12:46:27 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGJRl-0002jg-El; Fri, 13 Jan 2023 12:46:13 +0000 From: David Woodhouse To: Boqun Feng , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, kvm@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Lai Jiangshan , "Paul E . McKenney" , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , David Woodhouse , Paolo Bonzini , seanjc@google.com, Joel Fernandes , Matthew Wilcox , Michal Luczaj Subject: [PATCH 0/3] KVM: Make use of SRCU deadlock detection support Date: Fri, 13 Jan 2023 12:46:03 +0000 Message-Id: <20230113124606.10221-1-dwmw2@infradead.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230113065955.815667-1-boqun.feng@gmail.com> References: <20230113065955.815667-1-boqun.feng@gmail.com> MIME-Version: 1.0 Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754912533007441401?= X-GMAIL-MSGID: =?utf-8?q?1754912533007441401?= On Thu, 2023-01-12 at 22:59 -0800, Boqun Feng wrote: > This is actually a leftover of the recursive read deadlock detection > patchset: > > https://lore.kernel.org/lkml/20180411135647.21496-1-boqun.feng@gmail.com/ > > I resolve comments then and add more test cases, and hopefully this can > fulfill the request from KVM: > > https://lore.kernel.org/lkml/a14a13a690277d4cc95a4b26aa2d9a4d9b392a74.camel@infradead.org/ > > ;-) It definitely seems to work; thank you! I can revert some of the recent fixes from the KVM tree, apply your patches, and then I can trigger the lockdep warnings. To make it reliably trigger, we need to artificially call synchronize_srcu(&kvm->srcu) under kvm->lock on KVM init, because the circumstances under which that happens are a bit esoteric and don't always happen otherwise, so lockdep wouldn't notice. > The patch #3 is now WIP for two reasons: > > * It may conflicts with Paul's patchset on removing CONFIG_SRCU > > * I haven't found a proper way to "reinit" srcu_struct when > lockdep selftest runs: cleanup_srcu_struct() needs workqueue > however the tests can run before there is one. Understood. I think the KVM series which follows can stand alone and go via the KVM tree separately. As and when your series gets merged, it'll serve to protect against regressions. Thanks again! David Woodhouse (3): KVM: Show lockdep the kvm->mutex vs. kvm->srcu ordering rule KVM: selftests: Use enum for test numbers in xen_shinfo_test KVM: selftests: Add EVTCHNOP_send slow path test to xen_shinfo_test .../testing/selftests/kvm/x86_64/xen_shinfo_test.c | 165 ++++++++++++++------- virt/kvm/kvm_main.c | 10 ++ 2 files changed, 124 insertions(+), 51 deletions(-)