On Tue, Feb 17, 2026 at 08:11:34PM -0400, Jason Gunthorpe wrote:
> +     match_args.attach = attach;
> +     if (dmabuf->ops->match_mapping) {
> +             ret = dmabuf->ops->match_mapping(&match_args);
> +     }
> +
>       attach->dmabuf = dmabuf;
>       attach->importer_ops = importer_ops;
>       attach->importer_priv = importer_priv;

I may misunderstand the intended contract. match_mapping() runs while the
attachment is still zeroed and without dmabuf->resv held.

Patch 11's amdgpu callback needs importer_ops and importer_priv, so its XGMI
match cannot work here. Patch 12's VFIO callback asserts dmabuf->resv and
reads priv->vdev, which cleanup changes under that lock.

Should the core initialize the attachment and hold dmabuf->resv for
match_mapping(), or should callbacks avoid attachment and lock-protected
state?

Thanks,
Karl

Reply via email to