linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-mq: export blk_mq_submit_bio symbol
@ 2021-09-09  5:36 Praveen Kumar
  2021-09-09  5:48 ` Christoph Hellwig
  2021-09-09 16:16 ` Chaitanya Kulkarni
  0 siblings, 2 replies; 11+ messages in thread
From: Praveen Kumar @ 2021-09-09  5:36 UTC (permalink / raw)
  To: linux-block, linux-kernel; +Cc: axboe

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 <kumarpraveen@linux.microsoft.com>
---
 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-09  5:36 [PATCH] blk-mq: export blk_mq_submit_bio symbol Praveen Kumar
@ 2021-09-09  5:48 ` Christoph Hellwig
  2021-09-10 11:54   ` Praveen Kumar
  2021-09-09 16:16 ` Chaitanya Kulkarni
  1 sibling, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2021-09-09  5:48 UTC (permalink / raw)
  To: Praveen Kumar; +Cc: linux-block, linux-kernel, axboe

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-09  5:36 [PATCH] blk-mq: export blk_mq_submit_bio symbol Praveen Kumar
  2021-09-09  5:48 ` Christoph Hellwig
@ 2021-09-09 16:16 ` Chaitanya Kulkarni
  2021-09-13  4:24   ` Praveen Kumar
  1 sibling, 1 reply; 11+ messages in thread
From: Chaitanya Kulkarni @ 2021-09-09 16:16 UTC (permalink / raw)
  To: Praveen Kumar, linux-block, linux-kernel; +Cc: axboe


> 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
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-09  5:48 ` Christoph Hellwig
@ 2021-09-10 11:54   ` Praveen Kumar
  0 siblings, 0 replies; 11+ messages in thread
From: Praveen Kumar @ 2021-09-10 11:54 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-block, linux-kernel, axboe, lalita.muppana, schakrabarti,
	Michael Kelley, longli, KY Srinivasan

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-09 16:16 ` Chaitanya Kulkarni
@ 2021-09-13  4:24   ` Praveen Kumar
  2021-09-13  6:09     ` Christoph Hellwig
  0 siblings, 1 reply; 11+ messages in thread
From: Praveen Kumar @ 2021-09-13  4:24 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-block, linux-kernel; +Cc: axboe

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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-13  4:24   ` Praveen Kumar
@ 2021-09-13  6:09     ` Christoph Hellwig
  2021-09-13  7:03       ` Praveen Kumar
  0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2021-09-13  6:09 UTC (permalink / raw)
  To: Praveen Kumar; +Cc: Chaitanya Kulkarni, linux-block, linux-kernel, axboe

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-13  6:09     ` Christoph Hellwig
@ 2021-09-13  7:03       ` Praveen Kumar
  2021-09-20  5:30         ` Prasad Muppana
  0 siblings, 1 reply; 11+ messages in thread
From: Praveen Kumar @ 2021-09-13  7:03 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Chaitanya Kulkarni, linux-block, linux-kernel, axboe,
	schakrabarti, lalita.muppana

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-13  7:03       ` Praveen Kumar
@ 2021-09-20  5:30         ` Prasad Muppana
  2021-09-20 20:25           ` Chaitanya Kulkarni
  0 siblings, 1 reply; 11+ messages in thread
From: Prasad Muppana @ 2021-09-20  5:30 UTC (permalink / raw)
  To: Praveen Kumar, Christoph Hellwig
  Cc: Chaitanya Kulkarni, linux-block, linux-kernel, axboe, schakrabarti

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 <kumarpraveen@linux.microsoft.com> 
Sent: Monday, September 13, 2021 12:34 PM
To: Christoph Hellwig <hch@infradead.org>
Cc: Chaitanya Kulkarni <chaitanyak@nvidia.com>; linux-block@vger.kernel.org; linux-kernel@vger.kernel.org; axboe@kernel.dk; schakrabarti@linux.microsoft.com; Prasad Muppana <Lalita.Muppana@microsoft.com>
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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-20  5:30         ` Prasad Muppana
@ 2021-09-20 20:25           ` Chaitanya Kulkarni
  2021-09-22  5:45             ` Prasad Muppana
  0 siblings, 1 reply; 11+ messages in thread
From: Chaitanya Kulkarni @ 2021-09-20 20:25 UTC (permalink / raw)
  To: Prasad Muppana, Praveen Kumar, Christoph Hellwig
  Cc: linux-block, linux-kernel, axboe, schakrabarti

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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-20 20:25           ` Chaitanya Kulkarni
@ 2021-09-22  5:45             ` Prasad Muppana
  2021-09-22 14:29               ` Jens Axboe
  0 siblings, 1 reply; 11+ messages in thread
From: Prasad Muppana @ 2021-09-22  5:45 UTC (permalink / raw)
  To: Chaitanya Kulkarni, Praveen Kumar, Christoph Hellwig, Atin Mukherjee
  Cc: linux-block, linux-kernel, axboe, schakrabarti

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 <chaitanyak@nvidia.com> 
Sent: Tuesday, September 21, 2021 1:55 AM
To: Prasad Muppana <Lalita.Muppana@microsoft.com>; Praveen Kumar <kumarpraveen@linux.microsoft.com>; Christoph Hellwig <hch@infradead.org>
Cc: linux-block@vger.kernel.org; linux-kernel@vger.kernel.org; axboe@kernel.dk; schakrabarti@linux.microsoft.com
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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] blk-mq: export blk_mq_submit_bio symbol
  2021-09-22  5:45             ` Prasad Muppana
@ 2021-09-22 14:29               ` Jens Axboe
  0 siblings, 0 replies; 11+ messages in thread
From: Jens Axboe @ 2021-09-22 14:29 UTC (permalink / raw)
  To: Prasad Muppana, Chaitanya Kulkarni, Praveen Kumar,
	Christoph Hellwig, Atin Mukherjee
  Cc: linux-block, linux-kernel, schakrabarti

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-09-22 14:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09  5:36 [PATCH] blk-mq: export blk_mq_submit_bio symbol Praveen Kumar
2021-09-09  5:48 ` Christoph Hellwig
2021-09-10 11:54   ` Praveen Kumar
2021-09-09 16:16 ` Chaitanya Kulkarni
2021-09-13  4:24   ` Praveen Kumar
2021-09-13  6:09     ` Christoph Hellwig
2021-09-13  7:03       ` Praveen Kumar
2021-09-20  5:30         ` Prasad Muppana
2021-09-20 20:25           ` Chaitanya Kulkarni
2021-09-22  5:45             ` Prasad Muppana
2021-09-22 14:29               ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).