public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Jacob Moroni <jmoroni@google.com>
Cc: tatyana.e.nikolova@intel.com, krzysztof.czurylo@intel.com,
	leon@kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [RFC] RDMA/irdma: Add support for revocable dmabuf import
Date: Tue, 17 Feb 2026 19:21:58 -0400	[thread overview]
Message-ID: <20260217232158.GQ750753@ziepe.ca> (raw)
In-Reply-To: <CAHYDg1QdYZjT81gB6geWKpeRR1TEPKnk9XD1eXcMriVAOHCo4w@mail.gmail.com>

On Tue, Feb 17, 2026 at 06:08:54PM -0500, Jacob Moroni wrote:
> Hi,
> 
> Thanks for taking a look.
> 
> > Really need to explain this better, I forget how iwarp works - but you
> > can't release the rkey/stag in a way that something else can get it
> > reallocated.
> 
> I think the HW command names are a little confusing, but for irdma, the key
> allocation is actually handled by the driver. The key can't be reused until
> the region is fully deregistered (which calls irdma_free_stag), so a new
> registration can't grab the same key even if the dmabuf revocation occurs.

Hmm, maybe that is OK then. Please explain it though more clearly like
this paragraph
 
> > Finally, we don't actually support revocable mappings at the core code
> > level. We either have fully pinned or fully movable, so this is not
> > right to just change to ib_umem_dmabuf_get(), that assumes the HW is
> > fault capable.
> 
> Ack. It sounds like what I really want is more like ib_umem_dmabuf_get_pinned
> but with a functional invalidate_mappings method?

Yes, method provided by the driver.

> > Probably what you want to do is add a revoke callback to the pinned
> > importer?
>
> That does seem ideal.

Probably, but  I  mean some argument to the
ib_umem_dmabuf_get_pinned(), not a whole new op for MRs..

> Re-registering it as a 0 length region (will check
> the spec) seems like the easiest way to achieve it. Using a special PD
> for quarantine purposes should also work, but it would add a little more
> state and an object to manage (could we keep it in struct ib_device?).

Yes these are good options, but if they rkey is preserved it is not
strictly necessary to do these things. Pedentically the user should be
able to re-reg that mkey and revive it, but nobody does that and you
don't have to try to implement it.

> Should I create a new kernel device method for this? If so, then I wonder if
> it makes sense to expose it as a generic "invalidate_mr" method and let
> the drivers choose now to actually implement it (many can probably just
> forward the call to their internal rereg_mr logic).

I have on and off thought about doing something like that with rereg
mr as it would be more general, but I think for now just extending the
ib_umem_dmabuf_get_pinned() is reasonable, and avoids the races.

Keep in mind umems are used for more than just MRs, so a global op
gets a bit tricky.

Jason

  reply	other threads:[~2026-02-17 23:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 18:21 [RFC] RDMA/irdma: Add support for revocable dmabuf import Jacob Moroni
2026-02-17 18:45 ` Jason Gunthorpe
2026-02-17 23:08   ` Jacob Moroni
2026-02-17 23:21     ` Jason Gunthorpe [this message]
2026-02-18  9:05       ` Leon Romanovsky
2026-02-18 15:24         ` Jacob Moroni

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=20260217232158.GQ750753@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=jmoroni@google.com \
    --cc=krzysztof.czurylo@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=tatyana.e.nikolova@intel.com \
    /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