06 Sep, 2019

2 commits


06 Aug, 2019

2 commits


21 Jun, 2019

1 commit

  • With gcc 4.1:

    drivers/lightnvm/core.c: In function ‘nvm_remove_tgt’:
    drivers/lightnvm/core.c:510: warning: ‘t’ is used uninitialized in this function

    Indeed, if no NVM devices have been registered, t will be an
    uninitialized pointer, and may be dereferenced later. A call to
    nvm_remove_tgt() can be triggered from userspace by issuing the
    NVM_DEV_REMOVE ioctl on the lightnvm control device.

    Fix this by preinitializing t to NULL.

    Fixes: 843f2edbdde085b4 ("lightnvm: do not remove instance under global lock")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Geert Uytterhoeven
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program see the file copying if not
    write to the free software foundation 675 mass ave cambridge ma
    02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 3 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190531190112.675111872@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

07 May, 2019

4 commits

  • Currently all the target instances are removed under global nvm_lock.
    This was needed to ensure that nvm_dev struct will not be freed by
    hot unplug event during target removal. However, current implementation
    has some drawbacks, since the same lock is used when new nvme subsystem
    is registered, so we can have a situation, that due to long process of
    target removal on drive A, registration (and listing in OS) of the
    drive B will take a lot of time, since it will wait for that lock.

    Now when we have kref which ensures that nvm_dev will not be freed in
    the meantime, we can easily get rid of this lock for a time when we are
    removing nvm targets.

    Signed-off-by: Igor Konopko
    Reviewed-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Igor Konopko
     
  • When creation process is still in progress, target is not yet on
    targets list. This causes a chance for removing whole lightnvm
    subsystem by calling nvm_unregister() in the meantime and finally by
    causing kernel panic inside target init function.

    This patch changes the behaviour by adding kref variable which tracks
    all the users of nvm_dev structure. When nvm_dev is allocated, kref
    value is set to 1. Then before every target creation the value is
    increased and decreased after target removal. The extra reference
    is decreased when nvm subsystem is unregistered.

    Signed-off-by: Igor Konopko
    Reviewed-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Igor Konopko
     
  • When we trigger nvm target remove during device hot unplug, there is
    a probability to hit a general protection fault. This is caused by use
    of nvm_dev thay may be freed from another (hot unplug) thread
    (in the nvm_unregister function).

    Introduce lock in nvme_ioctl_dev_remove function to prevent this
    situation.

    Signed-off-by: Marcin Dziegielewski
    Reviewed-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Marcin Dziegielewski
     
  • Current lightnvm and pblk implementation does not care about NVMe max
    data transfer size, which can be smaller than 64*K=256K. There are
    existing NVMe controllers which NVMe max data transfer size is lower
    that 256K (for example 128K, which happens for existing NVMe
    controllers which are NVMe spec compliant). Such a controllers are not
    able to handle command which contains 64 PPAs, since the the size of
    DMAed buffer will be above the capabilities of such a controller.

    Signed-off-by: Igor Konopko
    Reviewed-by: Hans Holmberg
    Reviewed-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Igor Konopko
     

12 Dec, 2018

3 commits

  • Currently lightnvm and pblk uses single DMA pool, for which the entry
    size always is equal to PAGE_SIZE. The contents of each entry allocated
    from the DMA pool consists of a PPA list (8bytes * 64), leaving
    56bytes * 64 space for metadata. Since the metadata field can be bigger,
    such as 128 bytes, the static size does not cover this use-case.

    This patch adds support for I/O metadata above 56 bytes by changing DMA
    pool size based on device meta size and allows pblk to use OOB metadata
    >=16B.

    Reviewed-by: Javier González
    Signed-off-by: Igor Konopko
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Igor Konopko
     
  • Currently the geometry of an OCSSD is enumerated using a two step
    approach:

    First, nvm_register is called, the OCSSD identify command is issued,
    and second the geometry sos and csecs values are read either from the
    OCSSD identify if it is a 1.2 drive, or from the NVMe namespace data
    structure if it is a 2.0 device.

    This patch recombines it into a single step, such that nvm_register can
    use the csecs and sos fields independent of which version is used. This
    enables one to dynamically size the lightnvm subsystem dma pool.

    Reviewed-by: Igor Konopko
    Reviewed-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • With gcc 4.1:

    drivers/lightnvm/core.c: In function ‘nvm_get_bb_meta’:
    drivers/lightnvm/core.c:977: warning: ‘ret’ may be used uninitialized in this function

    and

    drivers/nvme/host/lightnvm.c: In function ‘nvme_nvm_get_chk_meta’:
    drivers/nvme/host/lightnvm.c:580: warning: ‘ret’ may be used uninitialized in this function

    Indeed, if (for the former) the number of channels or LUNs is zero, or
    (for both) the passed number of chunks is zero, ret will be returned
    uninitialized.

    Fix this by preinitializing ret to zero.

    Fixes: aff3fb18f957de93 ("lightnvm: move bad block and chunk state logic to core")
    Fixes: a294c199455187d1 ("lightnvm: implement get log report chunk helpers")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Geert Uytterhoeven
     

16 Nov, 2018

1 commit


09 Oct, 2018

