Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1258450rwi; Thu, 20 Oct 2022 10:21:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73v4S4lPMk6ze2dcvX3HE4Kx7nfT7dZ9VgUFeSXCMsHMwFXF16TBrzhiQ11gKTyinwUXLZ X-Received: by 2002:a17:907:c27:b0:791:81f2:f2b1 with SMTP id ga39-20020a1709070c2700b0079181f2f2b1mr12088471ejc.436.1666286504601; Thu, 20 Oct 2022 10:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666286504; cv=none; d=google.com; s=arc-20160816; b=UBJVKzwhodjbE+TWT0IfqUPQELz/SbzGFMn9wlmMrr5s1bTax/l/O0g2vnvQzF00sz eyMEIOtR6loxB4y4hFeG9Y8cq6tYDxZAihptRNEYI3zNVjRQ+AKHCTK8mLmc40jdIh63 4JW1MuT5WbUWlvIxjf9U2QRPLdAAjKTCTYflaMxgDWJh5/pQz04zfBEKlTWDO7+R2pw4 TCMpTCwcpvlzs6JCVORC1zcdiR20rE8JgRotAtebrvz/9Vav197gyZt2xUW3ei/N3VXj d0w2SX9zRqM/WF4UdATjHvryW4ikyd5oeZjkbepF5a/LhG8iYDTSysO+w5n14UW0IM6W IwJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=TUR9UP15QsroU59W9N2OvgMcXwfXPj1HigJZQ6HBl4s=; b=miWFrdsNS1WosGEydpSbv986LQPsLMsU4ekVkaT3a9AYwrEkYTCJRIXMwz3LN8Taa/ eArCNtVsPBJzl9RsVMf+PAV2cN890zJTx30LBtw+ir+Cu6pKGMXgLXVDjg/79LIsUTXm PFLKytDWACgxR7UV92bX75NQ6GwT2nV4s6YP4El/ug7QlkgL+pE0Nz7Gyic9NdzTalPl LmoT/VOuWWQvrM24fQaIU7UNuCBSuQ8I71K2Teh7NH+Opfn24XaSMaUzdJLkliNksHIJ ZA+yyFSeEDmLIIqRnwroiWRkwKzx1YqPLSPY0NIq2AqZUB4WVmkJDfB5cKdYyKtkveWS eoAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nYbt0LiN; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m22-20020a1709062ad600b0078e11e9286csi14013708eje.195.2022.10.20.10.21.18; Thu, 20 Oct 2022 10:21:44 -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=@gmail.com header.s=20210112 header.b=nYbt0LiN; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbiJTRNz (ORCPT + 99 others); Thu, 20 Oct 2022 13:13:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbiJTRNi (ORCPT ); Thu, 20 Oct 2022 13:13:38 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18F001A910B; Thu, 20 Oct 2022 10:13:37 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id bk15so35724579wrb.13; Thu, 20 Oct 2022 10:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TUR9UP15QsroU59W9N2OvgMcXwfXPj1HigJZQ6HBl4s=; b=nYbt0LiN2JHu2xyzaE3qLJP8Oh7Rzry1IfknyRHx7vYRnQZwjn1ifPrJaTyN8tu7Em FXOJXL8JuEA6M0GUVfFPuI9rX8dl8hmCXcFWXWOHEnDmcs8NL1C4IFmcg1uRq3HQg8eL lxiARDBtWJ6llNb4RaV7mXfCn9xPIOThgQRTtxd13RdQlfRk28ozCXqZnfhAZ6IraMig BNUJXtdF5ZKWy8hdf6ShDBY/HUDEuy4uLqKu3rcXZ0tB5M1HsPkXx2Fs3ESEP/IY21b1 bH0mgt2jp/GlRVcrf+iVsJjkN1dukXli8ayi6k3zgca6a8QQBCNXjymXY0p7PLUEMoTe fqng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TUR9UP15QsroU59W9N2OvgMcXwfXPj1HigJZQ6HBl4s=; b=UwYDFwvfHINyr7MTq6QsQFNLSXcqCD9gzGNoBZoMiNAcGwyTLKeKfV+XUE4oDvDuiV 5Q6jtvO1nKVN4QOlzMAERCkR1CmE+c/svEpenISsUL5EtfQ8eWXW859IVQ/lU5s3yYwp pxN2mgLYNd86yJzfZ8zexIxQeCtG5AlY226vzl9XfT5GdVJqAnO6TZ8AajWPCAgNTubi kuSBa4fDI/JTuJUoFX5DYXY2cRBwgf256TSSHVT7JmrdL/5I74OVJwfb6PIjI+J96r4U XjKCU9t8/S3fZDo38XKPYiIK4ddUyLnUfDI5J06WNkfEe26iEV087Q9eYpY9Lu50oHCI 9CCw== X-Gm-Message-State: ACrzQf1mp/s0gmWIuaGvDOJ1v80QAD/T2etNUyD6Vi2TRpBtPJuM9B5h BhdUOYNjwoPH8uO0UmaiukktMk8By3A= X-Received: by 2002:a5d:4e4b:0:b0:22e:47b3:6b5d with SMTP id r11-20020a5d4e4b000000b0022e47b36b5dmr9408377wrt.443.1666286015593; Thu, 20 Oct 2022 10:13:35 -0700 (PDT) Received: from ?IPV6:2a02:1811:cc83:eef0:7bf1:a0f8:a9aa:ac98? (ptr-dtfv0pmq82wc9dcpm6w.18120a2.ip6.access.telenet.be. [2a02:1811:cc83:eef0:7bf1:a0f8:a9aa:ac98]) by smtp.gmail.com with ESMTPSA id z23-20020a1cf417000000b003c6b874a0dfsm221022wma.14.2022.10.20.10.13.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Oct 2022 10:13:34 -0700 (PDT) Message-ID: <6e038fa4-563a-2690-2a62-b92df117714a@gmail.com> Date: Thu, 20 Oct 2022 19:13:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [BUG] infiniband: sw: rdmavt: possible ABBA deadlocks in rvt_ruc_loopback() Content-Language: en-US To: Jia-Ju Bai , dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca, Leon Romanovsky Cc: linux-rdma@vger.kernel.org, linux-kernel References: From: Niels Dossche In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 On 20/10/2022 15:37, Jia-Ju Bai wrote: > Hello, > > My static analysis tool reports several possible ABBA deadlock in the rdmavt driver in Linux 5.18: > > rvt_ruc_loopback() >   spin_lock_irqsave(&sqp->s_lock, flags); --> Line 3190 (Lock A) >   spin_lock(&sqp->r_lock); --> Line 3195 (Lock B) > > rvt_qp_mr_clean() >   spin_lock_irq(&qp->r_lock); --> Line 698 (Lock B) >   spin_lock(&qp->s_lock); --> Line 700 (Lock A) > > rvt_rc_timeout() >   spin_lock_irqsave(&qp->r_lock, flags); --> Line 2595 (Lock B) >   spin_lock(&qp->s_lock); --> Line 2596 (Lock A) > > rvt_modify_qp() >   spin_lock_irq(&qp->r_lock); --> Line 1419 (Lock B) >   spin_lock(&qp->s_lock); --> Line 1421(Lock A) > > _rvt_reset_qp() >   spin_lock_irq(&qp->r_lock); --> Line 907 (Lock B) >   spin_lock(&qp->s_lock); --> Line 909 (Lock A) > > rvt_reset_qp() >   spin_lock_irq(&qp->r_lock); --> Line 936 (Lock B) >   spin_lock(&qp->s_lock); --> Line 938 (Lock A) > > When rvt_ruc_loopback() is concurrently executed with rvt_qp_mr_clean(), rvt_rc_timeout(), rvt_modify_qp(), _rvt_reset_qp() or rvt_reset_qp(), the deadlocks can occur. > > I am not quite sure whether these possible deadlocks are real and how to fix them if real. > Any feedback would be appreciated, thanks :) > > Reported-by: TOTE Robot > > > Best wishes, > Jia-Ju Bai Hi I don't know whether this deadlock is real or not, but I wrote the offending code. If it's a real bug, I'm sorry about that. If that's the case the bug is also present in 2 other places of rvt_ruc_loopback() in v5.19+: 1) spin_lock_irqsave(&sqp->s_lock, flags); --> Line 3133 spin_lock(&sqp->r_lock); --> Line 3137 2) spin_lock_irqsave(&sqp->s_lock, flags); --> Line 3192 spin_lock(&sqp->r_lock); --> Line 3193 Kind regards Niels