Skip to content

Conversation

@rafalste
Copy link

@rafalste rafalste commented Apr 7, 2025

Change-Id: I58f0fa973cc78b1c7bfefd9ffd783a6f752baba3

@rafalste rafalste force-pushed the ocf_module_refactor branch from 1cda3c3 to 9cc8288 Compare April 7, 2025 09:49
@rafalste rafalste force-pushed the ocf_module_refactor branch 2 times, most recently from 217180c to a06263a Compare July 25, 2025 15:06
}

return status;
/* Increment queue refcount to prevent destroying management queue after cache device detach. */
ocf_queue_get(((struct vbdev_ocf_cache *)ocf_cache_get_priv(cache))->cache_mngt_q);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the mngt queue refcnt should be incremented once, on cache start. Incrementing it here feels like a workaround

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem turned out to be in the context cleaner refcount. Fixed.

SPDK_DEBUGLOG(vbdev_ocf, "OCF vbdev '%s': destroying IO channel\n",
spdk_bdev_get_name(&(((struct vbdev_ocf_core *)ocf_core_get_priv(core))->ocf_vbdev)));

ocf_queue_put(ch_destroy_ctx->queue);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core_bdev iochannel, the cache_bdev iochannel, the poller and the queue are all owned by vbdev_iochannel. I think you should decrement all their refcounter here on vbdev_channel_destroy just as you're creating them on vbdev_channel_create.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the channel context with all of those you mention is saved in queue priv, this decrementing will be done in vbdev_ocf_core_io_queue_stop() when the queue is destroyed.

