Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Xixin Liu <liuxixin@kylinos.cn>
To: linux-nvme@lists.infradead.org
Cc: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	hare@suse.de, shinichiro.kawasaki@wdc.com, liuxixin@kylinos.cn
Subject: Re: blktests nvme/062 lockdep — defer TLS inline send to io_work?
Date: Thu, 26 Jun 2026 09:19:41 +0800	[thread overview]
Message-ID: <cover.1782436781.git.liuxixin@kylinos.cn> (raw)
In-Reply-To: <ajtk1CaN1pBreS4O@shinmob>

Hi,

I'm looking at the nvme/062 failure Shinichiro reported on linux-7.1.y
(PROVE_LOCKING=y, blktests v5a62429536b1) and would like to sanity-check
a fix direction before sending a formal patch.

Link: https://lore.kernel.org/linux-nvme/ajtk1CaN1pBreS4O@shinmob/T/

Problem (reproduced on linux-next, same test)
---------------------------------------------
With PROVE_LOCKING=y, nvme/062 (TLS connect) fails with dmesg:

  WARNING: possible circular locking dependency detected
  ...
  tx_lock (tls_sw_sendmsg)
  ...
  &set->srcu (blk_mq / kblockd context)

The #0 stack is nvme_tcp_queue_request() doing an inline nvme_tcp_send_all()
from queue_rq, which calls tls_sw_sendmsg() while blk_mq still holds srcu.
Lockdep already knows tx_lock -> elevator_lock -> srcu, so the reverse
order triggers the cycle.

Teardown fixes (__fput_sync, memalloc_noio_save, 26bb12b9caaf) are already
present in current trees; 062 still fails — this looks like the TLS send
path on top of blk_mq, not the disconnect/teardown chain.

Proposed fix (one line + comment)
---------------------------------
Skip the queue_rq inline-send optimization when nvme_tcp_queue_tls(queue):

  if (queue->io_cpu == raw_smp_processor_id() &&
      !nvme_tcp_queue_tls(queue) &&
      empty && mutex_trylock(&queue->send_mutex)) {
          nvme_tcp_send_all(queue);
          ...
  }

TLS traffic would always go through nvme_tcp_io_work on nvme_tcp_wq (same
as write_space / backpressure paths already do).  Lab check: nvme/062
passes, no lockdep splat in dmesg.

Does skipping inline send for TLS queues (plain TCP unchanged) look like a
reasonable fix to you?  I can post [PATCH] if this direction sounds OK.

Thanks,
Xixin Liu



  reply	other threads:[~2026-06-26  1:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24  5:04 blktests failures with v7.1 kernel Shin'ichiro Kawasaki
2026-06-26  1:19 ` Xixin Liu [this message]
2026-06-26  6:40   ` blktests nvme/062 lockdep — defer TLS inline send to io_work? Hannes Reinecke
2026-06-29  7:00     ` Xixin Liu
2026-07-01  1:50       ` Xixin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1782436781.git.liuxixin@kylinos.cn \
    --to=liuxixin@kylinos.cn \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox