<feed xmlns='http://www.w3.org/2005/Atom'>
<title>BMC/Intel-BMC/linux.git/drivers/nvme/target/core.c, branch dev-5.8</title>
<subtitle>Intel OpenBMC Linux kernel source tree (mirror)</subtitle>
<id>https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev-5.8</id>
<link rel='self' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev-5.8'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/'/>
<updated>2020-06-11T15:10:06+00:00</updated>
<entry>
<title>nvmet: fail outstanding host posted AEN req</title>
<updated>2020-06-11T15:10:06+00:00</updated>
<author>
<name>Chaitanya Kulkarni</name>
<email>chaitanya.kulkarni@wdc.com</email>
</author>
<published>2020-06-09T23:55:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=819f7b88b48fd2bce932cfe3a38bf8fcefbcabe7'/>
<id>urn:sha1:819f7b88b48fd2bce932cfe3a38bf8fcefbcabe7</id>
<content type='text'>
In function nvmet_async_event_process() we only process AENs iff
there is an open slot on the ctrl-&gt;async_event_cmds[] &amp;&amp; aen
event list posted by the target is not empty. This keeps host
posted AEN outstanding if target generated AEN list is empty.
We do cleanup the target generated entries from the aen list in
nvmet_ctrl_free()-&gt; nvmet_async_events_free() but we don't
process AEN posted by the host. This leads to following problem :-

When processing admin sq at the time of nvmet_sq_destroy() holds
an extra percpu reference(atomic value = 1), so in the following code
path after switching to atomic rcu, release function (nvmet_sq_free())
is not getting called which blocks the sq-&gt;free_done in
nvmet_sq_destroy() :-

nvmet_sq_destroy()
 percpu_ref_kill_and_confirm()
 - __percpu_ref_switch_mode()
 --  __percpu_ref_switch_to_atomic()
 ---   call_rcu() -&gt; percpu_ref_switch_to_atomic_rcu()
 ----     /* calls switch callback */
 - percpu_ref_put()
 -- percpu_ref_put_many(ref, 1)
 --- else if (unlikely(atomic_long_sub_and_test(nr, &amp;ref-&gt;count)))
 ----   ref-&gt;release(ref); &lt;---- Not called.

This results in indefinite hang:-

  void nvmet_sq_destroy(struct nvmet_sq *sq)
...
          if (ctrl &amp;&amp; ctrl-&gt;sqs &amp;&amp; ctrl-&gt;sqs[0] == sq) {
                  nvmet_async_events_process(ctrl, status);
                  percpu_ref_put(&amp;sq-&gt;ref);
          }
          percpu_ref_kill_and_confirm(&amp;sq-&gt;ref, nvmet_confirm_sq);
          wait_for_completion(&amp;sq-&gt;confirm_done);
          wait_for_completion(&amp;sq-&gt;free_done); &lt;-- Hang here

