Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4172000imu; Mon, 7 Jan 2019 17:17:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/XW7ZyCkPzdsPD8dIxWg2re02XIjxgYH1J7k2eZge4NeMvvJyycIwGl+6BCqRdmOKJCAvB1 X-Received: by 2002:a62:2c81:: with SMTP id s123mr64394091pfs.174.1546910267755; Mon, 07 Jan 2019 17:17:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546910267; cv=none; d=google.com; s=arc-20160816; b=k2mLV7/recl9OCqiGyGJVUnDtGOBIRU1JPRSZELDbzRpAgWe8BbXpXyLr51LpbIB48 U1udsIBooN47way26SqRpph3o/sz2QMiQyB2sNEMjmnct+dm13HdAR7giezsx+5RKWW7 6TOpgITNfDE4n0XoF50Si6r47Q1t53/ha0ljiJlH3zuv6R3Tse3w9JHs98Vy08ynQ2xy kF8DzHFcq/k+iCCkWVcFcQVpvakemUKjXUKzKYdAExU2Phcrtaz8X+3F2D2vumgl9OTM z29ajRnXgLYaHNFCBE9+AM42B8iLtz4AwcYT0mf+DQAKNn76NrUPgDFXLBMOlLzMk/Ct l0Jg== 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:to; bh=MS1dY+SidCbLRSzMI2QnEzy71ECCScFOsLTfXNbFlCc=; b=qlhMiRzxxNUig4PmTbM8PcBxLiJtg1hP1deKlO6fZcddzGGrKUpG1QMp8Npt+B6r+Y vFNK1NzUMNXeTqv+tfXR32J890LeSS/gCsZImI7CsVO86UGUG1YgFl4+ishARhOMGtME +T6xB7yV/wVns+9o0s56E8WxarVytIkBwUi7JMy99+hbkjiu0eK0TQuDCVaBQcWN1UKT JvxAmbszkFVNgw9SG6DE7szRrdpb57Nwaed/gOiruhBs+AZuHrQ8qaPfLtWJ5Y+RCs/O rI4FrnxzYEcNAXfrWJcFWY6CcKnZUB7WwLxtirJFkCEA97SUQsr6F00n/fPkLvrvDtq+ cqIg== 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 bg7si43222251plb.149.2019.01.07.17.17.31; Mon, 07 Jan 2019 17:17:47 -0800 (PST) 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 S1727295AbfAHBQJ (ORCPT + 99 others); Mon, 7 Jan 2019 20:16:09 -0500 Received: from ale.deltatee.com ([207.54.116.67]:44620 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbfAHBQJ (ORCPT ); Mon, 7 Jan 2019 20:16:09 -0500 Received: from s0106602ad0811846.cg.shawcable.net ([68.147.191.165] helo=[192.168.0.18]) by ale.deltatee.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ggfzy-00049v-ON; Mon, 07 Jan 2019 18:16:08 -0700 To: Joey Zhang , jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com, linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org References: <1546830776-3138-1-git-send-email-joey.zhang@microchip.com> From: Logan Gunthorpe Message-ID: <2dccf9e6-d9d7-200e-f689-56c962ea5e7e@deltatee.com> Date: Mon, 7 Jan 2019 18:16:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1546830776-3138-1-git-send-email-joey.zhang@microchip.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 68.147.191.165 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, allenbh@gmail.com, dave.jiang@intel.com, jdmason@kudzu.us, joey.zhang@microchip.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_FREE autolearn=no autolearn_force=no version=3.4.2 Subject: Re: [PATCH] NTB: ntb_transport: Free MWs in ntb_transport_link_cleanup() 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 06/01/19 08:12 PM, Joey Zhang wrote: > If NTB peer host crashes or reboots, the NTB transport link will be > down and the MWs of NTB transport will be invalid. But the > ntb_transport_link_cleanup() does not free these invalid MWs. When > the NTB peer host is recovered later, NTB transport link will be > up and the ntb_set_mw() will not reset up MWs. Because the MWs of > NTB transport are invalid, the NTB transport will not work. > > We can fix it by freeing MWs when NTB transport link is down, then > the ntb_set_mw() will reset up MWs when NTB transport link is up. > > Signed-off-by: Joey Zhang Looks ok to me. Reviewed By: Logan Gunthorpe > --- > drivers/ntb/ntb_transport.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c > index 3bfdb45..6e8902d 100644 > --- a/drivers/ntb/ntb_transport.c > +++ b/drivers/ntb/ntb_transport.c > @@ -862,6 +862,9 @@ static void ntb_transport_link_cleanup(struct ntb_transport_ctx *nt) > if (!nt->link_is_up) > cancel_delayed_work_sync(&nt->link_work); > > + for (i = 0; i < nt->mw_count; i++) > + ntb_free_mw(nt, i); > + > /* The scratchpad registers keep the values if the remote side > * goes down, blast them now to give them a sane value the next > * time they are accessed >