alistair23-linux/include
Jeremy Fitzhardinge 1ea0704e0d mm: add a ptep_modify_prot transaction abstraction
This patch adds an API for doing read-modify-write updates to a pte's
protection bits which may race against hardware updates to the pte.
After reading the pte, the hardware may asynchonously set the accessed
or dirty bits on a pte, which would be lost when writing back the
modified pte value.

The existing technique to handle this race is to use
ptep_get_and_clear() atomically fetch the old pte value and clear it
in memory.  This has the effect of marking the pte as non-present,
which will prevent the hardware from updating its state.  When the new
value is written back, the pte will be present again, and the hardware
can resume updating the access/dirty flags.

When running in a virtualized environment, pagetable updates are
relatively expensive, since they generally involve some trap into the
hypervisor.  To mitigate the cost of these updates, we tend to batch
them.

However, because of the atomic nature of ptep_get_and_clear(), it is
inherently non-batchable.  This new interface allows batching by
giving the underlying implementation enough information to open a
transaction between the read and write phases:

ptep_modify_prot_start() returns the current pte value, and puts the
  pte entry into a state where either the hardware will not update the
  pte, or if it does, the updates will be preserved on commit.

ptep_modify_prot_commit() writes back the updated pte, makes sure that
  any hardware updates made since ptep_modify_prot_start() are
  preserved.

ptep_modify_prot_start() and _commit() must be exactly paired, and
used while holding the appropriate pte lock.  They do not protect
against other software updates of the pte in any way.

The current implementations of ptep_modify_prot_start and _commit are
functionally unchanged from before: _start() uses ptep_get_and_clear()
fetch the pte and zero the entry, preventing any hardware updates.
_commit() simply writes the new pte value back knowing that the
hardware has not updated the pte in the meantime.

The only current user of this interface is mprotect

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-06-25 15:15:53 +02:00
..
acpi proper prototype for acpi_processor_tstate_has_changed() 2008-06-11 19:13:46 -04:00
asm-alpha alpha: fix compile error in arch/alpha/mm/init.c 2008-06-23 18:26:04 -07:00
asm-arm [ARM] 5091/1: Add missing bitfield include to regs-lcd.h 2008-06-12 20:49:38 +01:00
asm-avr32 avr32: types: use <asm-generic/int-*.h> for the avr32 architecture 2008-05-02 16:18:20 -07:00
asm-blackfin Blackfin Serial Driver: Use timer to poll CTS PIN instead of workqueue. 2008-06-19 17:46:39 +08:00
asm-cris cris: types: use <asm-generic/int-*.h> for the cris architecture 2008-05-02 16:18:20 -07:00
asm-frv FRV: ip_fast_csum() requires a memory clobber on its inline asm 2008-06-05 10:31:21 -07:00
asm-generic mm: add a ptep_modify_prot transaction abstraction 2008-06-25 15:15:53 +02:00
asm-h8300 h8300: fix typo in header guard 2008-06-06 11:29:12 -07:00
asm-ia64 [IA64] Fix CONFIG_IA64_SGI_UV build error 2008-06-16 09:02:03 -07:00
asm-m32r asm-m32r/uaccess.h must #include <asm/setup.h> 2008-06-06 11:29:13 -07:00
asm-m68k m68k: Add ext2_find_{first,next}_bit() for ext4 2008-06-12 18:05:39 -07:00
asm-m68knommu m68knommu: rework definition of HZ 2008-05-01 08:08:36 -07:00
asm-mips [MIPS] Malta: Fix build errors for 64-bit kernels 2008-06-16 15:14:48 +01:00
asm-mn10300 MN10300: Fix typo in header guard 2008-05-28 07:59:06 -07:00
asm-parisc parisc: fix miscompilation of ip_fast_csum with gcc >= 4.3 2008-06-13 10:49:56 -04:00
asm-powerpc [POWERPC] Build fix for drivers/macintosh/mediabay.c 2008-06-16 15:00:47 +10:00
asm-ppc [POWERPC] ppc: More compile fixes 2008-05-12 22:57:51 +10:00
asm-s390 [S390] Fix __ctl_load/__ctl_store inline assembly constraints 2008-06-10 10:03:28 +02:00
asm-sh sh: fix miscompilation of ip_fast_csum with gcc >= 4.3 2008-06-02 12:40:14 +09:00
asm-sparc sparc: remove CVS keywords 2008-05-20 00:33:44 -07:00
asm-sparc64 sparc64: IO accessors fix 2008-05-30 02:01:28 -07:00
asm-um uml: activate_mm: remove the dead PF_BORROWED_MM check 2008-06-06 11:36:22 -07:00
asm-v850 v850: fix typo in header guard 2008-06-06 11:29:12 -07:00
asm-x86 Merge commit 'v2.6.26-rc8' into x86/xen 2008-06-25 12:16:51 +02:00
asm-xtensa asm-{alpha,h8300,um,v850,xtensa}/param.h: unbreak HZ for userspace 2008-05-14 19:11:14 -07:00
crypto [CRYPTO] api: Fix scatterwalk_sg_chain 2008-05-01 18:22:28 +08:00
keys KEYS: Fix the comment to match the file name in rxrpc-type.h. 2008-04-21 22:43:55 +00:00
linux Merge commit 'v2.6.26-rc8' into x86/xen 2008-06-25 12:16:51 +02:00
math-emu
media V4L/DVB (7911): Remove v4l2_video_std_fps prototype declaration 2008-06-05 06:35:42 -03:00
mtd UBI: make ubi-header.h local 2008-04-17 11:31:58 +03:00
net netns: Don't receive new packets in a dead network namespace. 2008-06-20 22:16:51 -07:00
pcmcia
rdma IB/core: Remove IB_DEVICE_SEND_W_INV capability flag 2008-06-09 09:58:42 -07:00
rxrpc
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2008-05-02 13:52:35 -07:00
sound [ALSA] ac97 - Fix ASUS A9T laptop output 2008-05-30 16:20:42 +02:00
video fbdev: platforming hecubafb and n411 2008-04-28 08:58:41 -07:00
xen Merge commit 'v2.6.26-rc8' into x86/xen 2008-06-25 12:16:51 +02:00
Kbuild