1. 31 Aug, 2011 4 commits
    • Simon Horman's avatar
      mmc: sdhi: initialise mmc_data->flags before use · b91df159
      Simon Horman authored
      This corrects a logic error that I introduced in
      "mmc: sdhi: Add write16_hook"
      Reported-by: default avatarMagnus Damm <magnus.damm@gmail.com>
      Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      b91df159
    • Mika Westerberg's avatar
      mmc: core: use non-reentrant workqueue for clock gating · 50a50f92
      Mika Westerberg authored
      The default multithread workqueue can cause the same work to be executed
      concurrently on a different CPUs. This isn't really suitable for clock
      gating as it might already gated the clock and gating it twice results both
      host->clk_old and host->ios.clock to be set to 0.
      
      To prevent this from happening we use system_nrt_wq instead.
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Tested-by: default avatarChris Ball <cjb@laptop.org>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      50a50f92
    • Mika Westerberg's avatar
      mmc: core: prevent aggressive clock gating racing with ios updates · 778e277c
      Mika Westerberg authored
      We have seen at least two different races when clock gating kicks in in a
      middle of ios structure update.
      
      First one happens when ios->clock is changed outside of aggressive clock
      gating framework, for example via mmc_set_clock(). The race might happen
      when we run following code:
      
      mmc_set_ios():
      	...
      	if (ios->clock > 0)
      		mmc_set_ungated(host);
      
      Now if gating kicks in right after the condition check we end up setting
      host->clk_gated to false even though we have just gated the clock. Next
      time a request is started we try to ungate and restore the clock in
      mmc_host_clk_hold(). However since we have host->clk_gated set to false the
      original clock is not restored.
      
      This eventually will cause the host controller to hang since its clock is
      disabled while we are trying to issue a request. For example on Intel
      Medfield platform we see:
      
      [   13.818610] mmc2: Timeout waiting for hardware interrupt.
      [   13.818698] sdhci: =========== REGISTER DUMP (mmc2)===========
      [   13.818753] sdhci: Sys addr: 0x00000000 | Version:  0x00008901
      [   13.818804] sdhci: Blk size: 0x00000000 | Blk cnt:  0x00000000
      [   13.818853] sdhci: Argument: 0x00000000 | Trn mode: 0x00000000
      [   13.818903] sdhci: Present:  0x1fff0000 | Host ctl: 0x00000001
      [   13.818951] sdhci: Power:    0x0000000d | Blk gap:  0x00000000
      [   13.819000] sdhci: Wake-up:  0x00000000 | Clock:    0x00000000
      [   13.819049] sdhci: Timeout:  0x00000000 | Int stat: 0x00000000
      [   13.819098] sdhci: Int enab: 0x00ff00c3 | Sig enab: 0x00ff00c3
      [   13.819147] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
      [   13.819196] sdhci: Caps:     0x6bee32b2 | Caps_1:   0x00000000
      [   13.819245] sdhci: Cmd:      0x00000000 | Max curr: 0x00000000
      [   13.819292] sdhci: Host ctl2: 0x00000000
      [   13.819331] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x00000000
      [   13.819377] sdhci: ===========================================
      [   13.919605] mmc2: Reset 0x2 never completed.
      
      and it never recovers.
      
      Second race might happen while running mmc_power_off():
      
      static void mmc_power_off(struct mmc_host *host)
      {
      	host->ios.clock = 0;
      	host->ios.vdd = 0;
      
      [ clock gating kicks in here ]
      
      	/*
      	 * Reset ocr mask to be the highest possible voltage supported for
      	 * this mmc host. This value will be used at next power up.
      	 */
      	host->ocr = 1 << (fls(host->ocr_avail) - 1);
      
      	if (!mmc_host_is_spi(host)) {
      		host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
      		host->ios.chip_select = MMC_CS_DONTCARE;
      	}
      	host->ios.power_mode = MMC_POWER_OFF;
      	host->ios.bus_width = MMC_BUS_WIDTH_1;
      	host->ios.timing = MMC_TIMING_LEGACY;
      	mmc_set_ios(host);
      }
      
      If the clock gating worker kicks in while we are only partially updated the
      ios structure the host controller gets incomplete ios and might not work as
      supposed. Again on Intel Medfield platform we get:
      
      [    4.185349] kernel BUG at drivers/mmc/host/sdhci.c:1155!
      [    4.185422] invalid opcode: 0000 [#1] PREEMPT SMP
      [    4.185509] Modules linked in:
      [    4.185565]
      [    4.185608] Pid: 4, comm: kworker/0:0 Not tainted 3.0.0+ #240 Intel Corporation Medfield/iCDKA
      [    4.185742] EIP: 0060:[<c136364e>] EFLAGS: 00010083 CPU: 0
      [    4.185827] EIP is at sdhci_set_power+0x3e/0xd0
      [    4.185891] EAX: f5ff98e0 EBX: f5ff98e0 ECX: 00000000 EDX: 00000001
      [    4.185970] ESI: f5ff977c EDI: f5ff9904 EBP: f644fe98 ESP: f644fe94
      [    4.186049]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
      [    4.186125] Process kworker/0:0 (pid: 4, ti=f644e000 task=f644c0e0 task.ti=f644e000)
      [    4.186219] Stack:
      [    4.186257]  f5ff98e0 f644feb0 c1365173 00000282 f5ff9460 f5ff96e0 f5ff96e0 f644feec
      [    4.186418]  c1355bd8 f644c0e0 c1499c3d f5ff96e0 f644fed4 00000006 f5ff96e0 00000286
      [    4.186579]  f644fedc c107922b f644feec 00000286 f5ff9460 f5ff9700 f644ff10 c135839e
      [    4.186739] Call Trace:
      [    4.186802]  [<c1365173>] sdhci_set_ios+0x1c3/0x340
      [    4.186883]  [<c1355bd8>] mmc_gate_clock+0x68/0x120
      [    4.186963]  [<c1499c3d>] ? _raw_spin_unlock_irqrestore+0x4d/0x60
      [    4.187052]  [<c107922b>] ? trace_hardirqs_on+0xb/0x10
      [    4.187134]  [<c135839e>] mmc_host_clk_gate_delayed+0xbe/0x130
      [    4.187219]  [<c105ec09>] ? process_one_work+0xf9/0x5b0
      [    4.187300]  [<c135841d>] mmc_host_clk_gate_work+0xd/0x10
      [    4.187379]  [<c105ec82>] process_one_work+0x172/0x5b0
      [    4.187457]  [<c105ec09>] ? process_one_work+0xf9/0x5b0
      [    4.187538]  [<c1358410>] ? mmc_host_clk_gate_delayed+0x130/0x130
      [    4.187625]  [<c105f3c8>] worker_thread+0x118/0x330
      [    4.187700]  [<c1496cee>] ? preempt_schedule+0x2e/0x50
      [    4.187779]  [<c105f2b0>] ? rescuer_thread+0x1f0/0x1f0
      [    4.187857]  [<c1062cf4>] kthread+0x74/0x80
      [    4.187931]  [<c1062c80>] ? __init_kthread_worker+0x60/0x60
      [    4.188015]  [<c149acfa>] kernel_thread_helper+0x6/0xd
      [    4.188079] Code: 81 fa 00 00 04 00 0f 84 a7 00 00 00 7f 21 81 fa 80 00 00 00 0f 84 92 00 00 00 81 fa 00 00 0
      [    4.188780] EIP: [<c136364e>] sdhci_set_power+0x3e/0xd0 SS:ESP 0068:f644fe94
      [    4.188898] ---[ end trace a7b23eecc71777e4 ]---
      
      This BUG() comes from the fact that ios.power_mode was still in previous
      value (MMC_POWER_ON) and ios.vdd was set to zero.
      
      We prevent these by inhibiting the clock gating while we update the ios
      structure.
      
      Both problems can be reproduced by simply running the device in a reboot
      loop.
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Tested-by: default avatarChris Ball <cjb@laptop.org>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      778e277c
    • Mika Westerberg's avatar
      mmc: rename mmc_host_clk_{ungate|gate} to mmc_host_clk_{hold|release} · 08c14071
      Mika Westerberg authored
      As per suggestion by Linus Walleij:
      
        > If you think the names of the functions are confusing then
        > you may rename them, say like this:
        >
        > mmc_host_clk_ungate() -> mmc_host_clk_hold()
        > mmc_host_clk_gate() -> mmc_host_clk_release()
        >
        > Which would make the usecases more clear
      
      (This is CC'd to stable@ because the next two patches, which fix
      observable races, depend on it.)
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      08c14071
  2. 28 Aug, 2011 1 commit
  3. 22 Aug, 2011 6 commits
  4. 21 Aug, 2011 4 commits
  5. 20 Aug, 2011 4 commits
  6. 19 Aug, 2011 15 commits
    • Jiaying Zhang's avatar
      ext4: flush any pending end_io requests before DIO reads w/dioread_nolock · dccaf33f
      Jiaying Zhang authored
      There is a race between ext4 buffer write and direct_IO read with
      dioread_nolock mount option enabled. The problem is that we clear
      PageWriteback flag during end_io time but will do
      uninitialized-to-initialized extent conversion later with dioread_nolock.
      If an O_direct read request comes in during this period, ext4 will return
      zero instead of the recently written data.
      
      This patch checks whether there are any pending uninitialized-to-initialized
      extent conversion requests before doing O_direct read to close the race.
      Note that this is just a bandaid fix. The fundamental issue is that we
      clear PageWriteback flag before we really complete an IO, which is
      problem-prone. To fix the fundamental issue, we may need to implement an
      extent tree cache that we can use to look up pending to-be-converted extents.
      Signed-off-by: default avatarJiaying Zhang <jiayingz@google.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: stable@kernel.org
      dccaf33f
    • Jesse Barnes's avatar
      drm/i915: set GFX_MODE to pre-Ivybridge default value even on Ivybridge · b095cd0a
      Jesse Barnes authored
      Prior to Ivybridge, the GFX_MODE would default to 0x800, meaning that
      MI_FLUSH would flush the TLBs in addition to the rest of the caches
      indicated in the MI_FLUSH command.  However starting with Ivybridge, the
      register defaults to 0x2800 out of reset, meaning that to invalidate the
      TLB we need to use PIPE_CONTROL.  Since we're not doing that yet, go
      back to the old default so things work.
      
      v2: don't forget to actually *clear* the new bit
      Reviewed-by: default avatarEric Anholt <eric@anholt.net>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Tested-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      b095cd0a
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 5ccc3874
      Linus Torvalds authored
      * 'for-linus' of git://git.kernel.dk/linux-block: (23 commits)
        Revert "cfq: Remove special treatment for metadata rqs."
        block: fix flush machinery for stacking drivers with differring flush flags
        block: improve rq_affinity placement
        blktrace: add FLUSH/FUA support
        Move some REQ flags to the common bio/request area
        allow blk_flush_policy to return REQ_FSEQ_DATA independent of *FLUSH
        xen/blkback: Make description more obvious.
        cfq-iosched: Add documentation about idling
        block: Make rq_affinity = 1 work as expected
        block: swim3: fix unterminated of_device_id table
        block/genhd.c: remove useless cast in diskstats_show()
        drivers/cdrom/cdrom.c: relax check on dvd manufacturer value
        drivers/block/drbd/drbd_nl.c: use bitmap_parse instead of __bitmap_parse
        bsg-lib: add module.h include
        cfq-iosched: Reduce linked group count upon group destruction
        blk-throttle: correctly determine sync bio
        loop: fix deadlock when sysfs and LOOP_CLR_FD race against each other
        loop: add BLK_DEV_LOOP_MIN_COUNT=%i to allow distros 0 pre-allocated loop devices
        loop: add management interface for on-demand device allocation
        loop: replace linked list of allocated devices with an idr index
        ...
      5ccc3874
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 · 0c3bef61
      Linus Torvalds authored
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
        PCI: OF: Don't crash when bridge parent is NULL.
        PCI: export pcie_bus_configure_settings symbol
        PCI: code and comments cleanup
        PCI: make cardbus-bridge resources optional
        PCI: make SRIOV resources optional
        PCI : ability to relocate assigned pci-resources
        PCI: honor child buses add_size in hot plug configuration
        PCI: Set PCI-E Max Payload Size on fabric
      0c3bef61
    • David Daney's avatar
      PCI: OF: Don't crash when bridge parent is NULL. · 69566dd8
      David Daney authored
      In pcibios_get_phb_of_node(), we will crash while booting if
      bus->bridge->parent is NULL.
      
      Check for this case and avoid dereferencing the NULL pointer.
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      69566dd8
    • Jens Axboe's avatar
      Revert "cfq: Remove special treatment for metadata rqs." · b53d1ed7
      Jens Axboe authored
      We have a kernel build regression since 3.1-rc1, which is about 10%
      regression. The kernel source is in an ext3 filesystem.
      Alex Shi bisect it to commit:
      commit a07405b7
      Author: Justin TerAvest <teravest@google.com>
      Date:   Sun Jul 10 22:09:19 2011 +0200
      
          cfq: Remove special treatment for metadata rqs.
      
      Apparently this is caused by lack metadata preemption, where ext3/ext4
      do use READ_META. I didn't see a way to fix the issue, so suggest
      reverting the patch.
      
      This reverts commit a07405b7.
      
      Reported-by: Alex Shi<alex.shi@intel.com>
      Reported-by: Shaohua Li<shaohua.li@intel.com>
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      b53d1ed7
    • Takashi Iwai's avatar
      ALSA: usb-audio - Fix missing mixer dB information · 38b65190
      Takashi Iwai authored
      The recent fix for testing dB range at the mixer creation time seems
      to cause regressions in some devices.  In such devices, reading the dB
      info at probing time gives an error, thus both dBmin and dBmax are still
      zero, and TLV flag isn't set although the later read of dB info succeeds.
      
      This patch adds a workaround for such a case by assuming that the later
      read will succeed.  In future, a similar test should be performed in a
      case where a wrong dB range is seen even in the later read.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Cc: <stable@kernel.org>
      38b65190
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc · 01b88335
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
        sparc: fix array bounds error setting up PCIC NMI trap
      01b88335
    • Linus Torvalds's avatar
      Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev · 2c4ac99f
      Linus Torvalds authored
      * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
        drivers/ata/sata_dwc_460ex.c: add missing kfree
        ata: Add iMX pata support
        pata_via: disable ATAPI DMA on AVERATEC 3200
        [libata] sata_sil: fix used-uninit warning
      2c4ac99f
    • Linus Torvalds's avatar
      Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 35a21b42
      Linus Torvalds authored
      * 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
        NFSv4.1: Return NFS4ERR_BADSESSION to callbacks during session resets
        NFSv4.1: Fix the callback 'highest_used_slotid' behaviour
        pnfs-obj: Fix the comp_index != 0 case
        pnfs-obj: Bug when we are running out of bio
        nfs: add missing prefetch.h include
      35a21b42
    • Ian Campbell's avatar
      sparc: fix array bounds error setting up PCIC NMI trap · 4a0342ca
      Ian Campbell authored
        CC      arch/sparc/kernel/pcic.o
      arch/sparc/kernel/pcic.c: In function 'pcic_probe':
      arch/sparc/kernel/pcic.c:359:33: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:359:8: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:360:33: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:360:8: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:361:33: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:361:8: error: array subscript is above array bounds [-Werror=array-bounds]
      cc1: all warnings being treated as errors
      
      I'm not particularly familiar with sparc but t_nmi (defined in head_32.S via
      the TRAP_ENTRY macro) and pcic_nmi_trap_patch (defined in entry.S) both appear
      to be 4 instructions long and I presume from the usage that instructions are
      int sized.
      Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: sparclinux@vger.kernel.org
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4a0342ca
    • Julia Lawall's avatar
      drivers/ata/sata_dwc_460ex.c: add missing kfree · a081da63
      Julia Lawall authored
      Currently, error handling code in this function calls the function
      sata_dwc_port_stop, but this function has essentially no effect if hsdevp
      has not been stored in ap, which is the case throughout this function.  The
      only effect is to print a debugging message including ap->print_id.
      
      The code is rewritten to not call sata_dwc_port_stop, but instead to jump
      to a local label that prints the original error message and the print_id
      information.  In the case where hsdevp has been already allocated (but not
      yet stored in ap), this value is freed as well.
      
      A simplified version of the semantic match that finds this problem is as
      follows: (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @exists@
      local idexpression x;
      statement S,S1;
      expression E;
      identifier fl;
      expression *ptr != NULL;
      @@
      
      x = \(kmalloc\|kzalloc\|kcalloc\)(...);
      ...
      if (x == NULL) S
      <... when != x
           when != if (...) { <+...kfree(x)...+> }
           when any
           when != true x == NULL
      x->fl
      ...>
      (
      if (x == NULL) S1
      |
      if (...) { ... when != x
                     when forall
      (
       return \(0\|<+...x...+>\|ptr\);
      |
      * return ...;
      )
      }
      )
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
      a081da63
    • Arnaud Patard (Rtp)'s avatar
      ata: Add iMX pata support · e39c75cf
      Arnaud Patard (Rtp) authored
      Add basic support for pata on iMX. It has been tested only on imx51.
      SDMA support will probably be added later so this version supports only
      PIO.
      
      v2:
        - enable only when needed IORDY
        - use dev_get_drvdata
      v3:
        - add missing clk_put() calls
        - use platform_get_irq()
        - fix resume code to avoid disabling IORDY on resume
      v4:
        - Remove EXPERIMENTAL and switch to depends on ARCH_MXC
        - Use devm_kzalloc()
        - make clock a must-have
        - Use only 1 ioremap
      Signed-off-by: default avatarArnaud Patard <arnaud.patard@rtp-net.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      e39c75cf
    • Tejun Heo's avatar
      pata_via: disable ATAPI DMA on AVERATEC 3200 · 6d0e194d
      Tejun Heo authored
      On AVERATEC 3200, pata_via causes memory corruption with ATAPI DMA,
      which often leads to random kernel oops.  The cause of the problem is
      not well understood yet and only small subset of machines using the
      controller seem affected.  Blacklist ATAPI DMA on the machine.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=11426Reported-and-tested-by: default avatarJim Bray <jimsantelmo@gmail.com>
      Cc: Alan Cox <alan@linux.intel.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
      6d0e194d
    • Jeff Garzik's avatar
      [libata] sata_sil: fix used-uninit warning · ebd1699e
      Jeff Garzik authored
      Init 'serror' to silence the following warning:
      
      drivers/ata/sata_sil.c: In function ‘sil_interrupt’:
      drivers/ata/sata_sil.c:453:14: warning: ‘serror’ may be used uninitialized in
      this function [-Wuninitialized]
      
      This is not a 'can never happen' but is nonetheless extremely unlikely.
      The easiest and cleanest warning fix is simply to init the var,
      rather than worry about marking the var uninit-ok.
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      ebd1699e
  7. 18 Aug, 2011 6 commits