1. 16 Feb, 2012 1 commit
    • Linus Torvalds's avatar
      i387: fix x86-64 preemption-unsafe user stack save/restore · 15d8791c
      Linus Torvalds authored
      Commit 5b1cbac3 ("i387: make irq_fpu_usable() tests more robust")
      added a sanity check to the #NM handler to verify that we never cause
      the "Device Not Available" exception in kernel mode.
      
      However, that check actually pinpointed a (fundamental) race where we do
      cause that exception as part of the signal stack FPU state save/restore
      code.
      
      Because we use the floating point instructions themselves to save and
      restore state directly from user mode, we cannot do that atomically with
      testing the TS_USEDFPU bit: the user mode access itself may cause a page
      fault, which causes a task switch, which saves and restores the FP/MMX
      state from the kernel buffers.
      
      This kind of "recursive" FP state save is fine per se, but it means that
      when the signal stack save/restore gets restarted, it will now take the
      '#NM' exception we originally tried to avoid.  With preemption this can
      happen even without the page fault - but because of the user access, we
      cannot just disable preemption around the save/restore instruction.
      
      There are various ways to solve this, including using the
      "enable/disable_page_fault()" helpers to not allow page faults at all
      during the sequence, and fall back to copying things by hand without the
      use of the native FP state save/restore instructions.
      
      However, the simplest thing to do is to just allow the #NM from kernel
      space, but fix the race in setting and clearing CR0.TS that this all
      exposed: the TS bit changes and the TS_USEDFPU bit absolutely have to be
      atomic wrt scheduling, so while the actual state save/restore can be
      interrupted and restarted, the act of actually clearing/setting CR0.TS
      and the TS_USEDFPU bit together must not.
      
      Instead of just adding random "preempt_disable/enable()" calls to what
      is already excessively ugly code, this introduces some helper functions
      that mostly mirror the "kernel_fpu_begin/end()" functionality, just for
      the user state instead.
      
      Those helper functions should probably eventually replace the other
      ad-hoc CR0.TS and TS_USEDFPU tests too, but I'll need to think about it
      some more: the task switching functionality in particular needs to
      expose the difference between the 'prev' and 'next' threads, while the
      new helper functions intentionally were written to only work with
      'current'.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      15d8791c
  2. 15 Feb, 2012 1 commit
    • Linus Torvalds's avatar
      i387: fix sense of sanity check · c38e2345
      Linus Torvalds authored
      The check for save_init_fpu() (introduced in commit 5b1cbac3: "i387:
      make irq_fpu_usable() tests more robust") was the wrong way around, but
      I hadn't noticed, because my "tests" were bogus: the FPU exceptions are
      disabled by default, so even doing a divide by zero never actually
      triggers this code at all unless you do extra work to enable them.
      
      So if anybody did enable them, they'd get one spurious warning.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c38e2345
  3. 14 Feb, 2012 34 commits
  4. 13 Feb, 2012 4 commits
    • Linus Torvalds's avatar
      Merge tag 'battery-fixes-for-v3.3-rc2' of git://git.infradead.org/users/cbou/battery-urgent · 3b582f39
      Linus Torvalds authored
      Just a few small fixes for a bunch of drivers. Nothing noteworthy.
      
      * tag 'battery-fixes-for-v3.3-rc2' of git://git.infradead.org/users/cbou/battery-urgent:
        lp8727_charger: Add terminating entry for i2c_device_id table
        power_supply: Fix modalias for charger-manager
        lp8727_chager: Fix permissions on a header file
        bq27x00_battery: Fix flag register read
        Revert "bq27x00_battery: Fix reporting status value for bq27500 battery"
      3b582f39
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs · 19be13cf
      Linus Torvalds authored
      Two bugfixes in XFS for 3.3: one fix passes KMEM_SLEEP to kmem_realloc
      instead of 0, and the other resolves a possible deadlock in xfs quotas.
      
      * 'for-linus' of git://oss.sgi.com/xfs/xfs:
        xfs: use a normal shrinker for the dquot freelist
        xfs: pass KM_SLEEP flag to kmem_realloc() in xlog_recover_add_to_cnt_trans()
      19be13cf
    • Linus Torvalds's avatar
      Merge branch 'omap-fixes-warnings' of git://git.linaro.org/people/rmk/linux-arm · b14a2998
      Linus Torvalds authored
      This set of changes are fixing various section mismatch warnings which
      look to be completely valid.  Primerily, those which are fixed are those
      which can cause oopses by manipulation of driver binding via sysfs.  For
      example: calling code marked __init from driver probe __devinit
      functions.
      
      Some of these changes will be reworked at the next merge window when the
      underlying reasons are sorted out.  In the mean time, I think it's
      important to have this fixed for correctness.
      
      Also included in this set are fixes to various error messages in OMAP -
      including making them gramatically correct, fixing a few spelling
      errors, and more importantly, making them greppable by unwrapping them.
      
      Tony Lindgren has acked all these patches, put them out for testing a
      week ago, and I've tested them on the platforms I have.
      
      * 'omap-fixes-warnings' of git://git.linaro.org/people/rmk/linux-arm:
        ARM: omap: resolve nebulous 'Error setting wl12xx data'
        ARM: omap: fix wrapped error messages in omap_hwmod.c
        ARM: omap: fix section mismatch warnings in mux.c caused by hsmmc.c
        ARM: omap: fix section mismatch warning for sdp3430_twl_gpio_setup()
        ARM: omap: fix section mismatch error for omap_4430sdp_display_init()
        ARM: omap: fix section mismatch warning for omap_secondary_startup()
        ARM: omap: preemptively fix section mismatch in omap4_sdp4430_wifi_mux_init()
        ARM: omap: fix section mismatch warning in mux.c
        ARM: omap: fix section mismatch errors in TWL PMIC driver
        ARM: omap: fix uninformative vc/i2c configuration error message
        ARM: omap: fix vc.c PMIC error message
        ARM: omap: fix prm44xx.c OMAP44XX_IRQ_PRCM build error
      b14a2998
    • Linus Torvalds's avatar
      Merge branch 'omap-fixes-urgent' of git://git.linaro.org/people/rmk/linux-arm · a269c2f5
      Linus Torvalds authored
      This pull request covers the major oopsing issues with OMAP, caused by
      the lack of the TWL driver.  Even when the TWL driver is not built in,
      we shouldn't oops.
      
      * 'omap-fixes-urgent' of git://git.linaro.org/people/rmk/linux-arm:
        ARM: omap: fix broken twl-core dependencies and ifdefs
        ARM: omap: fix oops in drivers/video/omap2/dss/dpi.c
        ARM: omap: fix oops in arch/arm/mach-omap2/vp.c when pmic is not found
      a269c2f5