[PATCH v2] nvmet: add support reading with offset from ANA log

Daniel Wagner dwagner at suse.de
Wed Jan 19 00:58:55 PST 2022


Hi Chaitanya,

On Wed, Jan 19, 2022 at 07:43:07AM +0000, Chaitanya Kulkarni wrote:
> I'm not against having this code but do you really have
> a client side usecase for this one that you can please
> explain ?
>
> Existing code should work fine to read the log pages and I've
> not received any complaints so far ..

All started with this call trace:

nvme nvme17: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 100.102.252.12:8009
nvme: page allocation failure: order:7, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0-1
CPU: 1 PID: 96790 Comm: nvme Kdump: loaded Tainted: G           OE  X    5.3.18-59.27-default #1 SLE15-SP3
Call Trace:
 dump_stack+0x66/0x8b
 warn_alloc+0x10b/0x190
 ? __alloc_pages_direct_compact+0x15e/0x170
 __alloc_pages_slowpath+0xcea/0xd20
 __alloc_pages_nodemask+0x2cb/0x320
 kmalloc_order+0x18/0x70
 kmalloc_order_trace+0x1d/0xa0
 __kmalloc+0x257/0x2b0
 nvme_mpath_init_identify+0xe5/0x190 [nvme_core]
 ? blk_queue_write_cache+0x30/0x60
 nvme_init_ctrl_finish+0x340/0xde0 [nvme_core]
 ? blk_mq_run_hw_queue+0x77/0x100
 nvme_tcp_setup_ctrl+0x396/0x680 [nvme_tcp]
 nvme_tcp_create_ctrl+0x31e/0x3c7 [nvme_tcp]
 nvmf_dev_write+0xb04/0xd70 [nvme_fabrics]
 ? common_file_perm+0x64/0x190
 ? vfs_write+0xad/0x1b0
 vfs_write+0xad/0x1b0
 ksys_write+0xa1/0xe0
 do_syscall_64+0x5b/0x1e0
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7fb44848bc30

The target says it support 49 ANA Group Descriptors and 65536
namespaces. The current code in Linux is allocating an ANA buffer large
enough to read the complete ANA log in one operation.

With the above numbers the buffer is

  16 + 16 * 49 + 65365 * 4 = 262260 bytes

large, ca 64.028 4k pages. This means when allocating the buffer, the
smallest bucket to allocated from is the 128kB (2^7).

So my idea was to limit the ana log buffer and read the it in chunks if
needed.

Anyway, I started with replicating the situation and found out that the
target code does not support reads with offsets hence this patch.

Daniel



More information about the Linux-nvme mailing list