Skip to contentSkip to conversation

Changing the way MMC block request ends

DISCUSSION Subhash Jadavani 2 participants 4 messages Apr 5, 2012 – Apr 6, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

For completing any block request, MMC block driver is calling:

       spin_lock_irq(queue-lock)
       __blk_end_request()
       spin_unlock_irq(queue-lock)

But if we analyze the sources of latency in kernel using ftrace, __blk_end_request() function seems to hold a spinlock with interrupts disabled for up to 6.5 ms sometimes. __blk_end_request() calls couple of functions and ftrace output shows that blk_update_bidi_request() function is almost taking 6ms. So I was wondering why can't we use the blk_end_request() rather than __blk_end_request(). Both function does the same thing except blk_end_request() doesn't take up the spinlock while calling the blk_update_bidi_request(). Is there any race condition which could occur if we call blk_update_bidi_request() without queue lock?

I looked into blk_update_bidi_request() function and it mainly updates bio's of a request and doesn't look to do any manipulation with request queue structure of block device. There are many block drivers (SCSI, IDE etc .) other than MMC uses blk_end_request() rather than __blk_end_request(). Was there any special reason we are using __blk_end_request() in MMC block driver? If there is no specific reason, I would like to post a patch which would make MMC driver to use blk_end_request().

Let me know your thoughts on this.

Regards,
Subhash

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw

Hi Chris,

Any thoughts or suggestions on this?

Regards,
Subhash

Quoted 47 lines

-----Original Message-----
From: [email protected] [mailto:linux-mmc- [email protected]] On Behalf Of Subhash Jadavani
Sent: Thursday, April 05, 2012 11:16 AM
To: [email protected]
Cc: [email protected]
Subject: Changing the way MMC block request ends

Hi,

For completing any block request, MMC block driver is calling:

       spin_lock_irq(queue-lock)
       __blk_end_request()
       spin_unlock_irq(queue-lock)

But if we analyze the sources of latency in kernel using ftrace, __blk_end_request() function seems to hold a spinlock with interrupts disabled for up to 6.5 ms sometimes. __blk_end_request() calls couple of functions and ftrace output shows that blk_update_bidi_request() function is almost taking 6ms. So I was wondering why can't we use the blk_end_request() rather than __blk_end_request(). Both function does the same thing except blk_end_request() doesn't take up the spinlock while calling the blk_update_bidi_request(). Is there any race condition which could occur if we call blk_update_bidi_request() without queue lock?

I looked into blk_update_bidi_request() function and it mainly updates bio's of a request and doesn't look to do any manipulation with request queue structure of block device. There are many block drivers (SCSI, IDE etc .) other than MMC uses blk_end_request() rather than __blk_end_request(). Was there any special reason we are using __blk_end_request() in MMC block driver? If there is no specific reason, I would like to post a patch which would make MMC driver to use blk_end_request().

Let me know your thoughts on this.

Regards,
Subhash

--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi Subhash,

Quoted 7 lines · Subhash Jadavani

I looked into blk_update_bidi_request() function and it mainly updates bio's of a request and doesn't look to do any manipulation with request queue structure of block device. There are many block drivers (SCSI, IDE etc .) other than MMC uses blk_end_request() rather than __blk_end_request(). Was there any special reason we are using __blk_end_request() in MMC block driver? If there is no specific reason, I would like to post a patch which would make MMC driver to use blk_end_request().

It looks like we've been using __blk_end_request() since fd539832c in 2007, which is as long as we've been using the blk_end_request API.

I haven't looked into it more closely, but it seems so far like there is no specific reason, and you should go ahead and post a patch along with your experimental results. Thanks!

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#3 lore raw

Hi Chris,

Quoted 18 lines

-----Original Message-----
From: [email protected] [mailto:linux-mmc- [email protected]] On Behalf Of Chris Ball
Sent: Friday, April 06, 2012 7:24 PM
To: Subhash Jadavani
Cc: [email protected]; [email protected]
Subject: Re: Changing the way MMC block request ends

Hi Subhash,

Quoted 7 lines · Subhash Jadavani

I looked into blk_update_bidi_request() function and it mainly updates bio's of a request and doesn't look to do any manipulation with request queue structure of block device. There are many block drivers (SCSI, IDE etc .) other than MMC uses blk_end_request() rather than __blk_end_request(). Was there any special reason we are using __blk_end_request() in MMC block driver? If there is no specific reason, I would like to post a patch which would make MMC driver to use

Quoted 3 lines

blk_end_request().

It looks like we've been using __blk_end_request() since fd539832c in

2007,

Quoted 3 lines

which is as long as we've been using the blk_end_request API.

I haven't looked into it more closely, but it seems so far like there is

no

Quoted 2 lines

specific reason, and you should go ahead and post a patch along with your experimental results. Thanks!

Thanks. Sure, will post the patch along with my test results.

Regards,
Subhash

Quoted 7 lines

- Chris.
--
Chris Ball <[email protected]> <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in

the

Quoted 2 lines

body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html