kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] use mmgrab
@ 2019-12-29 15:42 Julia Lawall
  2019-12-29 15:42 ` [PATCH 2/4] vfio: vfio_pci_nvlink2: " Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Julia Lawall @ 2019-12-29 15:42 UTC (permalink / raw)
  To: kvm; +Cc: kernel-janitors, Cornelia Huck, linux-kernel, linuxppc-dev, openrisc

Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
helper") and most of the kernel was updated to use it. Update a few
remaining files.

---

 arch/openrisc/kernel/smp.c          |    2 +-
 drivers/misc/cxl/context.c          |    2 +-
 drivers/vfio/pci/vfio_pci_nvlink2.c |    2 +-
 drivers/vfio/vfio_iommu_spapr_tce.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
  2019-12-29 15:42 [PATCH 0/4] use mmgrab Julia Lawall
@ 2019-12-29 15:42 ` Julia Lawall
  2020-01-06 23:05   ` Alex Williamson
  2020-01-07  9:14   ` Cornelia Huck
  2019-12-29 15:42 ` [PATCH 3/4] vfio/spapr_tce: " Julia Lawall
  2020-01-03 12:31 ` [PATCH 0/4] " Dan Carpenter
  2 siblings, 2 replies; 12+ messages in thread
From: Julia Lawall @ 2019-12-29 15:42 UTC (permalink / raw)
  To: Alex Williamson; +Cc: kernel-janitors, Cornelia Huck, kvm, linux-kernel

Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
helper") and most of the kernel was updated to use it. Update a
remaining file.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@ expression e; @@
- atomic_inc(&e->mm_count);
+ mmgrab(e);
</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 drivers/vfio/pci/vfio_pci_nvlink2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
index f2983f0f84be..43df10af7f66 100644
--- a/drivers/vfio/pci/vfio_pci_nvlink2.c
+++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
@@ -159,7 +159,7 @@ static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,
 	data->useraddr = vma->vm_start;
 	data->mm = current->mm;
 
-	atomic_inc(&data->mm->mm_count);
+	mmgrab(data->mm);
 	ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
 			vma_pages(vma), data->gpu_hpa, &data->mem);
 


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] vfio/spapr_tce: use mmgrab
  2019-12-29 15:42 [PATCH 0/4] use mmgrab Julia Lawall
  2019-12-29 15:42 ` [PATCH 2/4] vfio: vfio_pci_nvlink2: " Julia Lawall
@ 2019-12-29 15:42 ` Julia Lawall
  2020-01-06 23:05   ` Alex Williamson
  2020-01-07  9:14   ` Cornelia Huck
  2020-01-03 12:31 ` [PATCH 0/4] " Dan Carpenter
  2 siblings, 2 replies; 12+ messages in thread
From: Julia Lawall @ 2019-12-29 15:42 UTC (permalink / raw)
  To: Alex Williamson; +Cc: kernel-janitors, Cornelia Huck, kvm, linux-kernel

Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
helper") and most of the kernel was updated to use it. Update a
remaining file.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@ expression e; @@
- atomic_inc(&e->mm_count);
+ mmgrab(e);
</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 drivers/vfio/vfio_iommu_spapr_tce.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
index 26cef65b41e7..16b3adc508db 100644
--- a/drivers/vfio/vfio_iommu_spapr_tce.c
+++ b/drivers/vfio/vfio_iommu_spapr_tce.c
@@ -79,7 +79,7 @@ static long tce_iommu_mm_set(struct tce_container *container)
 	}
 	BUG_ON(!current->mm);
 	container->mm = current->mm;
-	atomic_inc(&container->mm->mm_count);
+	mmgrab(container->mm);
 
 	return 0;
 }


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/4] use mmgrab
  2019-12-29 15:42 [PATCH 0/4] use mmgrab Julia Lawall
  2019-12-29 15:42 ` [PATCH 2/4] vfio: vfio_pci_nvlink2: " Julia Lawall
  2019-12-29 15:42 ` [PATCH 3/4] vfio/spapr_tce: " Julia Lawall
@ 2020-01-03 12:31 ` Dan Carpenter
  2020-01-03 12:47   ` Julia Lawall
  2 siblings, 1 reply; 12+ messages in thread
From: Dan Carpenter @ 2020-01-03 12:31 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kvm, kernel-janitors, Cornelia Huck, linux-kernel, linuxppc-dev,
	openrisc

On Sun, Dec 29, 2019 at 04:42:54PM +0100, Julia Lawall wrote:
> Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> helper") and most of the kernel was updated to use it. Update a few
> remaining files.

I wonder if there is an automatic way to generate these kind of
Coccinelle scripts which use inlines instead of open coding.  Like maybe
make a list of one line functions, and then auto generate a recipe.  Or
the mmgrab() function could have multiple lines if the first few were
just sanity checks for NULL or something...

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/4] use mmgrab
  2020-01-03 12:31 ` [PATCH 0/4] " Dan Carpenter
