1. 08 8月, 2009 2 次提交
    • I
      x86: Introduce GDT_ENTRY_INIT(), fix APM · 72c4d853
      Ingo Molnar 提交于
      This crash:
      
      [    0.891983] calling  cache_sysfs_init+0x0/0x1ee @ 1
      [    0.897251] initcall cache_sysfs_init+0x0/0x1ee returned 0 after 405 usecs
      [    0.904019] calling  mce_init_device+0x0/0x242 @ 1
      [    0.909124] initcall mce_init_device+0x0/0x242 returned 0 after 347 usecs
      [    0.915815] calling  apm_init+0x0/0x38d @ 1
      [    0.919967] apm: BIOS version 1.2 Flags 0x07 (Driver version 1.16ac)
      [    0.926813] general protection fault: 0000 [#1]
      [    0.927269] last sysfs file:
      [    0.927269] Modules linked in:
      [    0.927269]
      [    0.927269] Pid: 271, comm: kapmd Not tainted (2.6.31-rc3-00100-gd520da1-dirty #311) System Product Name
      [    0.927269] EIP: 00c0:[<000082b2>] EFLAGS: 00010002 CPU: 0
      [    0.927269] EIP is at 0x82b2
      [    0.927269] EAX: 0000530e EBX: 00000000 ECX: 00000102 EDX: 00000000
      [    0.927269] ESI: 00000000 EDI: f6a4bf44 EBP: 67890000 ESP: f6a4beec
      [    0.927269]  DS: 00c8 ES: 0000 FS: 0000 GS: 0000 SS: 0068
      [    0.927269] Process kapmd (pid: 271, ti=f6a4a000 task=f7142280 task.ti=f6a4a000)
      [    0.927269] Stack:
      [    0.927269]  0000828d 02160000 00b88092 f6a4bf3c c102a63d 00000060 f6a4bf3c f6a4bf44
      [    0.927269] <0> 0000007b 0000007b 00000000 00000000 00000000 00000000 560aae9e 00000000
      [    0.927269] <0> 00000200 f705fd74 00000000 c102af70 f6a4bf60 c102a6ec 0000530e 00000000
      [    0.927269] Call Trace:
      [    0.927269]  [<c102a63d>] ? __apm_bios_call_simple+0x7d/0x110
      [    0.927269]  [<c102af70>] ? apm+0x0/0x6a0
      [    0.927269]  [<c102a6ec>] ? apm_bios_call_simple+0x1c/0x50
      [    0.927269]  [<c102b3f5>] ? apm+0x485/0x6a0
      [    0.927269]  [<c1038e7a>] ? finish_task_switch+0x2a/0xb0
      [    0.927269]  [<c164a69e>] ? schedule+0x31e/0x480
      [    0.927269]  [<c102af70>] ? apm+0x0/0x6a0
      [    0.927269]  [<c102af70>] ? apm+0x0/0x6a0
      [    0.927269]  [<c1052654>] ? kthread+0x74/0x80
      [    0.927269]  [<c10525e0>] ? kthread+0x0/0x80
      [    0.927269]  [<c101d627>] ? kernel_thread_helper+0x7/0x10
      [    0.927269] Code:  Bad EIP value.
      [    0.927269] EIP: [<000082b2>] 0x82b2 SS:ESP 0068:f6a4beec
      [    0.927269] ---[ end trace a7919e7f17c0a725 ]---
      [    0.927269] Kernel panic - not syncing: Fatal exception
      [    0.927269] Pid: 271, comm: kapmd Tainted: G      D    2.6.31-rc3-00100-gd520da1-dirty #311
      
      Is caused by an incorrect GDT_ENTRY_INIT() conversion in the apm
      code, as noticed by hpa.
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Noticed-by: N"H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      LKML-Reference: <20090808094905.GA2954@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      72c4d853
    • A
      x86: Introduce GDT_ENTRY_INIT() · 1e5de182
      Akinobu Mita 提交于
      GDT_ENTRY_INIT is static initializer of desc_struct.
      
      We already have similar macro GDT_ENTRY() but it's static
      initializer for u64 and it cannot be used for desc_struct.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      LKML-Reference: <20090718151219.GD11294@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1e5de182
  2. 20 7月, 2009 3 次提交
  3. 17 7月, 2009 2 次提交
  4. 14 7月, 2009 1 次提交
  5. 13 7月, 2009 2 次提交
    • R
      x86, apic: Fix false positive section mismatch in numaq_32.c · 7473727b
      Rakib Mullick 提交于
      The variable apic_numaq placed in noninit section references the
      function wakeup_secondary_cpu_via_nmi(), which is in __cpuinit
      section. Thus causes a section mismatch warning. To avoid such
      mismatch we mark apic_numaq as __refdata.
      
      We were warned by the following warning:
      
        WARNING: arch/x86/kernel/built-in.o(.data+0x932c): Section mismatch in
        reference from the variable apic_numaq to the function
        .cpuinit.text:wakeup_secondary_cpu_via_nmi()
      Signed-off-by: NRakib Mullick <rakib.mullick@gmail.com>
      LKML-Reference: <b9df5fa10907120407p6b4f67dtf4d563155488188a@mail.gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      7473727b
    • R
      x86: Fix false positive section mismatch in es7000_32.c · 151586d0
      Rakib Mullick 提交于
      The variable apic_es7000_cluster references the function __cpuinit
      wakeup_secondary_cpu_via_mip() from a noninit section. So we've been
      warned by the following warning. To avoid possible collision between
      init/noninit, its best to mark the variable as __refdata.
      
      We were warned by the following warning:
      
        LD      arch/x86/kernel/apic/built-in.o
        WARNING: arch/x86/kernel/apic/built-in.o(.data+0x198c): Section
        mismatch in reference from the variable apic_es7000_cluster to the
        function .cpuinit.text:wakeup_secondary_cpu_via_mip()
      Signed-off-by: NRakib Mullick <rakib.mullick@gmail.com>
      LKML-Reference: <b9df5fa10907120404k6279a10ch5e9682432272706f@mail.gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      151586d0
  6. 11 7月, 2009 4 次提交
    • R
      x86: Remove spurious printk level from segfault message · a1a08d1c
      Roland Dreier 提交于
      Since commit 5fd29d6c ("printk: clean up handling of log-levels
      and newlines"), the kernel logs segfaults like:
      
          <6>gnome-power-man[24509]: segfault at 20 ip 00007f9d4950465a sp 00007fffbb50fc70 error 4 in libgobject-2.0.so.0.2103.0[7f9d494f7000+45000]
      
      with the extra "<6>" being KERN_INFO.  This happens because the
      printk in show_signal_msg() started with KERN_CONT and then
      used "%s" to pass in the real level; and KERN_CONT is no longer
      an empty string, and printk only pays attention to the level at
      the very beginning of the format string.
      
      Therefore, remove the KERN_CONT from this printk, since it is
      now actively causing problems (and never really made any
      sense).
      Signed-off-by: NRoland Dreier <roland@digitalvampire.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <874otjitkj.fsf@shaolin.home.digitalvampire.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a1a08d1c
    • P
      sched: INIT_PREEMPT_COUNT · c99e6efe
      Peter Zijlstra 提交于
      Pull the initial preempt_count value into a single
      definition site.
      
      Maintainers for: alpha, ia64 and m68k, please have a look,
      your arch code is funny.
      
      The header magic is a bit odd, but similar to the KERNEL_DS
      one, CPP waits with expanding these macros until the
      INIT_THREAD_INFO macro itself is expanded, which is in
      arch/*/kernel/init_task.c where we've already included
      sched.h so we're good.
      
      Cc: tony.luck@intel.com
      Cc: rth@twiddle.net
      Cc: geert@linux-m68k.org
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NMatt Mackall <mpm@selenic.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c99e6efe
    • Y
      x86/pci: insert ioapic resource before assigning unassigned resources · 857fdc53
      Yinghai Lu 提交于
      Stephen reported that his DL585 G2 needed noapic after 2.6.22 (?)
      
      Dann bisected it down to:
        commit 30a18d6c
        Date:   Tue Feb 19 03:21:20 2008 -0800
      
            x86: multi pci root bus with different io resource range, on
            64-bit
      
      It turns out that:
        1. that AMD-based systems have two HT chains.
        2. BIOS doesn't allocate resources for BAR 6 of devices under 8132 etc
        3. that multi-peer-root patch will try to split root resources to peer
           root resources according to PCI conf of NB
        4. PCI core assigns unassigned resources, but they overlap with BARs
           that are used by ioapic addr of io4 and 8132.
      
      The reason: at that point ioapic address are not inserted yet.  Solution
      is to insert ioapic resources into the tree a bit earlier.
      Reported-by: NStephen Frost <sfrost@snowman.net>
      Reported-and-Tested-by: Ndann frazier <dannf@hp.com>
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Cc: stable@kernel.org
      Signed-off-by: NJesse Barnes <jbarnes@jbarnes-g45.(none)>
      857fdc53
    • J
      Fix congestion_wait() sync/async vs read/write confusion · 8aa7e847
      Jens Axboe 提交于
      Commit 1faa16d2 accidentally broke
      the bdi congestion wait queue logic, causing us to wait on congestion
      for WRITE (== 1) when we really wanted BLK_RW_ASYNC (== 0) instead.
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      8aa7e847
  7. 10 7月, 2009 2 次提交
  8. 09 7月, 2009 2 次提交
  9. 08 7月, 2009 1 次提交
  10. 07 7月, 2009 2 次提交
  11. 05 7月, 2009 1 次提交
  12. 04 7月, 2009 5 次提交
    • D
      intel-iommu: Restore DMAR_BROKEN_GFX_WA option for broken graphics drivers · 62edf5dc
      David Woodhouse 提交于
      We need to give people a little more time to fix the broken drivers.
      Re-introduce this, but tied in properly with the 'iommu=pt' support this
      time. Change the config option name and make it default to 'no' too.
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      62edf5dc
    • E
      x86: atomic64: Inline atomic64_read() again · a79f0da8
      Eric Dumazet 提交于
      Now atomic64_read() is light weight (no register pressure and
      small icache), we can inline it again.
      
      Also use "=&A" constraint instead of "+A" to avoid warning
      about unitialized 'res' variable. (gcc had to force 0 in eax/edx)
      
        $ size vmlinux.prev vmlinux.after
           text    data     bss     dec     hex filename
        4908667  451676 1684868 7045211  6b805b vmlinux.prev
        4908651  451676 1684868 7045195  6b804b vmlinux.after
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <4A4E1AA2.30002@gmail.com>
      [ Also fix typo in atomic64_set() export ]
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a79f0da8
    • I
      x86: atomic64: Clean up atomic64_sub_and_test() and atomic64_add_negative() · ddf9a003
      Ingo Molnar 提交于
      Linus noticed that the variable name 'old_val' is
      confusingly named in these functions - the correct
      naming is 'new_val'.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907030942260.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ddf9a003
    • I
      x86: atomic64: Improve atomic64_xchg() · 3a8d1788
      Ingo Molnar 提交于
      Remove the read-first logic from atomic64_xchg() and simplify
      the loop.
      
      This function was the last user of __atomic64_read() - remove it.
      
      Also, change the 'real_val' assumption from the somewhat quirky
      1ULL << 32 value to the (just as arbitrary, but simpler) value
      of 0.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <tip-05118ab8859492ac9ddda0154cf90e37b0a4a0b0@git.kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3a8d1788
    • I
      x86: atomic64: Export APIs to modules · 1fde902d
      Ingo Molnar 提交于
      atomic64_t primitives are used by a handful of drivers,
      so export the APIs consistently. These were inlined
      before.
      
      Also mark atomic64_32.o a core object, so that the symbols
      are available even if not linked to core kernel pieces.
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <tip-05118ab8859492ac9ddda0154cf90e37b0a4a0b0@git.kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1fde902d
  13. 03 7月, 2009 13 次提交
    • E
      x86: atomic64: Improve atomic64_read() · 67d7178f
      Eric Dumazet 提交于
      Optimize atomic64_read() as a special open-coded
      cmpxchg8b variant. This generates nicer code:
      
      arch/x86/lib/atomic64_32.o:
      
         text	   data	    bss	    dec	    hex	filename
          435	      0	      0	    435	    1b3	atomic64_32.o.before
          431	      0	      0	    431	    1af	atomic64_32.o.after
      
      md5:
         bd8ab95e69c93518578bfaf0ea3be4d9  atomic64_32.o.before.asm
         2bdfd4bd1f6b7b61b7fc127aef90ce3b  atomic64_32.o.after.asm
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      67d7178f
    • P
      x86: atomic64: Code atomic(64)_read and atomic(64)_set in C not CPP · 8e049ef0
      Paul Mackerras 提交于
      Occasionally we get bugs where atomic_read or atomic_set are
      used on atomic64_t variables or vice versa.  These bugs don't
      generate warnings on x86 because atomic_read and atomic_set are
      coded as macros rather than C functions, so we don't get any
      type-checking on their arguments; similarly for atomic64_read
      and atomic64_set in 64-bit kernels.
      
      This converts them to C functions so that the arguments are
      type-checked and bugs like this will get caught more easily. It
      also converts atomic_cmpxchg and atomic_xchg, and
      atomic64_cmpxchg and atomic64_xchg on 64-bit, so we get
      type-checking on their arguments too.
      
      Compiling a typical 64-bit x86 config, this generates no new
      warnings, and the vmlinux text is 86 bytes smaller.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8e049ef0
    • J
      x86: Remove unused function lapic_watchdog_ok() · c7210e1f
      Jaswinder Singh Rajput 提交于
      lapic_watchdog_ok() is a global function but no one is using it.
      Signed-off-by: NJaswinder Singh Rajput <jaswinderrajput@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      LKML-Reference: <1246554335.2242.29.camel@jaswinder.satnam>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c7210e1f
    • J
      x86: Remove unused variable disable_x2apic · 23d0cd8e
      Jaswinder Singh Rajput 提交于
      setup_nox2apic() is writing 1 to disable_x2apic but no one is reading it.
      Signed-off-by: NJaswinder Singh Rajput <jaswinderrajput@gmail.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      LKML-Reference: <1246554239.2242.27.camel@jaswinder.satnam>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      23d0cd8e
    • R
      x86, kvm: Fix section mismatches in kvm.c · d3ac8815
      Rakib Mullick 提交于
      The function paravirt_ops_setup() has been refering the
      variable no_timer_check, which is a __initdata. Thus generates
      the following warning. paravirt_ops_setup() function is called
      from kvm_guest_init() which is a __init function. So to fix
      this we mark paravirt_ops_setup as __init.
      
      The sections-check output that warned us about this was:
      
         LD      arch/x86/built-in.o
        WARNING: arch/x86/built-in.o(.text+0x166ce): Section mismatch in
        reference from the function paravirt_ops_setup() to the variable
        .init.data:no_timer_check
        The function paravirt_ops_setup() references
        the variable __initdata no_timer_check.
        This is often because paravirt_ops_setup lacks a __initdata
        annotation or the annotation of no_timer_check is wrong.
      Signed-off-by: NRakib Mullick <rakib.mullick@gmail.com>
      Acked-by: NAvi Kivity <avi@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      LKML-Reference: <b9df5fa10907012240y356427b8ta4bd07f0efc6a049@mail.gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d3ac8815
    • M
      x86: Add missing annotation to arch/x86/lib/copy_user_64.S::copy_to_user · 3fd382ce
      Mike Galbraith 提交于
      While examining symbol generation in perf_counter tools, I
      noticed that copy_to_user() had no size in vmlinux's symtab.
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Acked-by: NAlexander van Heukelum <heukelum@fastmail.fm>
      Acked-by: NCyrill Gorcunov <gorcunov@openvz.org>
      LKML-Reference: <1246512440.13293.3.camel@marge.simson.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3fd382ce
    • M
      x86: Fix fixmap page order for FIX_TEXT_POKE0,1 · 12b9d7cc
      Mathieu Desnoyers 提交于
      Masami reported:
      
      > Since the fixmap pages are assigned higher address to lower,
      > text_poke() has to use it with inverted order (FIX_TEXT_POKE1
      > to FIX_TEXT_POKE0).
      
      I prefer to just invert the order of the fixmap declaration.
      It's simpler and more straightforward.
      
      Backward fixmaps seems to be used by both x86 32 and 64.
      
      It's really rare but a nasty bug, because it only hurts when
      instructions to patch are crossing a page boundary. If this
      happens, the fixmap write accesses will spill on the following
      fixmap, which may very well crash the system. And this does not
      crash the system, it could leave illegal instructions in place.
      Thanks Masami for finding this.
      
      It seems to have crept into the 2.6.30-rc series, so this calls
      for a -stable inclusion.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Acked-by: NMasami Hiramatsu <mhiramat@redhat.com>
      Cc: <stable@kernel.org>
      LKML-Reference: <20090701213722.GH19926@Krystal>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      12b9d7cc
    • I
      x86: atomic64: Fix unclean type use in atomic64_xchg() · 199e2378
      Ingo Molnar 提交于
      Linus noticed that atomic64_xchg() uses atomic_read(), which
      happens to work because atomic_read() is a macro so the
      .counter value gets u64-read on 32-bit too - but this is really
      bogus and serious bugs are waiting to happen.
      
      Fix atomic64_xchg() to use __atomic64_read() instead.
      
      No code changed:
      
      arch/x86/lib/atomic64_32.o:
      
         text	   data	    bss	    dec	    hex	filename
          435	      0	      0	    435	    1b3	atomic64_32.o.before
          435	      0	      0	    435	    1b3	atomic64_32.o.after
      
      md5:
         bd8ab95e69c93518578bfaf0ea3be4d9  atomic64_32.o.before.asm
         bd8ab95e69c93518578bfaf0ea3be4d9  atomic64_32.o.after.asm
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      199e2378
    • I
      x86: atomic64: Make atomic_read() type-safe · 32171208
      Ingo Molnar 提交于
      Linus noticed that atomic64_xchg() uses atomic_read(), which
      happens to work because atomic_read() is a macro so the
      .counter value gets u64-read on 32-bit too - but this is really
      bogus and serious bugs are waiting to happen.
      
      Change atomic_read() to be a type-safe inline, and this exposes
      the atomic64 bogosity as well:
      
        arch/x86/lib/atomic64_32.c: In function ‘atomic64_xchg’:
        arch/x86/lib/atomic64_32.c:39: warning: passing argument 1 of ‘atomic_read’ from incompatible pointer type
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      32171208
    • I
      x86: atomic64: Reduce size of functions · 3ac805d2
      Ingo Molnar 提交于
      cmpxchg8b is a huge instruction in terms of register footprint,
      we almost never want to inline it, not even within the same
      code module.
      
      GCC 4.3 still messes up for two functions, under-judging the
      true cost of this instruction - so annotate two key functions
      to reduce the bloat:
      
      arch/x86/lib/atomic64_32.o:
      
         text	   data	    bss	    dec	    hex	filename
         1763	      0	      0	   1763	    6e3	atomic64_32.o.before
          435	      0	      0	    435	    1b3	atomic64_32.o.after
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3ac805d2
    • I
      x86: atomic64: Improve atomic64_add_return() · 824975ef
      Ingo Molnar 提交于
      Linus noted (based on Eric Dumazet's numbers) that we would
      probably be better off not trying an atomic_read() in
      atomic64_add_return() but intead intentionally let the first
      cmpxchg8b fail - to get a cache-friendly 'give me ownership
      of this cacheline' transaction. That can then be followed
      by the real cmpxchg8b which sets the value local to the CPU.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      824975ef
    • E
      x86: atomic64: Improve cmpxchg8b() · 69237f94
      Eric Dumazet 提交于
      Rewrite cmpxchg8b() to not use %edi register but a generic "+m"
      constraint, to increase compiler freedom in code generation and
      possibly better code.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      69237f94
    • E
      x86: atomic64: Improve atomic64_read() · aacf682f
      Eric Dumazet 提交于
      Linus noticed that the 32-bit version of atomic64_read() was
      being overly complex with re-reading the value and doing a
      retry loop over that.
      
      Instead we can just rely on cmpxchg8b returning either the new
      value or returning the current value.
      
      We can use any 'old' value, which will be faster as it can be
      loaded via immediates. Using some value that is not equal to
      the real value in memory the instruction gets faster.
      
      This also has the advantage that the CPU could avoid dirtying
      the cacheline.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      aacf682f