linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: willy@infradead.org
Cc: hans.westgaard.ry@oracle.com,
	"Doug Ledford" <dledford@redhat.com>,
	linux-rdma@vger.kernel.org,
	"Håkon Bugge" <haakon.bugge@oracle.com>,
	"Parav Pandit" <parav@mellanox.com>,
	"Jack Morgenstein" <jackm@dev.mellanox.co.il>,
	"Pravin Shedge" <pravin.shedge4linux@gmail.com>,
	linux-kernel@vger.kernel.org,
	"Matthew Wilcox" <mawilcox@microsoft.com>
Subject: Re: [PATCH v3 2/2] IB/mad: Use IDR for agent IDs
Date: Mon, 18 Jun 2018 11:26:05 -0600	[thread overview]
Message-ID: <20180618172605.GA32003@ziepe.ca> (raw)
In-Reply-To: <20180613123403.25233-3-willy@infradead.org>

On Wed, Jun 13, 2018 at 05:34:03AM -0700, willy@infradead.org wrote:
> 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.  We limit the assigned ID to be less
> than 2^24 as the mlx4 driver uses the most significant byte of the agent
> ID to store the slave number.  Users unlucky enough to see a collision
> between agent numbers and slave numbers see messages like:
> 
>  mlx4_ib: egress mad has non-null tid msb:1 class:4 slave:0
> 
> and the MAD layer stops working.
> 
> We look up the agent under protection of the RCU lock, which means we
> have to free the agent using kfree_rcu, and only increment the reference
> counter if it is not 0.
> 
> Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
> Reported-by: Hans Westgaard Ry <hans.westgaard.ry@oracle.com>
> Acked-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
> Tested-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
> ---
>  drivers/infiniband/core/mad.c      | 83 ++++++++++++++++++------------
>  drivers/infiniband/core/mad_priv.h |  7 +--
>  2 files changed, 55 insertions(+), 35 deletions(-)

Applied to for-next, thanks everyone

Jason

      reply	other threads:[~2018-06-18 17:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 12:34 [PATCH v3 0/2] Convert IB/mad to use an IDR for agent IDs Matthew Wilcox
2018-06-13 12:34 ` [PATCH v3 1/2] IDR: Expose the XArray lock Matthew Wilcox
2018-06-13 17:30   ` Jason Gunthorpe
2018-06-13 18:49     ` Matthew Wilcox
2018-06-13 18:45   ` [PATCH " Matthew Wilcox
2018-06-13 12:34 ` [PATCH v3 2/2] IB/mad: Use IDR for agent IDs Matthew Wilcox
2018-06-18 17:26   ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180618172605.GA32003@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=haakon.bugge@oracle.com \
    --cc=hans.westgaard.ry@oracle.com \
    --cc=jackm@dev.mellanox.co.il \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mawilcox@microsoft.com \
    --cc=parav@mellanox.com \
    --cc=pravin.shedge4linux@gmail.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).