LKML Archive on lore.kernel.org
 help / Atom feed
* linux-next: build failure after merge of the ida tree
@ 2018-08-10  6:36 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2018-08-10  6:36 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Mike Christie

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

Hi Matthew,

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

drivers/target/iscsi/iscsi_target_login.c: In function 'iscsi_login_zero_tsih_s1':
drivers/target/iscsi/iscsi_target_login.c:376:16: error: 'sess_idr_lock' undeclared (first use in this function); did you mean 'auth_id_lock'?
  spin_lock_bh(&sess_idr_lock);
                ^~~~~~~~~~~~~
                auth_id_lock
drivers/target/iscsi/iscsi_target_login.c:376:16: note: each undeclared identifier is reported only once for each function it appears in
drivers/target/iscsi/iscsi_target_login.c:377:14: error: 'sess_idr' undeclared (first use in this function); did you mean 'sess_ida'?
  idr_remove(&sess_idr, sess->session_index);
              ^~~~~~~~
              sess_ida

Caused by commit

  9cd88edeaa9d ("target/iscsi: Allocate session IDs from an IDA")

interacting with commit

  ad86353cbddb ("iscsi target: fix session creation failure handling")

I have reverted commit 9cd88edeaa9d for today.

-- 
Cheers,
Stephen Rothwell

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

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

* Re: linux-next: build failure after merge of the ida tree
  2018-07-18 13:31       ` Matthew Wilcox
@ 2018-07-18 14:25         ` Pablo Neira Ayuso
  0 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2018-07-18 14:25 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Stephen Rothwell, NetFilter, Linux-Next Mailing List,
	Linux Kernel Mailing List, Varsha Rao

On Wed, Jul 18, 2018 at 06:31:26AM -0700, Matthew Wilcox wrote:
> On Wed, Jul 18, 2018 at 03:27:46PM +0200, Pablo Neira Ayuso wrote:
> > On Wed, Jul 18, 2018 at 06:14:46AM -0700, Matthew Wilcox wrote:
> > > So Varsha, if you would like to take a look at transforming table->sets
> > > from a LIST_HEAD to an IDR, I think that would be a great use of your
> > > time.
> > 
> > Please, don't do so, we don't need a radix tree datastructure, it's
> > just more complexity.
> 
> It's no more complex to use than the list_* macros.

Problem is that some of the sets that we place in that list may have
no ID.

We basically have two type of sets:

* Sets with names, they have no IDs as the user provides a meaningful
  name from the control plane that can be used to add/delete elements,
  eg. IP addresses.

* Anonymous sets, these are built-in into rules, eg.

  ip saddr { 1.1.1.1, 2.2.2.2 }

  so we generate an ID that we can use to refer to the set.

For our usecase, I'm thinking, if we don't have a simple way to
allocate IDs through this API, we could just simplify our existing
codebase by using an u64 and use incremental id, we don't need to
recycle IDs, so that's one posibility I stop bothering you ;-)

BTW, the anti-pattern we have in our codebase is the same logic that we
have to allocate identifiers with netdevice name, see __dev_alloc_name()
in net/core/dev.c. *Someone* copied + pasted + mangled that original code
to make it fit into netfilter. I guess that code may benefit from a
simple way to allocate IDs without locking dependencies. Just an idea,
not that this is a priority.

Thanks!

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

* Re: linux-next: build failure after merge of the ida tree
  2018-07-18 13:27     ` Pablo Neira Ayuso
@ 2018-07-18 13:31       ` Matthew Wilcox
  2018-07-18 14:25         ` Pablo Neira Ayuso
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Wilcox @ 2018-07-18 13:31 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Stephen Rothwell, NetFilter, Linux-Next Mailing List,
	Linux Kernel Mailing List, Varsha Rao

On Wed, Jul 18, 2018 at 03:27:46PM +0200, Pablo Neira Ayuso wrote:
> On Wed, Jul 18, 2018 at 06:14:46AM -0700, Matthew Wilcox wrote:
> > So Varsha, if you would like to take a look at transforming table->sets
> > from a LIST_HEAD to an IDR, I think that would be a great use of your
> > time.
> 
> Please, don't do so, we don't need a radix tree datastructure, it's
> just more complexity.

It's no more complex to use than the list_* macros.

> We just wanted to have a simple way to allocate IDs using a bitmap
> structure in the background without reinventing the wheel.

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

* Re: linux-next: build failure after merge of the ida tree
  2018-07-18 13:14   ` Matthew Wilcox
@ 2018-07-18 13:27     ` Pablo Neira Ayuso
  2018-07-18 13:31       ` Matthew Wilcox
  0 siblings, 1 reply; 11+ messages in thread