@ 2020-01-03 12:47   ` Julia Lawall
  0 siblings, 0 replies; 12+ messages in thread
From: Julia Lawall @ 2020-01-03 12:47 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kvm, kernel-janitors, Cornelia Huck, linux-kernel, linuxppc-dev,
	openrisc



On Fri, 3 Jan 2020, Dan Carpenter wrote:

> On Sun, Dec 29, 2019 at 04:42:54PM +0100, Julia Lawall wrote:
> > Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> > helper") and most of the kernel was updated to use it. Update a few
> > remaining files.
>
> I wonder if there is an automatic way to generate these kind of
> Coccinelle scripts which use inlines instead of open coding.  Like maybe
> make a list of one line functions, and then auto generate a recipe.  Or
> the mmgrab() function could have multiple lines if the first few were
> just sanity checks for NULL or something...

I tried this at one point (10 years ago!):

https://pages.lip6.fr/Julia.Lawall/acp4is09-lawall.pdf

Perhaps it is worth reviving.

julia

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
  2019-12-29 15:42 ` [PATCH 2/4] vfio: vfio_pci_nvlink2: " Julia Lawall
@ 2020-01-06 23:05   ` Alex Williamson
  2020-01-07  5:51     ` Dan Carpenter
  2020-01-07 17:00     ` Julia Lawall
  2020-01-07  9:14   ` Cornelia Huck
  1 sibling, 2 replies; 12+ messages in thread
From: Alex Williamson @ 2020-01-06 23:05 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Cornelia Huck, kvm, linux-kernel

On Sun, 29 Dec 2019 16:42:56 +0100
Julia Lawall <Julia.Lawall@inria.fr> wrote:

> Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> helper") and most of the kernel was updated to use it. Update a
> remaining file.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> <smpl>
> @@ expression e; @@
> - atomic_inc(&e->mm_count);
> + mmgrab(e);
> </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> 
> ---
>  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> index f2983f0f84be..43df10af7f66 100644
> --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> @@ -159,7 +159,7 @@ static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,
>  	data->useraddr = vma->vm_start;
>  	data->mm = current->mm;
>  
> -	atomic_inc(&data->mm->mm_count);
> +	mmgrab(data->mm);
>  	ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
>  			vma_pages(vma), data->gpu_hpa, &data->mem);
>  
> 

Acked-by: Alex Williamson <alex.williamson@redhat.com>

Thanks!  I'm assuming these will be routed via janitors tree, please
let me know if you intend me to grab these two vfio patches from the
series.  Thanks,

