All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the net-next tree
@ 2019-07-09  3:56 Stephen Rothwell
  2019-07-09  6:43 ` Leon Romanovsky
  2019-07-09  9:00 ` Bernard Metzler
  0 siblings, 2 replies; 18+ messages in thread
From: Stephen Rothwell @ 2019-07-09  3:56 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: David Miller, Networking, Linux Next Mailing List,
	Linux Kernel Mailing List, Bernard Metzler

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

Hi all,

After merging the net-next tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/infiniband/sw/siw/siw_cm.c: In function 'siw_create_listen':
drivers/infiniband/sw/siw/siw_cm.c:1978:3: error: implicit declaration of function 'for_ifa'; did you mean 'fork_idle'? [-Werror=implicit-function-declaration]
   for_ifa(in_dev)
   ^~~~~~~
   fork_idle
drivers/infiniband/sw/siw/siw_cm.c:1978:18: error: expected ';' before '{' token
   for_ifa(in_dev)
                  ^
                  ;
   {
   ~

Caused by commit

  6c52fdc244b5 ("rdma/siw: connection management")

from the rdma tree.  I don't know why this didn't fail after I mereged
that tree.

I have marked that driver as depending on BROKEN for today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-09  3:56 linux-next: build failure after merge of the net-next tree Stephen Rothwell
@ 2019-07-09  6:43 ` Leon Romanovsky
  2019-07-10  4:31   ` Stephen Rothwell
                     ` (2 more replies)
  2019-07-09  9:00 ` Bernard Metzler
  1 sibling, 3 replies; 18+ messages in thread
From: Leon Romanovsky @ 2019-07-09  6:43 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Doug Ledford, Jason Gunthorpe, David Miller, Networking,
	Linux Next Mailing List, Linux Kernel Mailing List,
	Bernard Metzler

On Tue, Jul 09, 2019 at 01:56:36PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the net-next tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> drivers/infiniband/sw/siw/siw_cm.c: In function 'siw_create_listen':
> drivers/infiniband/sw/siw/siw_cm.c:1978:3: error: implicit declaration of function 'for_ifa'; did you mean 'fork_idle'? [-Werror=implicit-function-declaration]
>    for_ifa(in_dev)
>    ^~~~~~~
>    fork_idle
> drivers/infiniband/sw/siw/siw_cm.c:1978:18: error: expected ';' before '{' token
>    for_ifa(in_dev)
>                   ^
>                   ;
>    {
>    ~
>
> Caused by commit
>
>   6c52fdc244b5 ("rdma/siw: connection management")
>
> from the rdma tree.  I don't know why this didn't fail after I mereged
> that tree.

I had the same question, because I have this fix for a couple of days already.

From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00 2001
From: Leon Romanovsky <leonro@mellanox.com>
Date: Sun, 7 Jul 2019 10:43:42 +0300
Subject: [PATCH] Fixup to build SIW issue

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/sw/siw/siw_cm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index 8e618cb7261f..c883bf514341 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -1954,6 +1954,7 @@ static void siw_drop_listeners(struct iw_cm_id *id)
 int siw_create_listen(struct iw_cm_id *id, int backlog)
 {
 	struct net_device *dev = to_siw_dev(id->device)->netdev;
+	const struct in_ifaddr *ifa;
 	int rv = 0, listeners = 0;

 	siw_dbg(id->device, "id 0x%p: backlog %d\n", id, backlog);
@@ -1975,8 +1976,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
 			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));

-		for_ifa(in_dev)
-		{
+		in_dev_for_each_ifa_rcu(ifa, in_dev) {
 			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
 			    s_laddr.sin_addr.s_addr == ifa->ifa_address) {
 				s_laddr.sin_addr.s_addr = ifa->ifa_address;
@@ -1988,7 +1988,6 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 					listeners++;
 			}
 		}
-		endfor_ifa(in_dev);
 		in_dev_put(in_dev);
 	} else if (id->local_addr.ss_family == AF_INET6) {
 		struct inet6_dev *in6_dev = in6_dev_get(dev);
--
2.21.0


>
> I have marked that driver as depending on BROKEN for today.
>
> --
> Cheers,
> Stephen Rothwell



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

* Re:  Re: linux-next: build failure after merge of the net-next tree
  2019-07-09  3:56 linux-next: build failure after merge of the net-next tree Stephen Rothwell
  2019-07-09  6:43 ` Leon Romanovsky
@ 2019-07-09  9:00 ` Bernard Metzler
  1 sibling, 0 replies; 18+ messages in thread
From: Bernard Metzler @ 2019-07-09  9:00 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Stephen Rothwell, Doug Ledford, Jason Gunthorpe, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

-----"Leon Romanovsky" <leon@kernel.org> wrote: -----

>To: "Stephen Rothwell" <sfr@canb.auug.org.au>
>From: "Leon Romanovsky" <leon@kernel.org>
>Date: 07/09/2019 08:43AM
>Cc: "Doug Ledford" <dledford@redhat.com>, "Jason Gunthorpe"
><jgg@mellanox.com>, "David Miller" <davem@davemloft.net>,
>"Networking" <netdev@vger.kernel.org>, "Linux Next Mailing List"
><linux-next@vger.kernel.org>, "Linux Kernel Mailing List"
><linux-kernel@vger.kernel.org>, "Bernard Metzler"
><bmt@zurich.ibm.com>
>Subject: [EXTERNAL] Re: linux-next: build failure after merge of the
>net-next tree
>
>On Tue, Jul 09, 2019 at 01:56:36PM +1000, Stephen Rothwell wrote:
>> Hi all,
>>
>> After merging the net-next tree, today's linux-next build (x86_64
>> allmodconfig) failed like this:
>>
>> drivers/infiniband/sw/siw/siw_cm.c: In function
>'siw_create_listen':
>> drivers/infiniband/sw/siw/siw_cm.c:1978:3: error: implicit
>declaration of function 'for_ifa'; did you mean 'fork_idle'?
>[-Werror=implicit-function-declaration]
>>    for_ifa(in_dev)
>>    ^~~~~~~
>>    fork_idle
>> drivers/infiniband/sw/siw/siw_cm.c:1978:18: error: expected ';'
>before '{' token
>>    for_ifa(in_dev)
>>                   ^
>>                   ;
>>    {
>>    ~
>>
>> Caused by commit
>>
>>   6c52fdc244b5 ("rdma/siw: connection management")
>>
>> from the rdma tree.  I don't know why this didn't fail after I
>mereged
>> that tree.
>
>I had the same question, because I have this fix for a couple of days
>already.
>
>From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00
>2001
>From: Leon Romanovsky <leonro@mellanox.com>
>Date: Sun, 7 Jul 2019 10:43:42 +0300
>Subject: [PATCH] Fixup to build SIW issue
>
>Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>---
> drivers/infiniband/sw/siw/siw_cm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/infiniband/sw/siw/siw_cm.c
>b/drivers/infiniband/sw/siw/siw_cm.c
>index 8e618cb7261f..c883bf514341 100644
>--- a/drivers/infiniband/sw/siw/siw_cm.c
>+++ b/drivers/infiniband/sw/siw/siw_cm.c
>@@ -1954,6 +1954,7 @@ static void siw_drop_listeners(struct iw_cm_id
>*id)
> int siw_create_listen(struct iw_cm_id *id, int backlog)
> {
> 	struct net_device *dev = to_siw_dev(id->device)->netdev;
>+	const struct in_ifaddr *ifa;
> 	int rv = 0, listeners = 0;
>
> 	siw_dbg(id->device, "id 0x%p: backlog %d\n", id, backlog);
>@@ -1975,8 +1976,7 @@ int siw_create_listen(struct iw_cm_id *id, int
>backlog)
> 			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
> 			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
>
>-		for_ifa(in_dev)
>-		{
>+		in_dev_for_each_ifa_rcu(ifa, in_dev) {
> 			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
> 			    s_laddr.sin_addr.s_addr == ifa->ifa_address) {
> 				s_laddr.sin_addr.s_addr = ifa->ifa_address;
>@@ -1988,7 +1988,6 @@ int siw_create_listen(struct iw_cm_id *id, int
>backlog)
> 					listeners++;
> 			}
> 		}
>-		endfor_ifa(in_dev);
> 		in_dev_put(in_dev);
> 	} else if (id->local_addr.ss_family == AF_INET6) {
> 		struct inet6_dev *in6_dev = in6_dev_get(dev);
>--
>2.21.0
>
>
>>
>> I have marked that driver as depending on BROKEN for today.
>>
>> --
>> Cheers,
>> Stephen Rothwell
>
>
>
I am very sorry for that issues. Things are moving fast, and I
didn't realize 'for_ifa' recently went away. I agree with Leon,
his patch fixes the issue. So, please, let's apply that one.

Leon, many thanks for providing the fix.

Thanks very much,
Bernard.


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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-09  6:43 ` Leon Romanovsky
@ 2019-07-10  4:31   ` Stephen Rothwell
  2019-07-10  5:20     ` Leon Romanovsky
  2019-07-10 17:52   ` Jason Gunthorpe
  2019-07-11  8:00   ` Bernard Metzler
  2 siblings, 1 reply; 18+ messages in thread
From: Stephen Rothwell @ 2019-07-10  4:31 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Jason Gunthorpe, David Miller, Networking,
	Linux Next Mailing List, Linux Kernel Mailing List,
	Bernard Metzler

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

Hi Leon,

On Tue, 9 Jul 2019 09:43:46 +0300 Leon Romanovsky <leon@kernel.org> wrote:
>
> From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00 2001
> From: Leon Romanovsky <leonro@mellanox.com>
> Date: Sun, 7 Jul 2019 10:43:42 +0300
> Subject: [PATCH] Fixup to build SIW issue
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

I applied this to linux-next today and it fixes my build problems.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-10  4:31   ` Stephen Rothwell
@ 2019-07-10  5:20     ` Leon Romanovsky
  0 siblings, 0 replies; 18+ messages in thread
From: Leon Romanovsky @ 2019-07-10  5:20 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Doug Ledford, Jason Gunthorpe, David Miller, Networking,
	Linux Next Mailing List, Linux Kernel Mailing List,
	Bernard Metzler

On Wed, Jul 10, 2019 at 02:31:58PM +1000, Stephen Rothwell wrote:
> Hi Leon,
>
> On Tue, 9 Jul 2019 09:43:46 +0300 Leon Romanovsky <leon@kernel.org> wrote:
> >
> > From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00 2001
> > From: Leon Romanovsky <leonro@mellanox.com>
> > Date: Sun, 7 Jul 2019 10:43:42 +0300
> > Subject: [PATCH] Fixup to build SIW issue
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>
> I applied this to linux-next today and it fixes my build problems.

Thanks

>
> --
> Cheers,
> Stephen Rothwell



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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-09  6:43 ` Leon Romanovsky
  2019-07-10  4:31   ` Stephen Rothwell
@ 2019-07-10 17:52   ` Jason Gunthorpe
  2019-07-11  1:50     ` Stephen Rothwell
  2019-07-11  8:00   ` Bernard Metzler
  2 siblings, 1 reply; 18+ messages in thread
From: Jason Gunthorpe @ 2019-07-10 17:52 UTC (permalink / raw)
  To: Leon Romanovsky, Bernard Metzler
  Cc: Stephen Rothwell, Doug Ledford, David Miller, Networking,
	Linux Next Mailing List, Linux Kernel Mailing List

On Tue, Jul 09, 2019 at 09:43:46AM +0300, Leon Romanovsky wrote:
> On Tue, Jul 09, 2019 at 01:56:36PM +1000, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the net-next tree, today's linux-next build (x86_64
> > allmodconfig) failed like this:
> >
> > drivers/infiniband/sw/siw/siw_cm.c: In function 'siw_create_listen':
> > drivers/infiniband/sw/siw/siw_cm.c:1978:3: error: implicit declaration of function 'for_ifa'; did you mean 'fork_idle'? [-Werror=implicit-function-declaration]
> >    for_ifa(in_dev)
> >    ^~~~~~~
> >    fork_idle
> > drivers/infiniband/sw/siw/siw_cm.c:1978:18: error: expected ';' before '{' token
> >    for_ifa(in_dev)
> >                   ^
> >                   ;
> >    {
> >    ~
> >
> > Caused by commit
> >
> >   6c52fdc244b5 ("rdma/siw: connection management")
> >
> > from the rdma tree.  I don't know why this didn't fail after I mereged
> > that tree.
> 
> I had the same question, because I have this fix for a couple of days already.
> 
> From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00 2001
> From: Leon Romanovsky <leonro@mellanox.com>
> Date: Sun, 7 Jul 2019 10:43:42 +0300
> Subject: [PATCH] Fixup to build SIW issue
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>  drivers/infiniband/sw/siw/siw_cm.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
> index 8e618cb7261f..c883bf514341 100644
> +++ b/drivers/infiniband/sw/siw/siw_cm.c
> @@ -1954,6 +1954,7 @@ static void siw_drop_listeners(struct iw_cm_id *id)
>  int siw_create_listen(struct iw_cm_id *id, int backlog)
>  {
>  	struct net_device *dev = to_siw_dev(id->device)->netdev;
> +	const struct in_ifaddr *ifa;
>  	int rv = 0, listeners = 0;
> 
>  	siw_dbg(id->device, "id 0x%p: backlog %d\n", id, backlog);
> @@ -1975,8 +1976,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
>  			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
>  			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
> 
> -		for_ifa(in_dev)
> -		{
> +		in_dev_for_each_ifa_rcu(ifa, in_dev) {
>  			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||

Hum. There is no rcu lock held here and we can't use RCU anyhow as
siw_listen_address will sleep.

I think this needs to use rtnl, as below. Bernard, please urgently
confirm. Thanks

diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index 8e618cb7261f62..ee98e96a5bfaba 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -1965,6 +1965,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 	 */
 	if (id->local_addr.ss_family == AF_INET) {
 		struct in_device *in_dev = in_dev_get(dev);
+		const struct in_ifaddr *ifa;
 		struct sockaddr_in s_laddr, *s_raddr;
 
 		memcpy(&s_laddr, &id->local_addr, sizeof(s_laddr));
@@ -1975,8 +1976,8 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
 			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
 
-		for_ifa(in_dev)
-		{
+		rtnl_lock();
+		in_dev_for_each_ifa_rtnl(ifa, in_dev) {
 			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
 			    s_laddr.sin_addr.s_addr == ifa->ifa_address) {
 				s_laddr.sin_addr.s_addr = ifa->ifa_address;
@@ -1988,7 +1989,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 					listeners++;
 			}
 		}
-		endfor_ifa(in_dev);
+		rtnl_unlock();
 		in_dev_put(in_dev);
 	} else if (id->local_addr.ss_family == AF_INET6) {
 		struct inet6_dev *in6_dev = in6_dev_get(dev);

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-10 17:52   ` Jason Gunthorpe
@ 2019-07-11  1:50     ` Stephen Rothwell
  2019-07-11  2:26       ` Jason Gunthorpe
  0 siblings, 1 reply; 18+ messages in thread
From: Stephen Rothwell @ 2019-07-11  1:50 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Bernard Metzler, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 4311 bytes --]

Hi all,

On Wed, 10 Jul 2019 17:52:17 +0000 Jason Gunthorpe <jgg@mellanox.com> wrote:
>
> On Tue, Jul 09, 2019 at 09:43:46AM +0300, Leon Romanovsky wrote:
> > On Tue, Jul 09, 2019 at 01:56:36PM +1000, Stephen Rothwell wrote:  
> > > Hi all,
> > >
> > > After merging the net-next tree, today's linux-next build (x86_64
> > > allmodconfig) failed like this:
> > >
> > > drivers/infiniband/sw/siw/siw_cm.c: In function 'siw_create_listen':
> > > drivers/infiniband/sw/siw/siw_cm.c:1978:3: error: implicit declaration of function 'for_ifa'; did you mean 'fork_idle'? [-Werror=implicit-function-declaration]
> > >    for_ifa(in_dev)
> > >    ^~~~~~~
> > >    fork_idle
> > > drivers/infiniband/sw/siw/siw_cm.c:1978:18: error: expected ';' before '{' token
> > >    for_ifa(in_dev)
> > >                   ^
> > >                   ;
> > >    {
> > >    ~
> > >
> > > Caused by commit
> > >
> > >   6c52fdc244b5 ("rdma/siw: connection management")
> > >
> > > from the rdma tree.  I don't know why this didn't fail after I mereged
> > > that tree.  
> > 
> > I had the same question, because I have this fix for a couple of days already.
> > 
> > From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00 2001
> > From: Leon Romanovsky <leonro@mellanox.com>
> > Date: Sun, 7 Jul 2019 10:43:42 +0300
> > Subject: [PATCH] Fixup to build SIW issue
> > 
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> >  drivers/infiniband/sw/siw/siw_cm.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
> > index 8e618cb7261f..c883bf514341 100644
> > +++ b/drivers/infiniband/sw/siw/siw_cm.c
> > @@ -1954,6 +1954,7 @@ static void siw_drop_listeners(struct iw_cm_id *id)
> >  int siw_create_listen(struct iw_cm_id *id, int backlog)
> >  {
> >  	struct net_device *dev = to_siw_dev(id->device)->netdev;
> > +	const struct in_ifaddr *ifa;
> >  	int rv = 0, listeners = 0;
> > 
> >  	siw_dbg(id->device, "id 0x%p: backlog %d\n", id, backlog);
> > @@ -1975,8 +1976,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
> >  			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
> >  			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
> > 
> > -		for_ifa(in_dev)
> > -		{
> > +		in_dev_for_each_ifa_rcu(ifa, in_dev) {
> >  			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||  
> 
> Hum. There is no rcu lock held here and we can't use RCU anyhow as
> siw_listen_address will sleep.
> 
> I think this needs to use rtnl, as below. Bernard, please urgently
> confirm. Thanks
> 
> diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
> index 8e618cb7261f62..ee98e96a5bfaba 100644
> --- a/drivers/infiniband/sw/siw/siw_cm.c
> +++ b/drivers/infiniband/sw/siw/siw_cm.c
> @@ -1965,6 +1965,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
>  	 */
>  	if (id->local_addr.ss_family == AF_INET) {
>  		struct in_device *in_dev = in_dev_get(dev);
> +		const struct in_ifaddr *ifa;
>  		struct sockaddr_in s_laddr, *s_raddr;
>  
>  		memcpy(&s_laddr, &id->local_addr, sizeof(s_laddr));
> @@ -1975,8 +1976,8 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
>  			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
>  			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
>  
> -		for_ifa(in_dev)
> -		{
> +		rtnl_lock();
> +		in_dev_for_each_ifa_rtnl(ifa, in_dev) {
>  			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
>  			    s_laddr.sin_addr.s_addr == ifa->ifa_address) {
>  				s_laddr.sin_addr.s_addr = ifa->ifa_address;
> @@ -1988,7 +1989,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
>  					listeners++;
>  			}
>  		}
> -		endfor_ifa(in_dev);
> +		rtnl_unlock();
>  		in_dev_put(in_dev);
>  	} else if (id->local_addr.ss_family == AF_INET6) {
>  		struct inet6_dev *in6_dev = in6_dev_get(dev);

So today this failed to build after I merged the rdma tree (previously
it didn;t until after the net-next tree was merged (I assume a
dependency changed).  It failed because in_dev_for_each_ifa_rcu (and
in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next
tree :-(

I have disabled the driver again.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-11  1:50     ` Stephen Rothwell
@ 2019-07-11  2:26       ` Jason Gunthorpe
  2019-07-11  3:13         ` Stephen Rothwell
  0 siblings, 1 reply; 18+ messages in thread
From: Jason Gunthorpe @ 2019-07-11  2:26 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Leon Romanovsky, Bernard Metzler, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote:

> So today this failed to build after I merged the rdma tree (previously
> it didn;t until after the net-next tree was merged (I assume a
> dependency changed).  It failed because in_dev_for_each_ifa_rcu (and
> in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next
> tree :-(

? I'm confused.. 

rdma.git builds fine stand alone (I hope!)

If you merge it with netdev then the above patch is needed afer the
merge as netdev changed to ifa_rcu

I just did this a few hours ago to make and test the patch I sent
above..

Jason

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-11  2:26       ` Jason Gunthorpe
@ 2019-07-11  3:13         ` Stephen Rothwell
  2019-07-11  3:16           ` Stephen Rothwell
  0 siblings, 1 reply; 18+ messages in thread
From: Stephen Rothwell @ 2019-07-11  3:13 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Bernard Metzler, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]

Hi Jason,

On Thu, 11 Jul 2019 02:26:27 +0000 Jason Gunthorpe <jgg@mellanox.com> wrote:
>
> On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote:
> 
> > So today this failed to build after I merged the rdma tree (previously
> > it didn;t until after the net-next tree was merged (I assume a
> > dependency changed).  It failed because in_dev_for_each_ifa_rcu (and
> > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next
> > tree :-(  
> 
> ? I'm confused.. 
> 
> rdma.git builds fine stand alone (I hope!)

I have "Fixup to build SIW issue" from Leon (which switches to using
in_dev_for_each_ifa_rcu) included in the rmda tree merge commit because
without that the rdma tree would not build for me.  Are you saying that
I don't need that at all, now?

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-11  3:13         ` Stephen Rothwell
@ 2019-07-11  3:16           ` Stephen Rothwell
  2019-07-11  3:27             ` Stephen Rothwell
  2019-07-11  5:40             ` Leon Romanovsky
  0 siblings, 2 replies; 18+ messages in thread
From: Stephen Rothwell @ 2019-07-11  3:16 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Bernard Metzler, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

Hi all,

On Thu, 11 Jul 2019 13:13:44 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> On Thu, 11 Jul 2019 02:26:27 +0000 Jason Gunthorpe <jgg@mellanox.com> wrote:
> >
> > On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote:
> >   
> > > So today this failed to build after I merged the rdma tree (previously
> > > it didn;t until after the net-next tree was merged (I assume a
> > > dependency changed).  It failed because in_dev_for_each_ifa_rcu (and
> > > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next
> > > tree :-(    
> > 
> > ? I'm confused.. 
> > 
> > rdma.git builds fine stand alone (I hope!)  
> 
> I have "Fixup to build SIW issue" from Leon (which switches to using
> in_dev_for_each_ifa_rcu) included in the rmda tree merge commit because
> without that the rdma tree would not build for me.  Are you saying that
> I don't need that at all, now?

Actually , I get it now, "Fixup to build SIW issue" is really just a
fixup for the net-next and rdma trees merge ... OK, I will fix that up
tomorrow.  Sorry for my confusion.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-11  3:16           ` Stephen Rothwell
@ 2019-07-11  3:27             ` Stephen Rothwell
  2019-07-11  5:40             ` Leon Romanovsky
  1 sibling, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2019-07-11  3:27 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Bernard Metzler, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]

Hi all,

On Thu, 11 Jul 2019 13:16:03 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> On Thu, 11 Jul 2019 13:13:44 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > On Thu, 11 Jul 2019 02:26:27 +0000 Jason Gunthorpe <jgg@mellanox.com> wrote:  
> > >
> > > On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote:
> > >     
> > > > So today this failed to build after I merged the rdma tree (previously
> > > > it didn;t until after the net-next tree was merged (I assume a
> > > > dependency changed).  It failed because in_dev_for_each_ifa_rcu (and
> > > > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next
> > > > tree :-(      
> > > 
> > > ? I'm confused.. 
> > > 
> > > rdma.git builds fine stand alone (I hope!)    
> > 
> > I have "Fixup to build SIW issue" from Leon (which switches to using
> > in_dev_for_each_ifa_rcu) included in the rmda tree merge commit because
> > without that the rdma tree would not build for me.  Are you saying that
> > I don't need that at all, now?  
> 
> Actually , I get it now, "Fixup to build SIW issue" is really just a
> fixup for the net-next and rdma trees merge ... OK, I will fix that up
> tomorrow.  Sorry for my confusion.

Actually, I have rewound my tree and am starting from the merge of the
rdma tree again, so hopefully it should all be good today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-11  3:16           ` Stephen Rothwell
  2019-07-11  3:27             ` Stephen Rothwell
@ 2019-07-11  5:40             ` Leon Romanovsky
  1 sibling, 0 replies; 18+ messages in thread
From: Leon Romanovsky @ 2019-07-11  5:40 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Jason Gunthorpe, Bernard Metzler, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

On Thu, Jul 11, 2019 at 01:16:03PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> On Thu, 11 Jul 2019 13:13:44 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > On Thu, 11 Jul 2019 02:26:27 +0000 Jason Gunthorpe <jgg@mellanox.com> wrote:
> > >
> > > On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote:
> > >
> > > > So today this failed to build after I merged the rdma tree (previously
> > > > it didn;t until after the net-next tree was merged (I assume a
> > > > dependency changed).  It failed because in_dev_for_each_ifa_rcu (and
> > > > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next
> > > > tree :-(
> > >
> > > ? I'm confused..
> > >
> > > rdma.git builds fine stand alone (I hope!)
> >
> > I have "Fixup to build SIW issue" from Leon (which switches to using
> > in_dev_for_each_ifa_rcu) included in the rmda tree merge commit because
> > without that the rdma tree would not build for me.  Are you saying that
> > I don't need that at all, now?
>
> Actually , I get it now, "Fixup to build SIW issue" is really just a
> fixup for the net-next and rdma trees merge ... OK, I will fix that up
> tomorrow.  Sorry for my confusion.

Yes, it was for build only.

>
> --
> Cheers,
> Stephen Rothwell



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

* Re:  Re: linux-next: build failure after merge of the net-next tree
  2019-07-09  6:43 ` Leon Romanovsky
  2019-07-10  4:31   ` Stephen Rothwell
  2019-07-10 17:52   ` Jason Gunthorpe
@ 2019-07-11  8:00   ` Bernard Metzler
  2019-07-11 11:52     ` Jason Gunthorpe
  2019-07-11 12:29     ` Bernard Metzler
  2 siblings, 2 replies; 18+ messages in thread
From: Bernard Metzler @ 2019-07-11  8:00 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Stephen Rothwell, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

-----"Jason Gunthorpe" <jgg@mellanox.com> wrote: -----

>To: "Leon Romanovsky" <leon@kernel.org>, "Bernard Metzler"
><bmt@zurich.ibm.com>
>From: "Jason Gunthorpe" <jgg@mellanox.com>
>Date: 07/10/2019 07:52PM
>Cc: "Stephen Rothwell" <sfr@canb.auug.org.au>, "Doug Ledford"
><dledford@redhat.com>, "David Miller" <davem@davemloft.net>,
>"Networking" <netdev@vger.kernel.org>, "Linux Next Mailing List"
><linux-next@vger.kernel.org>, "Linux Kernel Mailing List"
><linux-kernel@vger.kernel.org>
>Subject: [EXTERNAL] Re: linux-next: build failure after merge of the
>net-next tree
>
>On Tue, Jul 09, 2019 at 09:43:46AM +0300, Leon Romanovsky wrote:
>> On Tue, Jul 09, 2019 at 01:56:36PM +1000, Stephen Rothwell wrote:
>> > Hi all,
>> >
>> > After merging the net-next tree, today's linux-next build (x86_64
>> > allmodconfig) failed like this:
>> >
>> > drivers/infiniband/sw/siw/siw_cm.c: In function
>'siw_create_listen':
>> > drivers/infiniband/sw/siw/siw_cm.c:1978:3: error: implicit
>declaration of function 'for_ifa'; did you mean 'fork_idle'?
>[-Werror=implicit-function-declaration]
>> >    for_ifa(in_dev)
>> >    ^~~~~~~
>> >    fork_idle
>> > drivers/infiniband/sw/siw/siw_cm.c:1978:18: error: expected ';'
>before '{' token
>> >    for_ifa(in_dev)
>> >                   ^
>> >                   ;
>> >    {
>> >    ~
>> >
>> > Caused by commit
>> >
>> >   6c52fdc244b5 ("rdma/siw: connection management")
>> >
>> > from the rdma tree.  I don't know why this didn't fail after I
>mereged
>> > that tree.
>> 
>> I had the same question, because I have this fix for a couple of
>days already.
>> 
>> From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00
>2001
>> From: Leon Romanovsky <leonro@mellanox.com>
>> Date: Sun, 7 Jul 2019 10:43:42 +0300
>> Subject: [PATCH] Fixup to build SIW issue
>> 
>> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>>  drivers/infiniband/sw/siw/siw_cm.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>> 
>> diff --git a/drivers/infiniband/sw/siw/siw_cm.c
>b/drivers/infiniband/sw/siw/siw_cm.c
>> index 8e618cb7261f..c883bf514341 100644
>> +++ b/drivers/infiniband/sw/siw/siw_cm.c
>> @@ -1954,6 +1954,7 @@ static void siw_drop_listeners(struct
>iw_cm_id *id)
>>  int siw_create_listen(struct iw_cm_id *id, int backlog)
>>  {
>>  	struct net_device *dev = to_siw_dev(id->device)->netdev;
>> +	const struct in_ifaddr *ifa;
>>  	int rv = 0, listeners = 0;
>> 
>>  	siw_dbg(id->device, "id 0x%p: backlog %d\n", id, backlog);
>> @@ -1975,8 +1976,7 @@ int siw_create_listen(struct iw_cm_id *id,
>int backlog)
>>  			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
>>  			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
>> 
>> -		for_ifa(in_dev)
>> -		{
>> +		in_dev_for_each_ifa_rcu(ifa, in_dev) {
>>  			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
>
>Hum. There is no rcu lock held here and we can't use RCU anyhow as
>siw_listen_address will sleep.
>
>I think this needs to use rtnl, as below. Bernard, please urgently
>confirm. Thanks
>

Hi Jason,

That listen will not sleep. The socket is just marked
listening. Accepting a new connection is handled asynchronously
by a work handler, kicked by a socket callback
(siw_cm_llp_state_change).

But, I think you are correct, we are missing the
rcu_read_lock/unlock around that iteration. Could we please add
that (see below)?

Thanks very much!
Bernard.

diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index c883bf514341..c5c060103993 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -1976,6 +1976,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
                        id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
                        &s_raddr->sin_addr, ntohs(s_raddr->sin_port));
 
+               rcu_read_lock();
                in_dev_for_each_ifa_rcu(ifa, in_dev) {
                        if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
                            s_laddr.sin_addr.s_addr == ifa->ifa_address) {
@@ -1988,6 +1989,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
                                        listeners++;
                        }
                }
+               rcu_read_unlock();
                in_dev_put(in_dev);
        } else if (id->local_addr.ss_family == AF_INET6) {
                struct inet6_dev *in6_dev = in6_dev_get(dev);



>diff --git a/drivers/infiniband/sw/siw/siw_cm.c
>b/drivers/infiniband/sw/siw/siw_cm.c
>index 8e618cb7261f62..ee98e96a5bfaba 100644
>--- a/drivers/infiniband/sw/siw/siw_cm.c
>+++ b/drivers/infiniband/sw/siw/siw_cm.c
>@@ -1965,6 +1965,7 @@ int siw_create_listen(struct iw_cm_id *id, int
>backlog)
> 	 */
> 	if (id->local_addr.ss_family == AF_INET) {
> 		struct in_device *in_dev = in_dev_get(dev);
>+		const struct in_ifaddr *ifa;
> 		struct sockaddr_in s_laddr, *s_raddr;
> 
> 		memcpy(&s_laddr, &id->local_addr, sizeof(s_laddr));
>@@ -1975,8 +1976,8 @@ int siw_create_listen(struct iw_cm_id *id, int
>backlog)
> 			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
> 			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
> 
>-		for_ifa(in_dev)
>-		{
>+		rtnl_lock();
>+		in_dev_for_each_ifa_rtnl(ifa, in_dev) {
> 			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
> 			    s_laddr.sin_addr.s_addr == ifa->ifa_address) {
> 				s_laddr.sin_addr.s_addr = ifa->ifa_address;
>@@ -1988,7 +1989,7 @@ int siw_create_listen(struct iw_cm_id *id, int
>backlog)
> 					listeners++;
> 			}
> 		}
>-		endfor_ifa(in_dev);
>+		rtnl_unlock();
> 		in_dev_put(in_dev);
> 	} else if (id->local_addr.ss_family == AF_INET6) {
> 		struct inet6_dev *in6_dev = in6_dev_get(dev);
>
>


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

* Re: Re: linux-next: build failure after merge of the net-next tree
  2019-07-11  8:00   ` Bernard Metzler
@ 2019-07-11 11:52     ` Jason Gunthorpe
  2019-07-11 12:29     ` Bernard Metzler
  1 sibling, 0 replies; 18+ messages in thread
From: Jason Gunthorpe @ 2019-07-11 11:52 UTC (permalink / raw)
  To: Bernard Metzler
  Cc: Leon Romanovsky, Stephen Rothwell, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

On Thu, Jul 11, 2019 at 08:00:49AM +0000, Bernard Metzler wrote:

> That listen will not sleep. The socket is just marked
> listening. 

Eh? siw_listen_address() calls siw_cep_alloc() which does:

	struct siw_cep *cep = kzalloc(sizeof(*cep), GFP_KERNEL);

Which is sleeping. Many other cases too.

Jason

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

* Re:  Re: Re: linux-next: build failure after merge of the net-next tree
  2019-07-11  8:00   ` Bernard Metzler
  2019-07-11 11:52     ` Jason Gunthorpe
@ 2019-07-11 12:29     ` Bernard Metzler
  2019-07-11 14:33       ` Jason Gunthorpe
  1 sibling, 1 reply; 18+ messages in thread
From: Bernard Metzler @ 2019-07-11 12:29 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Stephen Rothwell, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

-----"Jason Gunthorpe" <jgg@mellanox.com> wrote: -----

>To: "Bernard Metzler" <BMT@zurich.ibm.com>
>From: "Jason Gunthorpe" <jgg@mellanox.com>
>Date: 07/11/2019 01:53PM
>Cc: "Leon Romanovsky" <leon@kernel.org>, "Stephen Rothwell"
><sfr@canb.auug.org.au>, "Doug Ledford" <dledford@redhat.com>, "David
>Miller" <davem@davemloft.net>, "Networking" <netdev@vger.kernel.org>,
>"Linux Next Mailing List" <linux-next@vger.kernel.org>, "Linux Kernel
>Mailing List" <linux-kernel@vger.kernel.org>
>Subject: [EXTERNAL] Re: Re: linux-next: build failure after merge of
>the net-next tree
>
>On Thu, Jul 11, 2019 at 08:00:49AM +0000, Bernard Metzler wrote:
>
>> That listen will not sleep. The socket is just marked
>> listening. 
>
>Eh? siw_listen_address() calls siw_cep_alloc() which does:
>
>	struct siw_cep *cep = kzalloc(sizeof(*cep), GFP_KERNEL);
>
>Which is sleeping. Many other cases too.
>
>Jason
>
>
Ah, true! I was after really deep sleeps like user level
socket accept() calls ;) So you are correct of course.

Thanks!
Bernard


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

* Re: Re: Re: linux-next: build failure after merge of the net-next tree
  2019-07-11 12:29     ` Bernard Metzler
@ 2019-07-11 14:33       ` Jason Gunthorpe
  2019-07-12  1:45         ` Stephen Rothwell
  0 siblings, 1 reply; 18+ messages in thread
From: Jason Gunthorpe @ 2019-07-11 14:33 UTC (permalink / raw)
  To: Bernard Metzler
  Cc: Leon Romanovsky, Stephen Rothwell, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

On Thu, Jul 11, 2019 at 12:29:21PM +0000, Bernard Metzler wrote:
> 
> >To: "Bernard Metzler" <BMT@zurich.ibm.com>
> >From: "Jason Gunthorpe" <jgg@mellanox.com>
> >Date: 07/11/2019 01:53PM
> >Cc: "Leon Romanovsky" <leon@kernel.org>, "Stephen Rothwell"
> ><sfr@canb.auug.org.au>, "Doug Ledford" <dledford@redhat.com>, "David
> >Miller" <davem@davemloft.net>, "Networking" <netdev@vger.kernel.org>,
> >"Linux Next Mailing List" <linux-next@vger.kernel.org>, "Linux Kernel
> >Mailing List" <linux-kernel@vger.kernel.org>
> >Subject: [EXTERNAL] Re: Re: linux-next: build failure after merge of
> >the net-next tree
> >
> >On Thu, Jul 11, 2019 at 08:00:49AM +0000, Bernard Metzler wrote:
> >
> >> That listen will not sleep. The socket is just marked
> >> listening. 
> >
> >Eh? siw_listen_address() calls siw_cep_alloc() which does:
> >
> >	struct siw_cep *cep = kzalloc(sizeof(*cep), GFP_KERNEL);
> >
> >Which is sleeping. Many other cases too.
> >
> >Jason
> >
> >
> Ah, true! I was after really deep sleeps like user level
> socket accept() calls ;) So you are correct of course.

I've added this patch to the rdma tree to fix the missing locking.

The merge resolution will be simply swapping
for_ifa to in_dev_for_each_ifa_rtnl.

Jason

From c421651fa2295d1219c36674c7eb8c574542ceea Mon Sep 17 00:00:00 2001
From: Jason Gunthorpe <jgg@mellanox.com>
Date: Thu, 11 Jul 2019 11:29:42 -0300
Subject: [PATCH] RDMA/siw: Add missing rtnl_lock around access to ifa

ifa is protected by rcu or rtnl, add the missing locking. In this case we
have to use rtnl since siw_listen_address() is sleeping.

Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 drivers/infiniband/sw/siw/siw_cm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index 8e618cb7261f62..c25be723c15b64 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -1975,6 +1975,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 			id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
 			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
 
+		rtnl_lock();
 		for_ifa(in_dev)
 		{
 			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
@@ -1989,6 +1990,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 			}
 		}
 		endfor_ifa(in_dev);
+		rtnl_unlock();
 		in_dev_put(in_dev);
 	} else if (id->local_addr.ss_family == AF_INET6) {
 		struct inet6_dev *in6_dev = in6_dev_get(dev);
-- 
2.21.0


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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-11 14:33       ` Jason Gunthorpe
@ 2019-07-12  1:45         ` Stephen Rothwell
  2019-07-12 15:21           ` Jason Gunthorpe
  0 siblings, 1 reply; 18+ messages in thread
From: Stephen Rothwell @ 2019-07-12  1:45 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Bernard Metzler, Leon Romanovsky, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

Hi Jason,

On Thu, 11 Jul 2019 14:33:07 +0000 Jason Gunthorpe <jgg@mellanox.com> wrote:
>
> I've added this patch to the rdma tree to fix the missing locking.
> 
> The merge resolution will be simply swapping
> for_ifa to in_dev_for_each_ifa_rtnl.

OK, I added the below merge resolution patch to the merge of the rdma
tree today (since Linus' has merged the net-next tree now).

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 12 Jul 2019 11:28:30 +1000
Subject: [PATCH] RDMA: fix for removal of for_ifa()

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/infiniband/sw/siw/siw_cm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index 43f7f12e5f7f..cbea46ff6dd1 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -1951,6 +1951,7 @@ static void siw_drop_listeners(struct iw_cm_id *id)
 int siw_create_listen(struct iw_cm_id *id, int backlog)
 {
 	struct net_device *dev = to_siw_dev(id->device)->netdev;
+	const struct in_ifaddr *ifa;
 	int rv = 0, listeners = 0;
 
 	siw_dbg(id->device, "id 0x%p: backlog %d\n", id, backlog);
@@ -1973,8 +1974,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
 
 		rtnl_lock();
-		for_ifa(in_dev)
-		{
+		in_dev_for_each_ifa_rtnl(ifa, in_dev) {
 			if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
 			    s_laddr.sin_addr.s_addr == ifa->ifa_address) {
 				s_laddr.sin_addr.s_addr = ifa->ifa_address;
@@ -1986,7 +1986,6 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
 					listeners++;
 			}
 		}
-		endfor_ifa(in_dev);
 		rtnl_unlock();
 		in_dev_put(in_dev);
 	} else if (id->local_addr.ss_family == AF_INET6) {
-- 
2.20.1

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: build failure after merge of the net-next tree
  2019-07-12  1:45         ` Stephen Rothwell
@ 2019-07-12 15:21           ` Jason Gunthorpe
  0 siblings, 0 replies; 18+ messages in thread
From: Jason Gunthorpe @ 2019-07-12 15:21 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Bernard Metzler, Leon Romanovsky, Doug Ledford, David Miller,
	Networking, Linux Next Mailing List, Linux Kernel Mailing List

On Fri, Jul 12, 2019 at 11:45:57AM +1000, Stephen Rothwell wrote:
> Hi Jason,
> 
> On Thu, 11 Jul 2019 14:33:07 +0000 Jason Gunthorpe <jgg@mellanox.com> wrote:
> >
> > I've added this patch to the rdma tree to fix the missing locking.
> > 
> > The merge resolution will be simply swapping
> > for_ifa to in_dev_for_each_ifa_rtnl.
> 
> OK, I added the below merge resolution patch to the merge of the rdma
> tree today (since Linus' has merged the net-next tree now).

Yes, this is what I'm planning on using

Thanks,
Jason

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

end of thread, other threads:[~2019-07-12 15:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09  3:56 linux-next: build failure after merge of the net-next tree Stephen Rothwell
2019-07-09  6:43 ` Leon Romanovsky
2019-07-10  4:31   ` Stephen Rothwell
2019-07-10  5:20     ` Leon Romanovsky
2019-07-10 17:52   ` Jason Gunthorpe
2019-07-11  1:50     ` Stephen Rothwell
2019-07-11  2:26       ` Jason Gunthorpe
2019-07-11  3:13         ` Stephen Rothwell
2019-07-11  3:16           ` Stephen Rothwell
2019-07-11  3:27             ` Stephen Rothwell
2019-07-11  5:40             ` Leon Romanovsky
2019-07-11  8:00   ` Bernard Metzler
2019-07-11 11:52     ` Jason Gunthorpe
2019-07-11 12:29     ` Bernard Metzler
2019-07-11 14:33       ` Jason Gunthorpe
2019-07-12  1:45         ` Stephen Rothwell
2019-07-12 15:21           ` Jason Gunthorpe
2019-07-09  9:00 ` Bernard Metzler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.