Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-13 Thread jackm
On Fri, 8 Jun 2018 10:42:18 -0700 Matthew Wilcox wrote: > From: Matthew Wilcox > > Allocate agent IDs from a global IDR instead of an atomic variable. > This eliminates the possibility of reusing an ID which is already in > use after 4 billion registrations, and we can also limit the assigned

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-13 Thread Leon Romanovsky
On Tue, Jun 12, 2018 at 05:07:39PM -0700, Matthew Wilcox wrote: > On Tue, Jun 12, 2018 at 02:33:22PM -0600, Jason Gunthorpe wrote: > > > @@ -377,13 +378,24 @@ struct ib_mad_agent *ib_register_mad_agent(struct > > > ib_device *device, > > > goto error4; > > > } > > > > > > -

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-12 Thread Matthew Wilcox
On Tue, Jun 12, 2018 at 02:33:22PM -0600, Jason Gunthorpe wrote: > > @@ -377,13 +378,24 @@ struct ib_mad_agent *ib_register_mad_agent(struct > > ib_device *device, > > goto error4; > > } > > > > - spin_lock_irq(_priv->reg_lock); > > - mad_agent_priv->agent.hi_tid =

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-12 Thread Jason Gunthorpe
On Fri, Jun 08, 2018 at 10:42:18AM -0700, Matthew Wilcox wrote: > From: Matthew Wilcox > > Allocate agent IDs from a global IDR instead of an atomic variable. > This eliminates the possibility of reusing an ID which is already in > use after 4 billion registrations, and we can also limit the

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-12 Thread Jason Gunthorpe
On Tue, Jun 12, 2018 at 07:59:42AM +0300, jackm wrote: > On Mon, 11 Jun 2018 10:19:18 -0600 > Jason Gunthorpe wrote: > > > On Mon, Jun 11, 2018 at 09:19:14AM +0300, jackm wrote: > > > On Sun, 10 Jun 2018 22:42:03 -0600 > > > Jason Gunthorpe wrote: > > > > > > > Er, the spec has nothing to do

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-12 Thread Matthew Wilcox
On Tue, Jun 12, 2018 at 11:50:46AM +0300, jackm wrote: > On Fri, 8 Jun 2018 10:42:18 -0700 > Matthew Wilcox wrote: > > > + rcu_read_lock(); > > + mad_agent = idr_find(_mad_clients, hi_tid); > > + if (mad_agent > > && !atomic_inc_not_zero(_agent->refcount)) > > +

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-12 Thread jackm
On Fri, 8 Jun 2018 10:42:18 -0700 Matthew Wilcox wrote: > + rcu_read_lock(); > + mad_agent = idr_find(_mad_clients, hi_tid); > + if (mad_agent > && !atomic_inc_not_zero(_agent->refcount)) > + mad_agent = NULL; > +

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-11 Thread jackm
On Mon, 11 Jun 2018 10:19:18 -0600 Jason Gunthorpe wrote: > On Mon, Jun 11, 2018 at 09:19:14AM +0300, jackm wrote: > > On Sun, 10 Jun 2018 22:42:03 -0600 > > Jason Gunthorpe wrote: > > > > > Er, the spec has nothing to do with this. In Linux the TID is made > > > unique because the core code

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-11 Thread Jason Gunthorpe
On Mon, Jun 11, 2018 at 09:19:14AM +0300, jackm wrote: > On Sun, 10 Jun 2018 22:42:03 -0600 > Jason Gunthorpe wrote: > > > Er, the spec has nothing to do with this. In Linux the TID is made > > unique because the core code provides 32 bits that are unique and the > > user provides another 32

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-11 Thread jackm
On Sun, 10 Jun 2018 22:42:03 -0600 Jason Gunthorpe wrote: > Er, the spec has nothing to do with this. In Linux the TID is made > unique because the core code provides 32 bits that are unique and the > user provides another 32 bits that are unique. The driver cannot > change any of those bits

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-10 Thread Jason Gunthorpe
On Mon, Jun 11, 2018 at 07:34:25AM +0300, Leon Romanovsky wrote: > On Sun, Jun 10, 2018 at 02:30:27PM -0600, Jason Gunthorpe wrote: > > On Sun, Jun 10, 2018 at 03:25:05PM +0300, Leon Romanovsky wrote: > > > On Sun, Jun 10, 2018 at 03:43:05AM -0700, Matthew Wilcox wrote: > > > > On Sun, Jun 10,

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-10 Thread Leon Romanovsky
On Sun, Jun 10, 2018 at 02:30:27PM -0600, Jason Gunthorpe wrote: > On Sun, Jun 10, 2018 at 03:25:05PM +0300, Leon Romanovsky wrote: > > On Sun, Jun 10, 2018 at 03:43:05AM -0700, Matthew Wilcox wrote: > > > On Sun, Jun 10, 2018 at 09:30:28AM +0300, Leon Romanovsky wrote: > > > > 1. IBTA spec

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-10 Thread Jason Gunthorpe
On Sun, Jun 10, 2018 at 03:25:05PM +0300, Leon Romanovsky wrote: > On Sun, Jun 10, 2018 at 03:43:05AM -0700, Matthew Wilcox wrote: > > On Sun, Jun 10, 2018 at 09:30:28AM +0300, Leon Romanovsky wrote: > > > 1. IBTA spec doesn't talk at all about the size of TransactionID, more > > > on that in

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-10 Thread Leon Romanovsky
On Sun, Jun 10, 2018 at 03:43:05AM -0700, Matthew Wilcox wrote: > On Sun, Jun 10, 2018 at 09:30:28AM +0300, Leon Romanovsky wrote: > > 1. IBTA spec doesn't talk at all about the size of TransactionID, more > > on that in section "13.4.6.4 TRANSACTION ID USAGE", the specification > > says: "The

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-10 Thread Matthew Wilcox
On Sun, Jun 10, 2018 at 09:30:28AM +0300, Leon Romanovsky wrote: > 1. IBTA spec doesn't talk at all about the size of TransactionID, more > on that in section "13.4.6.4 TRANSACTION ID USAGE", the specification > says: "The contents of the TransactionID (TID) field are implementation- > dependent.

Re: [PATCH 2/2] IB/mad: Use IDR for agent IDs

2018-06-10 Thread Leon Romanovsky
On Fri, Jun 08, 2018 at 10:42:18AM -0700, Matthew Wilcox wrote: > From: Matthew Wilcox > > Allocate agent IDs from a global IDR instead of an atomic variable. > This eliminates the possibility of reusing an ID which is already in > use after 4 billion registrations, and we can also limit the