Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2887064ioo; Tue, 24 May 2022 08:07:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoNnhArqimgiTDfzGYxNQViuowqA0FGzeLvXlXPhMYfVnN1KLuu2vrgD+NBGSa+65FEh8X X-Received: by 2002:aa7:cad4:0:b0:428:715f:5ce4 with SMTP id l20-20020aa7cad4000000b00428715f5ce4mr30369505edt.124.1653404840113; Tue, 24 May 2022 08:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653404840; cv=none; d=google.com; s=arc-20160816; b=bX1WqI8MkjuCeoBUXRQ2EJgAuQUYaoYwnxc6Jc1ZV8JVCj2Tk559iGotWOuJyTXW5f 3cVaMnJCzrQGcN3TWud71m9C4QxWlL1zQ05/rJHm6VjXEzmTSfS73njXNyFHexO4zQzw lKC/TVDl/CktYsnUlzHl8vDnvKPbCvCRvimOamL+Ibngoteah99NkRusuPCC1FiaZYuq yBJ+xbsgcxgp4gYsRZ8sxPqZALMzzMDQ38Sphdvt5lQ5FJxFcmueFXbHblqnbRXCQTk8 QGVMRzQ7V1NaqBTlXQILnPQQDIwQ1JPBMm/BOjFgMOZf+hzpbBGENTs9d+DsmhT6IwKe MHcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date; bh=OCuuuaXcOE9MCtyhC8rc0d2zyX2BV9JfYjDzYlsoMps=; b=d1OsM4H2dZVDVH7oKj2uJyL7fzjzF2xqy5Gs7uD2IcwMRZVfHUKMiDIIqX4rOHfBiI P9ZFt9N/THi8wibaecjZCYSW048czrw6bsg0QBiOsfBsZKPnjdN6Iq8p6U94PoEFahaK BHxGFXDJgIVGesB2S6cK0K8mjQt5AHHV8rb+7sWjb5qPs1A5ZNJkytW8Z36zkPGh57cr hgk+sVyG78yngaRL2N6wFuhKTJregWh8k2kfZFDctj0nH8j2H5YU0zRSYiat4fOfyolI 0vyvjyAdcBA4RhR7YcESbgKaGcefD1v+JqjtMSRj9btSczmdWYq+EzIEsIFg9KHDCdSN vARg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs32-20020a1709073ea000b006e8439b41d1si3993692ejc.69.2022.05.24.08.06.53; Tue, 24 May 2022 08:07:20 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233987AbiEXLoa (ORCPT + 99 others); Tue, 24 May 2022 07:44:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234556AbiEXLoQ (ORCPT ); Tue, 24 May 2022 07:44:16 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CA8D1209F; Tue, 24 May 2022 04:43:53 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R471e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=tonylu@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VEHxxv7_1653392624; Received: from localhost(mailfrom:tonylu@linux.alibaba.com fp:SMTPD_---0VEHxxv7_1653392624) by smtp.aliyun-inc.com(127.0.0.1); Tue, 24 May 2022 19:43:45 +0800 Date: Tue, 24 May 2022 19:43:44 +0800 From: Tony Lu To: liuyacan@corp.netease.com Cc: kgraul@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, ubraun@linux.ibm.com Subject: Re: [PATCH v2 net] net/smc: postpone sk_refcnt increment in connect() Message-ID: Reply-To: Tony Lu References: <20220523152119.406443-1-liuyacan@corp.netease.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220523152119.406443-1-liuyacan@corp.netease.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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 Mon, May 23, 2022 at 11:21:19PM +0800, liuyacan@corp.netease.com wrote: > > >> This is a rather unusual problem that can come up when fallback=true BEFORE smc_connect() > > >> is called. But nevertheless, it is a problem. > > >> > > >> Right now I am not sure if it is okay when we NOT hold a ref to smc->sk during all fallback > > >> processing. This change also conflicts with a patch that is already on net-next (3aba1030). > > > > > > Do you mean put the ref to smc->sk during all fallback processing unconditionally and remove > > > the fallback branch sock_put() in __smc_release()? > > > > What I had in mind was to eventually call sock_put() in __smc_release() even if sk->sk_state == SMC_INIT > > (currently the extra check in the if() for sk->sk_state != SMC_INIT prevents the sock_put()), but only > > when it is sure that we actually reached the sock_hold() in smc_connect() before. > > > > But maybe we find out that the sock_hold() is not needed for fallback sockets, I don't know... > > I do think the sock_hold()/sock_put() for smc->sk is a bit complicated, Emm, I'm not sure if it > can be simplified.. > > In fact, I'm sure there must be another ref count issue in my environment,but I haven't caught it yet. I am wondering the issue of this ref count. If it is convenient, would you like to provide some more details? syzkaller has reported some issues about ref count, but syzkaller and others' bot don't have RDMA devices, they cannot cover most of the code routines in SMC. We are working on it to provide SMC fuzz test with RDMA environment. So it's very nice to have real world issues. Thanks, Tony Lu