Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp750390rwe; Fri, 14 Apr 2023 09:13:33 -0700 (PDT) X-Google-Smtp-Source: AKy350ZeCbWLEtRAe4rJHBZtRvjBKfV3bJJFYI79Y8V1wXImnS19UCZtz74Wf1DJbaFEuNip5oBg X-Received: by 2002:a17:902:da8f:b0:1a6:9794:a4 with SMTP id j15-20020a170902da8f00b001a6979400a4mr4217378plx.63.1681488812771; Fri, 14 Apr 2023 09:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681488812; cv=none; d=google.com; s=arc-20160816; b=u07OVp1V0fSlpSieRI6AR6/wfftdilUnLEzWvhQ3fUJCb9EjbOZRMIyhLcuYiG4vtv 5w1xRunKJtdqRaEKTZYLr7A05padZAjewY13dYdFB3hvZBnnAxA+I9QpryD8rxFQUWHZ r/ViL7VJM8GAqXqp1Q0T8DR9sJMTn5Wh3lNd3dmk4T8hLKvROJgB7vZPcwJmkHtVudkX HJUQqXxl3wlom1AXvhZxzdzmk2Bu1Ln/qlWGH78CzM+dYbZrf0U7ex8ymCxwgbgTVeW8 eOXfLeW8eSUQJ4giPJsmcBIBmmF/7hgIwUOgMq5WcqV5J1EmC3QqJfSxGMd3VdkbvLMV YdcA== 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:subject:mime-version:date:dkim-signature :message-id; bh=DpTXmit1ejSE9AiqoGnb66tLFIsHtNr5bViuZsAYkAc=; b=w8KHKyNSt5qyb2QGCFDoSdfFNbuFfA+ah0+jMHQXLVLWZi9P9UlqOe45CZyVF+ecAJ BkN9iOuzHQnOUz/SPSHFP8PaEc9YfF/mvsFDxmZ06Qk0W0VjMKXME9onmLakyOFuqcf7 h+BEmQ7aBtNQcQznsTLTBe2HnYM+bbJrf1X2Knw+UXUrkOFaa62ZhWvWVtjQhBvmG8KL 1LO5Ad7P8SjFjNlvZoTLAZpAQfkSe8ouXDkOrVHHFhxwiv4SZks96XLV3kqYUfaC7QLN VT5ECY3AmNnVFcCg2lgQ4Hw7cQ7A3G2fu42iKSC/UUN6KJCH0M5VROFSXCkvleZ7mBKU oF/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=nDszz0ZE; 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=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a170902900100b001a0a44fa597si4894796plp.109.2023.04.14.09.12.53; Fri, 14 Apr 2023 09:13:32 -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=@linux.dev header.s=key1 header.b=nDszz0ZE; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbjDNQGP (ORCPT + 99 others); Fri, 14 Apr 2023 12:06:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbjDNQGN (ORCPT ); Fri, 14 Apr 2023 12:06:13 -0400 X-Greylist: delayed 442 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 14 Apr 2023 09:05:57 PDT Received: from out-57.mta1.migadu.com (out-57.mta1.migadu.com [IPv6:2001:41d0:203:375::39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE74B453 for ; Fri, 14 Apr 2023 09:05:57 -0700 (PDT) Message-ID: <4d1cacbf-f9b2-07c7-75bf-61f34abc1841@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1681487913; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DpTXmit1ejSE9AiqoGnb66tLFIsHtNr5bViuZsAYkAc=; b=nDszz0ZEH77cLMMPj6z6O2CrJFYAzr1sK7tHNTQ/oyEPIooAnIuuYUbuiZs1iCd53D/1xM KXLWDMIwdnU7VbpmRlufelV+DTsO98xWmiyghnL+pUZwV8jnaaKHfkiwkQ9hbwj1Cyx8X2 1FGfqpjvZ9MB0FC0CO+LyypDjwih71M= Date: Fri, 14 Apr 2023 23:58:26 +0800 MIME-Version: 1.0 Subject: Re: [PATCH for-next 2/3] RDMA/rtrs: Fix rxe_dealloc_pd warning To: Leon Romanovsky , "Zhijian Li (Fujitsu)" Cc: Guoqing Jiang , "haris.iqbal@ionos.com" , "jinpu.wang@ionos.com" , "jgg@ziepe.ca" , "linux-rdma@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <1681108984-2-1-git-send-email-lizhijian@fujitsu.com> <1681108984-2-3-git-send-email-lizhijian@fujitsu.com> <20230410120809.GN182481@unreal> <0d9c57db-bca3-adb4-71fd-7362e4842917@linux.dev> <85323eb2-cfc7-d1b8-3a75-3fa63dde29db@fujitsu.com> <20230411122651.GV182481@unreal> <8fe62e38-e43d-3d6c-624f-1c8ce5859788@linux.dev> <20230413132418.GR17993@unreal> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: <20230413132418.GR17993@unreal> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 在 2023/4/13 21:24, Leon Romanovsky 写道: > On Thu, Apr 13, 2023 at 08:12:15AM +0000, Zhijian Li (Fujitsu) wrote: >> >> >> On 13/04/2023 15:35, Guoqing Jiang wrote: >>> Hi, >>> >>> I take a closer look today. >>> >>> On 4/12/23 09:15, Zhijian Li (Fujitsu) wrote: >>>> >>>> On 11/04/2023 20:26, Leon Romanovsky wrote: >>>>> On Tue, Apr 11, 2023 at 02:43:46AM +0000, Zhijian Li (Fujitsu) wrote: >>>>>> >>>>>> On 10/04/2023 21:10, Guoqing Jiang wrote: >>>>>>> >>>>>>> On 4/10/23 20:08, Leon Romanovsky wrote: >>>>>>>> On Mon, Apr 10, 2023 at 06:43:03AM +0000, Li Zhijian wrote: >>>>>>>>> The warning occurs when destroying PD whose reference count is not zero. >>>>>>>>> >>>>>>>>> Precodition: clt_path->s.con_num is 2. >>>>>>>>> So 2 cm connection will be created as below: >>>>>>>>> CPU0                                              CPU1 >>>>>>>>> init_conns {                              | >>>>>>>>>      create_cm() // a. con[0] created        | >>>>>>>>>                                              |  a'. rtrs_clt_rdma_cm_handler() { >>>>>>>>>                                              |    rtrs_rdma_addr_resolved() >>>>>>>>>                                              |      create_con_cq_qp(con); << con[0] >>>>>>>>>                                              |  } >>>>>>>>>                                              | in this moment, refcnt of PD was increased to 2+ >>> >>> What do you mean "refcnt of PD"? usecnt in struct ib_pd or dev_ref. >> >> I mean usecnt in struct ib_pd >> >> >> >>> >>>>>>>>>                                              | >>>>>>>>>      create_cm() // b. cid = 1, failed       | >>>>>>>>>        destroy_con_cq_qp()                   | >>>>>>>>>          rtrs_ib_dev_put()                   | >>>>>>>>>            dev_free()                        | >>>>>>>>>              ib_dealloc_pd(dev->ib_pd) << PD | >>>>>>>>>               is destroyed, but refcnt is    | >>>>>>>>>               still greater than 0           | >>> >>> Assuming you mean "pd->usecnt". We only allocate pd in con[0] by rtrs_ib_dev_find_or_add, >>> if con[1] failed to create cm, then alloc_path_reqs -> ib_alloc_mr -> atomic_inc(&pd->usecnt) >>> can't be triggered. Is there other places could increase the refcnt? >> >> >> Yes, when create a qp, it will also associate to this PD, that also mean refcnt of PD will be increased. >> >> When con[0](create_con_cq_qp) succeeded, refcnt of PD will be 2. and then when con[1] failed, since >> QP didn't create, refcnt of PD is still 2. con[1]'s cleanup will destroy the PD(ib_dealloc_pd) since dev_ref = 1, after that its >> refcnt is still 1. > > Why is refcnt 1 in con[1] destruction phase? It seems to me like a bug. Agree. We should find out why refcnt 1 and fix this problem. Zhu Yanjun > > Thanks