1. 20 3月, 2012 1 次提交
  2. 06 12月, 2011 1 次提交
    • K
      x86/paravirt: PTE updates in k(un)map_atomic need to be synchronous, regardless of lazy_mmu mode · 2cd1c8d4
      Konrad Rzeszutek Wilk 提交于
      Fix an outstanding issue that has been reported since 2.6.37.
      Under a heavy loaded machine processing "fork()" calls could
      crash with:
      
      BUG: unable to handle kernel paging request at f573fc8c
      IP: [<c01abc54>] swap_count_continued+0x104/0x180
      *pdpt = 000000002a3b9027 *pde = 0000000001bed067 *pte = 0000000000000000 Oops: 0000 [#1] SMP
      Modules linked in:
      Pid: 1638, comm: apache2 Not tainted 3.0.4-linode37 #1
      EIP: 0061:[<c01abc54>] EFLAGS: 00210246 CPU: 3
      EIP is at swap_count_continued+0x104/0x180
      .. snip..
      Call Trace:
       [<c01ac222>] ? __swap_duplicate+0xc2/0x160
       [<c01040f7>] ? pte_mfn_to_pfn+0x87/0xe0
       [<c01ac2e4>] ? swap_duplicate+0x14/0x40
       [<c01a0a6b>] ? copy_pte_range+0x45b/0x500
       [<c01a0ca5>] ? copy_page_range+0x195/0x200
       [<c01328c6>] ? dup_mmap+0x1c6/0x2c0
       [<c0132cf8>] ? dup_mm+0xa8/0x130
       [<c013376a>] ? copy_process+0x98a/0xb30
       [<c013395f>] ? do_fork+0x4f/0x280
       [<c01573b3>] ? getnstimeofday+0x43/0x100
       [<c010f770>] ? sys_clone+0x30/0x40
       [<c06c048d>] ? ptregs_clone+0x15/0x48
       [<c06bfb71>] ? syscall_call+0x7/0xb
      
      The problem is that in copy_page_range() we turn lazy mode on,
      and then in swap_entry_free() we call swap_count_continued()
      which ends up in:
      
               map = kmap_atomic(page, KM_USER0) + offset;
      
      and then later we touch *map.
      
      Since we are running in batched mode (lazy) we don't actually
      set up the PTE mappings and the kmap_atomic is not done
      synchronously and ends up trying to dereference a page that has
      not been set.
      
      Looking at kmap_atomic_prot_pfn(), it uses
      'arch_flush_lazy_mmu_mode' and doing the same in
      kmap_atomic_prot() and __kunmap_atomic() makes the problem go
      away.
      
      Interestingly, commit b8bcfe99 ("x86/paravirt: remove lazy
      mode in interrupts") removed part of this to fix an interrupt
      issue - but it went to far and did not consider this scenario.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2cd1c8d4
  3. 28 10月, 2010 1 次提交
  4. 27 10月, 2010 1 次提交
    • P
      mm: stack based kmap_atomic() · 3e4d3af5
      Peter Zijlstra 提交于
      Keep the current interface but ignore the KM_type and use a stack based
      approach.
      
      The advantage is that we get rid of crappy code like:
      
      	#define __KM_PTE			\
      		(in_nmi() ? KM_NMI_PTE : 	\
      		 in_irq() ? KM_IRQ_PTE :	\
      		 KM_PTE0)
      
      and in general can stop worrying about what context we're in and what kmap
      slots might be appropriate for that.
      
      The downside is that FRV kmap_atomic() gets more expensive.
      
      For now we use a CPP trick suggested by Andrew:
      
        #define kmap_atomic(page, args...) __kmap_atomic(page)
      
      to avoid having to touch all kmap_atomic() users in a single patch.
      
      [ not compiled on:
        - mn10300: the arch doesn't actually build with highmem to begin with ]
      
      [akpm@linux-foundation.org: coding-style fixes]
      [akpm@linux-foundation.org: fix up drivers/gpu/drm/i915/intel_overlay.c]
      Acked-by: NRik van Riel <riel@redhat.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NChris Metcalf <cmetcalf@tilera.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: David Miller <davem@davemloft.net>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Dave Airlie <airlied@linux.ie>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3e4d3af5
  5. 10 8月, 2010 1 次提交
    • C
      kmap_atomic: make kunmap_atomic() harder to misuse · 597781f3
      Cesar Eduardo Barros 提交于
      kunmap_atomic() is currently at level -4 on Rusty's "Hard To Misuse"
      list[1] ("Follow common convention and you'll get it wrong"), except in
      some architectures when CONFIG_DEBUG_HIGHMEM is set[2][3].
      
      kunmap() takes a pointer to a struct page; kunmap_atomic(), however, takes
      takes a pointer to within the page itself.  This seems to once in a while
      trip people up (the convention they are following is the one from
      kunmap()).
      
      Make it much harder to misuse, by moving it to level 9 on Rusty's list[4]
      ("The compiler/linker won't let you get it wrong").  This is done by
      refusing to build if the type of its first argument is a pointer to a
      struct page.
      
      The real kunmap_atomic() is renamed to kunmap_atomic_notypecheck()
      (which is what you would call in case for some strange reason calling it
      with a pointer to a struct page is not incorrect in your code).
      
      The previous version of this patch was compile tested on x86-64.
      
      [1] http://ozlabs.org/~rusty/index.cgi/tech/2008-04-01.html
      [2] In these cases, it is at level 5, "Do it right or it will always
          break at runtime."
      [3] At least mips and powerpc look very similar, and sparc also seems to
          share a common ancestor with both; there seems to be quite some
          degree of copy-and-paste coding here. The include/asm/highmem.h file
          for these three archs mention x86 CPUs at its top.
      [4] http://ozlabs.org/~rusty/index.cgi/tech/2008-03-30.html
      [5] As an aside, could someone tell me why mn10300 uses unsigned long as
          the first parameter of kunmap_atomic() instead of void *?
      Signed-off-by: NCesar Eduardo Barros <cesarb@cesarb.net>
      Cc: Russell King <linux@arm.linux.org.uk> (arch/arm)
      Cc: Ralf Baechle <ralf@linux-mips.org> (arch/mips)
      Cc: David Howells <dhowells@redhat.com> (arch/frv, arch/mn10300)
      Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com> (arch/mn10300)
      Cc: Kyle McMartin <kyle@mcmartin.ca> (arch/parisc)
      Cc: Helge Deller <deller@gmx.de> (arch/parisc)
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> (arch/parisc)
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> (arch/powerpc)
      Cc: Paul Mackerras <paulus@samba.org> (arch/powerpc)
      Cc: "David S. Miller" <davem@davemloft.net> (arch/sparc)
      Cc: Thomas Gleixner <tglx@linutronix.de> (arch/x86)
      Cc: Ingo Molnar <mingo@redhat.com> (arch/x86)
      Cc: "H. Peter Anvin" <hpa@zytor.com> (arch/x86)
      Cc: Arnd Bergmann <arnd@arndb.de> (include/asm-generic)
      Cc: Rusty Russell <rusty@rustcorp.com.au> ("Hard To Misuse" list)
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      597781f3
  6. 10 9月, 2009 1 次提交
  7. 29 7月, 2009 1 次提交
  8. 29 6月, 2009 1 次提交
  9. 04 4月, 2009 1 次提交
  10. 02 4月, 2009 1 次提交
  11. 01 4月, 2009 2 次提交
  12. 30 3月, 2009 1 次提交
  13. 13 3月, 2009 1 次提交
  14. 11 3月, 2009 2 次提交
  15. 05 3月, 2009 1 次提交
    • P
      x86: set_highmem_pages_init() cleanup, #2 · 6298e719
      Pekka Enberg 提交于
      Impact: cleanup
      
      The zones are set up at this stage so there's a highmem zone
      available even for the UMA case.
      
      The only difference there is that for machines that have
      CONFIG_HIGHMEM enabled but don't have any highmem available,
      ->zone_start_pfn is zero whereas highstart_pfn is non-zero).
      
      The field is left zeroed because of the !size test in
      free_area_init_core() but shouldn't be a problem because
      add_highpages_with_active_regions() handles empty ranges just
      fine.
      Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
      Cc: Mel Gorman <mel@csn.ul.ie>
      LKML-Reference: <1236154567.29024.23.camel@penberg-laptop>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6298e719
  16. 03 3月, 2009 2 次提交
  17. 18 10月, 2008 1 次提交
  18. 01 5月, 2008 1 次提交
  19. 29 3月, 2008 1 次提交
  20. 30 1月, 2008 1 次提交
  21. 11 10月, 2007 2 次提交
  22. 12 9月, 2007 1 次提交
    • A
      revert "highmem: catch illegal nesting" · 4150d3f5
      Andrew Morton 提交于
      Revert
      
      	commit 656dad31
      	Author: Ingo Molnar <mingo@elte.hu>
      	Date:   Sat Feb 10 01:46:36 2007 -0800
      
      	[PATCH] highmem: catch illegal nesting
      
      	Catch illegally nested kmap_atomic()s even if the page that is mapped by
      	the 'inner' instance is from lowmem.
      
      	This avoids spuriously zapped kmap-atomic ptes and turns hard to find
      	crashes into clear asserts at the bug site.
      
      Problem is, a get_zeroed_page(GFP_KERNEL) from interrupt context will trigger
      this check if non-irq code on this CPU holds a KM_USER0 mapping.  But that
      get_zeroed_page() will never be altering the kmap slot anyway due to the
      GFP_KERNEL.
      
      Cc: Christoph Lameter <clameter@sgi.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4150d3f5
  23. 03 5月, 2007 2 次提交
  24. 09 4月, 2007 1 次提交
  25. 12 2月, 2007 1 次提交
  26. 08 12月, 2006 2 次提交
  27. 01 10月, 2006 1 次提交
    • Z
      [PATCH] paravirt: kpte flush · 23002d88
      Zachary Amsden 提交于
      Create a new PTE function which combines clearing a kernel PTE with the
      subsequent flush.  This allows the two to be easily combined into a single
      hypercall or paravirt-op.  More subtly, reverse the order of the flush for
      kmap_atomic.  Instead of flushing on establishing a mapping, flush on clearing
      a mapping.  This eliminates the possibility of leaving stale kmap entries
      which may still have valid TLB mappings.  This is required for direct mode
      hypervisors, which need to reprotect all mappings of a given page when
      changing the page type from a normal page to a protected page (such as a page
      table or descriptor table page).  But it also provides some nicer semantics
      for real hardware, by providing extra debug-proofing against using stale
      mappings, as well as ensuring that no stale mappings exist when changing the
      cacheability attributes of a page, which could lead to cache conflicts when
      two different types of mappings exist for the same page.
      Signed-off-by: NZachary Amsden <zach@vmware.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      23002d88
  28. 26 9月, 2006 1 次提交
  29. 26 6月, 2005 1 次提交
  30. 24 6月, 2005 1 次提交
  31. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4