public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix update_mmu_cache in fremap.c
@ 2006-05-26 18:28 Hugh Dickins
  2006-05-26 20:10 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2006-05-26 18:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-ia64

There are two calls to update_mmu_cache in fremap.c, both defective.
The one in install_page needs to be accompanied by lazy_mmu_prot_update
(some other cleanup time, move that into ia64 update_mmu_cache itself); and
the one in install_file_pte should be removed since the pte is not present.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
 mm/fremap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 2.6.17-rc5/mm/fremap.c	2006-01-03 03:21:10.000000000 +0000
+++ linux/mm/fremap.c	2006-05-26 17:55:29.000000000 +0100
@@ -83,6 +83,7 @@ int install_page(struct mm_struct *mm, s
 	page_add_file_rmap(page);
 	pte_val = *pte;
 	update_mmu_cache(vma, addr, pte_val);
+	lazy_mmu_prot_update(pte_val);
 	err = 0;
 unlock:
 	pte_unmap_unlock(pte, ptl);
@@ -114,7 +115,6 @@ int install_file_pte(struct mm_struct *m
 
 	set_pte_at(mm, addr, pte, pgoff_to_pte(pgoff));
 	pte_val = *pte;
-	update_mmu_cache(vma, addr, pte_val);
 	pte_unmap_unlock(pte, ptl);
 	err = 0;
 out:

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

* Re: [PATCH] fix update_mmu_cache in fremap.c
  2006-05-26 18:28 [PATCH] fix update_mmu_cache in fremap.c Hugh Dickins
@ 2006-05-26 20:10 ` David Miller
  2006-05-26 22:43   ` Hugh Dickins
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2006-05-26 20:10 UTC (permalink / raw)
  To: hugh; +Cc: akpm, linux-kernel, linux-ia64

From: Hugh Dickins <hugh@veritas.com>
Date: Fri, 26 May 2006 19:28:14 +0100 (BST)

> There are two calls to update_mmu_cache in fremap.c, both defective.
> The one in install_page needs to be accompanied by lazy_mmu_prot_update
> (some other cleanup time, move that into ia64 update_mmu_cache itself); and
> the one in install_file_pte should be removed since the pte is not present.
> 
> Signed-off-by: Hugh Dickins <hugh@veritas.com>

Where did that rule come from?  We should call update_mmu_cache() even
if the PTE was not present before, look at the fault path in
mm/memory.c, it does this too.

This is where we install hash table entries for newly installed
mappings on sparc64 and powerpc, so this update_mmu_cache() call
is important even for not-previously-present mappings.

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

* Re: [PATCH] fix update_mmu_cache in fremap.c
  2006-05-26 20:10 ` David Miller
@ 2006-05-26 22:43   ` Hugh Dickins
  2006-05-26 23:37     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2006-05-26 22:43 UTC (permalink / raw)
  To: David Miller; +Cc: akpm, linux-kernel, linux-ia64

On Fri, 26 May 2006, David Miller wrote:
> From: Hugh Dickins <hugh@veritas.com>
> Date: Fri, 26 May 2006 19:28:14 +0100 (BST)
> 
> > There are two calls to update_mmu_cache in fremap.c, both defective.
> > The one in install_page needs to be accompanied by lazy_mmu_prot_update
> > (some other cleanup time, move that into ia64 update_mmu_cache itself); and
> > the one in install_file_pte should be removed since the pte is not present.
> > 
> > Signed-off-by: Hugh Dickins <hugh@veritas.com>
> 
> Where did that rule come from?  We should call update_mmu_cache() even
> if the PTE was not present before, look at the fault path in
> mm/memory.c, it does this too.
> 
> This is where we install hash table entries for newly installed
> mappings on sparc64 and powerpc, so this update_mmu_cache() call
> is important even for not-previously-present mappings.

Sure it's important for not-previously-present mappings, when you're
installing a present pte.  But the "file pte" being installed by
install_file_pte is not a real pte - it's a non-present entry (like
a swap entry), noting what file offset should be mapped there when
there's a fault (in a non-linear vma where that's not obvious).

Hugh

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

* Re: [PATCH] fix update_mmu_cache in fremap.c
  2006-05-26 22:43   ` Hugh Dickins
@ 2006-05-26 23:37     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2006-05-26 23:37 UTC (permalink / raw)
  To: hugh; +Cc: akpm, linux-kernel, linux-ia64

From: Hugh Dickins <hugh@veritas.com>
Date: Fri, 26 May 2006 23:43:47 +0100 (BST)

> Sure it's important for not-previously-present mappings, when you're
> installing a present pte.  But the "file pte" being installed by
> install_file_pte is not a real pte - it's a non-present entry (like
> a swap entry), noting what file offset should be mapped there when
> there's a fault (in a non-linear vma where that's not obvious).

My bad, the update_mmu_cache() certainly is erroneous in that
case.

Thanks for the clarification.

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

end of thread, other threads:[~2006-05-26 23:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-26 18:28 [PATCH] fix update_mmu_cache in fremap.c Hugh Dickins
2006-05-26 20:10 ` David Miller
2006-05-26 22:43   ` Hugh Dickins
2006-05-26 23:37     ` David Miller

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