1. 22 Feb, 2012 14 commits
    • Mahesh Salgaonkar's avatar
      fadump: Invalidate registration and release reserved memory for general use. · b500afff
      Mahesh Salgaonkar authored
      This patch introduces an sysfs interface '/sys/kernel/fadump_release_mem' to
      invalidate the last fadump registration, invalidate '/proc/vmcore', release
      the reserved memory for general use and re-register for future kernel dump.
      Once the dump is copied to the disk, unlike phyp dump, the userspace tool
      can release all the memory reserved for dump with one single operation of
      echo 1 to '/sys/kernel/fadump_release_mem'.
      
      Release the reserved memory region excluding the size of the memory required
      for future kernel dump registration. And therefore, unlike kdump, Fadump
      doesn't need a 2nd reboot to get back the system to the production
      configuration.
      Signed-off-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      b500afff
    • Mahesh Salgaonkar's avatar
      fadump: Introduce cleanup routine to invalidate /proc/vmcore. · 16257393
      Mahesh Salgaonkar authored
      With the firmware-assisted dump support we don't require a reboot when we
      are in second kernel after crash. The second kernel after crash is a normal
      kernel boot and has knowledge about entire system RAM with the page tables
      initialized for entire system RAM. Hence once the dump is saved to disk, we
      can just release the reserved memory area for general use and continue
      with second kernel as production kernel.
      
      Hence when we release the reserved memory that contains dump data, the
      '/proc/vmcore' will not be valid anymore. Hence this patch introduces
      a cleanup routine that invalidates and removes the /proc/vmcore file. This
      routine will be invoked before we release the reserved dump memory area.
      Signed-off-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      16257393
    • Mahesh Salgaonkar's avatar
      fadump: Add PT_NOTE program header for vmcoreinfo · d34c5f26
      Mahesh Salgaonkar authored
      Introduce a PT_NOTE program header that points to physical address of
      vmcoreinfo_note buffer declared in kernel/kexec.c. The vmcoreinfo
      note buffer is populated during crash_fadump() at the time of system
      crash.
      Signed-off-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      d34c5f26
    • Mahesh Salgaonkar's avatar
      fadump: Convert firmware-assisted cpu state dump data into elf notes. · ebaeb5ae
      Mahesh Salgaonkar authored
      When registered for firmware assisted dump on powerpc, firmware preserves
      the registers for the active CPUs during a system crash. This patch reads
      the cpu register data stored in Firmware-assisted dump format (except for
      crashing cpu) and converts it into elf notes and updates the PT_NOTE program
      header accordingly. The exact register state for crashing cpu is saved to
      fadump crash info structure in scratch area during crash_fadump() and read
      during second kernel boot.
      Signed-off-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ebaeb5ae
    • Mahesh Salgaonkar's avatar
      fadump: Initialize elfcore header and add PT_LOAD program headers. · 2df173d9
      Mahesh Salgaonkar authored
      Build the crash memory range list by traversing through system memory during
      the first kernel before we register for firmware-assisted dump. After the
      successful dump registration, initialize the elfcore header and populate
      PT_LOAD program headers with crash memory ranges. The elfcore header is
      saved in the scratch area within the reserved memory. The scratch area starts
      at the end of the memory reserved for saving RMR region contents. The
      scratch area contains fadump crash info structure that contains magic number
      for fadump validation and physical address where the eflcore header can be
      found. This structure will also be used to pass some important crash info
      data to the second kernel which will help second kernel to populate ELF core
      header with correct data before it gets exported through /proc/vmcore. Since
      the firmware preserves the entire partition memory at the time of crash the
      contents of the scratch area will be preserved till second kernel boot.
      
      Since the memory dump exported through /proc/vmcore is in ELF format similar
      to kdump, it will help us to reuse the kdump infrastructure for dump capture
      and filtering. Unlike phyp dump, userspace tool does not need to refer any
      sysfs interface while reading /proc/vmcore.
      
      NOTE: The current design implementation does not address a possibility of
      introducing additional fields (in future) to this structure without affecting
      compatibility. It's on TODO list to come up with better approach to
      address this.
      
      Reserved dump area start => +-------------------------------------+
                                  |  CPU state dump data                |
                                  +-------------------------------------+
                                  |  HPTE region data                   |
                                  +-------------------------------------+
                                  |  RMR region data                    |
      Scratch area start       => +-------------------------------------+
                                  |  fadump crash info structure {      |
                                  |     magic nummber                   |
                           +------|---- elfcorehdr_addr                 |
                           |      |  }                                  |
                           +----> +-------------------------------------+
                                  |  ELF core header                    |
      Reserved dump area end   => +-------------------------------------+
      Signed-off-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      2df173d9
    • Mahesh Salgaonkar's avatar
      fadump: Register for firmware assisted dump. · 3ccc00a7
      Mahesh Salgaonkar authored
      On 2012-02-20 11:02:51 Mon, Paul Mackerras wrote:
      > On Thu, Feb 16, 2012 at 04:44:30PM +0530, Mahesh J Salgaonkar wrote:
      >
      > If I have read the code correctly, we are going to get this printk on
      > non-pSeries machines or on older pSeries machines, even if the user
      > has not put the fadump=on option on the kernel command line.  The
      > printk will be annoying since there is no actual error condition.  It
      > seems to me that the condition for the printk should include
      > fw_dump.fadump_enabled.  In other words you should probably add
      >
      > 	if (!fw_dump.fadump_enabled)
      > 		return 0;
      >
      > at the beginning of the function.
      
      Hi Paul,
      
      Thanks for pointing it out. Please find the updated patch below.
      
      The existing patches above this (4/10 through 10/10) cleanly applies
      on this update.
      
      Thanks,
      -Mahesh.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      3ccc00a7
    • Mahesh Salgaonkar's avatar
      fadump: Reserve the memory for firmware assisted dump. · eb39c880
      Mahesh Salgaonkar authored
      Reserve the memory during early boot to preserve CPU state data, HPTE region
      and RMA (real mode area) region data in case of kernel crash. At the time of
      crash, powerpc firmware will store CPU state data, HPTE region data and move
      RMA region data to the reserved memory area.
      
      If the firmware-assisted dump fails to reserve the memory, then fallback
      to existing kexec-based kdump.
      
      Most of the code implementation to reserve memory has been
      adapted from phyp assisted dump implementation written by Linas Vepstas
      and Manish Ahuja
      
      This patch also introduces a config option CONFIG_FA_DUMP for firmware
      assisted dump feature on Powerpc (ppc64) architecture.
      Signed-off-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      eb39c880
    • Mahesh Salgaonkar's avatar
      fadump: Add documentation for firmware-assisted dump. · 8e0aa6d4
      Mahesh Salgaonkar authored
      Documentation for firmware-assisted dump. This document is based on the
      original documentation written for phyp assisted dump by Linas Vepstas
      and Manish Ahuja, with few changes to reflect the current implementation.
      Signed-off-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      8e0aa6d4
    • Kyle Moffett's avatar
      powerpc/mpic: Remove duplicate MPIC_WANTS_RESET flag · e55d7f73
      Kyle Moffett authored
      There are two separate flags controlling whether or not the MPIC is
      reset during initialization, which is completely unnecessary, and only
      one of them can be specified in the device tree.
      
      Also, most platforms in-tree right now do actually want to reset the
      MPIC during initialization anyways, which means lots of duplicate code
      passing the MPIC_WANTS_RESET flag.
      
      Fix all of the callers which currently do not pass the MPIC_WANTS_RESET
      flag to pass the MPIC_NO_RESET flag, then remove the MPIC_WANTS_RESET
      flag and make the code reset the MPIC by default.
      Signed-off-by: default avatarKyle Moffett <Kyle.D.Moffett@boeing.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      e55d7f73
    • Kyle Moffett's avatar
      powerpc/mpic: Add "last-interrupt-source" property to override hardware · c1b8d45d
      Kyle Moffett authored
      The FreeScale PowerQUICC-III-compatible (mpc85xx/mpc86xx) MPICs do not
      correctly report the number of hardware interrupt sources, so software
      needs to override the detected value with "256".
      
      To avoid needing to write custom board-specific code to detect that
      scenario, allow it to be easily overridden in the device-tree.
      Signed-off-by: default avatarKyle Moffett <Kyle.D.Moffett@boeing.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      c1b8d45d
    • Kyle Moffett's avatar
      powerpc/mpic: Remove MPIC_BROKEN_FRR_NIRQS and duplicate irq_count · 5019609f
      Kyle Moffett authored
      The mpic->irq_count variable is only used as a software error-checking
      limit to determine whether or not an IRQ number is valid.  In board code
      which does not manually specify an IRQ count to mpic_alloc(), i.e. 0, it
      is automatically detected from the number of ISUs and the ISU size.
      
      In practice, all hardware ends up with irq_count == num_sources, so all
      of the runtime checks on mpic->irq_count should just check the value of
      mpic->num_sources instead.
      
      When platform hardware does not correctly report the number of IRQs,
      which only happens on the MPC85xx/MPC86xx, the MPIC_BROKEN_FRR_NIRQS
      flag is used to override the detected value of num_sources with the
      manual irq_count parameter.  Since there's no need to manually specify
      the number of IRQs except in this case, the extra flag can be eliminated
      and the test changed to "irq_count != 0".
      Signed-off-by: default avatarKyle Moffett <Kyle.D.Moffett@boeing.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      5019609f
    • Kyle Moffett's avatar
      fsl/mpic: Create and document the "single-cpu-affinity" device-tree flag · 9ca163c8
      Kyle Moffett authored
      The Freescale MPIC (and perhaps others in the future) is incapable of
      routing non-IPI interrupts to more than once CPU at a time.  Currently
      all of the Freescale boards msut pass the MPIC_SINGLE_DEST_CPU flag to
      mpic_alloc(), but that information should really be present in the
      device-tree.
      
      Older board code can't rely on the device-tree having the property set,
      but newer platforms won't need it manually specified in the code.
      
      [BenH: Remove unrelated changes, folded in a different patch]
      Signed-off-by: default avatarKyle Moffett <Kyle.D.Moffett@boeing.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      9ca163c8
    • Kyle Moffett's avatar
      fsl/mpic: Document and use the "big-endian" device-tree flag · 98cca250
      Kyle Moffett authored
      The MPIC code checks for a "big-endian" property and sets the flag
      MPIC_BIG_ENDIAN if one is present, although prior to the "mpic->flags"
      fixup that would never have worked anways.
      
      Unfortunately, even now that it works properly, the Freescale mpic
      device-node (the "PowerQUICC-III"-compatible one) does not specify it,
      so all of the board ports need to manually pass it to mpic_alloc().
      
      Document the flag and add it to the pq3 device tree.  Existing code will
      still need to pass the MPIC_BIG_ENDIAN flag because their dtb may not
      have this property, but new platforms shouldn't need to do so.
      Signed-off-by: default avatarKyle Moffett <Kyle.D.Moffett@boeing.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      98cca250
    • Kyle Moffett's avatar
      powerpc/mpic: Fix use of "flags" variable in mpic_alloc() · 3a7a7176
      Kyle Moffett authored
      The mpic_alloc() function takes a "flags" parameter and assigns it into
      the mpic->flags variable fairly early on, but several later pieces of
      code detect various device-tree properties and save them into the
      "mpic->flags" variable (EG: "big-endian" => MPIC_BIG_ENDIAN).
      
      Unfortunately, a number of codepaths (including several which test the
      flag MPIC_BIG_ENDIAN!) test "flags" instead of "mpic->flags", and get
      wrong answers as a result.
      
      Consolidate the device-tree flag tests early in mpic_alloc() and change
      all of the checks after "mpic->flags" is init'ed to use "mpic->flags".
      
      [BenH: Fixed up use of mpic->node before it's initialized]
      Signed-off-by: default avatarKyle Moffett <Kyle.D.Moffett@boeing.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      3a7a7176
  2. 21 Feb, 2012 4 commits
  3. 20 Feb, 2012 4 commits
    • Linus Torvalds's avatar
      i387: support lazy restore of FPU state · 7e16838d
      Linus Torvalds authored
      This makes us recognize when we try to restore FPU state that matches
      what we already have in the FPU on this CPU, and avoids the restore
      entirely if so.
      
      To do this, we add two new data fields:
      
       - a percpu 'fpu_owner_task' variable that gets written any time we
         update the "has_fpu" field, and thus acts as a kind of back-pointer
         to the task that owns the CPU.  The exception is when we save the FPU
         state as part of a context switch - if the save can keep the FPU
         state around, we leave the 'fpu_owner_task' variable pointing at the
         task whose FP state still remains on the CPU.
      
       - a per-thread 'last_cpu' field, that indicates which CPU that thread
         used its FPU on last.  We update this on every context switch
         (writing an invalid CPU number if the last context switch didn't
         leave the FPU in a lazily usable state), so we know that *that*
         thread has done nothing else with the FPU since.
      
      These two fields together can be used when next switching back to the
      task to see if the CPU still matches: if 'fpu_owner_task' matches the
      task we are switching to, we know that no other task (or kernel FPU
      usage) touched the FPU on this CPU in the meantime, and if the current
      CPU number matches the 'last_cpu' field, we know that this thread did no
      other FP work on any other CPU, so the FPU state on the CPU must match
      what was saved on last context switch.
      
      In that case, we can avoid the 'f[x]rstor' entirely, and just clear the
      CR0.TS bit.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7e16838d
    • Linus Torvalds's avatar
      i387: use 'restore_fpu_checking()' directly in task switching code · 80ab6f1e
      Linus Torvalds authored
      This inlines what is usually just a couple of instructions, but more
      importantly it also fixes the theoretical error case (can that FPU
      restore really ever fail? Maybe we should remove the checking).
      
      We can't start sending signals from within the scheduler, we're much too
      deep in the kernel and are holding the runqueue lock etc.  So don't
      bother even trying.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      80ab6f1e
    • Linus Torvalds's avatar
      i387: fix up some fpu_counter confusion · cea20ca3
      Linus Torvalds authored
      This makes sure we clear the FPU usage counter for newly created tasks,
      just so that we start off in a known state (for example, don't try to
      preload the FPU state on the first task switch etc).
      
      It also fixes a thinko in when we increment the fpu_counter at task
      switch time, introduced by commit 34ddc81a ("i387: re-introduce FPU
      state preloading at context switch time").  We should increment the
      *new* task fpu_counter, not the old task, and only if we decide to use
      that state (whether lazily or preloaded).
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cea20ca3
    • Dmitry Kasatkin's avatar
      digsig: changed type of the timestamp · 59cca653
      Dmitry Kasatkin authored
      time_t was used in the signature and key packet headers,
      which is typedef of long and is different on 32 and 64 bit architectures.
      Signature and key format should be independent of architecture.
      Similar to GPG, I have changed the type to uint32_t.
      Signed-off-by: default avatarDmitry Kasatkin <dmitry.kasatkin@intel.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      59cca653
  4. 18 Feb, 2012 12 commits
    • Linus Torvalds's avatar
      Linux 3.3-rc4 · b01543df
      Linus Torvalds authored
      b01543df
    • Linus Torvalds's avatar
      Merge tag 'fixes-3.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · be2874cb
      Linus Torvalds authored
      These are the bug fixes that have accumulated since 3.3-rc3 in arm-soc.
      The majority of them are regression fixes for stuff that broke during
      the merge 3.3 window.
      
      The notable ones are:
      
      * The at91 ata drivers both broke because of an earlier cleanup patch that
        some other patches were based on. Jean-Christophe decided to remove
        the legacy at91_ide driver and fix the new-style at91-pata driver while
        keeping the cleanup patch. I almost rejected the patches for being too
        late and too big but in the end decided to accept them because they
        fix a regression.
      
      * A patch fixing build breakage from the sysdev-to-device conversion
        colliding with other changes touches a number of mach-s3c files.
      
      * b0654037 "ARM: orion: Fix Orion5x GPIO regression from MPP cleanup"
        is a mechanical change that unfortunately touches a lot of lines
        that should up in the diffstat.
      
      * tag 'fixes-3.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (28 commits)
        ARM: at91: drop ide driver in favor of the pata one
        pata/at91: use newly introduced SMC accessors
        ARM: at91: add accessor to manage SMC
        ARM: at91:rtc/rtc-at91sam9: ioremap register bank
        ARM: at91: USB AT91 gadget registration for module
        ep93xx: fix build of vision_ep93xx.c
        ARM: OMAP2xxx: PM: fix OMAP2xxx-specific UART idle bug in v3.3
        ARM: orion: Fix USB phy for orion5x.
        ARM: orion: Fix Orion5x GPIO regression from MPP cleanup
        ARM: EXYNOS: Add cpu-offset property in gic device tree node
        ARM: EXYNOS: Bring exynos4-dt up to date
        ARM: OMAP3: cm-t35: fix section mismatch warning
        ARM: OMAP2: Fix the OMAP2 only build break seen with 2011+ ARM tool-chains
        ARM: tegra: paz00: fix wrong UART port on mini-pcie plug
        ARM: tegra: paz00: fix wrong SD1 power gpio
        i2c: tegra: Add devexit_p() for remove
        ARM: EXYNOS: Correct M-5MOLS sensor clock frequency on Universal C210 board
        ARM: EXYNOS: Correct framebuffer window size on Nuri board
        ARM: SAMSUNG: Fix missing api-change from subsys_interface change
        ARM: EXYNOS: Fix "warning: initialization from incompatible pointer type"
        ...
      be2874cb
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 584216b7
      Linus Torvalds authored
      1) VETH_INFO_PEER netlink attribute needs to have it's size validated,
         from Thomas Graf.
      
      2) 'poll' module option of bnx2x driver crashes the machine, just remove
         it.  From Michal Schmidt.
      
      3) ks8851_mll driver reads the irq number from two places, but only
         initializes one of them, oops.  Use only one location and fix this
         problem, from Jan Weitzel.
      
      4) Fix buffer overrun and unicast sterring bugs in mellanox mlx4 driver,
         from Eugenia Emantayev.
      
      5) Swapped kcalloc() args in RxRPC and mlx4, from Axel Lin.
      
      6) PHY MDIO device name regression fixes from Florian Fainelli.
      
      7) If the wake event IRQ line is different from the netdevice one, we
         have to properly route it to the stmmac interrupt handler.  From
         Francesco Virlinzi.
      
      8) Fix rwlock lock initialization ordering bug in mac80211, from
         Mohammed Shafi Shajakhan.
      
      9) TCP lost_cnt can get out of sync, and in fact go negative, in certain
         circumstances.  Fix the way we specify what sequence range to operate
         on in tcp_sacktag_one() to fix this bug.  From Neal Cardwell.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (27 commits)
        net/ethernet: ks8851_mll fix irq handling
        veth: Enforce minimum size of VETH_INFO_PEER
        stmmac: update the driver version to Feb 2012 (v2)
        stmmac: move hw init in the probe (v2)
        stmmac: request_irq when use an ext wake irq line (v2)
        stmmac: do not discard frame on dribbling bit assert
        ipheth: Add iPhone 4S
        mlx4: add unicast steering entries to resource_tracker
        mlx4: fix QP tree trashing
        mlx4: fix buffer overrun
        3c59x: shorten timer period for slave devices
        netpoll: netpoll_poll_dev() should access dev->flags
        RxRPC: Fix kcalloc parameters swapped
        bnx2x: remove the 'poll' module option
        tcp: fix tcp_shifted_skb() adjustment of lost_cnt_hint for FACK
        ks8851: Fix NOHZ local_softirq_pending 08 warning
        bnx2x: fix bnx2x_storm_stats_update() on big endian
        ixp4xx-eth: fix PHY name to match MDIO bus name
        octeon: fix PHY name to match MDIO bus name
        fec: fix PHY name to match fixed MDIO bus name
        ...
      584216b7
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap · bff98bfc
      Linus Torvalds authored
      Fixes a bootstrapping issue for some registers when a less commonly used
      method for register cache initialisation is used.  Only affects a fairly
      small proportion of users that both don't use explicit register defaults
      and do use the cache.
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
        regmap: Fix cache defaults initialization from raw cache defaults
      bff98bfc
    • Linus Torvalds's avatar
      Merge tag 'ecryptfs-3.3-rc4-fixes' of... · 46860666
      Linus Torvalds authored
      Merge tag 'ecryptfs-3.3-rc4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs
      
      Fixes maximum filename length and filesystem type reporting in statfs() calls
      and also fixes stale inode mode bits on eCryptfs inodes after a POSIX ACL was
      set on the lower filesystem's inode.
      
      * tag 'ecryptfs-3.3-rc4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
        ecryptfs: remove the second argument of k[un]map_atomic()
        eCryptfs: Copy up lower inode attrs after setting lower xattr
        eCryptfs: Improve statfs reporting
      46860666
    • Linus Torvalds's avatar
      Merge tag 'pinctrl' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 7857b996
      Linus Torvalds authored
      pinctrl fixes for v3.3
      
      * tag 'pinctrl-for-torvalds-20120216' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: restore pin naming
      7857b996
    • Linus Torvalds's avatar
      Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc · 06ca7c43
      Linus Torvalds authored
      Here are a few more fixes for powerpc.  Some are regressions, the rest
      is simple/obvious/nasty enough that I deemed it good to go now.
      
      Here's also step one of deprecating legacy iSeries support: we are
      removing it from the main defconfig.
      
      Nobody seems to be using it anymore and the code is nasty to maintain,
      (involves horrible hacks in various low level areas of the kernel) so we
      plan to actually rip it out at some point.  For now let's just avoid
      building it by default.  Stephen will proceed to do the actual removal
      later (probably 3.4 or 3.5).
      
      * 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
        powerpc/perf: power_pmu_start restores incorrect values, breaking frequency events
        powerpc/adb: Use set_current_state()
        powerpc: Disable interrupts early in Program Check
        powerpc: Remove legacy iSeries from ppc64_defconfig
        powerpc/fsl/pci: Fix PCIe fixup regression
        powerpc: Fix kernel log of oops/panic instruction dump
      06ca7c43
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci · 7bcd5b46
      Linus Torvalds authored
      One regression fix for SR-IOV on PPC and a couple of misc fixes from
      Yinghai.
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci:
        PCI: Fix pci cardbus removal
        PCI: set pci sriov page size before reading SRIOV BAR
        PCI: workaround hard-wired bus number V2
      7bcd5b46
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 58e44baf
      Linus Torvalds authored
      3 radeon fixes, I have some exynos fixes to push later but I'll queue
      them separately once I've looked them over a bit.
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        drm/radeon/kms: fix MSI re-arm on rv370+
        drm/radeon/kms/atom: bios scratch reg handling updates
        drm/radeon/kms: drop lock in return path of radeon_fence_count_emitted.
      58e44baf
    • Linus Torvalds's avatar
    • Linus Torvalds's avatar
      i387: re-introduce FPU state preloading at context switch time · 34ddc81a
      Linus Torvalds authored
      After all the FPU state cleanups and finally finding the problem that
      caused all our FPU save/restore problems, this re-introduces the
      preloading of FPU state that was removed in commit b3b0870e ("i387:
      do not preload FPU state at task switch time").
      
      However, instead of simply reverting the removal, this reimplements
      preloading with several fixes, most notably
      
       - properly abstracted as a true FPU state switch, rather than as
         open-coded save and restore with various hacks.
      
         In particular, implementing it as a proper FPU state switch allows us
         to optimize the CR0.TS flag accesses: there is no reason to set the
         TS bit only to then almost immediately clear it again.  CR0 accesses
         are quite slow and expensive, don't flip the bit back and forth for
         no good reason.
      
       - Make sure that the same model works for both x86-32 and x86-64, so
         that there are no gratuitous differences between the two due to the
         way they save and restore segment state differently due to
         architectural differences that really don't matter to the FPU state.
      
       - Avoid exposing the "preload" state to the context switch routines,
         and in particular allow the concept of lazy state restore: if nothing
         else has used the FPU in the meantime, and the process is still on
         the same CPU, we can avoid restoring state from memory entirely, just
         re-expose the state that is still in the FPU unit.
      
         That optimized lazy restore isn't actually implemented here, but the
         infrastructure is set up for it.  Of course, older CPU's that use
         'fnsave' to save the state cannot take advantage of this, since the
         state saving also trashes the state.
      
      In other words, there is now an actual _design_ to the FPU state saving,
      rather than just random historical baggage.  Hopefully it's easier to
      follow as a result.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      34ddc81a
    • Linus Torvalds's avatar
      i387: move TS_USEDFPU flag from thread_info to task_struct · f94edacf
      Linus Torvalds authored
      This moves the bit that indicates whether a thread has ownership of the
      FPU from the TS_USEDFPU bit in thread_info->status to a word of its own
      (called 'has_fpu') in task_struct->thread.has_fpu.
      
      This fixes two independent bugs at the same time:
      
       - changing 'thread_info->status' from the scheduler causes nasty
         problems for the other users of that variable, since it is defined to
         be thread-synchronous (that's what the "TS_" part of the naming was
         supposed to indicate).
      
         So perfectly valid code could (and did) do
      
      	ti->status |= TS_RESTORE_SIGMASK;
      
         and the compiler was free to do that as separate load, or and store
         instructions.  Which can cause problems with preemption, since a task
         switch could happen in between, and change the TS_USEDFPU bit. The
         change to TS_USEDFPU would be overwritten by the final store.
      
         In practice, this seldom happened, though, because the 'status' field
         was seldom used more than once, so gcc would generally tend to
         generate code that used a read-modify-write instruction and thus
         happened to avoid this problem - RMW instructions are naturally low
         fat and preemption-safe.
      
       - On x86-32, the current_thread_info() pointer would, during interrupts
         and softirqs, point to a *copy* of the real thread_info, because
         x86-32 uses %esp to calculate the thread_info address, and thus the
         separate irq (and softirq) stacks would cause these kinds of odd
         thread_info copy aliases.
      
         This is normally not a problem, since interrupts aren't supposed to
         look at thread information anyway (what thread is running at
         interrupt time really isn't very well-defined), but it confused the
         heck out of irq_fpu_usable() and the code that tried to squirrel
         away the FPU state.
      
         (It also caused untold confusion for us poor kernel developers).
      
      It also turns out that using 'task_struct' is actually much more natural
      for most of the call sites that care about the FPU state, since they
      tend to work with the task struct for other reasons anyway (ie
      scheduling).  And the FPU data that we are going to save/restore is
      found there too.
      
      Thanks to Arjan Van De Ven <arjan@linux.intel.com> for pointing us to
      the %esp issue.
      
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Reported-and-tested-by: default avatarRaphael Prevost <raphael@buro.asia>
      Acked-and-tested-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
      Tested-by: default avatarPeter Anvin <hpa@zytor.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f94edacf
  5. 17 Feb, 2012 5 commits
    • Martin Schwidefsky's avatar
      [S390] correct ktime to tod clock comparator conversion · cf1eb40f
      Martin Schwidefsky authored
      The conversion of the ktime to a value suitable for the clock comparator
      does not take changes to wall_to_monotonic into account. In fact the
      conversion just needs the boot clock (sched_clock_base_cc) and the
      total_sleep_time.
      
      This is applicable to 3.2+ kernels.
      
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      cf1eb40f
    • Martin Schwidefsky's avatar
      [S390] 3215 deadlock with tty_wakeup · 656d9125
      Martin Schwidefsky authored
      The 3215 driver calls tty_wakeup from irq context while holding the
      device spinlock. If printk is called by any function on the callchain
      starting from tty_wakeup the system deadlocks on the device spinlock.
      Using a tasklet to call tty_wakup solves the problem.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      656d9125
    • Martin Schwidefsky's avatar
      [S390] incorrect PageTables counter for kvm page tables · 2320c579
      Martin Schwidefsky authored
      The page_table_free_pgste function is used for kvm processes to free page
      tables that have the pgste extension. It calls pgtable_page_ctor instead of
      pgtable_page_dtor which increases NR_PAGETABLE instead of decreasing it.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      2320c579
    • Heiko Carstens's avatar
      [S390] idle: avoid RCU usage in extended quiescent state · f3612304
      Heiko Carstens authored
      Avoid calling wake_up() from our NMI "bottom halve" from RCU extended
      quiescent state in idle. wake_up() has RCU read-side critical sections
      but this will be completely ignored by RCU if the cpu is in extended
      quiescent state.
      Which means that whatever object is being accessed from within the
      read-side critical section can be freed concurrently from a different
      cpu.
      So make sure we leave extended quiescent state before calling wake_up().
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      f3612304
    • Linus Torvalds's avatar
      i387: move AMD K7/K8 fpu fxsave/fxrstor workaround from save to restore · 4903062b
      Linus Torvalds authored
      The AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception is
      pending.  In order to not leak FIP state from one process to another, we
      need to do a floating point load after the fxsave of the old process,
      and before the fxrstor of the new FPU state.  That resets the state to
      the (uninteresting) kernel load, rather than some potentially sensitive
      user information.
      
      We used to do this directly after the FPU state save, but that is
      actually very inconvenient, since it
      
       (a) corrupts what is potentially perfectly good FPU state that we might
           want to lazy avoid restoring later and
      
       (b) on x86-64 it resulted in a very annoying ordering constraint, where
           "__unlazy_fpu()" in the task switch needs to be delayed until after
           the DS segment has been reloaded just to get the new DS value.
      
      Coupling it to the fxrstor instead of the fxsave automatically avoids
      both of these issues, and also ensures that we only do it when actually
      necessary (the FP state after a save may never actually get used).  It's
      simply a much more natural place for the leaked state cleanup.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4903062b
  6. 16 Feb, 2012 1 commit
    • Linus Torvalds's avatar
      i387: do not preload FPU state at task switch time · b3b0870e
      Linus Torvalds authored
      Yes, taking the trap to re-load the FPU/MMX state is expensive, but so
      is spending several days looking for a bug in the state save/restore
      code.  And the preload code has some rather subtle interactions with
      both paravirtualization support and segment state restore, so it's not
      nearly as simple as it should be.
      
      Also, now that we no longer necessarily depend on a single bit (ie
      TS_USEDFPU) for keeping track of the state of the FPU, we migth be able
      to do better.  If we are really switching between two processes that
      keep touching the FP state, save/restore is inevitable, but in the case
      of having one process that does most of the FPU usage, we may actually
      be able to do much better than the preloading.
      
      In particular, we may be able to keep track of which CPU the process ran
      on last, and also per CPU keep track of which process' FP state that CPU
      has.  For modern CPU's that don't destroy the FPU contents on save time,
      that would allow us to do a lazy restore by just re-enabling the
      existing FPU state - with no restore cost at all!
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b3b0870e