1. 12 Aug, 2013 1 commit
  2. 11 Aug, 2013 25 commits
  3. 04 Aug, 2013 14 commits
    • Greg Kroah-Hartman's avatar
      Linux 3.4.56 · 7b17c579
      Greg Kroah-Hartman authored
      7b17c579
    • Wanpeng Li's avatar
      mm/memory-hotplug: fix lowmem count overflow when offline pages · 19d22ea8
      Wanpeng Li authored
      commit cea27eb2 upstream.
      
      The logic for the memory-remove code fails to correctly account the
      Total High Memory when a memory block which contains High Memory is
      offlined as shown in the example below.  The following patch fixes it.
      
      Before logic memory remove:
      
      MemTotal:        7603740 kB
      MemFree:         6329612 kB
      Buffers:           94352 kB
      Cached:           872008 kB
      SwapCached:            0 kB
      Active:           626932 kB
      Inactive:         519216 kB
      Active(anon):     180776 kB
      Inactive(anon):   222944 kB
      Active(file):     446156 kB
      Inactive(file):   296272 kB
      Unevictable:           0 kB
      Mlocked:               0 kB
      HighTotal:       7294672 kB
      HighFree:        5704696 kB
      LowTotal:         309068 kB
      LowFree:          624916 kB
      
      After logic memory remove:
      
      MemTotal:        7079452 kB
      MemFree:         5805976 kB
      Buffers:           94372 kB
      Cached:           872000 kB
      SwapCached:            0 kB
      Active:           626936 kB
      Inactive:         519236 kB
      Active(anon):     180780 kB
      Inactive(anon):   222944 kB
      Active(file):     446156 kB
      Inactive(file):   296292 kB
      Unevictable:           0 kB
      Mlocked:               0 kB
      HighTotal:       7294672 kB
      HighFree:        5181024 kB
      LowTotal:       4294752076 kB
      LowFree:          624952 kB
      
      [mhocko@suse.cz: fix CONFIG_HIGHMEM=n build]
      Signed-off-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: <stable@vger.kernel.org>	[2.6.24+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarZhouping Liu <zliu@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19d22ea8
    • Michael S. Tsirkin's avatar
      virtio_net: fix race in RX VQ processing · 40a017c9
      Michael S. Tsirkin authored
      commit cbdadbbf upstream
      
      virtio net called virtqueue_enable_cq on RX path after napi_complete, so
      with NAPI_STATE_SCHED clear - outside the implicit napi lock.
      This violates the requirement to synchronize virtqueue_enable_cq wrt
      virtqueue_add_buf.  In particular, used event can move backwards,
      causing us to lose interrupts.
      In a debug build, this can trigger panic within START_USE.
      
      Jason Wang reports that he can trigger the races artificially,
      by adding udelay() in virtqueue_enable_cb() after virtio_mb().
      
      However, we must call napi_complete to clear NAPI_STATE_SCHED before
      polling the virtqueue for used buffers, otherwise napi_schedule_prep in
      a callback will fail, causing us to lose RX events.
      
      To fix, call virtqueue_enable_cb_prepare with NAPI_STATE_SCHED
      set (under napi lock), later call virtqueue_poll with
      NAPI_STATE_SCHED clear (outside the lock).
      Reported-by: default avatarJason Wang <jasowang@redhat.com>
      Tested-by: default avatarJason Wang <jasowang@redhat.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [wg: Backported to 3.2]
      Signed-off-by: default avatarWolfram Gloger <wmglo@dent.med.uni-muenchen.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40a017c9
    • Michael S. Tsirkin's avatar
      virtio: support unlocked queue poll · 2010fa31
      Michael S. Tsirkin authored
      commit cc229884 upstream.
      
      This adds a way to check ring empty state after enable_cb outside any
      locks. Will be used by virtio_net.
      
      Note: there's room for more optimization: caller is likely to have a
      memory barrier already, which means we might be able to get rid of a
      barrier here.  Deferring this optimization until we do some
      benchmarking.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [wg: Backported to 3.2]
      Signed-off-by: default avatarWolfram Gloger <wmglo@dent.med.uni-muenchen.de>
      [bwh: Backported to 3.4: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2010fa31
    • Linus Torvalds's avatar
      s390: move dummy io_remap_pfn_range() to asm/pgtable.h · c733e1a2
      Linus Torvalds authored
      commit 4f2e2903 upstream.
      
      Commit b4cbb197 ("vm: add vm_iomap_memory() helper function") added
      a helper function wrapper around io_remap_pfn_range(), and every other
      architecture defined it in <asm/pgtable.h>.
      
      The s390 choice of <asm/io.h> may make sense, but is not very convenient
      for this case, and gratuitous differences like that cause unexpected errors like this:
      
         mm/memory.c: In function 'vm_iomap_memory':
         mm/memory.c:2439:2: error: implicit declaration of function 'io_remap_pfn_range' [-Werror=implicit-function-declaration]
      
      Glory be the kbuild test robot who noticed this, bisected it, and
      reported it to the guilty parties (ie me).
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      [bwh: Backported to 3.2: the macro was not defined, so this is an addition
       and not a move]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c733e1a2
    • Steffen Maier's avatar
      zfcp: status read buffers on first adapter open with link down · 17a9afa3
      Steffen Maier authored
      commit 9edf7d75 upstream.
      
      Commit 64deb6ef
      "[SCSI] zfcp: Use status_read_buf_num provided by FCP channel"
      started using a value returned by the channel but only evaluated the value
      if the fabric link is up.
      Commit 8d88cf3f
      "[SCSI] zfcp: Update status read mempool"
      introduced mempool resizings based on the above value.
      On setting an FCP device online for the very first time since boot, a new
      zeroed adapter object is allocated. If the link is down, the number of
      status read requests remains zero. Since just the config data exchange is
      incomplete, we proceed with adapter open recovery. However, we
      unconditionally call mempool_resize with adapter->stat_read_buf_num == 0 in
      this case.
      
      This causes a kernel message "kernel BUG at mm/mempool.c:131!" in process
      "zfcperp<FCP-device-bus-ID>" with last function mempool_resize in Krnl PSW
      and zfcp_erp_thread in the Call Trace.
      
      Don't evaluate channel values which are invalid on link down. The number of
      status read requests is always valid, evaluated, and set to a positive
      minimum greater than zero. The adapter open recovery can proceed and the
      channel has status read buffers to inform us on a future link up event.
      While we are not aware of any other code path that could result in mempool
      resize attempts of size zero, we still also initialize the number of status
      read buffers to be posted to a static minimum number on adapter object
      allocation.
      
      Backported for 3.4-stable. commit a53c8fab since v3.6-rc1 unified
      copyright messages, e.g: revise such messages 'Copyright IBM Corporation'
      as 'Copyright IBM Corp', so updated the messages as a53c8fab did.
      Signed-off-by: default avatarSteffen Maier <maier@linux.vnet.ibm.com>
      Cc: <stable@vger.kernel.org> #2.6.35+
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarZhouping Liu <zliu@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      17a9afa3
    • Clemens Ladisch's avatar
      firewire: fix libdc1394/FlyCap2 iso event regression · a90a3ade
      Clemens Ladisch authored
      commit 0699a73a upstream.
      
      Commit 18d62711 (firewire: prevent dropping of completed iso packet
      header data) was intended to be an obvious bug fix, but libdc1394 and
      FlyCap2 depend on the old behaviour by ignoring all returned information
      and thus not noticing that not all packets have been received yet.  The
      result was that the video frame buffers would be saved before they
      contained the correct data.
      
      Reintroduce the old behaviour for old clients.
      Tested-by: default avatarStepan Salenikovich <stepan.salenikovich@gmail.com>
      Tested-by: default avatarJosep Bosch <jep250@gmail.com>
      Cc: <stable@vger.kernel.org> # 3.4+
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a90a3ade
    • David Vrabel's avatar
      xen/evtchn: avoid a deadlock when unbinding an event channel · 8924588c
      David Vrabel authored
      commit 179fbd5a upstream.
      
      Unbinding an event channel (either with the ioctl or when the evtchn
      device is closed) may deadlock because disable_irq() is called with
      port_user_lock held which is also locked by the interrupt handler.
      
      Think of the IOCTL_EVTCHN_UNBIND is being serviced, the routine has
      just taken the lock, and an interrupt happens. The evtchn_interrupt
      is invoked, tries to take the lock and spins forever.
      
      A quick glance at the code shows that the spinlock is a local IRQ
      variant. Unfortunately that does not help as "disable_irq() waits for
      the interrupt handler on all CPUs to stop running.  If the irq occurs
      on another VCPU, it tries to take port_user_lock and can't because
      the unbind ioctl is holding it." (from David). Hence we cannot
      depend on the said spinlock to protect us. We could make it a system
      wide IRQ disable spinlock but there is a better way.
      
      We can piggyback on the fact that the existence of the spinlock is
      to make get_port_user() checks be up-to-date. And we can alter those
      checks to not depend on the spin lock (as it's protected by u->bind_mutex
      in the ioctl) and can remove the unnecessary locking (this is
      IOCTL_EVTCHN_UNBIND) path.
      
      In the interrupt handler we cannot use the mutex, but we do not
      need it.
      
      "The unbind disables the irq before making the port user stale, so when
      you clear it you are guaranteed that the interrupt handler that might
      use that port cannot be running." (from David).
      
      Hence this patch removes the spinlock usage on the teardown path
      and piggybacks on disable_irq happening before we muck with the
      get_port_user() data. This ensures that the interrupt handler will
      never run on stale data.
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [v1: Expanded the commit description a bit]
      Signed-off-by: default avatarJonghwan Choi <jhbird.choi@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8924588c
    • NeilBrown's avatar
      md/raid10: remove use-after-free bug. · aa2f8abe
      NeilBrown authored
      commit 0eb25bb0 upstream.
      
      We always need to be careful when calling generic_make_request, as it
      can start a chain of events which might free something that we are
      using.
      
      Here is one place I wasn't careful enough.  If the wbio2 is not in
      use, then it might get freed at the first generic_make_request call.
      So perform all necessary tests first.
      
      This bug was introduced in 3.3-rc3 (24afd80d) and can cause an
      oops, so fix is suitable for any -stable since then.
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa2f8abe
    • NeilBrown's avatar
      md/raid5: fix interaction of 'replace' and 'recovery'. · 0761d079
      NeilBrown authored
      commit f94c0b66 upstream.
      
      If a device in a RAID4/5/6 is being replaced while another is being
      recovered, then the writes to the replacement device currently don't
      happen, resulting in corruption when the replacement completes and the
      new drive takes over.
      
      This is because the replacement writes are only triggered when
      's.replacing' is set and not when the similar 's.sync' is set (which
      is the case during resync and recovery - it means all devices need to
      be read).
      
      So schedule those writes when s.replacing is set as well.
      
      In this case we cannot use "STRIPE_INSYNC" to record that the
      replacement has happened as that is needed for recording that any
      parity calculation is complete.  So introduce STRIPE_REPLACED to
      record if the replacement has happened.
      
      For safety we should also check that STRIPE_COMPUTE_RUN is not set.
      This has a similar effect to the "s.locked == 0" test.  The latter
      ensure that now IO has been flagged but not started.  The former
      checks if any parity calculation has been flagged by not started.
      We must wait for both of these to complete before triggering the
      'replace'.
      
      Add a similar test to the subsequent check for "are we finished yet".
      This possibly isn't needed (is subsumed in the STRIPE_INSYNC test),
      but it makes it more obvious that the REPLACE will happen before we
      think we are finished.
      
      Finally if a NeedReplace device is not UPTODATE then that is an
      error.  We really must trigger a warning.
      
      This bug was introduced in commit 9a3e1101
      (md/raid5:  detect and handle replacements during recovery.)
      which introduced replacement for raid5.
      That was in 3.3-rc3, so any stable kernel since then would benefit
      from this fix.
      Reported-by: default avatarqindehua <13691222965@163.com>
      Tested-by: default avatarqindehua <qindehua@163.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0761d079
    • Al Viro's avatar
      livelock avoidance in sget() · 257e1c5c
      Al Viro authored
      commit acfec9a5 upstream.
      
      Eric Sandeen has found a nasty livelock in sget() - take a mount(2) about
      to fail.  The superblock is on ->fs_supers, ->s_umount is held exclusive,
      ->s_active is 1.  Along comes two more processes, trying to mount the same
      thing; sget() in each is picking that superblock, bumping ->s_count and
      trying to grab ->s_umount.  ->s_active is 3 now.  Original mount(2)
      finally gets to deactivate_locked_super() on failure; ->s_active is 2,
      superblock is still ->fs_supers because shutdown will *not* happen until
      ->s_active hits 0.  ->s_umount is dropped and now we have two processes
      chasing each other:
      s_active = 2, A acquired ->s_umount, B blocked
      A sees that the damn thing is stillborn, does deactivate_locked_super()
      s_active = 1, A drops ->s_umount, B gets it
      A restarts the search and finds the same superblock.  And bumps it ->s_active.
      s_active = 2, B holds ->s_umount, A blocked on trying to get it
      ... and we are in the earlier situation with A and B switched places.
      
      The root cause, of course, is that ->s_active should not grow until we'd
      got MS_BORN.  Then failing ->mount() will have deactivate_locked_super()
      shut the damn thing down.  Fortunately, it's easy to do - the key point
      is that grab_super() is called only for superblocks currently on ->fs_supers,
      so it can bump ->s_count and grab ->s_umount first, then check MS_BORN and
      bump ->s_active; we must never increment ->s_count for superblocks past
      ->kill_sb(), but grab_super() is never called for those.
      
      The bug is pretty old; we would've caught it by now, if not for accidental
      exclusion between sget() for block filesystems; the things like cgroup or
      e.g. mtd-based filesystems don't have anything of that sort, so they get
      bitten.  The right way to deal with that is obviously to fix sget()...
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      257e1c5c
    • Rick Farina (Zero_Chaos)'s avatar
      USB: serial: ftdi_sio: add more RT Systems ftdi devices · 428f268e
      Rick Farina (Zero_Chaos) authored
      commit fed1f1ed upstream.
      
      RT Systems makes many usb serial cables based on the ftdi_sio driver for
      programming various amateur radios.  This patch is a full listing of
      their current product offerings and should allow these cables to all
      be recognized.
      Signed-off-by: default avatarRick Farina (Zero_Chaos) <zerochaos@gentoo.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      428f268e
    • Alex Deucher's avatar
      drm/radeon/atom: initialize more atom interpretor elements to 0 · 1996c980
      Alex Deucher authored
      commit 42a21826 upstream.
      
      The ProcessAuxChannel table on some rv635 boards assumes
      the divmul members are initialized to 0 otherwise we get
      an invalid fb offset since it has a bad mask set when
      setting the fb base.  While here initialize all the
      atom interpretor elements to 0.
      
      Fixes:
      https://bugzilla.kernel.org/show_bug.cgi?id=60639Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1996c980
    • Alex Deucher's avatar
      drm/radeon: improve dac adjust heuristics for legacy pdac · e41f203d
      Alex Deucher authored
      commit 03ed8cf9 upstream.
      
      Hopefully avoid more quirks in the future due to bogus
      vbios dac data.
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e41f203d