1. 27 5月, 2020 9 次提交
    • M
      nvme: introduce NVME_NS_METADATA_SUPPORTED flag · b29f8485
      Max Gurtovoy 提交于
      This is a preparation for adding support for metadata in fabric
      controllers. New flag will imply that NVMe namespace supports getting
      metadata that was originally generated by host's block layer.
      Signed-off-by: NMax Gurtovoy <maxg@mellanox.com>
      Reviewed-by: NIsrael Rukshin <israelr@mellanox.com>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NJames Smart <james.smart@broadcom.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      b29f8485
    • M
      nvme: introduce namespace features flag · ffc89b1d
      Max Gurtovoy 提交于
      Replace the specific ext boolean (that implies on extended LBA format)
      with a feature in the new namespace features flag. This is a preparation
      for adding more namespace features (such as metadata specific features).
      Signed-off-by: NMax Gurtovoy <maxg@mellanox.com>
      Reviewed-by: NIsrael Rukshin <israelr@mellanox.com>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NJames Smart <james.smart@broadcom.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      ffc89b1d
    • D
      nvme: delete an unnecessary declaration · ec0862ac
      Dan Carpenter 提交于
      The nvme_put_ctrl() is implemented earlier as an inline function so
      this declaration isn't required.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Reviewed-by: NChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      ec0862ac
    • G
      nvme: replace zero-length array with flexible-array · f1e71d75
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      sizeof(flexible-array-member) triggers a warning because flexible array
      members have incomplete type[1]. There are some instances of code in
      which the sizeof operator is being incorrectly/erroneously applied to
      zero-length arrays and the result is zero. Such instances may be hiding
      some bugs. So, this work (flexible-array member conversions) will also
      help to get completely rid of those sorts of issues.
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      f1e71d75
    • D
      nvme: fix io_opt limit setting · 68ab60ca
      Damien Le Moal 提交于
      Currently, a namespace io_opt queue limit is set by default to the
      physical sector size of the namespace and to the the write optimal
      size (NOWS) when the namespace reports optimal IO sizes. This causes
      problems with block limits stacking in blk_stack_limits() when a
      namespace block device is combined with an HDD which generally do not
      report any optimal transfer size (io_opt limit is 0). The code:
      
      /* Optimal I/O a multiple of the physical block size? */
      if (t->io_opt & (t->physical_block_size - 1)) {
      	t->io_opt = 0;
      	t->misaligned = 1;
      	ret = -1;
      }
      
      in blk_stack_limits() results in an error return for this function when
      the combined devices have different but compatible physical sector
      sizes (e.g. 512B sector SSD with 4KB sector disks).
      
      Fix this by not setting the optimal IO size queue limit if the namespace
      does not report an optimal write size value.
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Reviewed-by: NBart van Assche <bvanassche@acm.org>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      68ab60ca
    • W
      nvme: disable streams when get stream params failed · 84e4c204
      Wu Bo 提交于
      Disable streams again if getting the stream params fails.
      Signed-off-by: NWu Bo <wubo40@huawei.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      84e4c204
    • M
      nvme-fc: print proper nvme-fc devloss_tmo value · 614fc1c0
      Martin George 提交于
      The nvme-fc devloss_tmo is computed as the min of either the
      ctrl_loss_tmo (max_retries * reconnect_delay) or the remote port's
      devloss_tmo. But what gets printed as the nvme-fc devloss_tmo in
      nvme_fc_reconnect_or_delete() is always the remote port's devloss_tmo
      value. So correct this by printing the min value instead.
      Signed-off-by: NMartin George <marting@netapp.com>
      Reviewed-by: NJames Smart <james.smart@broadcom.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      614fc1c0
    • W
      nvme-pci: make sure write/poll_queues less or equal then cpu count · 9c9e76d5
      Weiping Zhang 提交于
      Check module parameter write/poll_queues before using it to catch
      too large values.
      
      Reproducer:
      
      modprobe -r nvme
      modprobe nvme write_queues=`nproc`
      echo $((`nproc`+1)) > /sys/module/nvme/parameters/write_queues
      echo 1 > /sys/block/nvme0n1/device/reset_controller
      
      [  657.069000] ------------[ cut here ]------------
      [  657.069022] WARNING: CPU: 10 PID: 1163 at kernel/irq/affinity.c:390 irq_create_affinity_masks+0x47c/0x4a0
      [  657.069056]  dm_region_hash dm_log dm_mod
      [  657.069059] CPU: 10 PID: 1163 Comm: kworker/u193:9 Kdump: loaded Tainted: G        W         5.6.0+ #8
      [  657.069060] Hardware name: Inspur SA5212M5/YZMB-00882-104, BIOS 4.0.9 08/27/2019
      [  657.069064] Workqueue: nvme-reset-wq nvme_reset_work [nvme]
      [  657.069066] RIP: 0010:irq_create_affinity_masks+0x47c/0x4a0
      [  657.069067] Code: fe ff ff 48 c7 c0 b0 89 14 95 48 89 46 20 e9 e9 fb ff ff 31 c0 e9 90 fc ff ff 0f 0b 48 c7 44 24 08 00 00 00 00 e9 e9 fc ff ff <0f> 0b e9 87 fe ff ff 48 8b 7c 24 28 e8 33 a0 80 00 e9 b6 fc ff ff
      [  657.069068] RSP: 0018:ffffb505ce1ffc78 EFLAGS: 00010202
      [  657.069069] RAX: 0000000000000060 RBX: ffff9b97921fe5c0 RCX: 0000000000000000
      [  657.069069] RDX: ffff9b67bad80000 RSI: 00000000ffffffa0 RDI: 0000000000000000
      [  657.069070] RBP: 0000000000000000 R08: 0000000000000000 R09: ffff9b97921fe718
      [  657.069070] R10: ffff9b97921fe710 R11: 0000000000000001 R12: 0000000000000064
      [  657.069070] R13: 0000000000000060 R14: 0000000000000000 R15: 0000000000000001
      [  657.069071] FS:  0000000000000000(0000) GS:ffff9b67c0880000(0000) knlGS:0000000000000000
      [  657.069072] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  657.069072] CR2: 0000559eac6fc238 CR3: 000000057860a002 CR4: 00000000007606e0
      [  657.069073] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  657.069073] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  657.069073] PKRU: 55555554
      [  657.069074] Call Trace:
      [  657.069080]  __pci_enable_msix_range+0x233/0x5a0
      [  657.069085]  ? kernfs_put+0xec/0x190
      [  657.069086]  pci_alloc_irq_vectors_affinity+0xbb/0x130
      [  657.069089]  nvme_reset_work+0x6e6/0xeab [nvme]
      [  657.069093]  ? __switch_to_asm+0x34/0x70
      [  657.069094]  ? __switch_to_asm+0x40/0x70
      [  657.069095]  ? nvme_irq_check+0x30/0x30 [nvme]
      [  657.069098]  process_one_work+0x1a7/0x370
      [  657.069101]  worker_thread+0x1c9/0x380
      [  657.069102]  ? max_active_store+0x80/0x80
      [  657.069103]  kthread+0x112/0x130
      [  657.069104]  ? __kthread_parkme+0x70/0x70
      [  657.069105]  ret_from_fork+0x35/0x40
      [  657.069106] ---[ end trace f4f06b7d24513d06 ]---
      [  657.077110] nvme nvme0: 95/1/0 default/read/poll queues
      Signed-off-by: NWeiping Zhang <zhangweiping@didiglobal.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      9c9e76d5
    • S
      nvme-tcp: set MSG_SENDPAGE_NOTLAST with MSG_MORE when we have more to send · 5bb052d7
      Sagi Grimberg 提交于
      We can signal the stack that this is not the last page coming and the
      stack can build a larger tso segment, so go ahead and use it.
      Signed-off-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      5bb052d7
  2. 10 5月, 2020 31 次提交