Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1206963imm; Fri, 15 Jun 2018 13:01:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKt1MCtP9bGBx3/yAu9QPQkhor8if4dt7H9+xCK3a58Q/cIL7VDbwmCTOXBEWeALn/ozApK X-Received: by 2002:a62:4e07:: with SMTP id c7-v6mr3426533pfb.149.1529092886042; Fri, 15 Jun 2018 13:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529092886; cv=none; d=google.com; s=arc-20160816; b=Cs4bssuLuKMGQZpsB4OFH1q16HtXpF7IkkzYd+J31qZhLs0jER10dHb2jY+yCaQ8AE qIQ5uS+vd0y/KKO3g43gVsTQaIAU81f4LTNThariemsbfpA2rrcAux5VjqoDqZrqFvIK jlMeMUwyHdA4fRUolh4plTNCmGHp2HoEckAifVkNuPaTUqKy3dPVOxayX0wZqxlEPQF7 vB0ZT6Y6Gmn4HRhNpSH+J4kUMCHoNJNjKickLURRwRvdbDz20V046HIwCDbff/POMgfB fESdOb3oUxjNGL+d33y1HRUMQJ5no6lhCEK4bH6/YHnagnJHJbPZXv6OJW/9+nA8MnUK imsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:arc-authentication-results; bh=2g4V/bDjtpbOP5Ey/jCinoP2f/Ewie5j1Y1PxWy8ytI=; b=Dw/bxaR8vT4QEScq8ro9127G3YAs72suewocdT6xV/ziwxOgkyk5pYW5VO+wkhhUL3 d7O3L23TqdaUGdM0dIp9ApooxfBVU6aad0gwNk3HvI8DFPikheGoa0YydRyGJ6GEgMKB yYWtYcnYRjjNUtQyBnvO9vfRx4mNfbvBdlo2FCWAwQRGpYHBnS5i+6copK0ILPNvMwwJ n9UyLa38rN64AHXW4Gv7LfSdBDlx4l2+IzStN8SiBnC7B0rkHdh/CQSzgm9KqBxoeaFM 61M/cJAlx3sCnyQJwTGMQ/CEfLvqHe05tA4yPGkgGO7qC/UMYa7dYG4rEppxTIU3ThvW Nxzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g28-v6si9834232plj.307.2018.06.15.13.01.11; Fri, 15 Jun 2018 13:01:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966275AbeFOUAq (ORCPT + 99 others); Fri, 15 Jun 2018 16:00:46 -0400 Received: from ale.deltatee.com ([207.54.116.67]:52786 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966117AbeFOUAp (ORCPT ); Fri, 15 Jun 2018 16:00:45 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1fTutl-00072j-Cy; Fri, 15 Jun 2018 14:00:42 -0600 To: Serge Semin Cc: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, Jon Mason , Dave Jiang , Allen Hubbe , Shyam Sundar S K , Shuah Khan References: <20180609000819.13883-1-logang@deltatee.com> <20180609000819.13883-9-logang@deltatee.com> <20180615195122.GA25387@mobilestation> From: Logan Gunthorpe Message-ID: <505f2281-adcf-d1dc-ddca-8090cb34b1e6@deltatee.com> Date: Fri, 15 Jun 2018 14:00:40 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180615195122.GA25387@mobilestation> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: shuah@kernel.org, Shyam-sundar.S-k@amd.com, allenbh@gmail.com, dave.jiang@intel.com, jdmason@kudzu.us, linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, fancer.lancer@gmail.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH 7/8] NTB: perf: Fix race condition when run with ntb_test X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/06/18 01:51 PM, Serge Semin wrote: > On Fri, Jun 08, 2018 at 06:08:18PM -0600, Logan Gunthorpe wrote: >> When running ntb_test, the script tries to run the ntb_perf test >> immediately after probing the modules. Since adding multi-port support, >> this fails seeing the new initialization procedure in ntb_perf >> can not complete instantly. >> >> To fix this we add a completion which is waited on when a test is >> started. In this way, run can be written any time after the module is >> loaded and it will wait for the initialization to complete instead of >> sending an error. >> > > Hmm, this behavior is the feature of the driver and isn't a bug or race to be > fixed. ntb_perf driver returns -ENOLINK until the link is actually established, > when the memory windows are properly initialized so the test can be performed. > What do you think of leaving the algorithm as is, but instead to develop > the polling scheme in the ntb_test.sh script and break the script execution if > the link isn't established after sometime? At least we won't need to wait forever > in case if the peer hanged up or crashed while the NTB link negotiation algorithm > was in-progress. I think polling is really ugly and doesn't really address solve the issue of waiting forever. It's pretty easy to interrupt out of the wait and provides a much better clue to whats going on than an error. If we want to be more explicit, it would be pretty easy to start a timer in the bash script and use SIGALRM to exit if the link doesn't come up after 30 seconds or something. Logan