1. 21 Nov, 2011 6 commits
    • Tejun Heo's avatar
      freezer: remove racy clear_freeze_flag() and set PF_NOFREEZE on dead tasks · a585042f
      Tejun Heo authored
      clear_freeze_flag() in exit_mm() is racy.  Freezing can start
      afterwards.  Remove it.  Skipping freezer for exiting task will be
      properly implemented later.
      
      Also, freezable() was testing exit_state directly to make system
      freezer ignore dead tasks.  Let the exiting task set PF_NOFREEZE after
      entering TASK_DEAD instead.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      a585042f
    • Tejun Heo's avatar
      freezer: rename thaw_process() to __thaw_task() and simplify the implementation · a5be2d0d
      Tejun Heo authored
      thaw_process() now has only internal users - system and cgroup
      freezers.  Remove the unnecessary return value, rename, unexport and
      collapse __thaw_process() into it.  This will help further updates to
      the freezer code.
      
      -v3: oom_kill grew a use of thaw_process() while this patch was
           pending.  Convert it to use __thaw_task() for now.  In the longer
           term, this should be handled by allowing tasks to die if killed
           even if it's frozen.
      
      -v2: minor style update as suggested by Matt.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Paul Menage <menage@google.com>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      a5be2d0d
    • Tejun Heo's avatar
      freezer: implement and use kthread_freezable_should_stop() · 8a32c441
      Tejun Heo authored
      Writeback and thinkpad_acpi have been using thaw_process() to prevent
      deadlock between the freezer and kthread_stop(); unfortunately, this
      is inherently racy - nothing prevents freezing from happening between
      thaw_process() and kthread_stop().
      
      This patch implements kthread_freezable_should_stop() which enters
      refrigerator if necessary but is guaranteed to return if
      kthread_stop() is invoked.  Both thaw_process() users are converted to
      use the new function.
      
      Note that this deadlock condition exists for many of freezable
      kthreads.  They need to be converted to use the new should_stop or
      freezable workqueue.
      
      Tested with synthetic test case.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarHenrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Oleg Nesterov <oleg@redhat.com>
      8a32c441
    • Tejun Heo's avatar
      freezer: unexport refrigerator() and update try_to_freeze() slightly · a0acae0e
      Tejun Heo authored
      There is no reason to export two functions for entering the
      refrigerator.  Calling refrigerator() instead of try_to_freeze()
      doesn't save anything noticeable or removes any race condition.
      
      * Rename refrigerator() to __refrigerator() and make it return bool
        indicating whether it scheduled out for freezing.
      
      * Update try_to_freeze() to return bool and relay the return value of
        __refrigerator() if freezing().
      
      * Convert all refrigerator() users to try_to_freeze().
      
      * Update documentation accordingly.
      
      * While at it, add might_sleep() to try_to_freeze().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Samuel Ortiz <samuel@sortiz.org>
      Cc: Chris Mason <chris.mason@oracle.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
      Cc: Christoph Hellwig <hch@infradead.org>
      a0acae0e
    • Tejun Heo's avatar
      freezer: don't unnecessarily set PF_NOFREEZE explicitly · 3a7cbd50
      Tejun Heo authored
      Some drivers set PF_NOFREEZE in their kthread functions which is
      completely unnecessary and racy - some part of freezer code doesn't
      consider cases where PF_NOFREEZE is set asynchronous to freezer
      operations.
      
      In general, there's no reason to allow setting PF_NOFREEZE explicitly.
      Remove them and change the documentation to note that setting
      PF_NOFREEZE directly isn't allowed.
      
      -v2: Dropped change to twl4030-irq.c as it no longer uses PF_NOFREEZE.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatar"Gustavo F. Padovan" <padovan@profusion.mobi>
      Acked-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
      Cc: Marcel Holtmann <marcel@holtmann.org>
      Cc: wwang <wei_wang@realsil.com.cn>
      3a7cbd50
    • Tejun Heo's avatar
      freezer: fix current->state restoration race in refrigerator() · 50fb4f7f
      Tejun Heo authored
      refrigerator() saves current->state before entering frozen state and
      restores it before returning using __set_current_state(); however,
      this is racy, for example, please consider the following sequence.
      
      	set_current_state(TASK_INTERRUPTIBLE);
      	try_to_freeze();
      	if (kthread_should_stop())
      		break;
      	schedule();
      
      If kthread_stop() races with ->state restoration, the restoration can
      restore ->state to TASK_INTERRUPTIBLE after kthread_stop() sets it to
      TASK_RUNNING but kthread_should_stop() may still see zero
      ->should_stop because there's no memory barrier between restoring
      TASK_INTERRUPTIBLE and kthread_should_stop() test.
      
      This isn't restricted to kthread_should_stop().  current->state is
      often used in memory barrier based synchronization and silently
      restoring it w/o mb breaks them.
      
      Use set_current_state() instead.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      50fb4f7f
  2. 20 Nov, 2011 5 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 6fe4c6d4
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (86 commits)
        ipv4: fix redirect handling
        ping: dont increment ICMP_MIB_INERRORS
        sky2: fix hang in napi_disable
        sky2: enforce minimum ring size
        bonding: Don't allow mode change via sysfs with slaves present
        f_phonet: fix page offset of first received fragment
        stmmac: fix pm functions avoiding sleep on spinlock
        stmmac: remove spin_lock in stmmac_ioctl.
        stmmac: parameters auto-tuning through HW cap reg
        stmmac: fix advertising 1000Base capabilties for non GMII iface
        stmmac: use mdelay on timeout of sw reset
        sky2: version 1.30
        sky2: used fixed RSS key
        sky2: reduce default Tx ring size
        sky2: rename up/down functions
        sky2: pci posting issues
        sky2: fix hang on shutdown (and other irq issues)
        r6040: fix check against MCRO_HASHEN bit in r6040_multicast_list
        MAINTAINERS: change email address for shemminger
        pch_gbe: Move #include of module.h
        ...
      6fe4c6d4
    • Linus Torvalds's avatar
      Merge branch 'kvm-updates/3.2' of git://git.kernel.org/pub/scm/virt/kvm/kvm · a4cc3889
      Linus Torvalds authored
      * 'kvm-updates/3.2' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM guest: prevent tracing recursion with kvmclock
        Revert "KVM: PPC: Add support for explicit HIOR setting"
        KVM: VMX: Check for automatic switch msr table overflow
        KVM: VMX: Add support for guest/host-only profiling
        KVM: VMX: add support for switching of PERF_GLOBAL_CTRL
        KVM: s390: announce SYNC_MMU
        KVM: s390: Fix tprot locking
        KVM: s390: handle SIGP sense running intercepts
        KVM: s390: Fix RUNNING flag misinterpretation
      a4cc3889
    • Linus Torvalds's avatar
      Merge branch 'fixes' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm · bb893d15
      Linus Torvalds authored
      * 'fixes' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm:
        ARM: wire up process_vm_writev and process_vm_readv syscalls
        ARM: 7160/1: setup: avoid overflowing {elf,arch}_name from proc_info_list
        ARM: 7158/1: add new MFP implement for NUC900
        ARM: 7157/1: fix a building WARNING for nuc900
        ARM: 7156/1: l2x0: fix compile error on !CONFIG_USE_OF
        ARM: 7155/1: arch.h: Declare 'pt_regs' locally
        ARM: 7154/1: mach-bcmring: fix build error in dma.c
        ARM: 7153/1: mach-bcmring: fix build error in core.c
        ARM: 7152/1: distclean: Remove generated .dtb files
        ARM: 7150/1: Allow kernel unaligned accesses on ARMv6+ processors
        ARM: 7149/1: spi/pl022: Enable clock in probe
        Revert "ARM: 7098/1: kdump: copy kernel relocation code at the kexec prepare stage"
      bb893d15
    • Linus Torvalds's avatar
      Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 2d360fcb
      Linus Torvalds authored
      * 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        PM / Suspend: Fix bug in suspend statistics update
        PM / Hibernate: Fix the early termination of test modes
        PM / shmobile: Fix build of sh7372_pm_init() for CONFIG_PM unset
        PM Sleep: Do not extend wakeup paths to devices with ignore_children set
        PM / driver core: disable device's runtime PM during shutdown
        PM / devfreq: correct Kconfig dependency
        PM / devfreq: fix use after free in devfreq_remove_device
        PM / shmobile: Avoid restoring the INTCS state during initialization
        PM / devfreq: Remove compiler error after irq.h update
        PM / QoS: Properly use the WARN() macro in dev_pm_qos_add_request()
        PM / Clocks: Only disable enabled clocks in pm_clk_suspend()
        ARM: mach-shmobile: sh7372 A3SP no_suspend_console fix
        PM / shmobile: Don't skip debugging output in pd_power_up()
      2d360fcb
    • Avi Kivity's avatar
      KVM guest: prevent tracing recursion with kvmclock · 95ef1e52
      Avi Kivity authored
      Prevent tracing of preempt_disable() in get_cpu_var() in
      kvm_clock_read(). When CONFIG_DEBUG_PREEMPT is enabled,
      preempt_disable/enable() are traced and this causes the function_graph
      tracer to go into an infinite recursion. By open coding the
      preempt_disable() around the get_cpu_var(), we can use the notrace
      version which prevents preempt_disable/enable() from being traced and
      prevents the recursion.
      
      Based on a similar patch for Xen from Jeremy Fitzhardinge.
      Tested-by: default avatarGleb Natapov <gleb@redhat.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      95ef1e52
  3. 19 Nov, 2011 10 commits
  4. 18 Nov, 2011 17 commits
  5. 17 Nov, 2011 2 commits