🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Mark Brown Tue, 24 Nov 2026 15:22
linux-next: manual merge of the drm-misc tree with the net-next tree
#21902
Author: Mark Brown
Date: Tue, 24 Nov 2026 15:22
149 lines
12565 bytes
--SJSvMh+EHNwmA8Q2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi all,

Today's linux-next merge of the drm-misc tree got a conflict in:

  net/core/devmem.c

between commits:

  ede1618064a9b ("net: devmem: detach TX bindings on NETDEV_UNREGISTER")
  c4466d2c3e776 ("net: devmem: unmap dma_buf synchronously on queue uninsta=
ll")

=66rom the net-next tree and commit:

  77e0b2d2f4f37 ("treewide: Rename dma_buf_(un)map_attachment() to dma_buf_=
(un)map_sgt()")

=66rom the drm-misc tree.  I'm not sure this is an ideal time to be doing
tree wide refactorings...

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc net/core/devmem.c
index 3714364b5d9a5,a638aa3e806b7..0000000000000
--- a/net/core/devmem.c
+++ b/net/core/devmem.c
@@@ -67,84 -64,6 +67,84 @@@ static void net_devmem_dmabuf_binding_r
  	schedule_work(&binding->unbind_w);
  }
 =20
 +static void
 +net_devmem_dmabuf_binding_unmap(struct net_devmem_dmabuf_binding *binding)
 +{
 +	mutex_lock(&binding->lock);
 +	if (binding->sgt) {
 +		dma_resv_lock(binding->dmabuf->resv, NULL);
- 		dma_buf_unmap_attachment(binding->attachment, binding->sgt,
- 					 binding->direction);
++		dma_buf_unmap_sgt(binding->attachment, binding->sgt,
++				  binding->direction);
 +		dma_buf_unpin(binding->attachment);
 +		dma_resv_unlock(binding->dmabuf->resv);
 +		dma_buf_detach(binding->dmabuf, binding->attachment);
 +		binding->sgt =3D NULL;
 +		binding->attachment =3D NULL;
 +	}
 +	mutex_unlock(&binding->lock);
 +}
 +
 +/**
 + * net_devmem_lock_dev() - lock a binding's net_device if still alive
 + * @binding:		devmem binding whose @dev pointer to lock
 + * @dev_tracker:	reftracker for the held net_device reference
 + *
 + * Safely dereference @binding->dev, acquire netdev_lock() on the device,=
 and
 + * verify that @binding->dev has not been cleared while waiting for the l=
ock.
 + *
 + * Invariant: @binding->dev is set once at bind time and is only ever cle=
ared to
 + * NULL while holding netdev_lock(dev) (in mp_dmabuf_devmem_uninstall(),
 + * net_devmem_unbind_dmabuf(), or net_devmem_dev_unregister() during
 + * NETDEV_UNREGISTER before synchronize_net() and netdev_run_todo() free =
the
 + * net_device).
 + *
 + * Taking rcu_read_lock() guarantees that a non-NULL @dev read from
 + * @binding->dev has not yet completed unregister_netdevice_many_notify()
 + * (which waits for an RCU grace period via synchronize_net() after
 + * NETDEV_UNREGISTER before freeing the net_device), so netdev_hold() can
 + * safely acquire a reference before sleeping on netdev_lock(). Once
 + * netdev_lock(dev) is held, re-checking that READ_ONCE(binding->dev) =3D=
=3D dev
 + * guarantees that the device has not yet been detached from @binding and
 + * cannot finish unregistering until net_devmem_unlock_dev().
 + *
 + * Return: The locked and held net_device if @binding->dev is still non-N=
ULL,
 + * or NULL if already cleared.
 + */
 +struct net_device *
 +net_devmem_lock_dev(struct net_devmem_dmabuf_binding *binding,
 +		    netdevice_tracker *dev_tracker)
 +{
 +	struct net_device *dev;
 +
 +	rcu_read_lock();
 +	dev =3D READ_ONCE(binding->dev);
 +	if (!dev) {
 +		rcu_read_unlock();
 +		return NULL;
 +	}
 +	netdev_hold(dev, dev_tracker, GFP_ATOMIC);
 +	rcu_read_unlock();
 +
 +	netdev_lock(dev);
 +	if (READ_ONCE(binding->dev) !=3D dev) {
 +		netdev_unlock(dev);
 +		netdev_put(dev, dev_tracker);
 +		return NULL;
 +	}
 +
 +	return dev;
 +}
 +
 +void net_devmem_unlock_dev(struct net_device *dev,
 +			   netdevice_tracker *dev_tracker)
 +{
 +	if (!dev)
 +		return;
 +
 +	netdev_unlock(dev);
 +	netdev_put(dev, dev_tracker);
 +}
 +
  void __net_devmem_dmabuf_binding_free(struct work_struct *wq)
  {
  	struct net_devmem_dmabuf_binding *binding =3D container_of(wq, typeof(*b=
inding), unbind_w);

--SJSvMh+EHNwmA8Q2
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmsFq7oACgkQJNaLcl1U
h9BoaQf+Pf2MBlTrwHV7LBf1OK0NKLZZ6D71LmfJW3avr2B84OhEJ4s0OYiP5954
SNQ2YIjyn8f8xrpjFEYIHv2NkgJExHFozNC1b3khRJzqX6ExBmCW33qYD+U7shl7
LCQDCDt8cn6sBLUkcpVhiDd9RitUK17eLV9F9gVvJ4tp743jvNxmr77+eOe8RwWV
4JDCZdcAJaEaK55z6ckJ69FpzNC0wDmALaO+S8Bz3rde4bREMFWeu5dsQ+GsQCuS
QxyQenExXFTstHnMpyAJFOX5HF7edmjO9Bgmsl2yyjn5M3g8rZZs7foweX4bxJLq
Vbq910CKZXddl8pkrXteumQzeUUlNw==
=aNOo
-----END PGP SIGNATURE-----

--SJSvMh+EHNwmA8Q2--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads