1. 22 5月, 2019 1 次提交
    • D
      libnvdimm/namespace: Fix label tracking error · 866f0111
      Dan Williams 提交于
      commit c4703ce11c23423d4b46e3d59aef7979814fd608 upstream.
      
      Users have reported intermittent occurrences of DIMM initialization
      failures due to duplicate allocations of address capacity detected in
      the labels, or errors of the form below, both have the same root cause.
      
          nd namespace1.4: failed to track label: 0
          WARNING: CPU: 17 PID: 1381 at drivers/nvdimm/label.c:863
      
          RIP: 0010:__pmem_label_update+0x56c/0x590 [libnvdimm]
          Call Trace:
           ? nd_pmem_namespace_label_update+0xd6/0x160 [libnvdimm]
           nd_pmem_namespace_label_update+0xd6/0x160 [libnvdimm]
           uuid_store+0x17e/0x190 [libnvdimm]
           kernfs_fop_write+0xf0/0x1a0
           vfs_write+0xb7/0x1b0
           ksys_write+0x57/0xd0
           do_syscall_64+0x60/0x210
      
      Unfortunately those reports were typically with a busy parallel
      namespace creation / destruction loop making it difficult to see the
      components of the bug. However, Jane provided a simple reproducer using
      the work-in-progress sub-section implementation.
      
      When ndctl is reconfiguring a namespace it may take an existing defunct
      / disabled namespace and reconfigure it with a new uuid and other
      parameters. Critically namespace_update_uuid() takes existing address
      resources and renames them for the new namespace to use / reconfigure as
      it sees fit. The bug is that this rename only happens in the resource
      tracking tree. Existing labels with the old uuid are not reaped leading
      to a scenario where multiple active labels reference the same span of
      address range.
      
      Teach namespace_update_uuid() to flag any references to the old uuid for
      reaping at the next label update attempt.
      
      Cc: <stable@vger.kernel.org>
      Fixes: bf9bccc1 ("libnvdimm: pmem label sets and namespace instantiation")
      Link: https://github.com/pmem/ndctl/issues/91Reported-by: NJane Chu <jane.chu@oracle.com>
      Reported-by: NJeff Moyer <jmoyer@redhat.com>
      Reported-by: NErwin Tsaur <erwin.tsaur@oracle.com>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      866f0111
  2. 17 5月, 2019 1 次提交
  3. 24 3月, 2019 1 次提交
  4. 26 7月, 2018 1 次提交
  5. 15 7月, 2018 1 次提交
  6. 07 4月, 2018 1 次提交
    • D
      libnvdimm, namespace: use a safe lookup for dimm device name · 4f867220
      Dan Williams 提交于
      The following NULL dereference results from incorrectly assuming that
      ndd is valid in this print:
      
        struct nvdimm_drvdata *ndd = to_ndd(&nd_region->mapping[i]);
      
        /*
         * Give up if we don't find an instance of a uuid at each
         * position (from 0 to nd_region->ndr_mappings - 1), or if we
         * find a dimm with two instances of the same uuid.
         */
        dev_err(&nd_region->dev, "%s missing label for %pUb\n",
                        dev_name(ndd->dev), nd_label->uuid);
      
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
       IP: nd_region_register_namespaces+0xd67/0x13c0 [libnvdimm]
       PGD 0 P4D 0
       Oops: 0000 [#1] SMP PTI
       CPU: 43 PID: 673 Comm: kworker/u609:10 Not tainted 4.16.0-rc4+ #1
       [..]
       RIP: 0010:nd_region_register_namespaces+0xd67/0x13c0 [libnvdimm]
       [..]
       Call Trace:
        ? devres_add+0x2f/0x40
        ? devm_kmalloc+0x52/0x60
        ? nd_region_activate+0x9c/0x320 [libnvdimm]
        nd_region_probe+0x94/0x260 [libnvdimm]
        ? kernfs_add_one+0xe4/0x130
        nvdimm_bus_probe+0x63/0x100 [libnvdimm]
      
      Switch to using the nvdimm device directly.
      
      Fixes: 0e3b0d12 ("libnvdimm, namespace: allow multiple pmem...")
      Cc: <stable@vger.kernel.org>
      Reported-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      4f867220
  7. 07 3月, 2018 1 次提交
  8. 03 2月, 2018 1 次提交
  9. 08 10月, 2017 1 次提交
  10. 29 9月, 2017 1 次提交
  11. 19 9月, 2017 1 次提交
    • D
      libnvdimm, namespace: fix btt claim class crash · 33a56086
      Dan Williams 提交于
      Maurice reports:
      
          BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
          IP: holder_class_store+0x253/0x2b0 [libnvdimm]
      
      ...while trying to reconfigure an NVDIMM-N namespace into 'sector' /
      'btt' mode. The crash points to this line:
      
          (gdb) li *(holder_class_store+0x253)
          0x7773 is in holder_class_store (drivers/nvdimm/namespace_devs.c:1420).
          1415            for (i = 0; i < nd_region->ndr_mappings; i++) {
          1416                    struct nd_mapping *nd_mapping = &nd_region->mapping[i];
          1417                    struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
          1418                    struct nd_namespace_index *nsindex;
          1419
          1420                    nsindex = to_namespace_index(ndd, ndd->ns_current);
      
      ...where we are failing because ndd is NULL due to NVDIMM-N dimms not
      supporting labels.
      
      Long story short, default to the BTTv1 format in the label-less /
      NVDIMM-N case.
      
      Fixes: 14e49454 ("libnvdimm, btt: BTT updates for UEFI 2.7 format")
      Cc: <stable@vger.kernel.org>
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Reported-by: NMaurice A. Saldivar <maurice.a.saldivar@hpe.com>
      Tested-by: NMaurice A. Saldivar <maurice.a.saldivar@hpe.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      33a56086
  12. 12 8月, 2017 1 次提交
  13. 30 6月, 2017 1 次提交
  14. 28 6月, 2017 2 次提交
    • D
      libnvdimm, nfit: enable support for volatile ranges · c9e582aa
      Dan Williams 提交于
      Allow volatile nfit ranges to participate in all the same infrastructure
      provided for persistent memory regions. A resulting resulting namespace
      device will still be called "pmem", but the parent region type will be
      "nd_volatile". This is in preparation for disabling the dax ->flush()
      operation in the pmem driver when it is hosted on a volatile range.
      
      Cc: Jan Kara <jack@suse.cz>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Matthew Wilcox <mawilcox@microsoft.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      c9e582aa
    • D
      x86, libnvdimm, pmem: remove global pmem api · ca6a4657
      Dan Williams 提交于
      Now that all callers of the pmem api have been converted to dax helpers that
      call back to the pmem driver, we can remove include/linux/pmem.h and
      asm/pmem.h.
      
      Cc: <x86@kernel.org>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Toshi Kani <toshi.kani@hpe.com>
      Cc: Oliver O'Halloran <oohall@gmail.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      ca6a4657
  15. 16 6月, 2017 5 次提交
  16. 05 5月, 2017 2 次提交
  17. 01 3月, 2017 1 次提交
    • D
      nfit, libnvdimm: fix interleave set cookie calculation · 86ef58a4
      Dan Williams 提交于
      The interleave-set cookie is a sum that sanity checks the composition of
      an interleave set has not changed from when the namespace was initially
      created.  The checksum is calculated by sorting the DIMMs by their
      location in the interleave-set. The comparison for the sort must be
      64-bit wide, not byte-by-byte as performed by memcmp() in the broken
      case.
      
      Fix the implementation to accept correct cookie values in addition to
      the Linux "memcmp" order cookies, but only allow correct cookies to be
      generated going forward. It does mean that namespaces created by
      third-party-tooling, or created by newer kernels with this fix, will not
      validate on older kernels. However, there are a couple mitigating
      conditions:
      
          1/ platforms with namespace-label capable NVDIMMs are not widely
             available.
      
          2/ interleave-sets with a single-dimm are by definition not affected
             (nothing to sort). This covers the QEMU-KVM NVDIMM emulation case.
      
      The cookie stored in the namespace label will be fixed by any write the
      namespace label, the most straightforward way to achieve this is to
      write to the "alt_name" attribute of a namespace in sysfs.
      
      Cc: <stable@vger.kernel.org>
      Fixes: eaf96153 ("libnvdimm, nfit: add interleave-set state-tracking infrastructure")
      Reported-by: NNicholas Moulin <nicholas.w.moulin@linux.intel.com>
      Tested-by: NNicholas Moulin <nicholas.w.moulin@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      86ef58a4
  18. 01 2月, 2017 2 次提交
    • D
      libnvdimm, namespace: do not delete namespace-id 0 · 9d032f42
      Dan Williams 提交于
      Given that the naming of pmem devices changes from the pmemX form to the
      pmemX.Y form when namespace id is greater than 0, arrange for namespaces
      with id-0 to be exempt from deletion. Otherwise a simple reconfiguration
      of an existing namespace to a new mode results in a name change of the
      resulting block device:
      
          # ndctl list --namespace=namespace1.0
          {
            "dev":"namespace1.0",
            "mode":"raw",
            "size":2147483648,
            "uuid":"3dadf3dc-89b9-4b24-b20e-abc8a4707ce3",
            "blockdev":"pmem1"
          }
      
          # ndctl create-namespace --reconfig=namespace1.0 --mode=memory --force
          {
            "dev":"namespace1.1",
            "mode":"memory",
            "size":2111832064,
            "uuid":"7b4a6341-7318-4219-a02c-fb57c0bbf613",
            "blockdev":"pmem1.1"
          }
      
      This change does require tooling changes to explicitly look for
      namespaceX.0 if the seed has already advanced to another namespace.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 98a29c39 ("libnvdimm, namespace: allow creation of multiple pmem-namespaces per region")
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      9d032f42
    • B
      nvdimm: constify device_type structures · 970d14e3
      Bhumika Goyal 提交于
      Declare device_type structure as const as it is only stored in the
      type field of a device structure. This field is of type const, so add
      const to declaration of device_type structure.
      
      File size before:
        text	   data	    bss	    dec	    hex	filename
        19278	   3199	     16	  22493	   57dd	nvdimm/namespace_devs.o
      
      File size after:
        text	   data	    bss	    dec	    hex	filename
        19929	   3160	     16	  23105	   5a41	nvdimm/namespace_devs.o
      Signed-off-by: NBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      970d14e3
  19. 14 1月, 2017 1 次提交
  20. 16 12月, 2016 1 次提交
  21. 05 12月, 2016 1 次提交
  22. 29 11月, 2016 1 次提交
  23. 20 10月, 2016 1 次提交
  24. 08 10月, 2016 7 次提交
  25. 06 10月, 2016 2 次提交
  26. 01 10月, 2016 1 次提交