2021-09-09 05:40:02

by Praveen Kumar

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Praveen Kumar <[email protected]>
---
block/blk-mq.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 65d3a63aecc6..40a9b085f029 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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)
{
--
2.25.1


2021-09-09 06:38:14

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol

On Thu, Sep 09, 2021 at 11:06:53AM +0530, Praveen Kumar wrote:
> 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.

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.

2021-09-09 16:20:51

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol


> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 65d3a63aecc6..40a9b085f029 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -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 ?

> static size_t order_to_size(unsigned int order)
> {
> --
> 2.25.1
>

2021-09-10 11:58:28

by Praveen Kumar

[permalink] [raw]
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol

On 09-09-2021 11:18, Christoph Hellwig wrote:
> On Thu, Sep 09, 2021 at 11:06:53AM +0530, Praveen Kumar wrote:
>> 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.
>
> 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_noacct

Hope, 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.

2021-09-13 04:34:14

by Praveen Kumar

[permalink] [raw]
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol

On 09-09-2021 21:46, Chaitanya Kulkarni wrote:
>
>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>> index 65d3a63aecc6..40a9b085f029 100644
>> --- a/block/blk-mq.c
>> +++ b/block/blk-mq.c
>> @@ -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.

2021-09-13 06:13:10

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol

On Mon, Sep 13, 2021 at 09:54:54AM +0530, Praveen Kumar wrote:
> >> +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.

2021-09-13 07:06:16

by Praveen Kumar

[permalink] [raw]
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol

On 13-09-2021 11:39, Christoph Hellwig wrote:
> On Mon, Sep 13, 2021 at 09:54:54AM +0530, Praveen Kumar wrote:
>>>> +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.
>

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.

2021-09-20 11:44:14

by Prasad Muppana

[permalink] [raw]
Subject: RE: [PATCH] blk-mq: export blk_mq_submit_bio symbol

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

On 13-09-2021 11:39, Christoph Hellwig wrote:
> On Mon, Sep 13, 2021 at 09:54:54AM +0530, Praveen Kumar wrote:
>>>> +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.
>

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.

2021-09-21 02:55:00

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol

On 9/19/21 10:30 PM, Prasad Muppana wrote:
> 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.




2021-09-22 05:47:11

by Prasad Muppana

[permalink] [raw]
Subject: RE: [PATCH] blk-mq: export blk_mq_submit_bio symbol

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

On 9/19/21 10:30 PM, Prasad Muppana wrote:
> 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.




2021-09-22 14:30:42

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol

On 9/21/21 11:45 PM, Prasad Muppana wrote:
> 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.

--
Jens Axboe