linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* x86 ptep_get_and_clear question
@ 2001-02-15  1:50 Kanoj Sarcar
  2001-02-15  2:13 ` Ben LaHaise
  0 siblings, 1 reply; 21+ messages in thread
From: Kanoj Sarcar @ 2001-02-15  1:50 UTC (permalink / raw)
  To: linux-mm; +Cc: bcrl, mingo, alan

I would like to understand how ptep_get_and_clear() works for x86 on
2.4.1.

I am assuming on x86, we do not implement software dirty bit, as is
implemented in the mips processors. Rather, the kernel relies on the
x86 hardware to update the dirty bit automatically (from looking at 
the implementation of pte_mkwrite()).

Say I have processors 1 and 2. Say both processors have pulled in the 
mapping into their tlbs.

processor 1 is doing change_pte_range(), as an exmaple. It does the
ptep_get_and_clear(pte), which atomically reads the hardware managed
dirty bit, then clears the pte in memory. Now say processor 2 dirties
the page, and I am not sure what will happen. One possibility is that
processor 2 will see in its tlb that the page hasn't been dirtied on 
that processor yet, so then it will go look into the in-memory copy,
see that the pte is not marked dirty, and hence will mark the pte 
dirty. Thus, this dirty bit update is lost. Hence, ptep_get_and_clear()
isn't doing what I assume it was designed to do (from the comments in
mm/mprotect.c) (There are alternative fixes possible)

The other possibility of course is that somehow processor 2 will interlock
out (via hardware), processor 1 will do the flush_tlb_range() out of 
change_protection(), and then processor 1 will continue. If this is 
the assumption, I would like to know if this is in some Intel x86 specs.

Am I missing something?

I am assuming Ben Lahaise wrote this code. I remember having an earlier 
conversation with Alan about this too (we did not know which scenario 
could happen), who suggested I ask Ingo. I do not remember what happened
after that.

Thanks.

Kanoj
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

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

end of thread, other threads:[~2001-02-15 19:19 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-15  1:50 x86 ptep_get_and_clear question Kanoj Sarcar
2001-02-15  2:13 ` Ben LaHaise
2001-02-15  2:37   ` Kanoj Sarcar
2001-02-15 10:55   ` Jamie Lokier
2001-02-15 16:06     ` Ben LaHaise
2001-02-15 16:35       ` Jamie Lokier
2001-02-15 17:23         ` Kanoj Sarcar
2001-02-15 17:27           ` Ben LaHaise
2001-02-15 17:38             ` Kanoj Sarcar
2001-02-15 17:46               ` Ben LaHaise
2001-02-15 17:47           ` Jamie Lokier
2001-02-15 18:05             ` Kanoj Sarcar
2001-02-15 18:23             ` Kanoj Sarcar
2001-02-15 18:42               ` Jamie Lokier
2001-02-15 18:57                 ` Kanoj Sarcar
2001-02-15 19:06                   ` Ben LaHaise
2001-02-15 19:19                     ` Kanoj Sarcar
2001-02-15 18:51               ` Manfred Spraul
2001-02-15 19:05                 ` Kanoj Sarcar
2001-02-15 19:19                   ` Jamie Lokier
2001-02-15 19:07                 ` Jamie Lokier

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