Skip to content

Commit

Permalink
fix(tmp): io_channel put debug
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Savitskiy <[email protected]>
  • Loading branch information
dsavitskiy committed Nov 3, 2023
1 parent baffd90 commit 1548ae7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/bdev/bdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3650,6 +3650,14 @@ bdev_channel_destroy_resource(struct spdk_bdev_channel *ch)
{
struct spdk_bdev_shared_resource *shared_resource;
struct lba_range *range;
struct spdk_thread *tt = spdk_get_thread();
const char *tt_name = tt ? spdk_thread_get_name(tt) : "<null>";

SPDK_ERRLOG("@@@@ bdev_channel_destroy_resource(): chan_ctx=%p, bdev='%s', thread='%s' (%p)\n",
ch,
ch->bdev->name,
tt_name, tt);


bdev_free_io_stat(ch->stat);
#ifdef SPDK_CONFIG_VTUNE
Expand All @@ -3668,7 +3676,14 @@ bdev_channel_destroy_resource(struct spdk_bdev_channel *ch)
shared_resource = ch->shared_resource;

assert(TAILQ_EMPTY(&ch->io_locked));

if (TAILQ_EMPTY(&ch->io_submitted)) {
SPDK_ERRLOG(" |--> io_submitted empty: chan_ctx=%p, thread='%s' (%p)\n", ch, tt_name, tt);
} else {
SPDK_ERRLOG(" |--> io_submitted NOT EMPTY: chan_ctx=%p, thread='%s' (%p)\n", ch, tt_name, tt);
}
assert(TAILQ_EMPTY(&ch->io_submitted));

assert(TAILQ_EMPTY(&ch->io_accel_exec));
assert(TAILQ_EMPTY(&ch->io_memory_domain));
assert(ch->io_outstanding == 0);
Expand Down Expand Up @@ -3876,6 +3891,7 @@ bdev_channel_create(void *io_device, void *ctx_buf)
struct spdk_bdev_mgmt_channel *mgmt_ch;
struct spdk_bdev_shared_resource *shared_resource;
struct lba_range *range;
struct spdk_thread *tt;

ch->bdev = bdev;
ch->channel = bdev->fn_table->get_io_channel(bdev->ctxt);
Expand Down Expand Up @@ -3994,6 +4010,13 @@ bdev_channel_create(void *io_device, void *ctx_buf)

spdk_spin_unlock(&bdev->internal.spinlock);

tt = spdk_get_thread();
SPDK_ERRLOG("@@@@ bdev_channel_create(): chan_ctx=%p, io_device=%p, bdev='%s', thread='%s' (%p)\n",
ch,
io_device,
bdev->name,
tt ? spdk_thread_get_name(tt) : "<null>", tt);

return 0;
}

Expand Down Expand Up @@ -4354,10 +4377,17 @@ static void
bdev_channel_destroy(void *io_device, void *ctx_buf)
{
struct spdk_bdev_channel *ch = ctx_buf;
struct spdk_thread* tt = spdk_get_thread();

SPDK_DEBUGLOG(bdev, "Destroying channel %p for bdev %s on thread %p\n", ch, ch->bdev->name,
spdk_get_thread());

SPDK_ERRLOG("@@@@ bdev_channel_destroy(): chan_ctx=%p, io_device=%p, bdev='%s', thread='%s' (%p)\n",
ctx_buf,
io_device,
ch->bdev->name,
tt ? spdk_thread_get_name(tt) : "<null>", tt);

spdk_trace_record(TRACE_BDEV_IOCH_DESTROY, 0, 0, 0, ch->bdev->name,
spdk_thread_get_id(spdk_io_channel_get_thread(ch->channel)));

Expand Down
5 changes: 5 additions & 0 deletions lib/thread/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,11 @@ put_io_channel(void *arg)
"Releasing io_channel %p for io_device %s (%p) on thread %s\n",
ch, ch->dev->name, ch->dev->io_device, thread->name);

SPDK_ERRLOG("@@@@ put_io_channel(): io_chan=%p, chan_ctx=%p, io_device='%s' (%p), thread='%s' (%p)\n",
ch, spdk_io_channel_get_ctx(ch),
ch->dev->name, ch->dev->io_device,
thread->name, thread);

assert(ch->thread == thread);

ch->destroy_ref--;
Expand Down

0 comments on commit 1548ae7

Please sign in to comment.