From: Pablo Neira Ayuso @ 2018-07-18 13:27 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Stephen Rothwell, NetFilter, Linux-Next Mailing List,
	Linux Kernel Mailing List, Varsha Rao

On Wed, Jul 18, 2018 at 06:14:46AM -0700, Matthew Wilcox wrote:
> On Wed, Jul 18, 2018 at 11:24:26AM +0200, Pablo Neira Ayuso wrote:
> > > interacting with commit
> > > 
> > >   9679150a0bd5 ("netfilter: nf_tables: Use id allocation")
> > > 
> > > from the netfilter-next tree.
> > 
> > @Varsha, I'm very sorry, but I guess I have to toss your patch, I
> > would prefer avoid dependencies with the IDA API by now.
> 
> I've had a chance to read this patch a bit more carefully.  It transforms
> one anti-pattern into another, so I can't say I'm a fan.
> 
> The first is specific to the networking code; having a list of things
> with IDs, and constructing a bitmap when we need to allocate a new ID.
> 
> The second is having both an IDA and a list of things.
> 
> The more effective way to do all of this is to use an IDR.  You can get
> rid of the linked list *and* the IDA, and it's faster to iterate over.
> The root of the IDR is the same size as the list_head, and then you need
> only store the 4-byte ID in each element instead of the 16-byte list_head.
> 
> So Varsha, if you would like to take a look at transforming table->sets
> from a LIST_HEAD to an IDR, I think that would be a great use of your
> time.

Please, don't do so, we don't need a radix tree datastructure, it's
just more complexity.

We just wanted to have a simple way to allocate IDs using a bitmap
structure in the background without reinventing the wheel.

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

* Re: linux-next: build failure after merge of the ida tree
  2018-07-18 11:59   ` Matthew Wilcox
@ 2018-07-18 13:25     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2018-07-18 13:25 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Stephen Rothwell, NetFilter, Linux-Next Mailing List,
	Linux Kernel Mailing List, Varsha Rao

On Wed, Jul 18, 2018 at 04:59:19AM -0700, Matthew Wilcox wrote:
> On Wed, Jul 18, 2018 at 11:24:26AM +0200, Pablo Neira Ayuso wrote:
> > I see, we have no more lockless API for IDA anymore :-(. In our case,
> > we were already protected by the the nfnl_lock mutex, which it was
> > sufficient to ensure non-concurrent access to IDA structures.
> 
> You're actually the first user for whom this is true.  For every other
> user, the requirement to manage their own spinlock was a pain.
> 
> > Unless I'm missing anything, the new API forces use to the spinlock
> > call with disabled irq for each time we update something from the
> > netfilter netlink interface, so that's a no-go for us.
> 
> I can't believe that's a serious problem for you, though.  You're calling
> sscanf(), this can't possibly be a performance path.

It's not about performance, this is control plane code. This is
disabling irqs, which is something we don't need.

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

* Re: linux-next: build failure after merge of the ida tree
  2018-07-18  9:24 ` Pablo Neira Ayuso
  2018-07-18 11:59   ` Matthew Wilcox
@ 2018-07-18 13:14   ` Matthew Wilcox
  2018-07-18 13:27     ` Pablo Neira Ayuso
  1 sibling, 1 reply; 11+ messages in thread
From: Matthew Wilcox @ 2018-07-18 13:14 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Stephen Rothwell, NetFilter, Linux-Next Mailing List,
	Linux Kernel Mailing List, Varsha Rao

On Wed, Jul 18, 2018 at 11:24:26AM +0200, Pablo Neira Ayuso wrote:
> > interacting with commit
> > 
> >   9679150a0bd5 ("netfilter: nf_tables: Use id allocation")
> > 
> > from the netfilter-next tree.
> 
> @Varsha, I'm very sorry, but I guess I have to toss your patch, I
> would prefer avoid dependencies with the IDA API by now.

I've had a chance to read this patch a bit more carefully.  It transforms
one anti-pattern into another, so I can't say I'm a fan.

The first is specific to the networking code; having a list of things
with IDs, and constructing a bitmap when we need to allocate a new ID.

The second is having both an IDA and a list of things.

The more effective way to do all of this is to use an IDR.  You can get
rid of the linked list *and* the IDA, and it's faster to iterate over.
The root of the IDR is the same size as the list_head, and then you need
only store the 4-byte ID in each element instead of the 16-byte list_head.

So Varsha, if you would like to take a look at transforming table->sets
from a LIST_HEAD to an IDR, I think that would be a great use of your
time.

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

* Re: linux-next: build failure after merge of the ida tree
  2018-07-18  9:24 ` Pablo Neira Ayuso
