1. 12 10月, 2016 1 次提交
  2. 15 9月, 2016 1 次提交
    • B
      mtd: introduce the mtd_pairing_scheme concept · 477b0229
      Boris Brezillon 提交于
      MLC and TLC NAND devices are using NAND cells exposing more than one bit,
      but instead of attaching all the bits in a given cell to a single NAND
      page, each bit is usually attached to a different page. This concept is
      called 'page pairing', and has significant impacts on the flash storage
      usage.
      The main problem showed by these devices is that interrupting a page
      program operation may not only corrupt the page we are programming
      but also the page it is paired with, hence the need to expose to MTD
      users the pairing scheme information.
      
      The pairing APIs allows one to query pairing information attached to a
      given page (here called wunit), or the other way around (the wunit
      pointed by pairing information).
      It also provides several helpers to help the conversion between absolute
      offsets and wunits, and query the number of pairing groups.
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      Reviewed-by: NBrian Norris <computersforpeace@gmail.com>
      477b0229
  3. 06 5月, 2016 1 次提交
  4. 20 4月, 2016 2 次提交
    • B
      mtd: create an mtd_ooblayout_ops struct to ease ECC layout definition · adbbc3bc
      Boris Brezillon 提交于
      ECC layout definitions are currently exposed using the nand_ecclayout
      struct which embeds oobfree and eccpos arrays with predefined size.
      This approach was acceptable when NAND chips were providing relatively
      small OOB regions, but MLC and TLC now provide OOB regions of several
      hundreds of bytes, which implies a non negligible overhead for everybody
      even those who only need to support legacy NANDs.
      
      Create an mtd_ooblayout_ops interface providing the same functionality
      (expose the ECC and oobfree layout) without the need for this huge
      structure.
      
      The mtd->ecclayout is now deprecated and should be replaced by the
      equivalent mtd_ooblayout_ops. In the meantime we provide a wrapper around
      the ->ecclayout field to ease migration to this new model.
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      adbbc3bc
    • B
      mtd: add mtd_ooblayout_xxx() helper functions · 75eb2cec
      Boris Brezillon 提交于
      In order to make the ecclayout definition completely dynamic we need to
      rework the way the OOB layout are defined and iterated.
      
      Create a few mtd_ooblayout_xxx() helpers to ease OOB bytes manipulation
      and hide ecclayout internals to their users.
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      75eb2cec
  5. 13 4月, 2016 2 次提交
  6. 05 1月, 2016 1 次提交
    • B
      mtd: fix cmdlinepart parser, early naming for auto-filled MTD · 472b444e
      Brian Norris 提交于
      Commit 807f16d4 ("mtd: core: set some defaults when dev.parent is
      set") attempted to provide some default settings for MTDs that
       (a) assign the parent device and
       (b) don't provide their own name or owner
      
      However, this isn't a perfect drop-in replacement for the boilerplate
      found in some drivers, because the MTD name is used by partition
      parsers like cmdlinepart, but the name isn't set until add_mtd_device(),
      after the parsing is completed. This means cmdlinepart sees a NULL name
      and therefore will not work properly.
      
      Fix this by moving the default name and owner assignment to be first in
      the MTD registration process.
      
      [Note: this does not fix all reported issues, particularly with NAND
      drivers. Will require an additional fix for drivers/mtd/nand/]
      
      Fixes: 807f16d4 ("mtd: core: set some defaults when dev.parent is set")
      Reported-by: NHeiko Schocher <hs@denx.de>
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Cc: Heiko Schocher <hs@denx.de>
      Cc: Frans Klaver <fransklaver@gmail.com>
      472b444e
  7. 10 12月, 2015 3 次提交
  8. 13 11月, 2015 1 次提交
  9. 07 11月, 2015 2 次提交
    • M
      mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep... · d0164adc
      Mel Gorman 提交于
      mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd
      
      __GFP_WAIT has been used to identify atomic context in callers that hold
      spinlocks or are in interrupts.  They are expected to be high priority and
      have access one of two watermarks lower than "min" which can be referred
      to as the "atomic reserve".  __GFP_HIGH users get access to the first
      lower watermark and can be called the "high priority reserve".
      
      Over time, callers had a requirement to not block when fallback options
      were available.  Some have abused __GFP_WAIT leading to a situation where
      an optimisitic allocation with a fallback option can access atomic
      reserves.
      
      This patch uses __GFP_ATOMIC to identify callers that are truely atomic,
      cannot sleep and have no alternative.  High priority users continue to use
      __GFP_HIGH.  __GFP_DIRECT_RECLAIM identifies callers that can sleep and
      are willing to enter direct reclaim.  __GFP_KSWAPD_RECLAIM to identify
      callers that want to wake kswapd for background reclaim.  __GFP_WAIT is
      redefined as a caller that is willing to enter direct reclaim and wake
      kswapd for background reclaim.
      
      This patch then converts a number of sites
      
      o __GFP_ATOMIC is used by callers that are high priority and have memory
        pools for those requests. GFP_ATOMIC uses this flag.
      
      o Callers that have a limited mempool to guarantee forward progress clear
        __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall
        into this category where kswapd will still be woken but atomic reserves
        are not used as there is a one-entry mempool to guarantee progress.
      
      o Callers that are checking if they are non-blocking should use the
        helper gfpflags_allow_blocking() where possible. This is because
        checking for __GFP_WAIT as was done historically now can trigger false
        positives. Some exceptions like dm-crypt.c exist where the code intent
        is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to
        flag manipulations.
      
      o Callers that built their own GFP flags instead of starting with GFP_KERNEL
        and friends now also need to specify __GFP_KSWAPD_RECLAIM.
      
      The first key hazard to watch out for is callers that removed __GFP_WAIT
      and was depending on access to atomic reserves for inconspicuous reasons.
      In some cases it may be appropriate for them to use __GFP_HIGH.
      
      The second key hazard is callers that assembled their own combination of
      GFP flags instead of starting with something like GFP_KERNEL.  They may
      now wish to specify __GFP_KSWAPD_RECLAIM.  It's almost certainly harmless
      if it's missed in most cases as other activity will wake kswapd.
      Signed-off-by: NMel Gorman <mgorman@techsingularity.net>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Vitaly Wool <vitalywool@gmail.com>
      Cc: Rik van Riel <riel@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d0164adc
    • B
      mtd: don't WARN about overloaded users of mtd->reboot_notifier.notifier_call · f8479dd6
      Brian Norris 提交于
      There are multiple types of users of mtd->reboot_notifier.notifier_call:
      
      (1) A while back, the cfi_cmdset_000{1,2} chip drivers implemented a
      reboot notifier to (on a best effort basis) attempt to reset their flash
      chips before rebooting.
      
      (2) More recently, we implemented a common _reboot() hook so that MTD
      drivers (particularly, NAND flash) could better halt I/O operations
      without having to reimplement the same notifier boilerplate.
      
      Currently, the WARN_ONCE() condition here was written to handle (2), but
      at the same time it mis-diagnosed case (1) as an already-registered MTD.
      Let's fix this by having the WARN_ONCE() condition better imitate the
      condition that immediately follows it. (Wow, I don't know how I missed
      that one.)
      
      (Side note: Unfortunately, we can't yet combine the reboot notifier code
      for (1) and (2) with a patch like [1], because some users of (1) also
      use mtdconcat, and so the mtd_info struct from cfi_cmdset_000{1,2} won't
      actually get registered with mtdcore, and therefore their reboot
      notifier won't get registered.)
      
      [1] http://patchwork.ozlabs.org/patch/417981/Suggested-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Cc: Jesper Nilsson <jespern@axis.com>
      Cc: linux-cris-kernel@axis.com
      Tested-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      f8479dd6
  10. 27 10月, 2015 3 次提交
  11. 14 10月, 2015 2 次提交
  12. 29 9月, 2015 1 次提交
    • J
      mtd: Destroy mtd_idr on module_exit · 35667b99
      Johannes Thumshirn 提交于
      Destroy mtd_idr on module_exit, reclaiming the allocated memory.
      
      This was detected by the following semantic patch (written by Luis Rodriguez
      <mcgrof@suse.com>)
      <SmPL>
      @ defines_module_init @
      declarer name module_init, module_exit;
      declarer name DEFINE_IDR;
      identifier init;
      @@
      
      module_init(init);
      
      @ defines_module_exit @
      identifier exit;
      @@
      
      module_exit(exit);
      
      @ declares_idr depends on defines_module_init && defines_module_exit @
      identifier idr;
      @@
      
      DEFINE_IDR(idr);
      
      @ on_exit_calls_destroy depends on declares_idr && defines_module_exit @
      identifier declares_idr.idr, defines_module_exit.exit;
      @@
      
      exit(void)
      {
       ...
        idr_destroy(&idr);
        ...
      }
      
      @ missing_module_idr_destroy depends on declares_idr && defines_module_exit && !on_exit_calls_destroy @
      identifier declares_idr.idr, defines_module_exit.exit;
      @@
      
      exit(void)
      {
       ...
       +idr_destroy(&idr);
      }
      </SmPL>
      Signed-off-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      35667b99
  13. 17 6月, 2015 1 次提交
  14. 07 5月, 2015 1 次提交
  15. 06 4月, 2015 1 次提交
    • D
      mtd: part: Create the master device node when partitioned · 727dc612
      Dan Ehrenberg 提交于
      For many use cases, it helps to have a device node for the entire
      MTD device as well as device nodes for the individual partitions.
      For example, this allows querying the entire device's properties.
      A common idiom is to create an additional partition which spans
      over the whole device.
      
      This patch makes a config option, CONFIG_MTD_PARTITIONED_MASTER,
      which makes the master partition present even when the device is
      partitioned. This isn't turned on by default since it presents
      a backwards-incompatible device numbering.
      
      The patch also makes the parent of a partition device be the master,
      if the config flag is set, now that the master is a full device.
      Signed-off-by: NDan Ehrenberg <dehrenberg@chromium.org>
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      727dc612
  16. 08 2月, 2015 1 次提交
  17. 29 1月, 2015 1 次提交
  18. 21 1月, 2015 1 次提交
  19. 08 1月, 2015 1 次提交
  20. 20 8月, 2014 2 次提交
    • B
      mtd: remove dead non-char logic · 5e472128
      Brian Norris 提交于
      MTD used to allow compiling out character device support. This was
      dropped in the following commit, but some of the accompanying logic was
      never dropped:
      
        commit 660685d9
        Author: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
        Date:   Thu Mar 14 13:27:40 2013 +0200
      
            mtd: merge mtdchar module with mtdcore
      
      The weird logic was flagged by Coverity.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
      5e472128
    • B
      mtd: correct upper bounds check for mtd_*() APIs · 0c2b4e21
      Brian Norris 提交于
      When checking the upper boundary (i.e., whether an address is higher
      than the maximum size of the MTD), we should be doing an inclusive check
      (greater or equal). For instance, an address of 16MB (0x1000000) on a
      16MB device is invalid.
      
      The strengthening of this bounds check is redundant for those which
      already have a address+length check and ensure that the length is
      non-zero, but let's just fix them all, for completeness.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      0c2b4e21
  21. 09 7月, 2014 2 次提交
  22. 11 3月, 2014 2 次提交
  23. 04 1月, 2014 1 次提交
  24. 07 11月, 2013 2 次提交
  25. 28 10月, 2013 1 次提交
  26. 31 8月, 2013 1 次提交
  27. 04 7月, 2013 1 次提交
  28. 30 4月, 2013 1 次提交