Which breaks the further disconnect sequence. This problem seems to be
introduced after commit 64f5e9cdd711b ("nvmet: fix memory leak when
removing namespaces and controllers concurrently").

This patch processes ctrl-&gt;async_event_cmds[] in the admin sq destroy()
context irrespetive of aen_list. Also we get rid of the controller's
aen_list processing in the nvmet_sq_destroy() context and just ignore
ctrl-&gt;aen_list.

This results in nvmet_async_events_process() being called from workqueue
context so we adjust the code accordingly.

Fixes: 64f5e9cdd711 ("nvmet: fix memory leak when removing namespaces and controllers concurrently ")
Signed-off-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>nvmet: cleanups the loop in nvmet_async_events_process</title>
<updated>2020-05-27T05:12:40+00:00</updated>
<author>
<name>David Milburn</name>
<email>dmilburn@redhat.com</email>
</author>
<published>2020-05-18T18:59:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=1cdf9f7670a7d74e27177d5c390c2f8b3b9ba338'/>
<id>urn:sha1:1cdf9f7670a7d74e27177d5c390c2f8b3b9ba338</id>
<content type='text'>
Based-on-a-patch-by: Christoph Hellwig &lt;hch@infradead.org&gt;
Tested-by: Yi Zhang &lt;yi.zhang@redhat.com&gt;
Signed-off-by: David Milburn &lt;dmilburn@redhat.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: fix memory leak when removing namespaces and controllers concurrently</title>
<updated>2020-05-27T05:12:40+00:00</updated>
<author>
<name>Sagi Grimberg</name>
<email>sagi@grimberg.me</email>
</author>
<published>2020-05-20T19:48:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=64f5e9cdd711b030b05062c17b2ecfbce890cf4c'/>
<id>urn:sha1:64f5e9cdd711b030b05062c17b2ecfbce890cf4c</id>
<content type='text'>
When removing a namespace, we add an NS_CHANGE async event, however if
the controller admin queue is removed after the event was added but not
yet processed, we won't free the aens, resulting in the below memory
leak [1].

Fix that by moving nvmet_async_event_free to the final controller
release after it is detached from subsys-&gt;ctrls ensuring no async
events are added, and modify it to simply remove all pending aens.

--
$ cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff888c1af2c000 (size 32):
  comm "nvmetcli", pid 5164, jiffies 4295220864 (age 6829.924s)
  hex dump (first 32 bytes):
    28 01 82 3b 8b 88 ff ff 28 01 82 3b 8b 88 ff ff  (..;....(..;....
    02 00 04 65 76 65 6e 74 5f 66 69 6c 65 00 00 00  ...event_file...
  backtrace:
    [&lt;00000000217ae580&gt;] nvmet_add_async_event+0x57/0x290 [nvmet]
    [&lt;0000000012aa2ea9&gt;] nvmet_ns_changed+0x206/0x300 [nvmet]
    [&lt;00000000bb3fd52e&gt;] nvmet_ns_disable+0x367/0x4f0 [nvmet]
    [&lt;00000000e91ca9ec&gt;] nvmet_ns_free+0x15/0x180 [nvmet]
    [&lt;00000000a15deb52&gt;] config_item_release+0xf1/0x1c0
    [&lt;000000007e148432&gt;] configfs_rmdir+0x555/0x7c0
    [&lt;00000000f4506ea6&gt;] vfs_rmdir+0x142/0x3c0
    [&lt;0000000000acaaf0&gt;] do_rmdir+0x2b2/0x340
    [&lt;0000000034d1aa52&gt;] do_syscall_64+0xa5/0x4d0
    [&lt;00000000211f13bc&gt;] entry_SYSCALL_64_after_hwframe+0x6a/0xdf

Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
Reported-by: David Milburn &lt;dmilburn@redhat.com&gt;
Signed-off-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Tested-by: David Milburn &lt;dmilburn@redhat.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: add metadata support for block devices</title>
<updated>2020-05-27T05:12:40+00:00</updated>
<author>
<name>Israel Rukshin</name>
<email>israelr@mellanox.com</email>
</author>
<published>2020-05-19T14:06:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=c6e3f13398123a008cd2ee28f93510b113a32791'/>
<id>urn:sha1:c6e3f13398123a008cd2ee28f93510b113a32791</id>
<content type='text'>
Allocate the metadata SGL buffers and set metadata fields for the
request. Then create a block IO request for the metadata from the
protection SG list.

Signed-off-by: Israel Rukshin &lt;israelr@mellanox.com&gt;
Signed-off-by: Max Gurtovoy &lt;maxg@mellanox.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: add metadata/T10-PI support</title>
<updated>2020-05-27T05:12:40+00:00</updated>
<author>
<name>Israel Rukshin</name>
<email>israelr@mellanox.com</email>
</author>
<published>2020-05-19T14:06:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=ea52ac1c6605fbd25347fabf46233e260dd92eb2'/>
<id>urn:sha1:ea52ac1c6605fbd25347fabf46233e260dd92eb2</id>
<content type='text'>
Expose the namespace metadata format when PI is enabled. The user needs
to enable the capability per subsystem and per port. The other metadata
properties are taken from the namespace/bdev.

Usage example:
echo 1 &gt; /config/nvmet/subsystems/${NAME}/attr_pi_enable
echo 1 &gt; /config/nvmet/ports/${PORT_NUM}/param_pi_enable

Signed-off-by: Israel Rukshin &lt;israelr@mellanox.com&gt;
Signed-off-by: Max Gurtovoy &lt;maxg@mellanox.com&gt;
Reviewed-by: James Smart &lt;james.smart@broadcom.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: rename nvmet_check_data_len to nvmet_check_transfer_len</title>
<updated>2020-05-27T05:12:39+00:00</updated>
<author>
<name>Israel Rukshin</name>
<email>israelr@mellanox.com</email>
</author>
<published>2020-05-19T14:05:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=136cc1ffcf0a3309c59d844cb1a4ddad964ea3d8'/>
<id>urn:sha1:136cc1ffcf0a3309c59d844cb1a4ddad964ea3d8</id>
<content type='text'>
The function doesn't check only the data length, because the transfer
length includes also the metadata length in some cases. This is
preparation for adding metadata (T10-PI) support.

Signed-off-by: Israel Rukshin &lt;israelr@mellanox.com&gt;
Signed-off-by: Max Gurtovoy &lt;maxg@mellanox.com&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Reviewed-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Reviewed-by: James Smart &lt;james.smart@broadcom.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: generate AEN for ns revalidate size change</title>
<updated>2020-05-27T05:12:38+00:00</updated>
<author>
<name>Chaitanya Kulkarni</name>
<email>chaitanya.kulkarni@wdc.com</email>
</author>
<published>2020-05-19T08:06:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=de124f427347b0a1eb9708b1007251fc4c8a222f'/>
<id>urn:sha1:de124f427347b0a1eb9708b1007251fc4c8a222f</id>
<content type='text'>
The newly added function nvmet_ns_revalidate() does update the ns size
in the identify namespace in-core target data structure when host issues
id-ns command. This can lead to host having inconsistencies between size
of the namespace present in the id-ns command result and size of the
corresponding block device until host scans the namespaces explicitly.

To avoid this scenario generate AEN if old size is not same as the new
one in nvmet_ns_revalidate().

This will allow automatic AEN generation when host calls id-ns command
and also allows target to install userspace rules so that it can trigger
nvmet_ns_revalidate() (using configfs interface with the help of next
patch) resulting in appropriate AEN generation when underlying namespace
size change is detected.

Signed-off-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimbeg.me&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: add helper to revalidate bdev and file ns</title>
<updated>2020-05-27T05:12:38+00:00</updated>
<author>
<name>Chaitanya Kulkarni</name>
<email>chaitanya.kulkarni@wdc.com</email>
</author>
<published>2020-05-19T08:06:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=463c5fabb8dfca4941c4c50365bb7749ac5c9916'/>
<id>urn:sha1:463c5fabb8dfca4941c4c50365bb7749ac5c9916</id>
<content type='text'>
This patch adds a wrapper helper to indicate size change in the bdev &amp;
file-backed namespace when revalidating ns. This helper is needed in
order to minimize code repetition in the next patch for configfs.c and
existing admin-cmd.c.  

Signed-off-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimbeg.me&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: add async event tracing support</title>
<updated>2020-05-27T05:12:38+00:00</updated>
<author>
<name>Chaitanya Kulkarni</name>
<email>chaitanya.kulkarni@wdc.com</email>
</author>
<published>2020-05-19T08:06:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=696ece751366e7a02a81fa0228125fe25a47969d'/>
<id>urn:sha1:696ece751366e7a02a81fa0228125fe25a47969d</id>
<content type='text'>
This adds a new tracepoint for the target to trace async event. This is
helpful in debugging and comparing host and target side async events
especially when host is connected to different targets on different
machines and now that we rely on userspace components to generate AEN. 

Signed-off-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: make ctrl model configurable</title>
<updated>2020-03-04T17:09:08+00:00</updated>
<author>
<name>Mark Ruijter</name>
<email>MRuijter@onestopsystems.com</email>
</author>
<published>2020-01-30T18:29:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=013b7ebe5a0d70e2a02fd225174595e79c591b3e'/>
<id>urn:sha1:013b7ebe5a0d70e2a02fd225174595e79c591b3e</id>
<content type='text'>
This patch adds a new target subsys attribute which allows user to
optionally specify model name which then used in the
nvmet_execute_identify_ctrl() to fill up the nvme_id_ctrl structure.

The default value for the model is set to "Linux" for backward
compatibility.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Signed-off-by: Mark Ruijter &lt;MRuijter@onestopsystems.com&gt;
[chaitanya.kulkarni@wdc.com
 *Use macro for default model, coding style fixes.
 *Use RCU for accessing model in for configfs and in
  nvmet_execute_identify_ctrl().
]
Signed-off-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Signed-off-by: Keith Busch &lt;kbusch@kernel.org&gt;
</content>
</entry>
</feed>