@ 2018-07-18 11:59   ` Matthew Wilcox
  2018-07-18 13:25     ` Pablo Neira Ayuso
  2018-07-18 13:14   ` Matthew Wilcox
  1 sibling, 1 reply; 11+ messages in thread
From: Matthew Wilcox @ 2018-07-18 11:59 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Stephen Rothwell, NetFilter, Linux-Next Mailing List,
	Linux Kernel Mailing List, Varsha Rao

On Wed, Jul 18, 2018 at 11:24:26AM +0200, Pablo Neira Ayuso wrote:
> I see, we have no more lockless API for IDA anymore :-(. In our case,
> we were already protected by the the nfnl_lock mutex, which it was
> sufficient to ensure non-concurrent access to IDA structures.

You're actually the first user for whom this is true.  For every other
user, the requirement to manage their own spinlock was a pain.

> Unless I'm missing anything, the new API forces use to the spinlock
> call with disabled irq for each time we update something from the
> netfilter netlink interface, so that's a no-go for us.

I can't believe that's a serious problem for you, though.  You're calling
sscanf(), this can't possibly be a performance path.

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

* Re: linux-next: build failure after merge of the ida tree
  2018-07-18  6:54 Stephen Rothwell
@ 2018-07-18  9:24 ` Pablo Neira Ayuso
  2018-07-18 11:59   ` Matthew Wilcox
  2018-07-18 13:14   ` Matthew Wilcox
  0 siblings, 2 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2018-07-18  9:24 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Matthew Wilcox, NetFilter, Linux-Next Mailing List,
	Linux Kernel Mailing List, Varsha Rao

Hi Matthew, Stephen,

On Wed, Jul 18, 2018 at 04:54:06PM +1000, Stephen Rothwell wrote:
> Hi Matthew,
> 
> After merging the ida tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
> 
> net/netfilter/nf_tables_api.c: In function 'nf_tables_set_alloc_name':
> net/netfilter/nf_tables_api.c:3014:8: error: implicit declaration of function 'ida_get_new_above'; did you mean 'idr_get_next_ul'? [-Werror=implicit-function-declaration]
>     n = ida_get_new_above(&inuse, tmp, &id);
>         ^~~~~~~~~~~~~~~~~
>         idr_get_next_ul
> 
> Caused by commit
> 
>   3f2668c1e101 ("ida: Remove old API")