Alex


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] vfio/spapr_tce: use mmgrab
  2019-12-29 15:42 ` [PATCH 3/4] vfio/spapr_tce: " Julia Lawall
@ 2020-01-06 23:05   ` Alex Williamson
  2020-01-07  9:14   ` Cornelia Huck
  1 sibling, 0 replies; 12+ messages in thread
From: Alex Williamson @ 2020-01-06 23:05 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Cornelia Huck, kvm, linux-kernel

On Sun, 29 Dec 2019 16:42:57 +0100
Julia Lawall <Julia.Lawall@inria.fr> wrote:

> Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> helper") and most of the kernel was updated to use it. Update a
> remaining file.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> <smpl>
> @@ expression e; @@
> - atomic_inc(&e->mm_count);
> + mmgrab(e);
> </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> 
> ---
>  drivers/vfio/vfio_iommu_spapr_tce.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
> index 26cef65b41e7..16b3adc508db 100644
> --- a/drivers/vfio/vfio_iommu_spapr_tce.c
> +++ b/drivers/vfio/vfio_iommu_spapr_tce.c
> @@ -79,7 +79,7 @@ static long tce_iommu_mm_set(struct tce_container *container)
>  	}
>  	BUG_ON(!current->mm);
>  	container->mm = current->mm;
> -	atomic_inc(&container->mm->mm_count);
> +	mmgrab(container->mm);
>  
>  	return 0;
>  }
> 

Acked-by: Alex Williamson <alex.williamson@redhat.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
  2020-01-06 23:05   ` Alex Williamson
@ 2020-01-07  5:51     ` Dan Carpenter
  2020-01-07 17:00     ` Julia Lawall
  1 sibling, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2020-01-07  5:51 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Julia Lawall, kernel-janitors, Cornelia Huck, kvm, linux-kernel

On Mon, Jan 06, 2020 at 04:05:05PM -0700, Alex Williamson wrote:
> 
> Acked-by: Alex Williamson <alex.williamson@redhat.com>
> 
> Thanks!  I'm assuming these will be routed via janitors tree, please
> let me know if you intend me to grab these two vfio patches from the
> series.  Thanks,

There isn't a janitors tree.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
  2019-12-29 15:42 ` [PATCH 2/4] vfio: vfio_pci_nvlink2: " Julia Lawall
  2020-01-06 23:05   ` Alex Williamson
@ 2020-01-07  9:14   ` Cornelia Huck
  1 sibling, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-01-07  9:14 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Alex Williamson, kernel-janitors, kvm, linux-kernel

On Sun, 29 Dec 2019 16:42:56 +0100
Julia Lawall <Julia.Lawall@inria.fr> wrote:

> Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> helper") and most of the kernel was updated to use it. Update a
> remaining file.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> <smpl>
> @@ expression e; @@
> - atomic_inc(&e->mm_count);
> + mmgrab(e);
> </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> 
> ---
>  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] vfio/spapr_tce: use mmgrab
  2019-12-29 15:42 ` [PATCH 3/4] vfio/spapr_tce: " Julia Lawall
  2020-01-06 23:05   ` Alex Williamson
@ 2020-01-07  9:14   ` Cornelia Huck
  1 sibling, 0 replies; 12+ messages in thread
From: Cornelia Huck @ 2020-01-07  9:14 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Alex Williamson, kernel-janitors, kvm, linux-kernel

On Sun, 29 Dec 2019 16:42:57 +0100
Julia Lawall <Julia.Lawall@inria.fr> wrote:

> Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> helper") and most of the kernel was updated to use it. Update a
> remaining file.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> <smpl>
> @@ expression e; @@
> - atomic_inc(&e->mm_count);
> + mmgrab(e);
> </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> 
> ---
>  drivers/vfio/vfio_iommu_spapr_tce.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
  2020-01-06 23:05   ` Alex Williamson
  2020-01-07  5:51     ` Dan Carpenter
@ 2020-01-07 17:00     ` Julia Lawall
  2020-01-07 17:10       ` Alex Williamson
  1 sibling, 1 reply; 12+ messages in thread
From: Julia Lawall @ 2020-01-07 17:00 UTC (permalink / raw)
  To: Alex Williamson; +Cc: kernel-janitors, Cornelia Huck, kvm, linux-kernel



On Mon, 6 Jan 2020, Alex Williamson wrote:

