use mmgrab
Subsystems (6)
cover use mmgrab
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(-)
PATCH 1/4 misc: cxl: use mmgrab
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>
--- drivers/misc/cxl/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/context.c +1 -1
@@ -352,7 +352,7 @@ void cxl_context_free(struct cxl_context *ctx)void cxl_context_mm_count_get (struct cxl_context *ctx) {if (ctx->mm) -atomic_inc (&ctx->mm->mm_count); +mmgrab (ctx->mm); }void cxl_context_mm_count_put (struct cxl_context *ctx)
Re: [PATCH 1/4] misc: cxl: use mmgrab
Quoted 7 lines · Julia Lawall
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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/)
Quoted 7 lines
<smpl>
@@ expression e; @@
-atomic_inc(&e->mm_count);
+ mmgrab(e);
</smpl>Signed-off-by Julia Lawall <[email protected]>
Thanks!
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Michael Ellerman
AppliedRe: [PATCH 1/4] misc: cxl: use mmgrab
In reply to Julia LawallQuoted 7 lines · Julia Lawall
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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/)
Quoted 7 lines
<smpl>
@@ expression e; @@
-atomic_inc(&e->mm_count);
+ mmgrab(e);
</smpl>Signed-off-by Julia Lawall <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/30e813cf46ccaeea6508607632e49b4a1d743d2a
cheers
PATCH 2/4 vfio: vfio_pci_nvlink2: use mmgrab
In reply to Julia LawallMmgrab 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>
--- drivers/vfio/pci/vfio_pci_nvlink2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci_nvlink2.c +1 -1
@@ -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);
Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
Quoted 25 lines · On Sun, 29 Dec 2019 16:42:56 +0100 Julia Lawall <[email protected]> wrote:
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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 <[email protected]>--- drivers/vfio/pci/vfio_pci_nvlink2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vfio/pci/vfio_pci_nvlink2.c +0
-0
drivers/vfio/pci/vfio_pci_nvlink2.c static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev, · line 165
Quoted 8 lines
drivers/vfio/pci/vfio_pci_nvlink2.c +1
-1@@ -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);
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
Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
Quoted 6 lines · Alex Williamson
Acked-by Alex Williamson <[email protected]>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
Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
In reply to Alex WilliamsonQuoted 39 lines · Alex Williamson
Quoted 25 lines · On Sun, 29 Dec 2019 16:42:56 +0100 Julia Lawall <[email protected]> wrote:
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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 <[email protected]>--- drivers/vfio/pci/vfio_pci_nvlink2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vfio/pci/vfio_pci_nvlink2.c +0
-0drivers/vfio/pci/vfio_pci_nvlink2.c static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev, · line 165
Quoted 8 lines
drivers/vfio/pci/vfio_pci_nvlink2.c +1
-1@@ -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 <[email protected]>
Quoted 3 lines
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
Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
Quoted 41 lines · On Tue, 7 Jan 2020 18:00:31 +0100 (CET) Julia Lawall <[email protected]>…
Quoted 39 lines · Alex Williamson
Quoted 25 lines · On Sun, 29 Dec 2019 16:42:56 +0100 Julia Lawall <[email protected]> wrote:
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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 <[email protected]>--- drivers/vfio/pci/vfio_pci_nvlink2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vfio/pci/vfio_pci_nvlink2.c +0
-0drivers/vfio/pci/vfio_pci_nvlink2.c static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev, · line 165
Quoted 8 lines
drivers/vfio/pci/vfio_pci_nvlink2.c +1
-1@@ -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 <[email protected]>
Quoted 5 lines
Quoted 3 lines
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
Re: [PATCH 2/4] vfio: vfio_pci_nvlink2: use mmgrab
In reply to Julia LawallQuoted 13 lines · On Sun, 29 Dec 2019 16:42:56 +0100 Julia Lawall <[email protected]> wrote:
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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>
Quoted 5 lines
Signed-off-by Julia Lawall <[email protected]>--- drivers/vfio/pci/vfio_pci_nvlink2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 3/4 vfio/spapr_tce: use mmgrab
In reply to Julia LawallMmgrab 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>
--- drivers/vfio/vfio_iommu_spapr_tce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/vfio_iommu_spapr_tce.c +1 -1
@@ -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 ; }
Re: [PATCH 3/4] vfio/spapr_tce: use mmgrab
Quoted 25 lines · On Sun, 29 Dec 2019 16:42:57 +0100 Julia Lawall <[email protected]> wrote:
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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 <[email protected]>--- drivers/vfio/vfio_iommu_spapr_tce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vfio/vfio_iommu_spapr_tce.c +0
-0
drivers/vfio/vfio_iommu_spapr_tce.c static long tce_iommu_mm_set(struct tce_container *container) · line 85
Quoted 8 lines
drivers/vfio/vfio_iommu_spapr_tce.c +1
-1@@ -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 ; }
Re: [PATCH 3/4] vfio/spapr_tce: use mmgrab
In reply to Julia LawallQuoted 13 lines · On Sun, 29 Dec 2019 16:42:57 +0100 Julia Lawall <[email protected]> wrote:
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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>
Quoted 5 lines
Signed-off-by Julia Lawall <[email protected]>--- drivers/vfio/vfio_iommu_spapr_tce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 4/4 openrisc: use mmgrab
In reply to Julia LawallMmgrab 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>
---
I was not able to compile this file.
arch/openrisc/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/openrisc/kernel/smp.c +1 -1
@@ -113,7 +113,7 @@ asmlinkage __init void secondary_start_kernel(void)* All kernel threads share the same mm context; grab a * reference and switch to it. */ -atomic_inc (&mm->mm_count); +mmgrab (mm); current->active_mm = mm;cpumask_set_cpu (cpu,mm_cpumask (mm));
kbuild test robot
build botRe: [PATCH 4/4] openrisc: use mmgrab
I love your patch! Yet something to improve:
Hi Julia,
I love your patch! Yet something to improve:
[auto build test ERROR on vfio/next]
[also build test ERROR on char-misc/char-misc-testing v5.5-rc3 next-20191220] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Julia-Lawall/use-mmgrab/20191230-011611 base: https://github.com/awilliam/linux-vfio.git next config: openrisc-simple_smp_defconfig (attached as .config) compiler: or1k-linux-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=openrisc
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
arch/openrisc/kernel/smp.c: In function 'secondary_start_kernel':
>> arch/openrisc/kernel/smp.c:116:2: error: implicit declaration of function 'mmgrab'; did you mean 'igrab'? [-Werror=implicit-function-declaration]
116 | mmgrab(mm);
| ^~~~~~
| igrabcc1: some warnings being treated as errors
vim +116 arch/openrisc/kernel/smp.c
107
108 asmlinkage __init void secondary_start_kernel(void)
109 {
110 struct mm_struct *mm = &init_mm;
111 unsigned int cpu = smp_processor_id();
112 /*
113 * All kernel threads share the same mm context; grab a
114 * reference and switch to it.
115 */
> 116 mmgrab(mm);
117 current->active_mm = mm;
118 cpumask_set_cpu(cpu, mm_cpumask(mm));
119
120 pr_info("CPU%u: Booted secondary processor\n", cpu);
121
122 setup_cpuinfo();
123 openrisc_clockevent_init();
124
125 notify_cpu_starting(cpu);
126
127 /*
128 * OK, now it's safe to let the boot CPU continue
129 */
130 complete(&cpu_running);
131
132 synchronise_count_slave(cpu);
133 set_cpu_online(cpu, true);
134
135 local_irq_enable();
136
137 preempt_disable();
138 /*
139 * OK, it's off to the idle thread for us
140 */
141 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
142 }
143
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
Stafford Horne
maintainerRe: [PATCH 4/4] openrisc: use mmgrab
Quoted 23 lines · kbuild test robot
Hi Julia,
I love your patch! Yet something to improve:
[auto build test ERROR on vfio/next]
[also build test ERROR on char-misc/char-misc-testing v5.5-rc3 next-20191220] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]url: https://github.com/0day-ci/linux/commits/Julia-Lawall/use-mmgrab/20191230-011611 base: https://github.com/awilliam/linux-vfio.git next config: openrisc-simple_smp_defconfig (attached as .config) compiler: or1k-linux-gcc (GCC) 9.2.0reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=openriscIf you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>
Quoted 8 lines
All errors (new ones prefixed by >>):
arch/openrisc/kernel/smp.c: In function 'secondary_start_kernel':Quoted 1 line
Quoted 1 line
arch/openrisc/kernel/smp.c:116:2: error: implicit declaration of function 'mmgrab'; did you mean 'igrab'? [-Werror=implicit-function-declaration]116 | mmgrab(mm); | ^~~~~~ | igrabcc1: some warnings being treated as errors
Hi Julia,
It looks like this is just an include issue, do you want to revise the patch?
Once fixed, how do you plan to get this patch series merged? I can add the OpenRISC part to my queue or do you have a cleanups queue you can manage?
-Stafford
Stafford Horne
maintainerRe: [PATCH 4/4] openrisc: use mmgrab
In reply to kbuild test robotQuoted 63 lines · kbuild test robot
Hi Julia,
I love your patch! Yet something to improve:
[auto build test ERROR on vfio/next]
[also build test ERROR on char-misc/char-misc-testing v5.5-rc3 next-20191220] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]url: https://github.com/0day-ci/linux/commits/Julia-Lawall/use-mmgrab/20191230-011611 base: https://github.com/awilliam/linux-vfio.git next config: openrisc-simple_smp_defconfig (attached as .config) compiler: or1k-linux-gcc (GCC) 9.2.0reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=openriscIf you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>All errors (new ones prefixed by >>):
arch/openrisc/kernel/smp.c: In function 'secondary_start_kernel':Quoted 1 line
Quoted 1 line
arch/openrisc/kernel/smp.c:116:2: error: implicit declaration of function 'mmgrab'; did you mean 'igrab'? [-Werror=implicit-function-declaration]116 | mmgrab(mm); | ^~~~~~ | igrabcc1: some warnings being treated as errors
vim +116
arch/openrisc/kernel/smp.c107 108 asmlinkage __init void secondary_start_kernel(void) 109 { 110 struct mm_struct *mm = &init_mm; 111 unsigned int cpu = smp_processor_id(); 112 /* 113 * All kernel threads share the same mm context; grab a 114 * reference and switch to it. 115 */Quoted 1 line
116 mmgrab(mm);
117 current->active_mm = mm; 118 cpumask_set_cpu(cpu, mm_cpumask(mm)); 119 120 pr_info("CPU%u: Booted secondary processor\n", cpu); 121 122 setup_cpuinfo(); 123 openrisc_clockevent_init(); 124 125 notify_cpu_starting(cpu); 126 127 /* 128 * OK, now it's safe to let the boot CPU continue 129 */ 130 complete(&cpu_running); 131 132 synchronise_count_slave(cpu); 133 set_cpu_online(cpu, true); 134 135 local_irq_enable();
Quoted 9 lines
136 137 preempt_disable(); 138 /* 139 * OK, it's off to the idle thread for us 140 */ 141 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); 142 } 143
Hello, FYI I have fixed this commit and queued it on my 5.7 branch.
-Stafford
Quoted 3 lines · Julia Lawall
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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
Quoted 10 lines · Dan Carpenter
Quoted 3 lines · Julia Lawall
Mmgrab was introduced in commit
f1f1007644ff("mm: add newmmgrab()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