1. 17 Mar, 2020 2 commits
  2. 19 Nov, 2019 1 commit
  3. 17 Nov, 2019 1 commit
  4. 29 Aug, 2019 3 commits
  5. 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
      87a30e1f
  6. 05 Jun, 2019 1 commit
  7. 09 Apr, 2019 1 commit
    • Sakari Ailus's avatar
      treewide: Switch printk users from %pf and %pF to %ps and %pS, respectively · d75f773c
      Sakari Ailus authored
      %pF and %pf are functionally equivalent to %pS and %ps conversion
      specifiers. The former are deprecated, therefore switch the current users
      to use the preferred variant.
      
      The changes have been produced by the following command:
      
      	git grep -l '%p[fF]' | grep -v '^\(tools\|Documentation\)/' | \
      	while read i; do perl -i -pe 's/%pf/%ps/g; s/%pF/%pS/g;' $i; done
      
      And verifying the result.
      
      Link: http://lkml.kernel.org/r/20190325193229.23390-1-sakari.ailus@linux.intel.com
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: sparclinux@vger.kernel.org
      Cc: linux-um@lists.infradead.org
      Cc: xen-devel@lists.xenproject.org
      Cc: linux-acpi@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: drbd-dev@lists.linbit.com
      Cc: linux-block@vger.kernel.org
      Cc: linux-mmc@vger.kernel.org
      Cc: linux-nvdimm@lists.01.org
      Cc: linux-pci@vger.kernel.org
      Cc: linux-scsi@vger.kernel.org
      Cc: linux-btrfs@vger.kernel.org
      C...
      d75f773c
  8. 03 Feb, 2019 1 commit
  9. 21 Jan, 2019 1 commit
    • Dan Williams's avatar
      libnvdimm/security: Require nvdimm_security_setup_events() to succeed · 1cd73865
      Dan Williams authored
      The following warning:
      
          ACPI0012:00: security event setup failed: -19
      
      ...is meant to capture exceptional failures of sysfs_get_dirent(),
      however it will also fail in the common case when security support is
      disabled. A few issues:
      
      1/ A dev_warn() report for a common case is too chatty
      2/ The setup of this notifier is generic, no need for it to be driven
         from the nfit driver, it can exist completely in the core.
      3/ If it fails for any reason besides security support being disabled,
         that's fatal and should abort DIMM activation. Userspace may hang if
         it never gets overwrite notifications.
      4/ The dirent needs to be released.
      
      Move the call to the core 'dimm' driver, make it conditional on security
      support being active, make it fatal for the exceptional case, add the
      missing sysfs_put() at device disable time.
      
      Fixes: 7d988097
      
       ("...Add security DSM overwrite support")
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      1cd73865
  10. 21 Dec, 2018 6 commits
  11. 14 Dec, 2018 3 commits
  12. 12 Oct, 2018 1 commit
    • Alexander Duyck's avatar
      nvdimm: Split label init out from the logic for getting config data · 2d657d17
      Alexander Duyck authored
      
      
      This patch splits the initialization of the label data into two functions.
      One for doing the init, and another for reading the actual configuration
      data. The idea behind this is that by doing this we create a symmetry
      between the getting and setting of config data in that we have a function
      for both. In addition it will make it easier for us to identify the bits
      that are related to init versus the pieces that are a wrapper for reading
      data from the ACPI interface.
      
      So for example by splitting things out like this it becomes much more
      obvious that we were performing checks that weren't necessarily related to
      the set/get operations such as relying on ndd->data being present when the
      set and get ops should not care about a locally cached copy of the label
      area.
      Reviewed-by: default avatarToshi Kani <toshi.kani@hpe.com>
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      2d657d17
  13. 11 Oct, 2018 1 commit
    • Dan Williams's avatar
      libnvdimm, dimm: Maximize label transfer size · d11cf4a7
      Dan Williams authored
      
      
      Use kvzalloc() to bypass the arbitrary PAGE_SIZE limit of label transfer
      operations. Given the expense of calling into firmware, maximize the
      amount of label data we transfer per call to be up to the total label
      space if allowed by the firmware.
      
      Instead of limiting based on PAGE_SIZE we can instead simply limit the
      maximum size based on either the config_size int he case of the get
      operation, or the length of the write based on the set operation.
      
      On a system with 24 NVDIMM modules each with a config_size of 128K and a
      maximum transfer size of 64K - 4, this patch reduces the init time for the
      label data from around 24 seconds down to between 4-5 seconds.
      Reviewed-by: default avatarToshi Kani <toshi.kani@hpe.com>
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      d11cf4a7
  14. 25 Jul, 2018 1 commit
  15. 16 Apr, 2018 1 commit
    • Dan Williams's avatar
      libnvdimm, dimm: handle EACCES failures from label reads · e7c5a571
      Dan Williams authored
      The new support for the standard _LSR and _LSW methods neglected to also
      update the nvdimm_init_config_data() and nvdimm_set_config_data() to
      return the translated error code from failed commands. This precision is
      necessary because the locked status that was previously returned on
      ND_CMD_GET_CONFIG_SIZE commands is now returned on
      ND_CMD_{GET,SET}_CONFIG_DATA commands.
      
      If the kernel misses this indication it can inadvertently fall back to
      label-less mode when it should otherwise avoid all access to locked
      regions.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 4b27db7e
      
       ("acpi, nfit: add support for the _LSI, _LSR, and...")
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      e7c5a571
  16. 06 Mar, 2018 1 commit
  17. 07 Oct, 2017 1 commit
    • Dan Williams's avatar
      libnvdimm: introduce 'flags' attribute for DIMM 'lock' and 'alias' status · efbf6f50
      Dan Williams authored
      
      
      Given that we now how have two mechanisms for a DIMM to indicate that it
      is locked:
      
          * NVDIMM_FAMILY_INTEL 'get_config_size' _DSM command
      
          * ACPI 6.2 Label Storage Read / Write commands
      
      ...export the generic libnvdimm DIMM status in a new 'flags' attribute.
      
      This attribute can also reflect the 'alias' state which indicates
      whether the nvdimm core is enforcing labels for aliased-region-capacity
      that the given dimm is an interleave-set member.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      efbf6f50
  18. 28 Sep, 2017 1 commit
  19. 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>
      c9e582aa
    • 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
      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: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      ca6a4657
  20. 09 May, 2017 1 commit
    • Michal Hocko's avatar
      treewide: use kv[mz]alloc* rather than opencoded variants · 752ade68
      Michal Hocko authored
      There are many code paths opencoding kvmalloc.  Let's use the helper
      instead.  The main difference to kvmalloc is that those users are
      usually not considering all the aspects of the memory allocator.  E.g.
      allocation requests <= 32kB (with 4kB pages) are basically never failing
      and invoke OOM killer to satisfy the allocation.  This sounds too
      disruptive for something that has a reasonable fallback - the vmalloc.
      On the other hand those requests might fallback to vmalloc even when the
      memory allocator would succeed after several more reclaim/compaction
      attempts previously.  There is no guarantee something like that happens
      though.
      
      This patch converts many of those places to kv[mz]alloc* helpers because
      they are more conservative.
      
      Link: http://lkml.kernel.org/r/20170306103327.2766-2-mhocko@kernel.org
      
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> # Xen bits
      Acked-by: Kees Cook <keescook@chrom...
      752ade68
  21. 04 May, 2017 2 commits
  22. 04 Apr, 2017 1 commit
    • Dan Williams's avatar
      libnvdimm: fix blk free space accounting · fe514739
      Dan Williams authored
      Commit a1f3e4d6 "libnvdimm, region: update nd_region_available_dpa()
      for multi-pmem support" reworked blk dpa (DIMM Physical Address)
      accounting to comprehend multiple pmem namespace allocations aliasing
      with a given blk-dpa range.
      
      The following call trace is a result of failing to account for allocated
      blk capacity.
      
       WARNING: CPU: 1 PID: 2433 at tools/testing/nvdimm/../../../drivers/nvdimm/names
      4 size_store+0x6f3/0x930 [libnvdimm]
       nd_region region5: allocation underrun: 0x0 of 0x1000000 bytes
       [..]
       Call Trace:
        dump_stack+0x86/0xc3
        __warn+0xcb/0xf0
        warn_slowpath_fmt+0x5f/0x80
        size_store+0x6f3/0x930 [libnvdimm]
        dev_attr_store+0x18/0x30
      
      If a given blk-dpa allocation does not alias with any pmem ranges then
      the full allocation should be accounted as busy space, not the size of
      the current pmem contribution to the region.
      
      The thinkos that led to this confusion was not realizing that the struct
      resource management is already guaranteeing no collisions between pmem
      allocations and blk allocations on the same dimm. Also, we do not try to
      support blk allocations in aliased pmem holes.
      
      This patch also fixes a case where the available blk goes negative.
      
      Cc: <stable@vger.kernel.org>
      Fixes: a1f3e4d6
      
       ("libnvdimm, region: update nd_region_available_dpa() for multi-pmem support").
      Reported-by: default avatarDariusz Dokupil <dariusz.dokupil@intel.com>
      Reported-by: default avatarDave Jiang <dave.jiang@intel.com>
      Reported-by: default avatarVishal Verma <vishal.l.verma@intel.com>
      Tested-by: default avatarDave Jiang <dave.jiang@intel.com>
      Tested-by: default avatarVishal Verma <vishal.l.verma@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      fe514739
  23. 19 Oct, 2016 1 commit
    • Dan Williams's avatar
      libnvdimm: allow a platform to force enable label support · 42237e39
      Dan Williams authored
      
      
      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: <qemu-devel@nongnu.org>
      Cc: Haozhong Zhang <haozhong.zhang@intel.com>
      Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      42237e39
  24. 07 Oct, 2016 2 commits
    • Dan Williams's avatar
      libnvdimm, namespace: enable allocation of multiple pmem namespaces · 762d067d
      Dan Williams authored
      
      
      Now that we have nd_region_available_dpa() able to handle the presence
      of multiple PMEM allocations in aliased PMEM regions, reuse that same
      infrastructure to track allocations from free space.  In particular
      handle allocating from an aliased PMEM region in the case where there
      are dis-contiguous holes.  The allocation for BLK and PMEM are
      documented in the space_valid() helper:
      
          BLK-space is valid as long as it does not precede a PMEM
          allocation in a given region. PMEM-space must be contiguous
          and adjacent to an existing existing allocation (if one
          exists).
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      762d067d
    • Dan Williams's avatar
      libnvdimm, region: update nd_region_available_dpa() for multi-pmem support · a1f3e4d6
      Dan Williams authored
      
      
      The free dpa (dimm-physical-address) space calculation reports how much
      free space is available with consideration for aliased BLK + PMEM
      regions.  Recall that BLK capacity is allocated from high addresses and
      PMEM is allocated from low addresses in their respective regions.
      
      nd_region_available_dpa() accounts for the fact that the largest
      encroachment (lowest starting address) into PMEM capacity by a BLK
      allocation limits the available capacity to that point, regardless if
      there is BLK allocation hole at a higher address.  Similarly, for the
      multi-pmem case we need to track the largest encroachment (highest
       ending address) of a PMEM allocation in BLK capacity regardless of
      whether there is an allocation hole that a BLK allocation could fill at
      a lower address.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      a1f3e4d6
  25. 02 Sep, 2016 1 commit
  26. 29 Aug, 2016 1 commit
  27. 11 Jul, 2016 1 commit
    • Dan Williams's avatar
      libnvdimm, nfit: move flush hint mapping to region-device driver-data · e5ae3b25
      Dan Williams authored
      
      
      In preparation for triggering flushes of a DIMM's writes-posted-queue
      (WPQ) via the pmem driver move mapping of flush hint addresses to the
      region driver.  Since this uses devm_nvdimm_memremap() the flush
      addresses will remain mapped while any region to which the dimm belongs
      is active.
      
      We need to communicate more information to the nvdimm core to facilitate
      this mapping, namely each dimm object now carries an array of flush hint
      address resources.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      e5ae3b25