2019-07-09 04:18:18

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the net-next tree

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


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-07-09 06:47:16

by Leon Romanovsky

[permalink] [raw]
Subject: 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 <[email protected]>
Date: Sun, 7 Jul 2019 10:43:42 +0300
Subject: [PATCH] Fixup to build SIW issue

Signed-off-by: Leon Romanovsky <[email protected]>
---
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


2019-07-09 09:02:55

by Bernard Metzler

[permalink] [raw]
Subject: Re: Re: linux-next: build failure after merge of the net-next tree

-----"Leon Romanovsky" <[email protected]> wrote: -----

>To: "Stephen Rothwell" <[email protected]>
>From: "Leon Romanovsky" <[email protected]>
>Date: 07/09/2019 08:43AM
>Cc: "Doug Ledford" <[email protected]>, "Jason Gunthorpe"
><[email protected]>, "David Miller" <[email protected]>,
>"Networking" <[email protected]>, "Linux Next Mailing List"
><[email protected]>, "Linux Kernel Mailing List"
><[email protected]>, "Bernard Metzler"
><[email protected]>
>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 <[email protected]>
>Date: Sun, 7 Jul 2019 10:43:42 +0300
>Subject: [PATCH] Fixup to build SIW issue
>
>Signed-off-by: Leon Romanovsky <[email protected]>
>---
> 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.

2019-07-10 04:33:48

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

Hi Leon,

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

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

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-07-10 05:50:22

by Leon Romanovsky

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

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 <[email protected]> wrote:
> >
> > From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00 2001
> > From: Leon Romanovsky <[email protected]>
> > Date: Sun, 7 Jul 2019 10:43:42 +0300
> > Subject: [PATCH] Fixup to build SIW issue
> >
> > Signed-off-by: Leon Romanovsky <[email protected]>
>
> I applied this to linux-next today and it fixes my build problems.

Thanks

>
> --
> Cheers,
> Stephen Rothwell


2019-07-10 19:29:28

by Jason Gunthorpe

[permalink] [raw]
Subject: 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 <[email protected]>
> Date: Sun, 7 Jul 2019 10:43:42 +0300
> Subject: [PATCH] Fixup to build SIW issue
>
> Signed-off-by: Leon Romanovsky <[email protected]>
> 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);

2019-07-11 01:53:41

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

Hi all,

On Wed, 10 Jul 2019 17:52:17 +0000 Jason Gunthorpe <[email protected]> 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 <[email protected]>
> > Date: Sun, 7 Jul 2019 10:43:42 +0300
> > Subject: [PATCH] Fixup to build SIW issue
> >
> > Signed-off-by: Leon Romanovsky <[email protected]>
> > 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


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-07-11 02:46:27

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

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

2019-07-11 03:16:56

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

Hi all,

On Thu, 11 Jul 2019 13:13:44 +1000 Stephen Rothwell <[email protected]> wrote:
>
> On Thu, 11 Jul 2019 02:26:27 +0000 Jason Gunthorpe <[email protected]> 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


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-07-11 03:37:34

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

Hi Jason,

On Thu, 11 Jul 2019 02:26:27 +0000 Jason Gunthorpe <[email protected]> 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


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-07-11 03:48:18

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

Hi all,

On Thu, 11 Jul 2019 13:16:03 +1000 Stephen Rothwell <[email protected]> wrote:
>
> On Thu, 11 Jul 2019 13:13:44 +1000 Stephen Rothwell <[email protected]> wrote:
> >
> > On Thu, 11 Jul 2019 02:26:27 +0000 Jason Gunthorpe <[email protected]> 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


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-07-11 05:46:26

by Leon Romanovsky

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

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 <[email protected]> wrote:
> >
> > On Thu, 11 Jul 2019 02:26:27 +0000 Jason Gunthorpe <[email protected]> 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


2019-07-11 08:37:31

by Bernard Metzler

[permalink] [raw]
Subject: Re: Re: linux-next: build failure after merge of the net-next tree

-----"Jason Gunthorpe" <[email protected]> wrote: -----

>To: "Leon Romanovsky" <[email protected]>, "Bernard Metzler"
><[email protected]>
>From: "Jason Gunthorpe" <[email protected]>
>Date: 07/10/2019 07:52PM
>Cc: "Stephen Rothwell" <[email protected]>, "Doug Ledford"
><[email protected]>, "David Miller" <[email protected]>,
>"Networking" <[email protected]>, "Linux Next Mailing List"
><[email protected]>, "Linux Kernel Mailing List"
><[email protected]>
>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 <[email protected]>
>> Date: Sun, 7 Jul 2019 10:43:42 +0300
>> Subject: [PATCH] Fixup to build SIW issue
>>
>> Signed-off-by: Leon Romanovsky <[email protected]>
>> 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);
>
>

2019-07-11 11:54:36

by Jason Gunthorpe

[permalink] [raw]
Subject: 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

2019-07-11 12:31:54

by Bernard Metzler

[permalink] [raw]
Subject: Re: Re: Re: linux-next: build failure after merge of the net-next tree

-----"Jason Gunthorpe" <[email protected]> wrote: -----

>To: "Bernard Metzler" <[email protected]>
>From: "Jason Gunthorpe" <[email protected]>
>Date: 07/11/2019 01:53PM
>Cc: "Leon Romanovsky" <[email protected]>, "Stephen Rothwell"
><[email protected]>, "Doug Ledford" <[email protected]>, "David
>Miller" <[email protected]>, "Networking" <[email protected]>,
>"Linux Next Mailing List" <[email protected]>, "Linux Kernel
>Mailing List" <[email protected]>
>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

2019-07-11 14:33:47

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: Re: Re: linux-next: build failure after merge of the net-next tree

On Thu, Jul 11, 2019 at 12:29:21PM +0000, Bernard Metzler wrote:
>
> >To: "Bernard Metzler" <[email protected]>
> >From: "Jason Gunthorpe" <[email protected]>
> >Date: 07/11/2019 01:53PM
> >Cc: "Leon Romanovsky" <[email protected]>, "Stephen Rothwell"
> ><[email protected]>, "Doug Ledford" <[email protected]>, "David
> >Miller" <[email protected]>, "Networking" <[email protected]>,
> >"Linux Next Mailing List" <[email protected]>, "Linux Kernel
> >Mailing List" <[email protected]>
> >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 <[email protected]>
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 <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
---
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

2019-07-12 01:46:53

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

Hi Jason,

On Thu, 11 Jul 2019 14:33:07 +0000 Jason Gunthorpe <[email protected]> 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 <[email protected]>
Date: Fri, 12 Jul 2019 11:28:30 +1000
Subject: [PATCH] RDMA: fix for removal of for_ifa()

Signed-off-by: Stephen Rothwell <[email protected]>
---
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


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-07-12 15:23:36

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the net-next tree

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 <[email protected]> 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