1. 04 12月, 2018 1 次提交
  2. 09 10月, 2018 1 次提交
  3. 28 9月, 2018 1 次提交
  4. 21 5月, 2018 2 次提交
  5. 14 5月, 2018 1 次提交
  6. 02 5月, 2018 1 次提交
  7. 04 4月, 2018 1 次提交
  8. 23 3月, 2018 1 次提交
    • S
      mmc: block: Delete gendisk before cleaning up the request queue · 57678e5a
      Shawn Lin 提交于
      dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
      with a SD card hotplug during transfer reports a warning below
      introduced by commit a063057d ("block: Fix a race between
      request queue removal and the block cgroup controller"). So we
      should now remove the disk, partition and bdi sysfs attributes
      before cleaning up the request queue associated with the disk.
      
      [  410.331226] mmc1: card 59b4 removed
      [  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
      blk_cleanup_queue+0x138/0x140
      [  410.349294] Modules linked in:
      [  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
      4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
      [  410.350363] Hardware name: Excavator-RK3399 Board (DT)
      [  410.350819] Workqueue: events_freezable mmc_rescan
      [  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
      [  410.351663] pc : blk_cleanup_queue+0x138/0x140
      [  410.352054] lr : blk_cleanup_queue+0xac/0x140
      [  410.352436] sp : ffff0000092cbb90
      [  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
      [  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
      [  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
      [  410.354128] x23: 0000000000000060 x22: 0000000000000000
      [  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
      [  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
      [  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
      [  410.355994] x15: 0000000000000000 x14: 0000000000000400
      [  410.356461] x13: 0000000000000001 x12: 0000000000000001
      [  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
      [  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
      [  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
      [  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
      [  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
      [  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
      [  410.359726] Call trace:
      [  410.359943]  blk_cleanup_queue+0x138/0x140
      [  410.360305]  mmc_cleanup_queue+0x2c/0x48
      [  410.360652]  mmc_blk_remove_req+0x1c/0x98
      [  410.361005]  mmc_blk_remove+0x180/0x1c0
      [  410.361343]  mmc_bus_remove+0x1c/0x28
      [  410.361670]  device_release_driver_internal+0x154/0x1f0
      [  410.362128]  device_release_driver+0x14/0x20
      [  410.362504]  bus_remove_device+0xc8/0x108
      [  410.362858]  device_del+0x120/0x350
      [  410.363167]  mmc_remove_card+0x5c/0xb8
      [  410.363498]  mmc_sd_detect+0x40/0x78
      [  410.363813]  mmc_rescan+0x19c/0x368
      [  410.364123]  process_one_work+0x1ac/0x318
      [  410.364477]  worker_thread+0x50/0x450
      [  410.364801]  kthread+0xf8/0x128
      [  410.365081]  ret_from_fork+0x10/0x18
      [  410.365395] ---[ end trace 268e87a46c28968c ]---
      Reviewed-by: NBart Van Assche <bart.vanassche@wdc.com>
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      57678e5a
  9. 15 3月, 2018 3 次提交
  10. 18 12月, 2017 1 次提交
  11. 11 12月, 2017 16 次提交
  12. 23 11月, 2017 3 次提交
  13. 30 10月, 2017 6 次提交
    • A
      mmc: block: Prepare CQE data · 93482b3d
      Adrian Hunter 提交于
      Enhance mmc_blk_data_prep() to support CQE requests. That means adding
      some things that for non-CQE requests would be encoded into the command
      arguments - such as the block address, reliable-write flag, and data tag
      flag. Also the request tag is needed to provide the command queue task id,
      and a comment is added to explain the future possibility of defining a
      priority.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      93482b3d
    • A
      mmc: block: Use local variables in mmc_blk_data_prep() · d3377c01
      Adrian Hunter 提交于
      Use local variables in mmc_blk_data_prep() in preparation for adding CQE
      support which doesn't use the output variables.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      d3377c01
    • A
      mmc: core: Introduce host claiming by context · 6c0cedd1
      Adrian Hunter 提交于
      Currently the host can be claimed by a task.  Change this so that the host
      can be claimed by a context that may or may not be a task.  This provides
      for the host to be claimed by a block driver queue to support blk-mq, while
      maintaining compatibility with the existing use of mmc_claim_host().
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      6c0cedd1
    • L
      mmc: block: Fix bug when removing RPMB chardev · 1c87f735
      Linus Walleij 提交于
      I forgot to account for the fact that the device core holds a
      reference to a device added with device_initialize() that need
      to be released with a corresponding put_device() to reach a 0
      refcount at the end of the lifecycle.
      
      This led to a NULL pointer reference when freeing the device
      when e.g. unbidning the host device in sysfs.
      
      Fix this and use the device .release() callback to free the
      IDA and free:ing the memory used by the RPMB device.
      
      Before this patch:
      
      /sys/bus/amba/drivers/mmci-pl18x$ echo 80114000.sdi4_per2 > unbind
      [   29.797332] mmc3: card 0001 removed
      [   29.810791] Unable to handle kernel NULL pointer dereference at
                     virtual address 00000050
      [   29.818878] pgd = de70c000
      [   29.821624] [00000050] *pgd=1e70a831, *pte=00000000, *ppte=00000000
      [   29.827911] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
      [   29.833282] Modules linked in:
      [   29.836334] CPU: 1 PID: 154 Comm: sh Not tainted
                     4.14.0-rc3-00039-g83318e309566-dirty #736
      [   29.844604] Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
      [   29.851562] task: de572700 task.stack: de742000
      [   29.856079] PC is at kernfs_find_ns+0x8/0x100
      [   29.860443] LR is at kernfs_find_and_get_ns+0x30/0x48
      
      After this patch:
      
      /sys/bus/amba/drivers/mmci-pl18x$ echo 80005000.sdi4_per2 > unbind
      [   20.623382] mmc3: card 0001 removed
      
      Fixes: 97548575 ("mmc: block: Convert RPMB to a character device")
      Reported-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      1c87f735
    • L
      mmc: block: Delete mmc_access_rpmb() · 14f4ca7e
      Linus Walleij 提交于
      This function is used by the block layer queue to bail out of
      requests if the current request is towards an RPMB
      "block device".
      
      This was done to avoid boot time scanning of this "block
      device" which was never really a block device, thus duct-taping
      over the fact that it was badly engineered.
      
      This problem is now gone as we removed the offending RPMB block
      device in another patch and replaced it with a character
      device.
      
      Cc: Tomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      14f4ca7e
    • L
      mmc: block: Convert RPMB to a character device · 97548575
      Linus Walleij 提交于
      The RPMB partition on the eMMC devices is a special area used
      for storing cryptographically safe information signed by a
      special secret key. To write and read records from this special
      area, authentication is needed.
      
      The RPMB area is *only* and *exclusively* accessed using
      ioctl():s from userspace. It is not really a block device,
      as blocks cannot be read or written from the device, also
      the signed chunks that can be stored on the RPMB are actually
      256 bytes, not 512 making a block device a real bad fit.
      
      Currently the RPMB partition spawns a separate block device
      named /dev/mmcblkNrpmb for each device with an RPMB partition,
      including the creation of a block queue with its own kernel
      thread and all overhead associated with this. On the Ux500
      HREFv60 platform, for example, the two eMMCs means that two
      block queues with separate threads are created for no use
      whatsoever.
      
      I have concluded that this block device design for RPMB is
      actually pretty wrong. The RPMB area should have been designed
      to be accessed from /dev/mmcblkN directly, using ioctl()s on
      the main block device. It is however way too late to change
      that, since userspace expects to open an RPMB device in
      /dev/mmcblkNrpmb and we cannot break userspace.
      
      This patch tries to amend the situation using the following
      strategy:
      
      - Stop creating a block device for the RPMB partition/area
      
      - Instead create a custom, dynamic character device with
        the same name.
      
      - Make this new character device support exactly the same
        set of ioctl()s as the old block device.
      
      - Wrap the requests back to the same ioctl() handlers, but
        issue them on the block queue of the main partition/area,
        i.e. /dev/mmcblkN
      
      We need to create a special "rpmb" bus type in order to get
      udev and/or busybox hot/coldplug to instantiate the device
      node properly.
      
      Before the patch, this appears in 'ps aux':
      
      101 root       0:00 [mmcqd/2rpmb]
      123 root       0:00 [mmcqd/3rpmb]
      
      After applying the patch these surplus block queue threads
      are gone, but RPMB is as usable as ever using the userspace
      MMC tools, such as 'mmc rpmb read-counter'.
      
      We get instead those dynamice devices in /dev:
      
      brw-rw----    1 root     root      179,   0 Jan  1  2000 mmcblk0
      brw-rw----    1 root     root      179,   1 Jan  1  2000 mmcblk0p1
      brw-rw----    1 root     root      179,   2 Jan  1  2000 mmcblk0p2
      brw-rw----    1 root     root      179,   5 Jan  1  2000 mmcblk0p5
      brw-rw----    1 root     root      179,   8 Jan  1  2000 mmcblk2
      brw-rw----    1 root     root      179,  16 Jan  1  2000 mmcblk2boot0
      brw-rw----    1 root     root      179,  24 Jan  1  2000 mmcblk2boot1
      crw-rw----    1 root     root      248,   0 Jan  1  2000 mmcblk2rpmb
      brw-rw----    1 root     root      179,  32 Jan  1  2000 mmcblk3
      brw-rw----    1 root     root      179,  40 Jan  1  2000 mmcblk3boot0
      brw-rw----    1 root     root      179,  48 Jan  1  2000 mmcblk3boot1
      brw-rw----    1 root     root      179,  33 Jan  1  2000 mmcblk3p1
      crw-rw----    1 root     root      248,   1 Jan  1  2000 mmcblk3rpmb
      
      Notice the (248,0) and (248,1) character devices for RPMB.
      
      Cc: Tomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      97548575
  14. 04 10月, 2017 1 次提交
    • L
      mmc: Delete bounce buffer handling · de3ee99b
      Linus Walleij 提交于
      In may, Steven sent a patch deleting the bounce buffer handling
      and the CONFIG_MMC_BLOCK_BOUNCE option.
      
      I chose the less invasive path of making it a runtime config
      option, and we merged that successfully for kernel v4.12.
      
      The code is however just standing in the way and taking up
      space for seemingly no gain on any systems in wide use today.
      
      Pierre says the code was there to improve speed on TI SDHCI
      controllers on certain HP laptops and possibly some Ricoh
      controllers as well. Early SDHCI controllers lacked the
      scatter-gather feature, which made software bounce buffers
      a significant speed boost.
      
      We are clearly talking about the list of SDHCI PCI-based
      MMC/SD card readers found in the pci_ids[] list in
      drivers/mmc/host/sdhci-pci-core.c.
      
      The TI SDHCI derivative is not supported by the upstream
      kernel. This leaves the Ricoh.
      
      What we can however notice is that the x86 defconfigs in the
      kernel did not enable CONFIG_MMC_BLOCK_BOUNCE option, which
      means that any such laptop would have to have a custom
      configured kernel to actually take advantage of this
      bounce buffer speed-up. It simply seems like there was
      a speed optimization for the Ricoh controllers that noone
      was using. (I have not checked the distro defconfigs but
      I am pretty sure the situation is the same there.)
      
      Bounce buffers increased performance on the OMAP HSMMC
      at one point, and was part of the original submission in
      commit a45c6cb8 ("[ARM] 5369/1: omap mmc: Add new
         omap hsmmc controller for 2430 and 34xx, v3")
      
      This optimization was removed in
      commit 0ccd76d4 ("omap_hsmmc: Implement scatter-gather
         emulation")
      which found that scatter-gather emulation provided even
      better performance.
      
      The same was introduced for SDHCI in
      commit 2134a922 ("sdhci: scatter-gather (ADMA) support")
      
      I am pretty positively convinced that software
      scatter-gather emulation will do for any host controller what
      the bounce buffers were doing. Essentially, the bounce buffer
      was a reimplementation of software scatter-gather-emulation in
      the MMC subsystem, and it should be done away with.
      
      Cc: Pierre Ossman <pierre@ossman.eu>
      Cc: Juha Yrjola <juha.yrjola@solidboot.com>
      Cc: Steven J. Hill <Steven.Hill@cavium.com>
      Cc: Shawn Lin <shawn.lin@rock-chips.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Suggested-by: NSteven J. Hill <Steven.Hill@cavium.com>
      Suggested-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      de3ee99b
  15. 30 8月, 2017 1 次提交
    • S
      mmc: block: cast a informative log for no devidx available · e7b42769
      Shawn Lin 提交于
      The intention for this patch is to help folks debug the failure
      like this:
      
      dwmmc_rockchip fe320000.dwmmc: IDMAC supports 32-bit address mode.
      dwmmc_rockchip fe320000.dwmmc: Using internal DMA controller.
      dwmmc_rockchip fe320000.dwmmc: Version ID is 270a
      dwmmc_rockchip fe320000.dwmmc: DW MMC controller at irq 28,32 bit
      host data width,256 deep fifo
      dwmmc_rockchip fe320000.dwmmc: Got CD GPIO
      mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual
      400000HZ div = 0)
      mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz,
      actual 50000000HZ div = 0)
      mmc0: new high speed SDHC card at address 0007
      mmcblk: probe of mmc0:0007 failed with error -28
      
      The reason may be some buggy userspace daemon miss the disk remove
      uevent sometimes so it would finally make the SD card not work.
      So from the dmesg it only shows a errno of -28 but still don't understand
      what happened.
      
      For quick reproduce this, we could set max_devices to 8 and run
      
      for i in $(seq 1 9); do
        echo "========================" $i
        echo fe320000.dwmmc > /sys/bus/platform/drivers/dwmmc_rockchip/unbind
        sleep .5
        echo fe320000.dwmmc > /sys/bus/platform/drivers/dwmmc_rockchip/bind
        sleep .5
        mount -t vfat /dev/mmcblk0 /mnt
        sleep .5
      done
      
      Another possible reason would be the device has more partitions than
      what we support, so that they have to increase their max_devices.
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      e7b42769