linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the akpm-current tree with the powerpc-fixes tree
@ 2019-04-23  9:06 Stephen Rothwell
  2019-04-23 17:00 ` Ira Weiny
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2019-04-23  9:06 UTC (permalink / raw)
  To: Andrew Morton, Michael Ellerman, PowerPC
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Alexey Kardashevskiy, Ira Weiny

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

Hi all,

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

  arch/powerpc/mm/mmu_context_iommu.c

between commits:

  eb9d7a62c386 ("powerpc/mm_iommu: Fix potential deadlock")
  7a3a4d763837 ("powerpc/mm_iommu: Allow pinning large regions")

from the powerpc-fixes tree and commit:

  02f506bad7af ("mm/gup: replace get_user_pages_longterm() with FOLL_LONGTERM")

from the akpm-current 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.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/powerpc/mm/mmu_context_iommu.c
index 8330f135294f,755fe7adc0d8..000000000000
--- a/arch/powerpc/mm/mmu_context_iommu.c
+++ b/arch/powerpc/mm/mmu_context_iommu.c
@@@ -135,27 -144,18 +131,28 @@@ static long mm_iommu_do_alloc(struct mm
  	}
  
  	down_read(&mm->mmap_sem);
 -	ret = get_user_pages(ua, entries, FOLL_WRITE | FOLL_LONGTERM,
 -			     mem->hpages, NULL);
 +	chunk = (1UL << (PAGE_SHIFT + MAX_ORDER - 1)) /
 +			sizeof(struct vm_area_struct *);
 +	chunk = min(chunk, entries);
 +	for (entry = 0; entry < entries; entry += chunk) {
 +		unsigned long n = min(entries - entry, chunk);
 +
- 		ret = get_user_pages_longterm(ua + (entry << PAGE_SHIFT), n,
- 				FOLL_WRITE, mem->hpages + entry, NULL);
++		ret = get_user_pages(ua + (entry << PAGE_SHIFT), n,
++				     FOLL_WRITE | FOLL_LONGTERM,
++				     mem->hpages + entry, NULL);
 +		if (ret == n) {
 +			pinned += n;
 +			continue;
 +		}
 +		if (ret > 0)
 +			pinned += ret;
 +		break;
 +	}
  	up_read(&mm->mmap_sem);
 -	if (ret != entries) {
 -		/* free the reference taken */
 -		for (i = 0; i < ret; i++)
 -			put_page(mem->hpages[i]);
 -
 -		vfree(mem->hpas);
 -		kfree(mem);
 -		ret = -EFAULT;
 -		goto unlock_exit;
 +	if (pinned != entries) {
 +		if (!ret)
 +			ret = -EFAULT;
 +		goto free_exit;
  	}
  
  	pageshift = PAGE_SHIFT;

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

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

* Re: linux-next: manual merge of the akpm-current tree with the powerpc-fixes tree
  2019-04-23  9:06 linux-next: manual merge of the akpm-current tree with the powerpc-fixes tree Stephen Rothwell
@ 2019-04-23 17:00 ` Ira Weiny
  0 siblings, 0 replies; 3+ messages in thread
From: Ira Weiny @ 2019-04-23 17:00 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Andrew Morton, Michael Ellerman, PowerPC,
	Linux Next Mailing List, Linux Kernel Mailing List,
	Alexey Kardashevskiy

On Tue, Apr 23, 2019 at 07:06:06PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the akpm-current tree got a conflict in:
> 
>   arch/powerpc/mm/mmu_context_iommu.c
> 
> between commits:
> 
>   eb9d7a62c386 ("powerpc/mm_iommu: Fix potential deadlock")
>   7a3a4d763837 ("powerpc/mm_iommu: Allow pinning large regions")
> 
> from the powerpc-fixes tree and commit:
> 
>   02f506bad7af ("mm/gup: replace get_user_pages_longterm() with FOLL_LONGTERM")
> 
> from the akpm-current tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This

Thanks Stephen

Looks good for my changes.

Acked-by: Ira Weiny <ira.weiny@intel.com>