vbdev_ocf_base_detach(struct vbdev_ocf_base *base)
{
if (base->thread && base->thread != spdk_get_thread()) {
spdk_thread_send_msg(base->thread, _base_detach, base);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error returned by spdk_thread_send_msg() shouldn't be ignored

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost all usage of spdk_thread_send_msg() in all other modules look like this. But you're right - why not use it if it's there. Fixed.

ocf_queue_t queue = ctx;
int i, queue_runs;

queue_runs = spdk_min(ocf_queue_pending_io(queue), VBDEV_OCF_QUEUE_RUN_MAX);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a limit of queue runs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To not run the queue for to long and let it be rescheduled if needed.

return;
SPDK_DEBUGLOG(vbdev_ocf, "OCF cache '%s': module stop visit\n", ocf_cache_get_name(cache));

/* Increment cache refcount to not destroy cache structs before destroying all cores. */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a workaround. I think we should have a proper management of cache lifetime.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already removed this bit because it is actually not needed anymore since cache stop is not triggered asynchronously with cores detach any more.
I found a better solution for this in later commits and it is taken care of by this check:
ocf_cache_get_core_count(cache) == ocf_cache_get_core_inactive_count(cache)

Comment on lines 873 to 879
// impossible to be true ?
if (!core) {
SPDK_ERRLOG("OCF vbdev '%s': failed to submit IO - no OCF core device\n",
spdk_bdev_get_name(bdev_io->bdev));
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's impossible it could be a BUG_ON

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This situation is not possible to occur, so I removed this check. Nevertheless, added an assert here just to be sure.

@rafalste rafalste force-pushed the ocf_module_refactor branch 4 times, most recently from 46b141d to b5510ef Compare September 19, 2025 13:31
@rafalste rafalste force-pushed the ocf_module_refactor branch 2 times, most recently from 266d53d to 43e7e51 Compare October 7, 2025 15:58
@rafalste rafalste force-pushed the ocf_module_refactor branch 2 times, most recently from e4b03ac to 9ba18bf Compare October 14, 2025 15:20
@rafalste rafalste force-pushed the ocf_module_refactor branch 2 times, most recently from 71f7311 to 472ff8a Compare October 31, 2025 14:50
@github-actions
Copy link

SPDK manages code review in https://review.spdk.io. This PR will be closed automatically.

@github-actions github-actions bot added the Stale label Dec 17, 2025
@github-actions github-actions bot closed this Dec 18, 2025
@rafalste rafalste reopened this Dec 18, 2025
@rafalste rafalste removed the Stale label Dec 18, 2025
@github-actions
Copy link

SPDK manages code review in https://review.spdk.io. This PR will be closed automatically.

@github-actions github-actions bot added the Stale label Dec 20, 2025
Rafal Stefanowski added 8 commits December 20, 2025 16:02
Change-Id: Icf9704d338fe8fe5d3f6ef8eb5f9255af4a649d2
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I58f0fa973cc78b1c7bfefd9ffd783a6f752baba3
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ie8d756c4374f5fb75e39a885b203a6b6883d1bf5
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I82aae275e79444afbda292bd0cc8211d18fd5c0e
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I74ef4446df4f51d662b31e2774a8d1c7f1c11df0
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I6cd3262aed2b309929df68d24fac5b431ecfc006
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ie509dc0f48e76cd9c01cb7e07ef8698dfa3bab14
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I91828704921fb74ff538ba37e6f6a5a8cbd218bf
Signed-off-by: Rafal Stefanowski <[email protected]>
Rafal Stefanowski added 26 commits December 20, 2025 16:02
- check cache/core block size
- merge cache stop paths
- unify adding cores from waitlist
- error handling
- comments
- cleanup

Change-Id: Ib111089a9e5fe1ec155487db3b2c4541d1ce9520
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I1d4ecf9555f9996d236c4985ce460a8839b02e2f
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I0049cda213a5d037819b877cd1279286a1a68841
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ia6aa94a2f352d1f9178958dd34e7e069ea2bc3d9
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ib36ae38a03d1bca9b2595a78b7cc162ab787ebe8
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I70e3d6470dc3f0c7a6a493472746ccdc3bd3c6e7
Signed-off-by: Rafal Stefanowski <[email protected]>
- update cache IO channels after device detach/attach
- fix management queue refcount
- fix IO channels double free
- handle spdk_thread_send_msg() errors
- do not allow using OCF core as base bdev for another OCF core
- remove redundant checks
- remove cluttering logs

Change-Id: I34f2aceb434d5752c787ae6071cce3930bc44575
Signed-off-by: Rafal Stefanowski <[email protected]>
- current module config
- generic bdev info
- generic bdev stats
- OCF stats

Change-Id: If63774a399902caaa50c09ef2e89a9837e5db95a
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I106829e59cdf145ed62998c6b101d4efd7389821
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ib43ab22b3fa457e624deae912b3c587bdf6b0648
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Id6ddfa4042427715f7927c7d66fb98ee9904881c
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I7242902219bcb5604df51f8a06feb50e86426541
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ia187bee78d1e1078eefcb49ebcaf73ffd601f479
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I3753edb1643a4465c9768e6a8a13cd4c21cc6443
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I488ec6c802299aba39f38743cad12a429ece066e
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I107349f86aef598b5ec112d1a6df5de20ea4a2c3
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ie01d40cebf469df6d84f5689b2767f6aa7f3721c
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I915d5af1cce0ce38bca45462a7b66d14ce8be8e7
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I3607fd8a261755440fdd2948a027a37aaf66d67e
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: If00f029f084e5f500af7d7e6524cf33193fa1860
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ib038d093689c45fade8515861b50cb2b30f5601d
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I323302f657e0d943acd3b4d4e4c8bd3efd4931d0
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Iaeaf9a9af3c82d908efddf5947a55bf8b2f0fcc2
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: Ibba93fc9803babcc9c3055aeb223825c580f7743
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I80e5bc492f9025a13ba4cdc7ca12676bb0ef3f8f
Signed-off-by: Rafal Stefanowski <[email protected]>
Change-Id: I03748efcc653d49fe561731046ff236fcd37314a
Signed-off-by: Rafal Stefanowski <[email protected]>
@rafalste rafalste force-pushed the ocf_module_refactor branch from 472ff8a to 4a15191 Compare December 20, 2025 15:17
@rafalste rafalste removed the Stale label Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants