1. 09 Oct, 2014 26 commits
    • Andrew Hunter's avatar
      jiffies: Fix timeval conversion to jiffies · 79d627d4
      Andrew Hunter authored
      commit d78c9300 upstream.
      
      timeval_to_jiffies tried to round a timeval up to an integral number
      of jiffies, but the logic for doing so was incorrect: intervals
      corresponding to exactly N jiffies would become N+1. This manifested
      itself particularly repeatedly stopping/starting an itimer:
      
      setitimer(ITIMER_PROF, &val, NULL);
      setitimer(ITIMER_PROF, NULL, &val);
      
      would add a full tick to val, _even if it was exactly representable in
      terms of jiffies_ (say, the result of a previous rounding.)  Doing
      this repeatedly would cause unbounded growth in val.  So fix the math.
      
      Here's what was wrong with the conversion: we essentially computed
      (eliding seconds)
      
      jiffies = usec  * (NSEC_PER_USEC/TICK_NSEC)
      
      by using scaling arithmetic, which took the best approximation of
      NSEC_PER_USEC/TICK_NSEC with denominator of 2^USEC_JIFFIE_SC =
      x/(2^USEC_JIFFIE_SC), and computed:
      
      jiffies = (usec * x) >> USEC_JIFFIE_SC
      
      and rounded this calculation up in the intermediate form (since we
      can't necessarily exactly represent TICK_NSEC in usec.) But the
      scaling arithmetic is a (very slight) *over*approximation of the true
      value; that is, instead of dividing by (1 usec/ 1 jiffie), we
      effectively divided by (1 usec/1 jiffie)-epsilon (rounding
      down). This would normally be fine, but we want to round timeouts up,
      and we did so by adding 2^USEC_JIFFIE_SC - 1 before the shift; this
      would be fine if our division was exact, but dividing this by the
      slightly smaller factor was equivalent to adding just _over_ 1 to the
      final result (instead of just _under_ 1, as desired.)
      
      In particular, with HZ=1000, we consistently computed that 10000 usec
      was 11 jiffies; the same was true for any exact multiple of
      TICK_NSEC.
      
      We could possibly still round in the intermediate form, adding
      something less than 2^USEC_JIFFIE_SC - 1, but easier still is to
      convert usec->nsec, round in nanoseconds, and then convert using
      time*spec*_to_jiffies.  This adds one constant multiplication, and is
      not observably slower in microbenchmarks on recent x86 hardware.
      
      Tested: the following program:
      
      int main() {
        struct itimerval zero = {{0, 0}, {0, 0}};
        /* Initially set to 10 ms. */
        struct itimerval initial = zero;
        initial.it_interval.tv_usec = 10000;
        setitimer(ITIMER_PROF, &initial, NULL);
        /* Save and restore several times. */
        for (size_t i = 0; i < 10; ++i) {
          struct itimerval prev;
          setitimer(ITIMER_PROF, &zero, &prev);
          /* on old kernels, this goes up by TICK_USEC every iteration */
          printf("previous value: %ld %ld %ld %ld\n",
                 prev.it_interval.tv_sec, prev.it_interval.tv_usec,
                 prev.it_value.tv_sec, prev.it_value.tv_usec);
          setitimer(ITIMER_PROF, &prev, NULL);
        }
          return 0;
      }
      
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Reviewed-by: default avatarPaul Turner <pjt@google.com>
      Reported-by: default avatarAaron Jacobs <jacobsa@google.com>
      Signed-off-by: default avatarAndrew Hunter <ahh@google.com>
      [jstultz: Tweaked to apply to 3.17-rc]
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      [bwh: Backported to 3.16: adjust filename]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79d627d4
    • Hans Verkuil's avatar
      media: vb2: fix VBI/poll regression · 1c1e2cc7
      Hans Verkuil authored
      commit 58d75f4b upstream.
      
      The recent conversion of saa7134 to vb2 unconvered a poll() bug that
      broke the teletext applications alevt and mtt. These applications
      expect that calling poll() without having called VIDIOC_STREAMON will
      cause poll() to return POLLERR. That did not happen in vb2.
      
      This patch fixes that behavior. It also fixes what should happen when
      poll() is called when STREAMON is called but no buffers have been
      queued. In that case poll() will also return POLLERR, but only for
      capture queues since output queues will always return POLLOUT
      anyway in that situation.
      
      This brings the vb2 behavior in line with the old videobuf behavior.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c1e2cc7
    • Mel Gorman's avatar
      mm: numa: Do not mark PTEs pte_numa when splitting huge pages · 106aad13
      Mel Gorman authored
      commit abc40bd2 upstream.
      
      This patch reverts 1ba6e0b5 ("mm: numa: split_huge_page: transfer the
      NUMA type from the pmd to the pte"). If a huge page is being split due
      a protection change and the tail will be in a PROT_NONE vma then NUMA
      hinting PTEs are temporarily created in the protected VMA.
      
       VM_RW|VM_PROTNONE
      |-----------------|
            ^
            split here
      
      In the specific case above, it should get fixed up by change_pte_range()
      but there is a window of opportunity for weirdness to happen. Similarly,
      if a huge page is shrunk and split during a protection update but before
      pmd_numa is cleared then a pte_numa can be left behind.
      
      Instead of adding complexity trying to deal with the case, this patch
      will not mark PTEs NUMA when splitting a huge page. NUMA hinting faults
      will not be triggered which is marginal in comparison to the complexity
      in dealing with the corner cases during THP split.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Acked-by: default avatarRik van Riel <riel@redhat.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      106aad13
    • Waiman Long's avatar
      mm, thp: move invariant bug check out of loop in __split_huge_page_map · c16f6baf
      Waiman Long authored
      commit f8303c25 upstream.
      
      In __split_huge_page_map(), the check for page_mapcount(page) is
      invariant within the for loop.  Because of the fact that the macro is
      implemented using atomic_read(), the redundant check cannot be optimized
      away by the compiler leading to unnecessary read to the page structure.
      
      This patch moves the invariant bug check out of the loop so that it will
      be done only once.  On a 3.16-rc1 based kernel, the execution time of a
      microbenchmark that broke up 1000 transparent huge pages using munmap()
      had an execution time of 38,245us and 38,548us with and without the
      patch respectively.  The performance gain is about 1%.
      Signed-off-by: default avatarWaiman Long <Waiman.Long@hp.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Scott J Norton <scott.norton@hp.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c16f6baf
    • Bruno Prémont's avatar
      vgaarb: Don't default exclusively to first video device with mem+io · ce027dac
      Bruno Prémont authored
      commit 86fd887b upstream.
      
      Commit 20cde694 ("x86, ia64: Move EFI_FB vga_default_device()
      initialization to pci_vga_fixup()") moved boot video device detection from
      efifb to x86 and ia64 pci/fixup.c.
      
      For dual-GPU Apple computers above change represents a regression as code
      in efifb did forcefully override vga_default_device while the merge did not
      (vgaarb happens prior to PCI fixup).
      
      To improve on initial device selection by vgaarb (it cannot know if PCI
      device not behind bridges see/decode legacy VGA I/O or not), move the
      screen_info based check from pci_video_fixup() to vgaarb's init function and
      use it to refine/override decision taken while adding the individual PCI
      VGA devices.  This way PCI fixup has no reason to adjust vga_default_device
      anymore but can depend on its value for flagging shadowed VBIOS.
      
      This has the nice benefit of removing duplicated code but does introduce a
      #if defined() block in vgaarb.  Not all architectures have screen_info and
      would cause compile to fail without it.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=84461Reported-and-Tested-By: default avatarAndreas Noever <andreas.noever@gmail.com>
      Signed-off-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: Matthew Garrett <matthew.garrett@nebula.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ce027dac
    • Bruno Prémont's avatar
      x86, ia64: Move EFI_FB vga_default_device() initialization to pci_vga_fixup() · 7babfd7f
      Bruno Prémont authored
      commit 20cde694 upstream.
      
      Commit b4aa0163 ("efifb: Implement vga_default_device() (v2)") added
      efifb vga_default_device() so EFI systems that do not load shadow VBIOS or
      setup VGA get proper value for boot_vga PCI sysfs attribute on the
      corresponding PCI device.
      
      Xorg doesn't detect devices when boot_vga=0, e.g., on some EFI systems such
      as MacBookAir2,1.  Xorg detects the GPU and finds the DRI device but then
      bails out with "no devices detected".
      
      Note: When vga_default_device() is set boot_vga PCI sysfs attribute
      reflects its state.  When unset this attribute is 1 whenever
      IORESOURCE_ROM_SHADOW flag is set.
      
      With introduction of sysfb/simplefb/simpledrm efifb is getting obsolete
      while having native drivers for the GPU also makes selecting sysfb/efifb
      optional.
      
      Remove the efifb implementation of vga_default_device() and initialize
      vgaarb's vga_default_device() with the PCI GPU that matches boot
      screen_info in pci_fixup_video().
      
      [bhelgaas: remove unused "dev" in efifb_setup()]
      Fixes: b4aa0163 ("efifb: Implement vga_default_device() (v2)")
      Tested-by: default avatarAnibal Francisco Martinez Cortina <linuxkid.zeuz@gmail.com>
      Signed-off-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarMatthew Garrett <matthew.garrett@nebula.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7babfd7f
    • Hans de Goede's avatar
    • Hans de Goede's avatar
      uas: Disable uas on ASM1051 devices · d7d36249
      Hans de Goede authored
      commit a9c54caa upstream.
      
      There are a large numbers of issues with ASM1051 devices in uas mode:
      
      1) They do not support REPORT SUPPORTED OPERATION CODES
      
      2) They use out of spec 8 byte status iu-s when they have no sense data,
         switching to normal 16 byte status iu-s when they do have sense data.
      
      3) They hang / crash when combined with some disks, e.g. a Crucial M500 ssd.
      
      4) They hang / crash when stressed (through e.g. sg_reset --bus) with disks
         with which then normally do work (once 1 & 2 are worked around).
      
      Where as in BOT mode they appear to work fine, so the best way forward with
      these devices is to just blacklist them for uas usage.
      
      Unfortunately this is easier said then done. as older versions of the ASM1053
      (which works fine) use the same usb-id as the ASM1051.
      
      When connected over USB-3 the 2 can be told apart by the number of streams
      they support. So this patch adds some less then pretty code to disable uas for
      the ASM1051. When connected over USB-2, simply disable uas alltogether for
      devices with the shared usb-id.
      
      Cc: stable@vger.kernel.org # 3.16
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7d36249
    • Hans de Goede's avatar
      uas: Log a warning when we cannot use uas because the hcd lacks streams · d751f881
      Hans de Goede authored
      commit 43508be5 upstream.
      
      So that an user who wants to use uas can see why he is not getting uas.
      
      Also move the check down so that we don't warn if there are other reasons
      why uas cannot work.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d751f881
    • Hans de Goede's avatar
      uas: Only complain about missing sg if all other checks succeed · d9d4dc60
      Hans de Goede authored
      commit cc4deafc upstream.
      
      Don't complain about controllers without sg support if there are other
      reasons why uas cannot be used anyways.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9d4dc60
    • Steven Rostedt (Red Hat)'s avatar
      ring-buffer: Fix infinite spin in reading buffer · 70e9e520
      Steven Rostedt (Red Hat) authored
      commit 24607f11 upstream.
      
      Commit 651e22f2 "ring-buffer: Always reset iterator to reader page"
      fixed one bug but in the process caused another one. The reset is to
      update the header page, but that fix also changed the way the cached
      reads were updated. The cache reads are used to test if an iterator
      needs to be updated or not.
      
      A ring buffer iterator, when created, disables writes to the ring buffer
      but does not stop other readers or consuming reads from happening.
      Although all readers are synchronized via a lock, they are only
      synchronized when in the ring buffer functions. Those functions may
      be called by any number of readers. The iterator continues down when
      its not interrupted by a consuming reader. If a consuming read
      occurs, the iterator starts from the beginning of the buffer.
      
      The way the iterator sees that a consuming read has happened since
      its last read is by checking the reader "cache". The cache holds the
      last counts of the read and the reader page itself.
      
      Commit 651e22f2 changed what was saved by the cache_read when
      the rb_iter_reset() occurred, making the iterator never match the cache.
      Then if the iterator calls rb_iter_reset(), it will go into an
      infinite loop by checking if the cache doesn't match, doing the reset
      and retrying, just to see that the cache still doesn't match! Which
      should never happen as the reset is suppose to set the cache to the
      current value and there's locks that keep a consuming reader from
      having access to the data.
      
      Fixes: 651e22f2 "ring-buffer: Always reset iterator to reader page"
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70e9e520
    • Josh Triplett's avatar
      init/Kconfig: Fix HAVE_FUTEX_CMPXCHG to not break up the EXPERT menu · f3b920a7
      Josh Triplett authored
      commit 62b4d204 upstream.
      
      commit 03b8c7b6 ("futex: Allow
      architectures to skip futex_atomic_cmpxchg_inatomic() test") added the
      HAVE_FUTEX_CMPXCHG symbol right below FUTEX.  This placed it right in
      the middle of the options for the EXPERT menu.  However,
      HAVE_FUTEX_CMPXCHG does not depend on EXPERT or FUTEX, so Kconfig stops
      placing items in the EXPERT menu, and displays the remaining several
      EXPERT items (starting with EPOLL) directly in the General Setup menu.
      
      Since both users of HAVE_FUTEX_CMPXCHG only select it "if FUTEX", make
      HAVE_FUTEX_CMPXCHG itself depend on FUTEX.  With this change, the
      subsequent items display as part of the EXPERT menu again; the EMBEDDED
      menu now appears as the next top-level item in the General Setup menu,
      which makes General Setup much shorter and more usable.
      Signed-off-by: default avatarJosh Triplett <josh@joshtriplett.org>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f3b920a7
    • Steve French's avatar
      Fix problem recognizing symlinks · f173e28f
      Steve French authored
      commit 19e81573 upstream.
      
      Changeset eb85d94b introduced a problem where if a cifs open
      fails during query info of a file we
      will still try to close the file (happens with certain types
      of reparse points) even though the file handle is not valid.
      
      In addition for SMB2/SMB3 we were not mapping the return code returned
      by Windows when trying to open a file (like a Windows NFS symlink)
      which is a reparse point.
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      Reviewed-by: default avatarPavel Shilovsky <pshilovsky@samba.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f173e28f
    • Chris Wilson's avatar
      drm/i915: Flush the PTEs after updating them before suspend · 332cec01
      Chris Wilson authored
      commit 91e56499 upstream.
      
      As we use WC updates of the PTE, we are responsible for notifying the
      hardware when to flush its TLBs. Do so after we zap all the PTEs before
      suspend (and the BIOS tries to read our GTT).
      
      Fixes a regression from
      
      commit 828c7908
      Author: Ben Widawsky <benjamin.widawsky@intel.com>
      Date:   Wed Oct 16 09:21:30 2013 -0700
      
          drm/i915: Disable GGTT PTEs on GEN6+ suspend
      
      that survived and continue to cause harm even after
      
      commit e568af1c
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Wed Mar 26 20:08:20 2014 +0100
      
          drm/i915: Undo gtt scratch pte unmapping again
      
      v2: Trivial rebase.
      v3: Fixes requires pointer dances.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82340
      Tested-by: ming.yao@intel.com
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
      Cc: Todd Previte <tprevite@gmail.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      332cec01
    • NeilBrown's avatar
      md/raid5: disable 'DISCARD' by default due to safety concerns. · ede6b1e9
      NeilBrown authored
      commit 8e0e99ba upstream.
      
      It has come to my attention (thanks Martin) that 'discard_zeroes_data'
      is only a hint.  Some devices in some cases don't do what it
      says on the label.
      
      The use of DISCARD in RAID5 depends on reads from discarded regions
      being predictably zero.  If a write to a previously discarded region
      performs a read-modify-write cycle it assumes that the parity block
      was consistent with the data blocks.  If all were zero, this would
      be the case.  If some are and some aren't this would not be the case.
      This could lead to data corruption after a device failure when
      data needs to be reconstructed from the parity.
      
      As we cannot trust 'discard_zeroes_data', ignore it by default
      and so disallow DISCARD on all raid4/5/6 arrays.
      
      As many devices are trustworthy, and as there are benefits to using
      DISCARD, add a module parameter to over-ride this caution and cause
      DISCARD to work if discard_zeroes_data is set.
      
      If a site want to enable DISCARD on some arrays but not on others they
      should select DISCARD support at the filesystem level, and set the
      raid456 module parameter.
          raid456.devices_handle_discard_safely=Y
      
      As this is a data-safety issue, I believe this patch is suitable for
      -stable.
      DISCARD support for RAID456 was added in 3.7
      
      Cc: Shaohua Li <shli@kernel.org>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: Heinz Mauelshagen <heinzm@redhat.com>
      Acked-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Acked-by: default avatarMike Snitzer <snitzer@redhat.com>
      Fixes: 620125f2Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ede6b1e9
    • Rafael J. Wysocki's avatar
      cpufreq: pcc-cpufreq: Fix wait_event() under spinlock · 9346dc9c
      Rafael J. Wysocki authored
      commit e65b5ddb upstream.
      
      Fix the following bug introduced by commit 8fec051e (cpufreq:
      Convert existing drivers to use cpufreq_freq_transition_{begin|end})
      that forgot to move the spin_lock() in pcc_cpufreq_target() past
      cpufreq_freq_transition_begin() which calls wait_event():
      
      BUG: sleeping function called from invalid context at drivers/cpufreq/cpufreq.c:370
      in_atomic(): 1, irqs_disabled(): 0, pid: 2636, name: modprobe
      Preemption disabled at:[<ffffffffa04d74d7>] pcc_cpufreq_target+0x27/0x200 [pcc_cpufreq]
      [   51.025044]
      CPU: 57 PID: 2636 Comm: modprobe Tainted: G            E  3.17.0-default #7
      Hardware name: Hewlett-Packard ProLiant DL980 G7, BIOS P66 07/07/2010
       00000000ffffffff ffff88026c46b828 ffffffff81589dbd 0000000000000000
       ffff880037978090 ffff88026c46b848 ffffffff8108e1df ffff880037978090
       0000000000000000 ffff88026c46b878 ffffffff8108e298 ffff88026d73ec00
      Call Trace:
       [<ffffffff81589dbd>] dump_stack+0x4d/0x90
       [<ffffffff8108e1df>] ___might_sleep+0x10f/0x180
       [<ffffffff8108e298>] __might_sleep+0x48/0xd0
       [<ffffffff8145b905>] cpufreq_freq_transition_begin+0x75/0x140 drivers/cpufreq/cpufreq.c:370 wait_event(policy->transition_wait, !policy->transition_ongoing);
       [<ffffffff8108fc99>] ? preempt_count_add+0xb9/0xc0
       [<ffffffffa04d7513>] pcc_cpufreq_target+0x63/0x200 [pcc_cpufreq] drivers/cpufreq/pcc-cpufreq.c:207 spin_lock(&pcc_lock);
       [<ffffffff810e0d0f>] ? update_ts_time_stats+0x7f/0xb0
       [<ffffffff8145be55>] __cpufreq_driver_target+0x85/0x170
       [<ffffffff8145e4c8>] od_check_cpu+0xa8/0xb0
       [<ffffffff8145ef10>] dbs_check_cpu+0x180/0x1d0
       [<ffffffff8145f310>] cpufreq_governor_dbs+0x3b0/0x720
       [<ffffffff8145ebe3>] od_cpufreq_governor_dbs+0x33/0xe0
       [<ffffffff814593d9>] __cpufreq_governor+0xa9/0x210
       [<ffffffff81459fb2>] cpufreq_set_policy+0x1e2/0x2e0
       [<ffffffff8145a6cc>] cpufreq_init_policy+0x8c/0x110
       [<ffffffff8145c9a0>] ? cpufreq_update_policy+0x1b0/0x1b0
       [<ffffffff8108fb99>] ? preempt_count_sub+0xb9/0x100
       [<ffffffff8145c6c6>] __cpufreq_add_dev+0x596/0x6b0
       [<ffffffffa016c608>] ? pcc_cpufreq_probe+0x4b4/0x4b4 [pcc_cpufreq]
       [<ffffffff8145c7ee>] cpufreq_add_dev+0xe/0x10
       [<ffffffff81408e81>] subsys_interface_register+0xc1/0xf0
       [<ffffffff8108fb99>] ? preempt_count_sub+0xb9/0x100
       [<ffffffff8145b3d7>] cpufreq_register_driver+0x117/0x2a0
       [<ffffffffa016c65d>] pcc_cpufreq_init+0x55/0x9f8 [pcc_cpufreq]
       [<ffffffffa016c608>] ? pcc_cpufreq_probe+0x4b4/0x4b4 [pcc_cpufreq]
       [<ffffffff81000298>] do_one_initcall+0xc8/0x1f0
       [<ffffffff811a731d>] ? __vunmap+0x9d/0x100
       [<ffffffff810eb9a0>] do_init_module+0x30/0x1b0
       [<ffffffff810edfa6>] load_module+0x686/0x710
       [<ffffffff810ebb20>] ? do_init_module+0x1b0/0x1b0
       [<ffffffff810ee1db>] SyS_init_module+0x9b/0xc0
       [<ffffffff8158f7a9>] system_call_fastpath+0x16/0x1b
      
      Fixes: 8fec051e (cpufreq: Convert existing drivers to use cpufreq_freq_transition_{begin|end})
      Reported-and-tested-by: default avatarMike Galbraith <umgwanakikbuti@gmail.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9346dc9c
    • Arnd Bergmann's avatar
      cpufreq: integrator: fix integrator_cpufreq_remove return type · 2c36e464
      Arnd Bergmann authored
      commit d62dbf77 upstream.
      
      When building this driver as a module, we get a helpful warning
      about the return type:
      
      drivers/cpufreq/integrator-cpufreq.c:232:2: warning: initialization from incompatible pointer type
        .remove = __exit_p(integrator_cpufreq_remove),
      
      If the remove callback returns void, the caller gets an undefined
      value as it expects an integer to be returned. This fixes the
      problem by passing down the value from cpufreq_unregister_driver.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2c36e464
    • Aaron Lu's avatar
      ACPI / i915: Update the condition to ignore firmware backlight change request · 8cc97651
      Aaron Lu authored
      commit 77076c7a upstream.
      
      Some of the Thinkpads' firmware will issue a backlight change request
      through i915 operation region unconditionally on AC plug/unplug, the
      backlight level used is arbitrary and thus should be ignored. This is
      handled by commit 0b9f7d93 (ACPI / i915: ignore firmware requests
      for backlight change). Then there is a Dell laptop whose vendor backlight
      interface also makes use of operation region to change backlight level
      and with the above commit, that interface no long works. The condition
      used to ignore the backlight change request from firmware is thus
      changed to: if the vendor backlight interface is not in use and the ACPI
      backlight interface is broken, we ignore the requests; oterwise, we keep
      processing them.
      
      Fixes: 0b9f7d93 (ACPI / i915: ignore firmware requests for backlight change)
      Link: https://lkml.org/lkml/2014/9/23/854Reported-and-tested-by: default avatarPali Rohár <pali.rohar@gmail.com>
      Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
      Acked-by: default avatarDaniel Vetter <daniel@ffwll.ch>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8cc97651
    • Alexandru M Stan's avatar
      i2c: rk3x: fix 0 length write transfers · 57ca8495
      Alexandru M Stan authored
      commit cf27020d upstream.
      
      i2cdetect -q was broken (everything was a false positive, and no transfers were
      actually being sent over i2c). The way it works is by sending a 0 length write
      request and checking for NACK. This patch fixes the 0 length writes and actually
      sends them.
      Reported-by: default avatarDoug Anderson <dianders@chromium.org>
      Signed-off-by: default avatarAlexandru M Stan <amstan@chromium.org>
      Tested-by: default avatarDoug Anderson <dianders@chromium.org>
      Tested-by: default avatarMax Schwarz <max.schwarz@online.de>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      57ca8495
    • Andy Gross's avatar
      i2c: qup: Fix order of runtime pm initialization · 7f28469c
      Andy Gross authored
      commit 86b59bbf upstream.
      
      The runtime pm calls need to be done before populating the children via the
      i2c_add_adapter call.  If this is not done, a child can run into issues trying
      to do i2c read/writes due to the pm_runtime_sync failing.
      Signed-off-by: default avatarAndy Gross <agross@codeaurora.org>
      Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
      Acked-by: default avatarBjorn Andersson <bjorn.andersson@sonymobile.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7f28469c
    • Mel Gorman's avatar
      mm: migrate: Close race between migration completion and mprotect · e9203e7b
      Mel Gorman authored
      commit d3cb8bf6 upstream.
      
      A migration entry is marked as write if pte_write was true at the time the
      entry was created. The VMA protections are not double checked when migration
      entries are being removed as mprotect marks write-migration-entries as
      read. It means that potentially we take a spurious fault to mark PTEs write
      again but it's straight-forward. However, there is a race between write
      migrations being marked read and migrations finishing. This potentially
      allows a PTE to be write that should have been read. Close this race by
      double checking the VMA permissions using maybe_mkwrite when migration
      completes.
      
      [torvalds@linux-foundation.org: use maybe_mkwrite]
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Acked-by: default avatarRik van Riel <riel@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9203e7b
    • Johannes Weiner's avatar
      mm: memcontrol: do not iterate uninitialized memcgs · a1130ef0
      Johannes Weiner authored
      commit 2f7dd7a4 upstream.
      
      The cgroup iterators yield css objects that have not yet gone through
      css_online(), but they are not complete memcgs at this point and so the
      memcg iterators should not return them.  Commit d8ad3055 ("mm/memcg:
      iteration skip memcgs not yet fully initialized") set out to implement
      exactly this, but it uses CSS_ONLINE, a cgroup-internal flag that does
      not meet the ordering requirements for memcg, and so the iterator may
      skip over initialized groups, or return partially initialized memcgs.
      
      The cgroup core can not reasonably provide a clear answer on whether the
      object around the css has been fully initialized, as that depends on
      controller-specific locking and lifetime rules.  Thus, introduce a
      memcg-specific flag that is set after the memcg has been initialized in
      css_online(), and read before mem_cgroup_iter() callers access the memcg
      members.
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Tejun Heo <tj@kernel.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1130ef0
    • Peter Zijlstra's avatar
      perf: fix perf bug in fork() · 54a9ae91
      Peter Zijlstra authored
      commit 6c72e350 upstream.
      
      Oleg noticed that a cleanup by Sylvain actually uncovered a bug; by
      calling perf_event_free_task() when failing sched_fork() we will not yet
      have done the memset() on ->perf_event_ctxp[] and will therefore try and
      'free' the inherited contexts, which are still in use by the parent
      process.  This is bad..
      Suggested-by: default avatarOleg Nesterov <oleg@redhat.com>
      Reported-by: default avatarOleg Nesterov <oleg@redhat.com>
      Reported-by: default avatarSylvain 'ythier' Hitier <sylvain.hitier@gmail.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      54a9ae91
    • Xiubo Li's avatar
      ASoC: core: fix possible ZERO_SIZE_PTR pointer dereferencing error. · 8f805204
      Xiubo Li authored
      commit 6596aa04 upstream.
      
      Since we cannot make sure the 'params->num_regs' will always be none
      zero here, and then if it equals to zero, the kmemdup() will return
      ZERO_SIZE_PTR, which equals to ((void *)16).
      
      So this patch fix this with just doing the zero check before calling
      kmemdup().
      Signed-off-by: default avatarXiubo Li <Li.Xiubo@freescale.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f805204
    • Stefan Kristiansson's avatar
      ASoC: ssm2602: do not hardcode type to SSM2602 · 5b744c01
      Stefan Kristiansson authored
      commit fe2a08b3 upstream.
      
      The correct type (SSM2602/SSM2603/SSM2604) is passed down
      from the ssm2602_spi_probe()/ssm2602_spi_probe() functions,
      so use that instead of hardcoding it to SSM2602 in
      ssm2602_probe().
      
      Fixes: c924dc68 ("ASoC: ssm2602: Split SPI and I2C code into different modules")
      Signed-off-by: default avatarStefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b744c01
    • Jan Kara's avatar
      udf: Avoid infinite loop when processing indirect ICBs · 7478bcf7
      Jan Kara authored
      commit c03aa9f6 upstream.
      
      We did not implement any bound on number of indirect ICBs we follow when
      loading inode. Thus corrupted medium could cause kernel to go into an
      infinite loop, possibly causing a stack overflow.
      
      Fix the possible stack overflow by removing recursion from
      __udf_read_inode() and limit number of indirect ICBs we follow to avoid
      infinite loops.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Cc: Chuck Ebbert <cebbert.lkml@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7478bcf7
  2. 05 Oct, 2014 14 commits