> 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.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc arch/powerpc/mm/mmu_context_iommu.c
> index 8330f135294f,755fe7adc0d8..000000000000
> --- a/arch/powerpc/mm/mmu_context_iommu.c
> +++ b/arch/powerpc/mm/mmu_context_iommu.c
> @@@ -135,27 -144,18 +131,28 @@@ static long mm_iommu_do_alloc(struct mm
>   	}
>   
>   	down_read(&mm->mmap_sem);
>  -	ret = get_user_pages(ua, entries, FOLL_WRITE | FOLL_LONGTERM,
>  -			     mem->hpages, NULL);
>  +	chunk = (1UL << (PAGE_SHIFT + MAX_ORDER - 1)) /
>  +			sizeof(struct vm_area_struct *);
>  +	chunk = min(chunk, entries);
>  +	for (entry = 0; entry < entries; entry += chunk) {
>  +		unsigned long n = min(entries - entry, chunk);
>  +
> - 		ret = get_user_pages_longterm(ua + (entry << PAGE_SHIFT), n,
> - 				FOLL_WRITE, mem->hpages + entry, NULL);
> ++		ret = get_user_pages(ua + (entry << PAGE_SHIFT), n,
> ++				     FOLL_WRITE | FOLL_LONGTERM,
> ++				     mem->hpages + entry, NULL);
>  +		if (ret == n) {
>  +			pinned += n;
>  +			continue;
>  +		}
>  +		if (ret > 0)
>  +			pinned += ret;
>  +		break;
>  +	}
>   	up_read(&mm->mmap_sem);
>  -	if (ret != entries) {
>  -		/* free the reference taken */
>  -		for (i = 0; i < ret; i++)
>  -			put_page(mem->hpages[i]);
>  -
>  -		vfree(mem->hpas);
>  -		kfree(mem);
>  -		ret = -EFAULT;
>  -		goto unlock_exit;
>  +	if (pinned != entries) {
>  +		if (!ret)
>  +			ret = -EFAULT;
>  +		goto free_exit;
>   	}
>   
>   	pageshift = PAGE_SHIFT;



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

* linux-next: manual merge of the akpm-current tree with the powerpc-fixes tree
@ 2019-02-06  5:15 Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2019-02-06  5:15 UTC (permalink / raw)
  To: Andrew Morton, Michael Ellerman, Benjamin Herrenschmidt, PowerPC
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Aneesh Kumar K.V

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

Hi all,

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

  arch/powerpc/mm/pgtable-book3s64.c

between commit:

  579b9239c1f3 ("powerpc/radix: Fix kernel crash with mremap()")

from the powerpc-fixes tree and commit:

  41bde21e85a7 ("arch/powerpc/mm: Nest MMU workaround for mprotect RW upgrade")

from the akpm-current 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.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/powerpc/mm/pgtable-book3s64.c
index ecd31569a120,9f154efed1ae..c11c60056669
--- a/arch/powerpc/mm/pgtable-book3s64.c
+++ b/arch/powerpc/mm/pgtable-book3s64.c
@@@ -401,24 -398,27 +398,49 @@@ void arch_report_meminfo(struct seq_fil
  }
  #endif /* CONFIG_PROC_FS */
  
 +/*
 + * For hash translation mode, we use the deposited table to store hash slot
 + * information and they are stored at PTRS_PER_PMD offset from related pmd
 + * location. Hence a pmd move requires deposit and withdraw.
 + *
 + * For radix translation with split pmd ptl, we store the deposited table in the
 + * pmd page. Hence if we have different pmd page we need to withdraw during pmd
 + * move.
 + *
 + * With hash we use deposited table always irrespective of anon or not.
 + * With radix we use deposited table only for anonymous mapping.
 + */
 +int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
 +			   struct spinlock *old_pmd_ptl,
 +			   struct vm_area_struct *vma)
 +{
 +	if (radix_enabled())
 +		return (new_pmd_ptl != old_pmd_ptl) && vma_is_anonymous(vma);
 +
 +	return true;
 +}
++
+ pte_t ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr,
+ 			     pte_t *ptep)
+ {
+ 	unsigned long pte_val;
+ 
+ 	/*
+ 	 * Clear the _PAGE_PRESENT so that no hardware parallel update is
+ 	 * possible. Also keep the pte_present true so that we don't take
+ 	 * wrong fault.
+ 	 */
+ 	pte_val = pte_update(vma->vm_mm, addr, ptep, _PAGE_PRESENT, _PAGE_INVALID, 0);
+ 
+ 	return __pte(pte_val);
+ 
+ }
+ 
+ void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
+ 			     pte_t *ptep, pte_t old_pte, pte_t pte)
+ {
+ 	if (radix_enabled())
+ 		return radix__ptep_modify_prot_commit(vma, addr,
+ 						      ptep, old_pte, pte);
+ 	set_pte_at(vma->vm_mm, addr, ptep, pte);
+ }

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

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

end of thread, other threads:[~2019-04-23 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23  9:06 linux-next: manual merge of the akpm-current tree with the powerpc-fixes tree Stephen Rothwell
2019-04-23 17:00 ` Ira Weiny
  -- strict thread matches above, loose matches on Subject: below --
2019-02-06  5:15 Stephen Rothwell

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).