24 Apr, 2018

1 commit

  • commit c31898c8c711f2bbbcaebe802a55827e288d875a upstream.

    At initialization time the 'dimm' driver caches a copy of the memory
    device's label area and reserves address space for each of the
    namespaces defined.

    However, as can be seen below, the reservation occurs even when the
    index blocks are invalid:

    nvdimm nmem0: nvdimm_init_config_data: len: 131072 rc: 0
    nvdimm nmem0: config data size: 131072
    nvdimm nmem0: __nd_label_validate: nsindex0 labelsize 1 invalid
    nvdimm nmem0: __nd_label_validate: nsindex1 labelsize 1 invalid
    nvdimm nmem0: : pmem-6025e505: 0x1000000000 @ 0xf50000000 reserve
    Fixes: 4a826c83db4e ("libnvdimm: namespace indices: read and validate")
    Reported-by: Krzysztof Rusocki
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     

30 Nov, 2017

1 commit

  • commit d34cb808402898e53b9a9bcbbedd01667a78723b upstream.

    If we successfully enable a DIMM then it must not be locked and we can
    clear the label-read failure condition. Otherwise, we need to reload the
    entire bus provider driver to achieve the same effect, and that can
    disrupt unrelated DIMMs and namespaces.

    Fixes: 9d62ed965118 ("libnvdimm: handle locked label storage areas")
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     

05 May, 2017

1 commit

  • Per the latest version of the "NVDIMM DSM Interface Example" [1], the
    label data retrieval routine can report a "locked" status. In this case
    all regions associated with that DIMM are disabled until the label area
    is unlocked. Provide generic libnvdimm enabling for NVDIMMs with label
    data area locking capabilities.

    [1]: http://pmem.io/documents/

    Signed-off-by: Dan Williams

    Dan Williams
     

19 Oct, 2016

1 commit

  • Platforms like QEMU-KVM implement an NFIT table and label DSMs.
    However, since that environment does not define an aliased
    configuration, the labels are currently ignored and the kernel registers
    a single full-sized pmem-namespace per region. Now that the kernel
    supports sub-divisions of pmem regions the labels have a purpose.
    Arrange for the labels to be honored when we find an existing / valid
    namespace index block.

    Cc:
    Cc: Haozhong Zhang
    Cc: Xiao Guangrong
    Signed-off-by: Dan Williams

    Dan Williams
     

02 Sep, 2016

1 commit

  • 'ndctl list --buses --dimms' does not list any NVDIMM-Ns since
    they are considered as idle. ndctl checks if any driver is
    attached to nmem device. nvdimm_probe() always fails in
    nvdimm_init_nsarea() since NVDIMM-Ns do not implement optinal
    ND_CMD_GET_CONFIG_DATA command.

    Change nvdimm_probe() to accept the case that the CONFIG_DATA
    command is not implemented for NVDIMM-Ns. The driver attaches
    without ndd, which keeps it no-op to the device.

    Reported-by: Brian Boylston
    Signed-off-by: Toshi Kani
    Cc: Dan Williams
    Tested-by: Johannes Thumshirn
    Acked-by: Johannes Thumshirn
    Signed-off-by: Dan Williams

    Toshi Kani
     

25 Jun, 2015

4 commits

  • A complete label set is a PMEM-label per-dimm per-interleave-set where
    all the UUIDs match and the interleave set cookie matches the hosting
    interleave set.

    Present sysfs attributes for manipulation of a PMEM-namespace's
    'alt_name', 'uuid', and 'size' attributes. A later patch will make
    these settings persistent by writing back the label.

    Note that PMEM allocations grow forwards from the start of an interleave
    set (lowest dimm-physical-address (DPA)). BLK-namespaces that alias
    with a PMEM interleave set will grow allocations backward from the
    highest DPA.

    Cc: Greg KH
    Cc: Neil Brown
    Acked-by: Christoph Hellwig
    Signed-off-by: Dan Williams

    Dan Williams
     
  • This on media label format [1] consists of two index blocks followed by
    an array of labels. None of these structures are ever updated in place.
    A sequence number tracks the current active index and the next one to
    write, while labels are written to free slots.

    +------------+
    | |
    | nsindex0 |
    | |
    +------------+
    | |
    | nsindex1 |
    | |
    +------------+
    | label0 |
    +------------+
    | label1 |
    +------------+
    | |
    ....nslot...
    | |
    +------------+
    | labelN |
    +------------+

    After reading valid labels, store the dpa ranges they claim into
    per-dimm resource trees.

    [1]: http://pmem.io/documents/NVDIMM_Namespace_Spec.pdf

    Cc: Neil Brown
    Acked-by: Christoph Hellwig
    Signed-off-by: Dan Williams

    Dan Williams
     
  • The libnvdimm region driver is an intermediary driver that translates
    non-volatile "region"s into "namespace" sub-devices that are surfaced by
    persistent memory block-device drivers (PMEM and BLK).

    ACPI 6 introduces the concept that a given nvdimm may simultaneously
    offer multiple access modes to its media through direct PMEM load/store
    access, or windowed BLK mode. Existing nvdimms mostly implement a PMEM
    interface, some offer a BLK-like mode, but never both as ACPI 6 defines.
    If an nvdimm is single interfaced, then there is no need for dimm
    metadata labels. For these devices we can take the region boundaries
    directly to create a child namespace device (nd_namespace_io).

    Acked-by: Christoph Hellwig
    Tested-by: Toshi Kani
    Signed-off-by: Dan Williams

    Dan Williams
     
  • * Implement the device-model infrastructure for loading modules and
    attaching drivers to nvdimm devices. This is a simple association of a
    nd-device-type number with a driver that has a bitmask of supported
    device types. To facilitate userspace bind/unbind operations 'modalias'
    and 'devtype', that also appear in the uevent, are added as generic
    sysfs attributes for all nvdimm devices. The reason for the device-type
    number is to support sub-types within a given parent devtype, be it a
    vendor-specific sub-type or otherwise.

    * The first consumer of this infrastructure is the driver
    for dimm devices. It simply uses control messages to retrieve and
    store the configuration-data image (label set) from each dimm.

    Note: nd_device_register() arranges for asynchronous registration of
    nvdimm bus devices by default.

    Cc: Greg KH
    Cc: Neil Brown
    Acked-by: Christoph Hellwig
    Tested-by: Toshi Kani
    Signed-off-by: Dan Williams

    Dan Williams