1. 01 6月, 2018 1 次提交
    • R
      linvdimm, pmem: Preserve read-only setting for pmem devices · 254a4cd5
      Robert Elliott 提交于
      The pmem driver does not honor a forced read-only setting for very long:
      	$ blockdev --setro /dev/pmem0
      	$ blockdev --getro /dev/pmem0
      	1
      
      followed by various commands like these:
      	$ blockdev --rereadpt /dev/pmem0
      	or
      	$ mkfs.ext4 /dev/pmem0
      
      results in this in the kernel serial log:
      	 nd_pmem namespace0.0: region0 read-write, marking pmem0 read-write
      
      with the read-only setting lost:
      	$ blockdev --getro /dev/pmem0
      	0
      
      That's from bus.c nvdimm_revalidate_disk(), which always applies the
      setting from nd_region (which is initially based on the ACPI NFIT
      NVDIMM state flags not_armed bit).
      
      In contrast, commit 20bd1d02 ("scsi: sd: Keep disk read-only when
      re-reading partition") fixed this issue for SCSI devices to preserve
      the previous setting if it was set to read-only.
      
      This patch modifies bus.c to preserve any previous read-only setting.
      It also eliminates the kernel serial log print except for cases where
      read-write is changed to read-only, so it doesn't print read-only to
      read-only non-changes.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 58138820 ("libnvdimm, nfit: handle unarmed dimms, mark namespaces read-only")
      Signed-off-by: NRobert Elliott <elliott@hpe.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      254a4cd5
  2. 20 4月, 2018 2 次提交
  3. 16 4月, 2018 1 次提交
    • D
      libnvdimm, dimm: handle EACCES failures from label reads · e7c5a571
      Dan Williams 提交于
      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: NDan Williams <dan.j.williams@intel.com>
      e7c5a571
  4. 10 4月, 2018 1 次提交
    • D
      libnvdimm, of_pmem: workaround OF_NUMA=n build error · 291717b6
      Dan Williams 提交于
      Stephen reports that an x86 allmodconfig build fails to build the
      of_pmem driver due to a missing definition of of_node_to_nid(). That
      helper is currently only exported in the OF_NUMA=y case. In other cases,
      ppc and sparc, it is a weak symbol, and outside of those platforms it is
      a static inline.
      
      Until an OF_NUMA=n configuration can reliably support usage of
      of_node_to_nid() in modules across architectures, mark this driver as
      'bool' instead of 'tristate'.
      
      Cc: Rob Herring <robh@kernel.org>
      Cc: Oliver O'Halloran <oohall@gmail.com>
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      291717b6
  5. 07 4月, 2018 5 次提交
  6. 04 4月, 2018 1 次提交
  7. 03 4月, 2018 1 次提交
  8. 22 3月, 2018 2 次提交
    • D
      libnvdimm, nfit: fix persistence domain reporting · fe9a552e
      Dan Williams 提交于
      The persistence domain is a point in the platform where once writes
      reach that destination the platform claims it will make them persistent
      relative to power loss. In the ACPI NFIT this is currently communicated
      as 2 bits in the "NFIT - Platform Capabilities Structure". The bits
      comprise a hierarchy, i.e. bit0 "CPU Cache Flush to NVDIMM Durability on
      Power Loss Capable" implies bit1 "Memory Controller Flush to NVDIMM
      Durability on Power Loss Capable".
      
      Commit 96c3a239 "libnvdimm: expose platform persistence attr..."
      shows the persistence domain as flags, but it's really an enumerated
      hierarchy.
      
      Fix this newly introduced user ABI to show the closest available
      persistence domain before userspace develops dependencies on seeing, or
      needing to develop code to tolerate, the raw NFIT flags communicated
      through the libnvdimm-generic region attribute.
      
      Fixes: 96c3a239 ("libnvdimm: expose platform persistence attr...")
      Reviewed-by: NDave Jiang <dave.jiang@intel.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      fe9a552e
    • D
      libnvdimm, region: hide persistence_domain when unknown · 896196dc
      Dan Williams 提交于
      Similar to other region attributes, do not emit the persistence_domain
      attribute if its contents are empty.
      
      Fixes: 96c3a239 ("libnvdimm: expose platform persistence attr...")
      Cc: Dave Jiang <dave.jiang@intel.com>
      Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      896196dc
  9. 18 3月, 2018 1 次提交
    • B
      block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into <linux/blkdev.h> · 233bde21
      Bart Van Assche 提交于
      It happens often while I'm preparing a patch for a block driver that
      I'm wondering: is a definition of SECTOR_SIZE and/or SECTOR_SHIFT
      available for this driver? Do I have to introduce definitions of these
      constants before I can use these constants? To avoid this confusion,
      move the existing definitions of SECTOR_SIZE and SECTOR_SHIFT into the
      <linux/blkdev.h> header file such that these become available for all
      block drivers. Make the SECTOR_SIZE definition in the uapi msdos_fs.h
      header file conditional to avoid that including that header file after
      <linux/blkdev.h> causes the compiler to complain about a SECTOR_SIZE
      redefinition.
      
      Note: the SECTOR_SIZE / SECTOR_SHIFT / SECTOR_BITS definitions have
      not been removed from uapi header files nor from NAND drivers in
      which these constants are used for another purpose than converting
      block layer offsets and sizes into a number of sectors.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Reviewed-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NBart Van Assche <bart.vanassche@wdc.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      233bde21
  10. 16 3月, 2018 2 次提交
  11. 15 3月, 2018 1 次提交
  12. 14 3月, 2018 1 次提交
  13. 09 3月, 2018 1 次提交
  14. 08 3月, 2018 1 次提交
  15. 07 3月, 2018 1 次提交
  16. 03 3月, 2018 1 次提交
    • D
      libnvdimm: re-enable deep flush for pmem devices via fsync() · 5fdf8e5b
      Dave Jiang 提交于
      Re-enable deep flush so that users always have a way to be sure that a
      write makes it all the way out to media. Writes from the PMEM driver
      always arrive at the NVDIMM since movnt is used to bypass the cache, and
      the driver relies on the ADR (Asynchronous DRAM Refresh) mechanism to
      flush write buffers on power failure. The Deep Flush mechanism is there
      to explicitly write buffers to protect against (rare) ADR failure.  This
      change prevents a regression in deep flush behavior so that applications
      can continue to depend on fsync() as a mechanism to trigger deep flush
      in the filesystem-DAX case.
      
      Fixes: 06e8ccda ("acpi: nfit: Add support for detect platform CPU cache...")
      Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      5fdf8e5b
  17. 01 3月, 2018 1 次提交
  18. 03 2月, 2018 1 次提交
  19. 02 2月, 2018 2 次提交
  20. 20 1月, 2018 1 次提交
    • J
      libnvdimm, btt: fix uninitialized err_lock · d08cd5e0
      Jeff Moyer 提交于
      When a sector mode namespace is initially created, the arena's err_lock
      is not initialized.  If, on the other hand, the namespace already
      exists, the mutex is initialized.  To fix the issue, I moved the mutex
      initialization into the arena_alloc, which is called by both
      discover_arenas and create_arenas.
      
      This was discovered on an older kernel where mutex_trylock checks the
      count to determine whether the lock is held.  Because the data structure
      is kzalloc-d, that count was 0 (held), and I/O to the device would hang
      forever waiting for the lock to be released (see btt_write_pg, for
      example).  Current kernels have a different mutex implementation that
      checks for a non-null owner, and so this doesn't show up as a problem.
      If that lock were ever contended, it might cause issues, but you'd have
      to be really unlucky, I think.
      Signed-off-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      d08cd5e0
  21. 09 1月, 2018 1 次提交
  22. 22 12月, 2017 2 次提交
  23. 20 12月, 2017 2 次提交
    • D
      libnvdimm, dax: fix 1GB-aligned namespaces vs physical misalignment · 41fce90f
      Dan Williams 提交于
      The following namespace configuration attempt:
      
          # ndctl create-namespace -e namespace0.0 -m devdax -a 1G -f
          libndctl: ndctl_dax_enable: dax0.1: failed to enable
            Error: namespace0.0: failed to enable
      
          failed to reconfigure namespace: No such device or address
      
      ...fails when the backing memory range is not physically aligned to 1G:
      
          # cat /proc/iomem | grep Persistent
          210000000-30fffffff : Persistent Memory (legacy)
      
      In the above example the 4G persistent memory range starts and ends on a
      256MB boundary.
      
      We handle this case correctly when needing to handle cases that violate
      section alignment (128MB) collisions against "System RAM", and we simply
      need to extend that padding/truncation for the 1GB alignment use case.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 315c5625 ("libnvdimm, pfn: add 'align' attribute...")
      Reported-and-tested-by: NJane Chu <jane.chu@oracle.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      41fce90f
    • D
      libnvdimm, pfn: fix start_pad handling for aligned namespaces · 19deaa21
      Dan Williams 提交于
      The alignment checks at pfn driver startup fail to properly account for
      the 'start_pad' in the case where the namespace is misaligned relative
      to its internal alignment. This is typically triggered in 1G aligned
      namespace, but could theoretically trigger with small namespace
      alignments. When this triggers the kernel reports messages of the form:
      
          dax2.1: bad offset: 0x3c000000 dax disabled align: 0x40000000
      
      Cc: <stable@vger.kernel.org>
      Fixes: 1ee6667c ("libnvdimm, pfn, dax: fix initialization vs autodetect...")
      Reported-by: NJane Chu <jane.chu@oracle.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      19deaa21
  24. 05 12月, 2017 1 次提交
    • D
      nfit, libnvdimm: deprecate the generic SMART ioctl · cdd77d3e
      Dan Williams 提交于
      The kernel's ND_IOCTL_SMART_THRESHOLD command is based on a payload
      definition that has become broken / out-of-sync with recent versions of
      the NVDIMM_FAMILY_INTEL definition. Deprecate the use of the
      ND_IOCTL_SMART_THRESHOLD command in favor of the ND_CMD_CALL approach
      taken by NVDIMM_FAMILY_{HPE,MSFT}, where we can manage the per-vendor
      variance in userspace.
      
      In a couple years, when the new scheme is widely deployed in userspace
      packages, the ND_IOCTL_SMART_THRESHOLD support can be removed. For now
      we prevent new binaries from compiling against the kernel header
      definitions, but kernel still compatible with old binaries. The
      libndctl.h [1] header is now the authoritative interface definition for
      NVDIMM SMART.
      
      [1]: https://github.com/pmem/ndctlSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      cdd77d3e
  25. 16 11月, 2017 1 次提交
  26. 03 11月, 2017 2 次提交
  27. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  28. 12 10月, 2017 1 次提交
  29. 08 10月, 2017 1 次提交