Skip to contentSkip to conversation

linux-next: manual merge of the mm tree with the rdma tree

DISCUSSION Stephen Rothwell 2 participants 2 messages Jan 27, 2023 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

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

drivers/infiniband/hw/hfi1/file_ops.c

between commit:

1ec82317a1da ("IB/hfi1: Use dma_mmap_coherent for matching buffers")

from the rdma tree and commit:

6fe0afd07701 ("mm: replace vma->vm_flags direct modifications with modifier calls")

from the mm tree.

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.

Signature · 42 lines
Cheers,
Stephen Rothwell

diff --cc drivers/infiniband/hw/hfi1/file_ops.c
index e03b0207856e,c6e59bc480f9..000000000000
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@@ -424,17 -403,8 +424,17 @@@ static int hfi1_file_mmap(struct file *
  			ret = -EPERM;
  			goto done;
  		}
- 		vma->vm_flags &= ~VM_MAYWRITE;
+ 		vm_flags_clear(vma, VM_MAYWRITE);
 -		addr = vma->vm_start;
 +		/*
 +		 * Mmap multiple separate allocations into a single vma.  From
 +		 * here, dma_mmap_coherent() calls dma_direct_mmap(), which
 +		 * requires the mmap to exactly fill the vma starting at
 +		 * vma_start.  Adjust the vma start and end for each eager
 +		 * buffer segment mapped.  Restore the originals when done.
 +		 */
 +		vm_start_save = vma->vm_start;
 +		vm_end_save = vma->vm_end;
 +		vma->vm_end = vma->vm_start;
  		for (i = 0 ; i < uctxt->egrbufs.numbufs; i++) {
  			memlen = uctxt->egrbufs.buffers[i].len;
  			memvirt = uctxt->egrbufs.buffers[i].addr;
@@@ -560,9 -528,11 +560,9 @@@
  		goto done;
  	}
  
- 	vma->vm_flags = flags;
+ 	vm_flags_reset(vma, flags);
 -	hfi1_cdbg(PROC,
 -		  "%u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), flags:0x%lx\n",
 -		    ctxt, subctxt, type, mapio, vmf, memaddr, memlen,
 -		    vma->vm_end - vma->vm_start, vma->vm_flags);
 +	mmap_cdbg(ctxt, subctxt, type, mapio, vmf, memaddr, memvirt, memdma, 
 +		  memlen, vma);
  	if (vmf) {
  		vma->vm_pgoff = PFN_DOWN(memaddr);
  		vma->vm_ops = &vm_ops;
#1 lore raw
Quoted 15 lines · Stephen Rothwell

Hi all,

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

drivers/infiniband/hw/hfi1/file_ops.c

between commit:

1ec82317a1da ("IB/hfi1: Use dma_mmap_coherent for matching buffers")

from the rdma tree and commit:

6fe0afd07701 ("mm: replace vma->vm_flags direct modifications with modifier calls")

Quoted 8 lines

from the mm tree.

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.

Hi Stephen,
Conflict resolution for 6fe0afd07701 looks good to me. Thanks,
Suren.

Quoted 44 lines

--
Cheers,
Stephen Rothwell

drivers/infiniband/hw/hfi1/file_ops.c +2 -2
diff --cc drivers/infiniband/hw/hfi1/file_ops.c
index e03b0207856e,c6e59bc480f9..000000000000
@@@ -424,17 -403,8 +424,17 @@@ static int hfi1_file_mmap(struct file *
                        ret = -EPERM;
                        goto done;
                }
-               vma->vm_flags &= ~VM_MAYWRITE;
+               vm_flags_clear(vma, VM_MAYWRITE);
 -              addr = vma->vm_start;
 +              /*
 +               * Mmap multiple separate allocations into a single vma.  From
 +               * here, dma_mmap_coherent() calls dma_direct_mmap(), which
 +               * requires the mmap to exactly fill the vma starting at
 +               * vma_start.  Adjust the vma start and end for each eager
 +               * buffer segment mapped.  Restore the originals when done.
 +               */
 +              vm_start_save = vma->vm_start;
 +              vm_end_save = vma->vm_end;
 +              vma->vm_end = vma->vm_start;
                for (i = 0 ; i < uctxt->egrbufs.numbufs; i++) {
                        memlen = uctxt->egrbufs.buffers[i].len;
                        memvirt = uctxt->egrbufs.buffers[i].addr;
@@@ -560,9 -528,11 +560,9 @@@
                goto done;
        }
 
-       vma->vm_flags = flags;
+       vm_flags_reset(vma, flags);
 -      hfi1_cdbg(PROC,
 -                "%u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), flags:0x%lx\n",
 -                  ctxt, subctxt, type, mapio, vmf, memaddr, memlen,
 -                  vma->vm_end - vma->vm_start, vma->vm_flags);
 +      mmap_cdbg(ctxt, subctxt, type, mapio, vmf, memaddr, memvirt, memdma,
 +                memlen, vma);
        if (vmf) {
                vma->vm_pgoff = PFN_DOWN(memaddr);
                vma->vm_ops = &vm_ops;