1. 30 Aug, 2009 1 commit
  2. 28 Aug, 2009 1 commit
    • Thomas Gleixner's avatar
      clocksource: Resolve cpu hotplug dead lock with TSC unstable · 7285dd7f
      Thomas Gleixner authored
      Martin Schwidefsky analyzed it:
      To register a clocksource the clocksource_mutex is acquired and if
      necessary timekeeping_notify is called to install the clocksource as
      the timekeeper clock. timekeeping_notify uses stop_machine which needs
      to take cpu_add_remove_lock mutex.
      Starting a new cpu is done with the cpu_add_remove_lock mutex held.
      native_cpu_up checks the tsc of the new cpu and if the tsc is no good
      clocksource_change_rating is called. Which needs the clocksource_mutex
      and the deadlock is complete.
      
      The solution is to replace the TSC via the clocksource watchdog
      mechanism. Mark the TSC as unstable and schedule the watchdog work so
      it gets removed in the watchdog thread context.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <new-submission>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: John Stultz <johnstul@us.ibm.com>
      7285dd7f
  3. 26 Aug, 2009 1 commit
  4. 25 Aug, 2009 2 commits
    • Hiroshi Shimamoto's avatar
      timekeeping: Fix invalid getboottime() value · 36d47481
      Hiroshi Shimamoto authored
      Don't use timespec_add_safe() with wall_to_monotonic, because
      wall_to_monotonic has negative values which will cause overflow
      in timespec_add_safe(). That makes btime in /proc/stat invalid.
      Signed-off-by: default avatarHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: John Stultz <johnstul@us.ibm.com>
      Cc: Daniel Walker <dwalker@fifo99.com>
      LKML-Reference: <4A937FDE.4050506@ct.jp.nec.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      36d47481
    • Paul Mundt's avatar
      timekeeping: Fix up read_persistent_clock() breakage on sh · 0ceb4c3e
      Paul Mundt authored
      The recent commit "timekeeping: Increase granularity of
      read_persistent_clock()" introduced read_persistent_clock()
      rework which inadvertently broke the sh conversion:
      
      	arch/sh/kernel/time.c:45: error: passing argument 1 of 'rtc_sh_get_time' from incompatible pointer type
      	distcc[13470] ERROR: compile arch/sh/kernel/time.c on sprygo/32 failed
      	make[2]: *** [arch/sh/kernel/time.o] Error 1
      
      This trivial fix gets it working again.
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      LKML-Reference: <20090824223239.GB20832@linux-sh.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0ceb4c3e
  5. 23 Aug, 2009 1 commit
  6. 21 Aug, 2009 2 commits
    • john stultz's avatar
      time: Introduce CLOCK_REALTIME_COARSE · da15cfda
      john stultz authored
      After talking with some application writers who want very fast, but not
      fine-grained timestamps, I decided to try to implement new clock_ids
      to clock_gettime(): CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE
      which returns the time at the last tick. This is very fast as we don't
      have to access any hardware (which can be very painful if you're using
      something like the acpi_pm clocksource), and we can even use the vdso
      clock_gettime() method to avoid the syscall. The only trade off is you
      only get low-res tick grained time resolution.
      
      This isn't a new idea, I know Ingo has a patch in the -rt tree that made
      the vsyscall gettimeofday() return coarse grained time when the
      vsyscall64 sysctrl was set to 2. However this affects all applications
      on a system.
      
      With this method, applications can choose the proper speed/granularity
      trade-off for themselves.
      Signed-off-by: default avatarJohn Stultz <johnstul@us.ibm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: nikolag@ca.ibm.com
      Cc: Darren Hart <dvhltc@us.ibm.com>
      Cc: arjan@infradead.org
      Cc: jonathan@jonmasters.org
      LKML-Reference: <1250734414.6897.5.camel@localhost.localdomain>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      da15cfda
    • Thomas Gleixner's avatar
      x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown · 8cab02dc
      Thomas Gleixner authored
      This basically reverts commit 1a0c009a (x86: unregister PIT
      clocksource when PIT is disabled) because the problem which was tried
      to address with that patch has been solved by commit 3f68535a
      (clocksource: sanity check sysfs clocksource changes).
      
      The problem addressed by the original patch is that PIT could be
      selected as clocksource after the system switched the PIT off or set
      the PIT into one shot mode which would result in complete timekeeping
      wreckage.
      
      Now with the sysfs sanity check in place PIT cannot be selected again
      when the system is in oneshot mode. The system will not switch to one
      shot mode as long as PIT is installed because PIT is not suitable for
      one shot.
      
      The shutdown case which happens when the lapic timer is installed is
      covered by the fact that init_pit_clocksource() is called after the
      lapic timer take over and then does not install the PIT clocksource
      at all.
      
      We should have done the sanity checks back then, but ...
      
      This also solves the locking problem which was reported vs. the
      clocksource rework.
      
      LKML-Reference: <new-submission>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: john stultz <johnstul@us.ibm.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      8cab02dc
  7. 19 Aug, 2009 2 commits
    • Martin Schwidefsky's avatar
      clocksource: Avoid clocksource watchdog circular locking dependency · 01548f4d
      Martin Schwidefsky authored
      stop_machine from a multithreaded workqueue is not allowed because
      of a circular locking dependency between cpu_down and the workqueue
      execution. Use a kernel thread to do the clocksource downgrade.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: john stultz <johnstul@us.ibm.com>
      LKML-Reference: <20090818170942.3ab80c91@skybase>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      01548f4d
    • Thomas Gleixner's avatar
      clocksource: Protect the watchdog rating changes with clocksource_mutex · d0981a1b
      Thomas Gleixner authored
      Martin pointed out that commit 6ea41d2529 (clocksource: Call
      clocksource_change_rating() outside of watchdog_lock) has a
      theoretical reference count problem. The calls to
      clocksource_change_rating() are now done outside of the clocksource
      mutex and outside of the watchdog lock. A concurrent
      clocksource_unregister() could remove the clock.
      
      Split out the code which changes the rating from
      clocksource_change_rating() into __clocksource_change_rating().
      
      Protect the clocksource_watchdog_work() code sequence with the
      clocksource_mutex() and call __clocksource_change_rating().
      
      LKML-Reference: <alpine.LFD.2.00.0908171038420.2782@localhost.localdomain>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      d0981a1b
  8. 15 Aug, 2009 16 commits
  9. 14 Aug, 2009 1 commit
  10. 13 Aug, 2009 13 commits
    • Linus Torvalds's avatar
      Linux 2.6.31-rc6 · 64f1607f
      Linus Torvalds authored
      64f1607f
    • Linus Torvalds's avatar
      genirq: prevent wakeup of freed irq thread · 2d860ad7
      Linus Torvalds authored
      free_irq() can remove an irqaction while the corresponding interrupt
      is in progress, but free_irq() sets action->thread to NULL
      unconditionally, which might lead to a NULL pointer dereference in
      handle_IRQ_event() when the hard interrupt context tries to wake up
      the handler thread.
      
      Prevent this by moving the thread stop after synchronize_irq(). No
      need to set action->thread to NULL either as action is going to be
      freed anyway.
      
      This fixes a boot crash reported against preempt-rt which uses the
      mainline irq threads code to implement full irq threading.
      
      [ tglx: removed local irqthread variable ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      2d860ad7
    • Linus Torvalds's avatar
      Merge branch 'perfcounters-fixes-for-linus' of... · 3493e84d
      Linus Torvalds authored
      Merge branch 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
      
      * 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
        perf_counter: Report the cloning task as parent on perf_counter_fork()
        perf_counter: Fix an ipi-deadlock
        perf: Rework/fix the whole read vs group stuff
        perf_counter: Fix swcounter context invariance
        perf report: Don't show unresolved DSOs and symbols when -S/-d is used
        perf tools: Add a general option to enable raw sample records
        perf tools: Add a per tracepoint counter attribute to get raw sample
        perf_counter: Provide hw_perf_counter_setup_online() APIs
        perf list: Fix large list output by using the pager
        perf_counter, x86: Fix/improve apic fallback
        perf record: Add missing -C option support for specifying profile cpu
        perf tools: Fix dso__new handle() to handle deleted DSOs
        perf tools: Fix fallback to cplus_demangle() when bfd_demangle() is not available
        perf report: Show the tid too in -D
        perf record: Fix .tid and .pid fill-in when synthesizing events
        perf_counter, x86: Fix generic cache events on P6-mobile CPUs
        perf_counter, x86: Fix lapic printk message
      3493e84d
    • Linus Torvalds's avatar
      Merge branch 'core-fixes-for-linus' of... · 919aa96a
      Linus Torvalds authored
      Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
      
      * 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
        futex: Fix handling of bad requeue syscall pairing
        futex: Fix compat_futex to be same as futex for REQUEUE_PI
        locking, sched: Give waitqueue spinlocks their own lockdep classes
        futex: Update futex_q lock_ptr on requeue proxy lock
      919aa96a
    • Linus Torvalds's avatar
      Merge branch 'x86-fixes-for-linus' of... · 1c2ffff4
      Linus Torvalds authored
      Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
      
      * 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
        x86: Fix oops in identify_cpu() on CPUs without CPUID
        x86: Clear incorrectly forced X86_FEATURE_LAHF_LM flag
        x86, mce: therm_throt - change when we print messages
        x86: Add reboot quirk for every 5 series MacBook/Pro
      1c2ffff4
    • Linus Torvalds's avatar
      Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2 · bc7af9ba
      Linus Torvalds authored
      * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2: (22 commits)
        ocfs2: Fix possible deadlock when extending quota file
        ocfs2: keep index within status_map[]
        ocfs2: Initialize the cluster we're writing to in a non-sparse extend
        ocfs2: Remove redundant BUG_ON in __dlm_queue_ast()
        ocfs2/quota: Release lock for error in ocfs2_quota_write.
        ocfs2: Define credit counts for quota operations
        ocfs2: Remove syncjiff field from quota info
        ocfs2: Fix initialization of blockcheck stats
        ocfs2: Zero out padding of on disk dquot structure
        ocfs2: Initialize blocks allocated to local quota file
        ocfs2: Mark buffer uptodate before calling ocfs2_journal_access_dq()
        ocfs2: Make global quota files blocksize aligned
        ocfs2: Use ocfs2_rec_clusters in ocfs2_adjust_adjacent_records.
        ocfs2: Fix deadlock on umount
        ocfs2: Add extra credits and access the modified bh in update_edge_lengths.
        ocfs2: Fail ocfs2_get_block() immediately when a block needs allocation
        ocfs2: Fix error return in ocfs2_write_cluster()
        ocfs2: Fix compilation warning for fs/ocfs2/xattr.c
        ocfs2: Initialize count in aio_write before generic_write_checks
        ocfs2: log the actual return value of ocfs2_file_aio_write()
        ...
      bc7af9ba
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://neil.brown.name/md · d58d2d1a
      Linus Torvalds authored
      * 'for-linus' of git://neil.brown.name/md:
        md: allow upper limit for resync/reshape to be set when array is read-only
        md/raid5: Properly remove excess drives after shrinking a raid5/6
        md/raid5: make sure a reshape restarts at the correct address.
        md/raid5: allow new reshape modes to be restarted in the middle.
        md: never advance 'events' counter by more than 1.
        Remove deadlock potential in md_open
      d58d2d1a
    • Linus Torvalds's avatar
      Merge branch 'sh/for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 · 7334219c
      Linus Torvalds authored
      * 'sh/for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
        sh: fix i2c init order on ap325rxa V2
        sh: fix i2c init order on Migo-R V2
        sh: convert processor device setup functions to arch_initcall()
      7334219c
    • Linus Torvalds's avatar
      Make sock_sendpage() use kernel_sendpage() · e6949583
      Linus Torvalds authored
      kernel_sendpage() does the proper default case handling for when the
      socket doesn't have a native sendpage implementation.
      
      Now, arguably this might be something that we could instead solve by
      just specifying that all protocols should do it themselves at the
      protocol level, but we really only care about the common protocols.
      Does anybody really care about sendpage on something like Appletalk? Not
      likely.
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Acked-by: default avatarJulien TINNES <julien@cr0.org>
      Acked-by: default avatarTavis Ormandy <taviso@sdf.lonestar.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e6949583
    • Peter Zijlstra's avatar
      perf_counter: Report the cloning task as parent on perf_counter_fork() · 94d5d1b2
      Peter Zijlstra authored
      A bug in (9f498cc5: perf_counter: Full task tracing) makes
      profiling multi-threaded apps it go belly up.
      
      [ output as: (PID:TID):(PPID:PTID) ]
      
       # ./perf report -D | grep FORK
      0x4b0 [0x18]: PERF_EVENT_FORK: (3237:3237):(3236:3236)
      0xa10 [0x18]: PERF_EVENT_FORK: (3237:3238):(3236:3236)
      0xa70 [0x18]: PERF_EVENT_FORK: (3237:3239):(3236:3236)
      0xad0 [0x18]: PERF_EVENT_FORK: (3237:3240):(3236:3236)
      0xb18 [0x18]: PERF_EVENT_FORK: (3237:3241):(3236:3236)
      
      Shows us that the test (27d028de perf report: Update for the new
      FORK/EXIT events) in builtin-report.c:
      
              /*
               * A thread clone will have the same PID for both
               * parent and child.
               */
              if (thread == parent)
                      return 0;
      
      Will clearly fail.
      
      The problem is that perf_counter_fork() reports the actual
      parent, instead of the cloning thread.
      
      Fixing that (with the below patch), yields:
      
       # ./perf report -D | grep FORK
      0x4c8 [0x18]: PERF_EVENT_FORK: (1590:1590):(1589:1589)
      0xbd8 [0x18]: PERF_EVENT_FORK: (1590:1591):(1590:1590)
      0xc80 [0x18]: PERF_EVENT_FORK: (1590:1592):(1590:1590)
      0x3338 [0x18]: PERF_EVENT_FORK: (1590:1593):(1590:1590)
      0x66b0 [0x18]: PERF_EVENT_FORK: (1590:1594):(1590:1590)
      
      Which both makes more sense and doesn't confuse perf report
      anymore.
      Reported-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: paulus@samba.org
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Arjan van de Ven <arjan@infradead.org>
      LKML-Reference: <1250172882.5241.62.camel@twins>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      94d5d1b2
    • Peter Zijlstra's avatar
      perf_counter: Fix an ipi-deadlock · 970892a9
      Peter Zijlstra authored
      perf_pending_counter() is called from IRQ context and will call
      perf_counter_disable(), however perf_counter_disable() uses
      smp_call_function_single() which doesn't fancy being used with
      IRQs disabled due to IPI deadlocks.
      
      Fix this by making it use the local __perf_counter_disable()
      call and teaching the counter_sched_out() code about pending
      disables as well.
      
      This should cover the case where a counter migrates before the
      pending queue gets processed.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Corey J Ashford <cjashfor@us.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: stephane eranian <eranian@googlemail.com>
      LKML-Reference: <20090813103655.244097721@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      970892a9
    • Peter Zijlstra's avatar
      perf: Rework/fix the whole read vs group stuff · 3dab77fb
      Peter Zijlstra authored
      Replace PERF_SAMPLE_GROUP with PERF_SAMPLE_READ and introduce
      PERF_FORMAT_GROUP to deal with group reads in a more generic
      way.
      
      This allows you to get group reads out of read() as well.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Corey J Ashford <cjashfor@us.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: stephane eranian <eranian@googlemail.com>
      LKML-Reference: <20090813103655.117411814@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3dab77fb
    • Peter Zijlstra's avatar
      perf_counter: Fix swcounter context invariance · bcfc2602
      Peter Zijlstra authored
      perf_swcounter_is_counting() uses a lock, which means we cannot
      use swcounters from NMI or when holding that particular lock,
      this is unintended.
      
      The below removes the lock, this opens up race window, but not
      worse than the swcounters already experience due to RCU
      traversal of the context in perf_swcounter_ctx_event().
      
      This also fixes the hard lockups while opening a lockdep
      tracepoint counter.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: stephane eranian <eranian@googlemail.com>
      Cc: Corey J Ashford <cjashfor@us.ibm.com>
      LKML-Reference: <1250149915.10001.66.camel@twins>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bcfc2602