4 commits

  • There is a number of places in the lightnvm subsystem where the user
    iterates over the ppa list. Before iterating, the user must know if it
    is a single or multiple LBAs due to vector commands using either the
    nvm_rq ->ppa_addr or ->ppa_list fields on command submission, which
    leads to open-coding the if/else statement.

    Instead of having multiple if/else's, move it into a function that can
    be called by its users.

    A nice side effect of this cleanup is that this patch fixes up a
    bunch of cases where we don't consider the single-ppa case in pblk.

    Signed-off-by: Hans Holmberg
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Hans Holmberg
     
  • pblk implements two data paths for recovery line state. One for 1.2
    and another for 2.0, instead of having pblk implement these, combine
    them in the core to reduce complexity and make available to other
    targets.

    The new interface will adhere to the 2.0 chunk definition,
    including managing open chunks with an active write pointer. To provide
    this interface, a 1.2 device recovers the state of the chunks by
    manually detecting if a chunk is either free/open/close/offline, and if
    open, scanning the flash pages sequentially to find the next writeable
    page. This process takes on average ~10 seconds on a device with 64 dies,
    1024 blocks and 60us read access time. The process can be parallelized
    but is left out for maintenance simplicity, as the 1.2 specification is
    deprecated. For 2.0 devices, the logic is maintained internally in the
    drive and retrieved through the 2.0 interface.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • A 1.2 device is able to manage the logical to physical mapping
    table internally or leave it to the host.

    A target only supports one of those approaches, and therefore must
    check on initialization. Move this check to core to avoid each target
    implement the check.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • Add nvm_set_flags helper to enable core to appropriately
    set the command flags for read/write/erase depending on which version
    a drive supports.

    The flags arguments can be distilled into the access hint,
    scrambling, and program/erase suspend. Replace the access hint with
    a "is_seq" parameter. The rest of the flags are dependent on the
    command opcode, which is trivial to detect and set.

    Signed-off-by: Matias Bjørling
    Reviewed-by: Javier González
    Signed-off-by: Jens Axboe

    Matias Bjørling
     

01 Jun, 2018

1 commit

  • If the namespace is unregistered before the LightNVM target is removed
    (e.g., on hot unplug) it is too late for the target to store any metadata
    on the device - any attempt to write to the device will fail. In this
    case, pass on a "gracefull teardown" flag to the target to let it know
    when this happens.

    In the case of pblk, we pad the open line (close all open chunks) to
    improve data retention. In the event of an ungraceful shutdown, avoid
    this part and just clean up.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     

30 Mar, 2018

13 commits

  • The 2.0 spec provides a report chunk log page that can be retrieved
    using the stangard nvme get log page. This replaces the dedicated
    get/put bad block table in 1.2.

    This patch implements the helper functions to allow targets retrieve the
    chunk metadata using get log page. It makes nvme_get_log_ext available
    outside of nvme core so that we can use it form lightnvm.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • On address conversions, use the generic device, instead of the target
    device. This allows to use conversions outside of the target's realm.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Add support for 2.0 address format. Also, align address bits for 1.2 and
    2.0 to be able to operate on channel and luns without requiring a format
    conversion. Use a generic address format for this purpose.

    Also, convert the generic operations to the generic format in pblk.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Normalize nomenclature for naming channels, luns, chunks, planes and
    sectors as well as derivations in order to improve readability.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Separate the version between major and minor on the generic geometry and
    represent it through sysfs in the 2.0 path. The 1.2 path only shows the
    major version to preserve the existing user space interface.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Currently, the device geometry is stored redundantly in the nvm_id and
    nvm_geo structures at a device level. Moreover, when instantiating
    targets on a specific number of LUNs, these structures are replicated
    and manually modified to fit the instance channel and LUN partitioning.

    Instead, create a generic geometry around nvm_geo, which can be used by
    (i) the underlying device to describe the geometry of the whole device,
    and (ii) instances to describe their geometry independently.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Fixes: 38401d231de65 ("lightnvm: set target over-provision on create ioctl")
    Signed-off-by: Heiner Litz
    Reviewed-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Heiner Litz
     
  • Currently all functions for handling the lightnvm core ioctl commands
    do a check for CAP_SYS_ADMIN.

    Change this to fail early in nvm_ctl_ioctl(), so we don't have to
    duplicate the permission checks all over.

    Signed-off-by: Johannes Thumshirn
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Johannes Thumshirn
     
  • The nvme driver sets up the size of the nvme namespace in two steps.
    First it initializes the device with standard logical block and
    metadata sizes, and then sets the correct logical block and metadata
    size. Due to the OCSSD 2.0 specification relies on the namespace to
    expose these sizes for correct initialization, let it be updated
    appropriately on the LightNVM side as well.

    Signed-off-by: Matias Bjørling
    Acked-by: Keith Busch
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The value of max_phys_sect is always static. Instead of
    defining it in the nvm_dev_ops structure, declare it as a global
    value.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The field is no longer used.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • Implement the geometry data structures for 2.0 and enable a drive
    to be identified as one, including exposing the appropriate 2.0
    sysfs entries.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • There are no groups in the 2.0 specification, make sure that the
    nvm_id structure is flattened before 2.0 data structures are added.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     

01 Mar, 2018

1 commit


05 Jan, 2018

6 commits


13 Oct, 2017

1 commit