> On Sun, 29 Dec 2019 16:42:56 +0100
> Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> > Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> > helper") and most of the kernel was updated to use it. Update a
> > remaining file.
> >
> > The semantic patch that makes this change is as follows:
> > (http://coccinelle.lip6.fr/)
> >
> > <smpl>
> > @@ expression e; @@
> > - atomic_inc(&e->mm_count);
> > + mmgrab(e);
> > </smpl>
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> >
> > ---
> >  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > index f2983f0f84be..43df10af7f66 100644
> > --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> > +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > @@ -159,7 +159,7 @@ static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,
> >  	data->useraddr = vma->vm_start;
> >  	data->mm = current->mm;
> >
> > -	atomic_inc(&data->mm->mm_count);
> > +	mmgrab(data->mm);
> >  	ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
> >  			vma_pages(vma), data->gpu_hpa, &data->mem);
> >
> >
>
> Acked-by: Alex Williamson <alex.williamson@redhat.com>
>
> Thanks!  I'm assuming these will be routed via janitors tree, please
> let me know if you intend me to grab these two vfio patches from the
> series.  Thanks,

Please take them directly.

thanks,
julia

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
  2020-01-07 17:00     ` Julia Lawall
@ 2020-01-07 17:10       ` Alex Williamson
  0 siblings, 0 replies; 12+ messages in thread
From: Alex Williamson @ 2020-01-07 17:10 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Cornelia Huck, kvm, linux-kernel

On Tue, 7 Jan 2020 18:00:31 +0100 (CET)
Julia Lawall <julia.lawall@inria.fr> wrote:

> On Mon, 6 Jan 2020, Alex Williamson wrote:
> 
> > On Sun, 29 Dec 2019 16:42:56 +0100
> > Julia Lawall <Julia.Lawall@inria.fr> wrote:
> >  
> > > Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> > > helper") and most of the kernel was updated to use it. Update a
> > > remaining file.
> > >
> > > The semantic patch that makes this change is as follows:
> > > (http://coccinelle.lip6.fr/)
> > >
> > > <smpl>
> > > @@ expression e; @@
> > > - atomic_inc(&e->mm_count);
> > > + mmgrab(e);
> > > </smpl>
> > >
> > > Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> > >
> > > ---
> > >  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > > index f2983f0f84be..43df10af7f66 100644
> > > --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> > > +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > > @@ -159,7 +159,7 @@ static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,
> > >  	data->useraddr = vma->vm_start;
> > >  	data->mm = current->mm;
> > >
> > > -	atomic_inc(&data->mm->mm_count);
> > > +	mmgrab(data->mm);
> > >  	ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
> > >  			vma_pages(vma), data->gpu_hpa, &data->mem);
> > >
> > >  
> >
> > Acked-by: Alex Williamson <alex.williamson@redhat.com>
> >
> > Thanks!  I'm assuming these will be routed via janitors tree, please
> > let me know if you intend me to grab these two vfio patches from the
> > series.  Thanks,  
> 
> Please take them directly.

Ok, I'll queue patches 2 & 3 for v5.6.  Thanks,

Alex


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-01-07 17:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-29 15:42 [PATCH 0/4] use mmgrab Julia Lawall
2019-12-29 15:42 ` [PATCH 2/4] vfio: vfio_pci_nvlink2: " Julia Lawall
2020-01-06 23:05   ` Alex Williamson
2020-01-07  5:51     ` Dan Carpenter
2020-01-07 17:00     ` Julia Lawall
2020-01-07 17:10       ` Alex Williamson
2020-01-07  9:14   ` Cornelia Huck
2019-12-29 15:42 ` [PATCH 3/4] vfio/spapr_tce: " Julia Lawall
2020-01-06 23:05   ` Alex Williamson
2020-01-07  9:14   ` Cornelia Huck
2020-01-03 12:31 ` [PATCH 0/4] " Dan Carpenter
2020-01-03 12:47   ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).