1. 24 Sep, 2019 1 commit
  2. 05 Sep, 2019 2 commits
  3. 18 Jul, 2019 1 commit
    • Dan Williams's avatar
      driver-core, libnvdimm: Let device subsystems add local lockdep coverage · 87a30e1f
      Dan Williams authored
      For good reason, the standard device_lock() is marked
      lockdep_set_novalidate_class() because there is simply no sane way to
      describe the myriad ways the device_lock() ordered with other locks.
      However, that leaves subsystems that know their own local device_lock()
      ordering rules to find lock ordering mistakes manually. Instead,
      introduce an optional / additional lockdep-enabled lock that a subsystem
      can acquire in all the same paths that the device_lock() is acquired.
      A conversion of the NFIT driver and NVDIMM subsystem to a
      lockdep-validate device_lock() scheme is included. The
      debug_nvdimm_lock() implementation implements the correct lock-class and
      stacking order for the libnvdimm device topology hierarchy.
      Yes, this is a hack, but hopefully it is a useful hack for other
      subsystems device_lock() debug sessions. Quoting Greg:
          "Yeah, it feels a bit hacky but it's really up to a subsystem to mess up
           using it as much as anything else, so user beware :)
           I don't object to it if it makes things easier for you to debug."
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
      Link: https://lore.kernel.org/r/156341210661.292348.7014034644265455704.stgit@dwillia2-desk3.amr.corp.intel.com
  4. 05 Jul, 2019 1 commit
  5. 05 Jun, 2019 1 commit
  6. 01 May, 2019 1 commit
    • Dan Williams's avatar
      libnvdimm/namespace: Fix label tracking error · c4703ce1
      Dan Williams authored
      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]
      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/91
      Reported-by: default avatarJane Chu <jane.chu@oracle.com>
      Reported-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Reported-by: default avatarErwin Tsaur <erwin.tsaur@oracle.com>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
  7. 22 Mar, 2019 1 commit
  8. 04 Mar, 2019 1 commit
  9. 12 Feb, 2019 1 commit
    • Dan Williams's avatar
      libnvdimm/pmem: Honor force_raw for legacy pmem regions · fa7d2e63
      Dan Williams authored
      For recovery, where non-dax access is needed to a given physical address
      range, and testing, allow the 'force_raw' attribute to override the
      default establishment of a dev_pagemap.
      Otherwise without this capability it is possible to end up with a
      namespace that can not be activated due to corrupted info-block, and one
      that can not be repaired due to a section collision.
      Cc: <stable@vger.kernel.org>
      Fixes: 004f1afb
       ("libnvdimm, pmem: direct map legacy pmem by default")
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
  10. 03 Feb, 2019 1 commit
  11. 10 Dec, 2018 1 commit
  12. 02 Oct, 2018 1 commit
  13. 25 Jul, 2018 1 commit
  14. 14 Jul, 2018 1 commit
  15. 07 Apr, 2018 1 commit
    • Dan Williams's avatar
      libnvdimm, namespace: use a safe lookup for dimm device name · 4f867220
      Dan Williams authored
      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: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
  16. 06 Mar, 2018 1 commit
  17. 03 Feb, 2018 1 commit
  18. 07 Oct, 2017 1 commit
  19. 28 Sep, 2017 1 commit
  20. 19 Sep, 2017 1 commit
    • Dan Williams's avatar
      libnvdimm, namespace: fix btt claim class crash · 33a56086
      Dan Williams authored
      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;
          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: default avatarMaurice A. Saldivar <maurice.a.saldivar@hpe.com>
      Tested-by: default avatarMaurice A. Saldivar <maurice.a.saldivar@hpe.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
  21. 12 Aug, 2017 1 commit
  22. 29 Jun, 2017 1 commit
  23. 27 Jun, 2017 2 commits
    • Dan Williams's avatar
      libnvdimm, nfit: enable support for volatile ranges · c9e582aa
      Dan Williams authored
      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: default avatarDan Williams <dan.j.williams@intel.com>
    • Dan Williams's avatar
      x86, libnvdimm, pmem: remove global pmem api · ca6a4657
      Dan Williams authored
      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
      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: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
  24. 15 Jun, 2017 5 commits
  25. 04 May, 2017 2 commits
  26. 01 Mar, 2017 1 commit
    • Dan Williams's avatar
      nfit, libnvdimm: fix interleave set cookie calculation · 86ef58a4
      Dan Williams authored
      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
      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
          1/ platforms with namespace-label capable NVDIMMs are not widely
          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: default avatarNicholas Moulin <nicholas.w.moulin@linux.intel.com>
      Tested-by: default avatarNicholas Moulin <nicholas.w.moulin@linux.intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
  27. 01 Feb, 2017 2 commits
    • Dan Williams's avatar
      libnvdimm, namespace: do not delete namespace-id 0 · 9d032f42
      Dan Williams authored
      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
          # ndctl create-namespace --reconfig=namespace1.0 --mode=memory --force
      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: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    • Bhumika Goyal's avatar
      nvdimm: constify device_type structures · 970d14e3
      Bhumika Goyal authored
      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: default avatarBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
  28. 13 Jan, 2017 1 commit
  29. 16 Dec, 2016 1 commit
  30. 04 Dec, 2016 1 commit
  31. 28 Nov, 2016 1 commit
  32. 19 Oct, 2016 1 commit