linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NTB: ntb_transport: Free MWs in ntb_transport_link_cleanup()
@ 2019-01-07  3:12 Joey Zhang
  2019-01-08  1:16 ` Logan Gunthorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Joey Zhang @ 2019-01-07  3:12 UTC (permalink / raw)
  To: jdmason, dave.jiang, allenbh, linux-ntb, linux-kernel; +Cc: Joey Zhang

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 <joey.zhang@microchip.com>
---
 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
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] NTB: ntb_transport: Free MWs in ntb_transport_link_cleanup()
  2019-01-07  3:12 [PATCH] NTB: ntb_transport: Free MWs in ntb_transport_link_cleanup() Joey Zhang
@ 2019-01-08  1:16 ` Logan Gunthorpe
  2019-02-11 14:34   ` Jon Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Logan Gunthorpe @ 2019-01-08  1:16 UTC (permalink / raw)
  To: Joey Zhang, jdmason, dave.jiang, allenbh, linux-ntb, linux-kernel



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 <joey.zhang@microchip.com>

Looks ok to me.

Reviewed By: Logan Gunthorpe <logang@deltatee.com>

> ---
>  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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] NTB: ntb_transport: Free MWs in ntb_transport_link_cleanup()
  2019-01-08  1:16 ` Logan Gunthorpe
@ 2019-02-11 14:34   ` Jon Mason
  0 siblings, 0 replies; 3+ messages in thread
From: Jon Mason @ 2019-02-11 14:34 UTC (permalink / raw)
  To: Logan Gunthorpe; +Cc: Joey Zhang, dave.jiang, allenbh, linux-ntb, linux-kernel

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 <joey.zhang@microchip.com>
> 
> Looks ok to me.

Added to the ntb branch, thanks!

> Reviewed By: Logan Gunthorpe <logang@deltatee.com>

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
> > 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-11 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07  3:12 [PATCH] NTB: ntb_transport: Free MWs in ntb_transport_link_cleanup() Joey Zhang
2019-01-08  1:16 ` Logan Gunthorpe
2019-02-11 14:34   ` Jon Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).