mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* linux-next: manual merge of the drm-misc tree with the net-next tree
@ 2026-11-24 15:22 Mark Brown
  0 siblings, 0 replies; only message in thread
From: Mark Brown @ 2026-11-24 15:22 UTC (permalink / raw)
  To: Simona Vetter, Intel Graphics, DRI
  Cc: Alistair Popple, Christian König, David Miller,
	Jakub Kicinski, Jason Gunthorpe, Jason Gunthorpe,
	Linux Kernel Mailing List, Linux Next Mailing List, Mina Almasry,
	Networking, Paolo Abeni

[-- Attachment #1: Type: text/plain, Size: 4108 bytes --]

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 uninstall")

from the net-next tree and commit:

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

from 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);
  }
  
 +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 = NULL;
 +		binding->attachment = 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 lock.
 + *
 + * Invariant: @binding->dev is set once at bind time and is only ever cleared 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) == 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-NULL,
 + * 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 = 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) != 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 = container_of(wq, typeof(*binding), unbind_w);

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-24 15:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 15:22 linux-next: manual merge of the drm-misc tree with the net-next tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®