linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* _PAGE_HWWRITE missing in pte_mkdirty()?
@ 2003-04-25 10:33 Joakim Tjernlund
  2003-04-25 14:56 ` Dan Malek
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2003-04-25 10:33 UTC (permalink / raw)
  To: Linuxppc-Dev@Lists. Linuxppc. Org


Hi

I noticed that pte_mkdirty() does not set the change bit(HWWRITE) when
dirtying a page. I think it should. Is there a reason why it doesn't?

Patch below which adds HWWRITE to pte_mkdirty()

 Jocke

Index: include/asm-ppc/pgtable.h
===================================================================
RCS file: /home/cvsadmin/cvsroot/kernel/linuxppc/include/asm-ppc/pgtable.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 pgtable.h
--- include/asm-ppc/pgtable.h	1 Nov 2002 13:44:24 -0000	1.1.1.1
+++ include/asm-ppc/pgtable.h	25 Apr 2003 09:20:47 -0000
@@ -526,7 +526,7 @@
 static inline pte_t pte_mkwrite(pte_t pte) {
 	pte_val(pte) |= _PAGE_RW; return pte; }
 static inline pte_t pte_mkdirty(pte_t pte) {
-	pte_val(pte) |= _PAGE_DIRTY; return pte; }
+	pte_val(pte) |= _PAGE_DIRTY  | _PAGE_HWWRITE; return pte; }
 static inline pte_t pte_mkyoung(pte_t pte) {
 	pte_val(pte) |= _PAGE_ACCESSED; return pte; }


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: _PAGE_HWWRITE missing in pte_mkdirty()?
  2003-04-25 10:33 _PAGE_HWWRITE missing in pte_mkdirty()? Joakim Tjernlund
@ 2003-04-25 14:56 ` Dan Malek
  2003-04-25 15:34   ` Joakim Tjernlund
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Malek @ 2003-04-25 14:56 UTC (permalink / raw)
  To: joakim.tjernlund; +Cc: Linuxppc-Dev@Lists. Linuxppc. Org


Joakim Tjernlund wrote:

> I noticed that pte_mkdirty() does not set the change bit(HWWRITE) when
> dirtying a page. I think it should. Is there a reason why it doesn't?

A dirty page doesn't necessarily indicate a write enabled page.  Setting
_PAGE_HWWRITE without _PAGE_RW is an error.  On PPC, RW and DIRTY are
software status bits, HWWRITE actually contols write access.

Thanks.


	-- Dan


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* RE: _PAGE_HWWRITE missing in pte_mkdirty()?
  2003-04-25 14:56 ` Dan Malek
@ 2003-04-25 15:34   ` Joakim Tjernlund
  2003-04-26 23:51     ` Paul Mackerras
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2003-04-25 15:34 UTC (permalink / raw)
  To: Dan Malek; +Cc: Linuxppc-Dev@Lists. Linuxppc. Org


> Joakim Tjernlund wrote:
>
> > I noticed that pte_mkdirty() does not set the change bit(HWWRITE) when
> > dirtying a page. I think it should. Is there a reason why it doesn't?
>
> A dirty page doesn't necessarily indicate a write enabled page.  Setting
> _PAGE_HWWRITE without _PAGE_RW is an error.  On PPC, RW and DIRTY are
> software status bits, HWWRITE actually contols write access.

OK, I wasn't aware that you can have dirty pages without _PAGE_RW.

   Jocke


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* RE: _PAGE_HWWRITE missing in pte_mkdirty()?
  2003-04-25 15:34   ` Joakim Tjernlund
@ 2003-04-26 23:51     ` Paul Mackerras
  2003-04-27  9:31       ` Joakim Tjernlund
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Mackerras @ 2003-04-26 23:51 UTC (permalink / raw)
  To: joakim.tjernlund; +Cc: Linuxppc-Dev@Lists. Linuxppc. Org


Joakim Tjernlund writes:

> OK, I wasn't aware that you can have dirty pages without _PAGE_RW.

Yes, think about what happens if a process has a writable dirty page
(in a private or anonymous mapping) and the process does a fork.  The
page becomes copy-on-write, so we have to make it non-writable, but it
is still dirty.

Whether the kernel actually ever calls pte_mkdirty on a non-writable
page is a different question, of course. :)

Paul.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: _PAGE_HWWRITE missing in pte_mkdirty()?
  2003-04-26 23:51     ` Paul Mackerras
@ 2003-04-27  9:31       ` Joakim Tjernlund
  0 siblings, 0 replies; 5+ messages in thread
From: Joakim Tjernlund @ 2003-04-27  9:31 UTC (permalink / raw)
  To: paulus; +Cc: Linuxppc-Dev@Lists. Linuxppc. Org


> Joakim Tjernlund writes:
>
> > OK, I wasn't aware that you can have dirty pages without _PAGE_RW.
>
> Yes, think about what happens if a process has a writable dirty page
> (in a private or anonymous mapping) and the process does a fork.  The
> page becomes copy-on-write, so we have to make it non-writable, but it
> is still dirty.

Yes, that makes sense. Thanks.

> Whether the kernel actually ever calls pte_mkdirty on a non-writable
> page is a different question, of course. :)

I don't think the kernel calls pte_mkdirty in this case. I tried it on my mpc862 system and it worked fine.
I was just trying to avoid DTLB errors.

   Jocke

PS.
  Could comment on my previous post about cacheable_memcpy() as well?
  http://lists.linuxppc.org/linuxppc-dev/200304/msg00057.html

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2003-04-27  9:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-25 10:33 _PAGE_HWWRITE missing in pte_mkdirty()? Joakim Tjernlund
2003-04-25 14:56 ` Dan Malek
2003-04-25 15:34   ` Joakim Tjernlund
2003-04-26 23:51     ` Paul Mackerras
2003-04-27  9:31       ` Joakim Tjernlund

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