Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2749793imj; Mon, 11 Feb 2019 07:56:42 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaf2nq2kH1azC2WAIbMQpaNWhw52Dz96LjbyEuaDd6sKb1/uFI1qkZTyRCxhnlBK3/2wGK3 X-Received: by 2002:a17:902:108a:: with SMTP id c10mr29413851pla.131.1549900602880; Mon, 11 Feb 2019 07:56:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900602; cv=none; d=google.com; s=arc-20160816; b=Npm9nyxVnrs/aAfuBucbtpPpTl2utOPzC4/fKHhsOPJz7BzbCjYVfK78tydcCw4ON0 9E762a3fdpUMVkGny5NtX3fuL4KfYzCLMwX7hlvzPQg0Vua1M2yQ4/2ZnsFjd8bg1hJR wP82mAjBDcz/RtkBrUW9+Vi8IRVfy4YTB/hd7Y2lDeLRc9/35RtmYrAYruditTkZC/4m dKIqXZESmuM2E9rZBcV+kWU3bpHwXEW8mOM5jAJ4pnEQrtNkKrfA2y7lS8+pZF8ahyRV ooDNIu7J2hhGE+nkU2nDJ+4Yb2an0eHU/2Nn0ejL96aMBlIznCoKwkGX1PLeF7Pa3evD HvwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hj0MjswvEEpi6GUcA72y7SumBVEoA1u1KmXStbni5s8=; b=k5s60aEM89wWKnpB1+zL09x2z8gndr6jQHHnvsDoDubmlJlPYjkB4iBhv1ZBgsr73A oaZJjk6V82R/NIh+Iz3VDmH8qD9LgzljaHx33eWzGRd69kiPTRZb5fGCNUM0l51VVfrE unAr+UMQgMAUcbpsqPdJEsoong0HM/oiU+59YUmqxieuostQh5docy3ffsCBFg3H7mmC rYAAzh1kURyLgq8gUxjGISDMi3XukWJNsRyoT6VbTzsD4qVNR5OmPWfgONKYhGTSXOL3 6ohBSpJ8ajCKahguuBrhC4pWqEjbw7UzQCdgEeY3YgLwq8olhxknYtWSGiQVzykbU+8W zZqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kudzu-us.20150623.gappssmtp.com header.s=20150623 header.b=2TFXZsd3; 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 b24si9653816pgi.308.2019.02.11.07.56.26; Mon, 11 Feb 2019 07:56:42 -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; dkim=pass header.i=@kudzu-us.20150623.gappssmtp.com header.s=20150623 header.b=2TFXZsd3; 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 S1727705AbfBKPzc (ORCPT + 99 others); Mon, 11 Feb 2019 10:55:32 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:37597 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730236AbfBKOfC (ORCPT ); Mon, 11 Feb 2019 09:35:02 -0500 Received: by mail-yw1-f68.google.com with SMTP id k14so4255228ywe.4 for ; Mon, 11 Feb 2019 06:35:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kudzu-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hj0MjswvEEpi6GUcA72y7SumBVEoA1u1KmXStbni5s8=; b=2TFXZsd38q8t9ZoeodhurKIh7X92YNULkkeVe3drZ/Zi4m57s0KWI3UMxhmRUEAgef iSKnqIgH5Qz8p4GfMeCUl6O3ApsKvWYIynVbWd570KzP/TlnxxuOHtJTZAvWBXqUMfiq 3L7jKBkyHL/4DK0NBa82UZN+unsVLpVQvnrRpdDzDfVbNhAKuanXO6KTU4MumzwI44Uq ab0dQbFVtiIrPpLUGkmB2/s3/EvXOrD9qshNfsYz75jO/iJ0L5afMQPeKkuUfO9pUhxm TBTSzo4pShwy6LJcDzWRBhHeRDeJgg3EGsIYZy0SweDwOuNJvSkp6VgWR0Qs8M9kX42R qbUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hj0MjswvEEpi6GUcA72y7SumBVEoA1u1KmXStbni5s8=; b=hwUa1wq7fzWh6itvidyfZbAgwPbUpnlj9oH2J1IfBPbwSnbmZypo+3YhGSmghUUCuK I4d7EB/hTjYNzgZzzwQnwkGVMpE7dt8WORPCZX7i9PNBLO/S9MIrjLyq+BhVYsafZfed SaC0PGDFG85xeLkEPrzWFm6Q74rfFySbVnNDrwDHF06lDQSs7X0eFLGEMzOYUnPp8lHn IpdY7RFjErPeB8/z8B/0YT3PG4Px7dzrlJieOH5doqHpiXk9rRtc+gSCjxmp11YurKbY zmhzB9BmMG1fq6O5Lfivqmjx7wBLTMPlVBq14qwLDZO6pCEVqWN7rB2PxpegiVRHcIDs cSYg== X-Gm-Message-State: AHQUAuanNtOiB6aESXjsL4UyxQtePugZ4vER8nD+XuagSPhvYzg3eXw+ JAkfB6u7jXZwVpFvXDzys4pDBQ== X-Received: by 2002:a81:3d96:: with SMTP id k144mr28899978ywa.339.1549895700968; Mon, 11 Feb 2019 06:35:00 -0800 (PST) Received: from kudzu.us (76-230-155-4.lightspeed.rlghnc.sbcglobal.net. [76.230.155.4]) by smtp.gmail.com with ESMTPSA id v9sm4149610ywh.2.2019.02.11.06.35.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 06:35:00 -0800 (PST) Date: Mon, 11 Feb 2019 09:34:58 -0500 From: Jon Mason To: Logan Gunthorpe Cc: Joey Zhang , dave.jiang@intel.com, allenbh@gmail.com, linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] NTB: ntb_transport: Free MWs in ntb_transport_link_cleanup() Message-ID: <20190211143458.GA13951@kudzu.us> References: <1546830776-3138-1-git-send-email-joey.zhang@microchip.com> <2dccf9e6-d9d7-200e-f689-56c962ea5e7e@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2dccf9e6-d9d7-200e-f689-56c962ea5e7e@deltatee.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 07, 2019 at 06:16:02PM -0700, Logan Gunthorpe wrote: > > > 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. Added to the ntb branch, thanks! > Reviewed By: Logan Gunthorpe Looks like your missed the '-' ;-) I took the liberity of adding it Thanks, Jon > > > --- > > 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 > >