I see, we have no more lockless API for IDA anymore :-(. In our case,
we were already protected by the the nfnl_lock mutex, which it was
sufficient to ensure non-concurrent access to IDA structures.

Unless I'm missing anything, the new API forces use to the spinlock
call with disabled irq for each time we update something from the
netfilter netlink interface, so that's a no-go for us.

> interacting with commit
> 
>   9679150a0bd5 ("netfilter: nf_tables: Use id allocation")
> 
> from the netfilter-next tree.

@Varsha, I'm very sorry, but I guess I have to toss your patch, I
would prefer avoid dependencies with the IDA API by now.

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

* linux-next: build failure after merge of the ida tree
@ 2018-07-18  6:54 Stephen Rothwell
  2018-07-18  9:24 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Rothwell @ 2018-07-18  6:54 UTC (permalink / raw)
  To: Matthew Wilcox, Pablo Neira Ayuso, NetFilter
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Varsha Rao

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

Hi Matthew,

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

net/netfilter/nf_tables_api.c: In function 'nf_tables_set_alloc_name':
net/netfilter/nf_tables_api.c:3014:8: error: implicit declaration of function 'ida_get_new_above'; did you mean 'idr_get_next_ul'? [-Werror=implicit-function-declaration]
    n = ida_get_new_above(&inuse, tmp, &id);
        ^~~~~~~~~~~~~~~~~
        idr_get_next_ul

Caused by commit

  3f2668c1e101 ("ida: Remove old API")

interacting with commit

  9679150a0bd5 ("netfilter: nf_tables: Use id allocation")

from the netfilter-next tree.

I took a guess and applied the following merge fix patch.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 18 Jul 2018 16:42:26 +1000
Subject: [PATCH] ida: merge fix for ida_get_new_above() removal

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 net/netfilter/nf_tables_api.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b7b5fbcda8dd..151b89174979 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2995,7 +2995,7 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,
 {
 	const struct nft_set *i;
 	const char *p;
-	unsigned int n = 0, id = 0;
+	int id = 0;
 	DEFINE_IDA(inuse);
 
 	p = strchr(name, '%');
@@ -3011,22 +3011,22 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,
 			if (!sscanf(i->name, name, &tmp))
 				continue;
 
-			n = ida_get_new_above(&inuse, tmp, &id);
-			if (n < 0) {
-				if (n == -EAGAIN)
+			id = ida_alloc_min(&inuse, tmp, GFP_KERNEL);
+			if (id < 0) {
+				if (id == -EAGAIN)
 					return -ENOMEM;
 
-				return n;
+				return id;
 			}
 		}
 
-		n = ida_get_new_above(&inuse, 0, &id);
+		id = ida_alloc(&inuse, GFP_KERNEL);
 		ida_destroy(&inuse);
 
-		if (n < 0) {
-			if (n == -EAGAIN)
+		if (id < 0) {
+			if (id == -EAGAIN)
 				return -ENOMEM;
-			return n;
+			return id;
 		}
 
 	}

-- 
Cheers,
Stephen Rothwell

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

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

* linux-next: build failure after merge of the ida tree
@ 2018-07-05  5:13 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2018-07-05  5:13 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Linux-Next Mailing List, Linux Kernel Mailing List

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

Hi Matthew,

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

lib/test_xarray.c: In function 'xa_alloc_value':
lib/test_xarray.c:39:16: error: implicit declaration of function 'xa_alloc'; did you mean 'ida_alloc'? [-Werror=implicit-function-declaration]
  XA_BUG_ON(xa, xa_alloc(xa, &id, xa_mk_value(index), GFP_KERNEL) != 0);
                ^
lib/test_xarray.c:21:6: note: in definition of macro 'XA_BUG_ON'
  if (x) {      \
      ^

Caused by commit

  1af163b61ed6 ("xarray: Track free entries in an XArray")

I have reverted that commit for today (and the following one).

-- 
Cheers,
Stephen Rothwell

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

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

* linux-next: build failure after merge of the ida tree
@ 2018-07-05  4:36 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2018-07-05  4:36 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Linux-Next Mailing List, Linux Kernel Mailing List

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

Hi all,

After merging the ida tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

In file included from include/linux/kernel.h:14:0,
                 from include/asm-generic/bug.h:18,
                 from arch/powerpc/include/asm/bug.h:128,
                 from include/linux/bug.h:5,
                 from arch/powerpc/include/asm/mmu.h:126,
                 from arch/powerpc/include/asm/lppaca.h:36,
                 from arch/powerpc/include/asm/paca.h:21,
                 from arch/powerpc/include/asm/current.h:16,
                 from include/linux/mutex.h:14,
                 from arch/powerpc/platforms/powernv/vas-window.c:13:
arch/powerpc/platforms/powernv/vas-window.c: In function 'vas_assign_window_id':
arch/powerpc/platforms/powernv/vas-window.c:528:42: error: 'VAX_WINDOWS_PER_CHIP' undeclared (first use in this function); did you mean 'VAS_WINDOWS_PER_CHIP'?
   pr_err("Too many (%d) open windows\n", VAX_WINDOWS_PER_CHIP);
                                          ^
include/linux/printk.h:304:33: note: in definition of macro 'pr_err'
  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                 ^~~~~~~~~~~
arch/powerpc/platforms/powernv/vas-window.c:528:42: note: each undeclared identifier is reported only once for each function it appears in
   pr_err("Too many (%d) open windows\n", VAX_WINDOWS_PER_CHIP);
                                          ^
include/linux/printk.h:304:33: note: in definition of macro 'pr_err'
  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                 ^~~~~~~~~~~

Caused by commit

  bbf959d51112 ("ppc: Convert vas ID allocation to new IDA API")

I applied the following fix patch for today:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 5 Jul 2018 14:33:40 +1000
Subject: [PATCH] ppc: fixup for "Convert vas ID allocation to new IDA API"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/powernv/vas-window.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
index d313b38846eb..97c9b4863609 100644
--- a/arch/powerpc/platforms/powernv/vas-window.c
+++ b/arch/powerpc/platforms/powernv/vas-window.c
@@ -525,7 +525,7 @@ static int vas_assign_window_id(struct ida *ida)
 	int winid = ida_alloc_max(ida, VAS_WINDOWS_PER_CHIP, GFP_KERNEL);
 
 	if (winid == -ENOSPC) {
-		pr_err("Too many (%d) open windows\n", VAX_WINDOWS_PER_CHIP);
+		pr_err("Too many (%d) open windows\n", VAS_WINDOWS_PER_CHIP);
 		return -EAGAIN;
 	}
 
-- 
2.17.1

-- 
Cheers,
Stephen Rothwell

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

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

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10  6:36 linux-next: build failure after merge of the ida tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2018-07-18  6:54 Stephen Rothwell
2018-07-18  9:24 ` Pablo Neira Ayuso
2018-07-18 11:59   ` Matthew Wilcox
2018-07-18 13:25     ` Pablo Neira Ayuso
2018-07-18 13:14   ` Matthew Wilcox
2018-07-18 13:27     ` Pablo Neira Ayuso
2018-07-18 13:31       ` Matthew Wilcox
2018-07-18 14:25         ` Pablo Neira Ayuso
2018-07-05  5:13 Stephen Rothwell
2018-07-05  4:36 Stephen Rothwell

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox