blk-mq: export blk_mq_submit_bio symbol
PATCH 1/1 blk-mq: export blk_mq_submit_bio symbol
There are use-cases like replication where need to hook the blk I/O operations for devices and perform specific operation and fallback to its original I/O operations.
Prior to v5.9 there was make_request_fn and then blk_mq_submit_bio exported apis, which provided infrastructure to drivers to develop these features. However in v5.10-rc1 with below commit the API was removed from the export list.
Previous commit: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.10-rc1&id=681cc5e8667e8579a2da8fa4090c48a2d73fc3bb
This patch exports the blk_mq_submit_bio symbol to provide flexibility to the drivers.
--- block/blk-mq.c | 1 + 1 file changed, 1 insertion(+)
block/blk-mq.c +1 -0
@@ -2283,6 +2283,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio)blk_queue_exit (q);return BLK_QC_T_NONE ; } +EXPORT_SYMBOL_GPL (blk_mq_submit_bio);static size_t order_to_size (unsigned int order) {
Signature · 1 line
2.25.1
Quoted 8 lines · Praveen Kumar
There are use-cases like replication where need to hook the blk I/O operations for devices and perform specific operation and fallback to its original I/O operations.
Prior to v5.9 there wasmake_request_fnand thenblk_mq_submit_bioexported apis, which provided infrastructure to drivers to develop these features. However in v5.10-rc1 with below commit the API was removed from the export list.
Quoted 4 lines
Previous commit: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.10-rc1&id=681cc5e8667e8579a2da8fa4090c48a2d73fc3bb
This patch exports the
blk_mq_submit_biosymbol to provide flexibility to the drivers.
Please send your users of this "feature" to this list for inclusion and we'll help you to massage them into a non-broken version.
And yes, you should have gotten the memo by now that we don't export anything for out of tree modules.
Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · Praveen Kumar
There are use-cases like replication where need to hook the blk I/O operations for devices and perform specific operation and fallback to its original I/O operations.
Prior to v5.9 there wasmake_request_fnand thenblk_mq_submit_bioexported apis, which provided infrastructure to drivers to develop these features. However in v5.10-rc1 with below commit the API was removed from the export list.
Quoted 8 lines
Quoted 4 lines
Previous commit: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.10-rc1&id=681cc5e8667e8579a2da8fa4090c48a2d73fc3bb
This patch exports the
blk_mq_submit_biosymbol to provide flexibility to the drivers.Please send your users of this "feature" to this list for inclusion and we'll help you to massage them into a non-broken version.
Thank you for the response and appreciate your help. Providing a bit of details below.
The disk replication solution which I mentioned, hooks all the block i/o operation using make_request_fn for specific device request queue and do some massaging and then call the standard block operations. The flow is something like below :
replication_func_init (struct block_device *bdev)
... orig_queue = bdev_get_queue(bdev) // save the original state
... orig_request_fn = orig_queue->request_fn;
... orig_queue->make_request_fn = custom_function(say "replicate_request_func")
replicate_request_func(...) {
... does some driver specific massaging
... // calls original
if (orig_queue->make_request_fn)
orig_queue->make_request_fn(...)
else
blk_mq_make_request(...)...
Now, the current implementation have make_request_fn moved to submit_bio, one probable approach is to somehow, update the original submit_bio to custom "replicate_submit_bio_func" and then handle the case likewise as done in "replicate_request_func". But, "blk_mq_submit_bio" is not exported symbol..
Second, "submit_bio_noacct" is the next approach which we thought can be used for submit the bio, but, for case where original submit_bio is NULL, we will end calling recursively the new submit_bio, and panic.
replicate_submit_bio_func
... does some driver specific massaging
... // calls exported symbol
submit_bio_noacct
__submit_bio_noacct(bio)
__submit_bio
disk->fops->submit_bio(bio) -> updated API
replicate_submit_bio_func
submit_bio_noacctHope, the provided information helps understanding the problem. If not, please do let us know, we will try to provide more details accordingly. Also, please do provide your thoughts and suggestions how can we achieve the above kind of functionality on latest kernel version.
Further, we were trying to understand the history over the removal of make_request_fn in the queue within blk_mq_init_allocated_queue API, but didn't find much. Can you please provide any information regarding the same. Also, is there a possibility of have similar kind of implemenation for submit_bio ?
...
- q->make_request_fn = blk_mq_make_request;
...
Patch : https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/block/blk-mq.c?h=v5.14&id=8cf7961dab42c9177a556b719c15f5b9449c24d1
Regards,
~Praveen.
block/blk-mq.c blk_qc_t blk_mq_submit_bio(struct bio *bio) · line 2287
Quoted 11 lines
block/blk-mq.c +1
-0@@ -2283,6 +2283,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio)blk_queue_exit (q);return BLK_QC_T_NONE ; } +EXPORT_SYMBOL_GPL (blk_mq_submit_bio);
Where is the code that used this API ?
Quoted 5 lines
block/blk-mq.c +0
-1static size_t order_to_size (unsigned int order) { --2.25.1
Quoted 14 lines · Chaitanya Kulkarni
block/blk-mq.c blk_qc_t blk_mq_submit_bio(struct bio *bio) · line 2287
Quoted 11 lines
block/blk-mq.c +1
-0@@ -2283,6 +2283,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio)blk_queue_exit (q);return BLK_QC_T_NONE ; } +EXPORT_SYMBOL_GPL (blk_mq_submit_bio);Where is the code that used this API ?
Thanks Chaitanya for your response. Please check my response to Christoph. That should give overall understanding of the use-case.
Regards,
~Praveen.
Quoted 8 lines · Praveen Kumar
Quoted 5 lines
Quoted 2 lines
+EXPORT_SYMBOL_GPL(blk_mq_submit_bio);
Where is the code that used this API ?
Thanks Chaitanya for your response. Please check my response to Christoph. That should give overall understanding of the use-case.
Which really doesn't matter, while you keep ingoring the relevant question. If you code is not upstream or at least actively being submitted upstream your questions have no relevance whatsoever. If you do not undertand that basic fact your are in the wrong place here.
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Praveen Kumar
Quoted 5 lines
Quoted 2 lines
+EXPORT_SYMBOL_GPL(blk_mq_submit_bio);
Where is the code that used this API ?
Quoted 9 lines
Quoted 2 lines
Thanks Chaitanya for your response. Please check my response to Christoph. That should give overall understanding of the use-case.
Which really doesn't matter, while you keep ingoring the relevant question. If you code is not upstream or at least actively being submitted upstream your questions have no relevance whatsoever. If you do not undertand that basic fact your are in the wrong place here.
Hi Christoph,
The upstream activity is being planned and will take sometime to reach to that state as we have to make it ready for latest kernel.
To achieve the same, we were finding some solutions to handle latest changes. If you have scanned my previous email where I have provided a detail what the driver is doing, I did mention that we plan to use "blk_mq_submit_bio" but failed to do so, as code is not exported. So, to the specific answer, this API is NOT being used anywhere as of now.
However, as you mentioned, the API cannot be exported for any specific driver, is there any solution or way if a custom driver wants to hook the existing bio path and massage it and then fall back to original flow ?
Regards,
~Praveen.
Hi Christoph,
We are in the process of opening the source code for the driver and stuck with this issue which is causing delay in the process. Currently, the Linux customers are impacted by this issue and mostly RHEL8.4 and Ubuntu customers are blocked. So we are looking for any solution that can mitigate this issue as short term goal and in the meantime, we will open the source which will have long term solution to handle this issue. Please help here in this case.
With Thanks,
Prasad
-----Original Message-----
From: Praveen Kumar <[email protected]>
Sent: Monday, September 13, 2021 12:34 PM
To: Christoph Hellwig <[email protected]>
Cc: Chaitanya Kulkarni <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Prasad Muppana <[email protected]>
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Praveen Kumar
Quoted 5 lines
Quoted 2 lines
+EXPORT_SYMBOL_GPL(blk_mq_submit_bio);
Where is the code that used this API ?
Quoted 9 lines
Quoted 2 lines
Thanks Chaitanya for your response. Please check my response to Christoph. That should give overall understanding of the use-case.
Which really doesn't matter, while you keep ingoring the relevant question. If you code is not upstream or at least actively being submitted upstream your questions have no relevance whatsoever. If you do not undertand that basic fact your are in the wrong place here.
Hi Christoph,
The upstream activity is being planned and will take sometime to reach to that state as we have to make it ready for latest kernel.
To achieve the same, we were finding some solutions to handle latest changes.
If you have scanned my previous email where I have provided a detail what the driver is doing, I did mention that we plan to use "blk_mq_submit_bio" but failed to do so, as code is not exported. So, to the specific answer, this API is NOT being used anywhere as of now.
However, as you mentioned, the API cannot be exported for any specific driver, is there any solution or way if a custom driver wants to hook the existing bio path and massage it and then fall back to original flow ?
Regards,
~Praveen.
Quoted 7 lines · Prasad Muppana
External email: Use caution opening links or attachments
Hi Christoph,
We are in the process of opening the source code for the driver and stuck with this issue which is causing delay in the process. Currently, the Linux customers are impacted by this issue and mostly RHEL8.4 and Ubuntu customers are blocked. So we are looking for any solution that can mitigate this issue as short term goal and in the meantime, we will open the source which will have long term solution to handle this issue. Please help here in this case.
The ideal way is to submit this with the code that is using this.
Hi Chaitanya,
Thanks for the response.
Our driver code is not yet public and so Praveen has explained the flow of the code. Please let me know is there any other way to get some help here quickly.
With Thanks,
Prasad
-----Original Message-----
From: Chaitanya Kulkarni <[email protected]>
Sent: Tuesday, September 21, 2021 1:55 AM
To: Prasad Muppana <[email protected]>; Praveen Kumar <[email protected]>; Christoph Hellwig <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
Quoted 7 lines · Prasad Muppana
External email: Use caution opening links or attachments
Hi Christoph,
We are in the process of opening the source code for the driver and stuck with this issue which is causing delay in the process. Currently, the Linux customers are impacted by this issue and mostly RHEL8.4 and Ubuntu customers are blocked. So we are looking for any solution that can mitigate this issue as short term goal and in the meantime, we will open the source which will have long term solution to handle this issue. Please help here in this case.
The ideal way is to submit this with the code that is using this.
Jens Axboe
maintainerQuoted 7 lines · Prasad Muppana
Hi Chaitanya,
Thanks for the response.
Our driver code is not yet public and so Praveen has explained the flow of the code. Please let me know is there any other way to get some help here quickly.
The explanation, while appreciated, doesn't solve the problem here. We _never_ add any exports for APIs that don't have any in-kernel users. That's a hard rule that we've had forever. As such, there is not a path for entry for this particular patch right now. It should be submitted alongside the upstream submission request for the code using it, as a preparatory patch.
Signature · 1 line
Jens Axboe