Skip to contentSkip to conversation

mmc: block: Add write packing control

PATCH [email protected] 2 participants 9 messages Jul 24, 2012 – Sep 6, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 1 line

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 1 line

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means that we should probably plan on holding off merging it until after 3.6.

Quoted 1 line

Here are the open issues; please correct any misunderstandings: With

Seungwon's patchset ("Support packed write command"):

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

* I still don't have a good set of representative benchmarks showing what kind of performance changes come with this patchset. It seems

like we've had a small amount of testing on one controller/eMMC part combo from Seungwon, and an entirely different test from Maya, and the

results

Quoted 1 line
Quoted 1 line

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and after the patchset.

Quoted 1 line
Quoted 1 line

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 11 lines
Quoted 11 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 3 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace before

trying to fix it. Maya has a theory about writes overwhelming reads, but Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 1 line
Quoted 1 line

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 2 lines
Quoted 2 lines

since it allows the MMC to fetch many write requests in a row, instead of fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can be

Quoted 3 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 8 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next blk_fetch_request should get the next read and continue as before.

Quoted 2 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for the first write request completion before fetching another write request. During this time the read request could be inserted into the CFQ and since it has higher priority than the async write it will be dispatched in the next fetch. So, the result would be 2 write requests followed by one read request and the read would have to wait for completion of only 2 write requests.
With packing, all the 5 write requests will be fetched in a row, and then the read will arrive and be dispatched in the next fetch. Then the read will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can "aggregate" several requests to be inserted into the scheduler before waking the MMC queue thread.
This leads to a situation where there are several write requests in the CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then I agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the packing stopped due to an empty queue, meaning that the read was inserted to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped the packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 2 lines

And I requested blktrace to confirm that this is indeed the behaviour.

The trace logs show that in case of no packing, there are maximum of 3-4 requests issued before a read request, while with packing there are also cases of 6 and 7 requests dispatched before a read request.

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and let us know if you reach other conclusions.

Thanks,
Maya

Quoted 2 lines

Your rest of the arguments anyway depend on this assertion, so can you

please clarify this.

Quoted 5 lines
Quoted 5 lines

To overcome this behavior, the solution would be to stop the write packing when a read request is fetched, and this is the algorithm suggested by the write packing control.
Let's also keep in mind that lmdd benchmarking doesn't fully reflect

the

Quoted 1 line
Quoted 1 line

real life in which there are not many scenarios that cause massive read

and write operations. In our user-common-scenarios tests we saw that in many cases the write packing decreases the read latency. It can happen in

Quoted 2 lines
Quoted 2 lines

cases where the same amount of write requests is fetched with and without packing. In such a case the write packing decreases the transfer time

of

Quoted 6 lines
Quoted 6 lines

the write requests and causes the read request to wait for a shorter time.

Quoted 3 lines

With Maya's patchset ("write packing control"):
* Venkat thinks that HPI should be used, and the number-of-requests metric is too coarse, and it doesn't let you disable packing at the

right time, and you're essentially implementing a new I/O scheduler inside the MMC subsystem without understanding the root cause for why that's

necessary.

Quoted 1 line
Quoted 1 line

According to our measurements the stop transmission (CMD12) + HPI is a

heavy operation that may take up to several milliseconds. Therefore, a massive usage of HPI can cause a degradation of performance.

Quoted 2 lines
Quoted 2 lines

In addition, it doesn’t provide a complete solution for read during write since it doesn’t solve the problem of “what to do with the interrupted

write request remainder?”. That is, a common interrupting read request will usually be followed by another one. If we just continue to write the

Quoted 1 line
Quoted 1 line

interrupted write request remainder we will probably get another HPI

due

Quoted 2 lines
Quoted 2 lines

to the second read request, so eventually we may end up with lots of HPIs and write retries. A complete solution will be: stop the current write,

change packing mode to non-packing, serve the read request, push back the

Quoted 1 line
Quoted 1 line

write remainders to the block I/O scheduler and let him schedule them

again probably after the read burst ends (this requires block layer support of course).

Quoted 1 line
Quoted 1 line

Regarding the packing control, there seem to be a confusion since the

number-of-requests is the trigger for *enabling* the packing (after it was

Quoted 1 line
Quoted 1 line

disabled), while a single read request disable packing. Therefore, the

packing is stopped at the right time.

Quoted 1 line
Quoted 1 line

The packing control doesn't add any scheduling policy to the MMC layer.

The write packing feature is the one changing the scheduling policy by fetching many write requests in a row without a delay that allows read requests to come in the middle.

Quoted 2 lines
Quoted 2 lines

By disabling the write packing, the write packing control returns the old scheduling policy. It causes the MMC to fetch the requests one by one,

thus read requests are served as before.

Quoted 1 line
Quoted 1 line

It is correct that the trigger for enabling the write packing control

should be adjusted per platform and doesn't give a complete solution. As

Quoted 2 lines
Quoted 2 lines

I
mentioned above, the complete solution will include the usage of write

packing control, a re-insert of the write packed to the scheduler when a

Quoted 1 line
Quoted 1 line

read request is fetched and usage of HPI to stop the packing that is

already transferred.

Quoted 2 lines
Quoted 2 lines

To summarize -
We recommend including the write packing in 3.6 due to the following

reasons:

Quoted 3 lines
Quoted 3 lines

1. It significantly improves the write throughput
2. In some of the cases it even decreases the read latency
3. The read degradation in simultaneous read-write flows already exist,

even without this feature

Quoted 1 line
Quoted 1 line

As for the write packing control, it can be included in 3.6 to supply a

partial solution for the read degradation or we can postpone it to 3.7 and

Quoted 6 lines
Quoted 6 lines

integrate it as part of the complete solution.
Thanks,
Maya

Quoted 2 lines

My sense is that there's no way we can solve all of these to satisfaction in the next week (which is when the merge window will

open), but that by waiting a cycle we might come up with some good

answers.

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

What do other people think? If you're excited about these patchsets,

now would be a fine time to come forward with your benchmarking results

and to help understand the reads-during-writes regression.

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

Attached are the trace logs for parallel read and write lmdd operations.

Quoted 240 lines · On Tue, July 24, 2012 1:44 am, [email protected] wrote:
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 1 line

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 1 line

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means that
we should probably plan on holding off merging it until after 3.6.

Quoted 1 line

Here are the open issues; please correct any misunderstandings: With

Seungwon's patchset ("Support packed write command"):

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

* I still don't have a good set of representative benchmarks showing what kind of performance changes come with this patchset. It seems

like we've had a small amount of testing on one controller/eMMC part combo
from Seungwon, and an entirely different test from Maya, and the

results

Quoted 1 line
Quoted 1 line

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and after the patchset.

Quoted 1 line
Quoted 1 line

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 4 lines
Quoted 4 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace before

trying to fix it. Maya has a theory about writes overwhelming reads, but
Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 1 line
Quoted 1 line

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 3 lines
Quoted 3 lines

since it allows the MMC to fetch many write requests in a row, instead of
fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can be

Quoted 3 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 8 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next blk_fetch_request should get the next read and continue as before.

Quoted 2 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for the first write request completion before fetching another write request. During this time the read request could be inserted into the CFQ and since it has higher priority than the async write it will be dispatched in the next fetch. So, the result would be 2 write requests followed by one read request and the read would have to wait for completion of only 2 write requests.
With packing, all the 5 write requests will be fetched in a row, and then the read will arrive and be dispatched in the next fetch. Then the read will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can "aggregate" several requests to be inserted into the scheduler before waking the MMC queue thread.
This leads to a situation where there are several write requests in the CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then I agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the packing stopped due to an empty queue, meaning that the read was inserted to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped the packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 2 lines

And I requested blktrace to confirm that this is indeed the behaviour.

The trace logs show that in case of no packing, there are maximum of 3-4 requests issued before a read request, while with packing there are also cases of 6 and 7 requests dispatched before a read request.

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and let us know if you reach other conclusions.

Thanks,
Maya

Quoted 2 lines

Your rest of the arguments anyway depend on this assertion, so can you

please clarify this.

Quoted 7 lines
Quoted 7 lines

To overcome this behavior, the solution would be to stop the write packing
when a read request is fetched, and this is the algorithm suggested by the
write packing control.
Let's also keep in mind that lmdd benchmarking doesn't fully reflect

the

Quoted 1 line
Quoted 1 line

real life in which there are not many scenarios that cause massive read

and write operations. In our user-common-scenarios tests we saw that in many cases the write packing decreases the read latency. It can happen in

Quoted 3 lines
Quoted 3 lines

cases where the same amount of write requests is fetched with and without
packing. In such a case the write packing decreases the transfer time

of

Quoted 8 lines
Quoted 8 lines

the write requests and causes the read request to wait for a shorter time.

Quoted 3 lines

With Maya's patchset ("write packing control"):
* Venkat thinks that HPI should be used, and the number-of-requests metric is too coarse, and it doesn't let you disable packing at the

right time, and you're essentially implementing a new I/O scheduler inside
the MMC subsystem without understanding the root cause for why that's

necessary.

Quoted 1 line
Quoted 1 line

According to our measurements the stop transmission (CMD12) + HPI is a

heavy operation that may take up to several milliseconds. Therefore, a massive usage of HPI can cause a degradation of performance.

Quoted 3 lines
Quoted 3 lines

In addition, it doesn’t provide a complete solution for read during write
since it doesn’t solve the problem of “what to do with the interrupted

write request remainder?”. That is, a common interrupting read request will usually be followed by another one. If we just continue to write the

Quoted 1 line
Quoted 1 line

interrupted write request remainder we will probably get another HPI

due

Quoted 3 lines
Quoted 3 lines

to the second read request, so eventually we may end up with lots of HPIs
and write retries. A complete solution will be: stop the current write,

change packing mode to non-packing, serve the read request, push back the

Quoted 1 line
Quoted 1 line

write remainders to the block I/O scheduler and let him schedule them

again probably after the read burst ends (this requires block layer support of course).

Quoted 1 line
Quoted 1 line

Regarding the packing control, there seem to be a confusion since the

number-of-requests is the trigger for *enabling* the packing (after it was

Quoted 1 line
Quoted 1 line

disabled), while a single read request disable packing. Therefore, the

packing is stopped at the right time.

Quoted 1 line
Quoted 1 line

The packing control doesn't add any scheduling policy to the MMC layer.

The write packing feature is the one changing the scheduling policy by fetching many write requests in a row without a delay that allows read requests to come in the middle.

Quoted 3 lines
Quoted 3 lines

By disabling the write packing, the write packing control returns the old
scheduling policy. It causes the MMC to fetch the requests one by one,

thus read requests are served as before.

Quoted 1 line
Quoted 1 line

It is correct that the trigger for enabling the write packing control

should be adjusted per platform and doesn't give a complete solution. As

Quoted 2 lines
Quoted 2 lines

I
mentioned above, the complete solution will include the usage of write

packing control, a re-insert of the write packed to the scheduler when a

Quoted 1 line
Quoted 1 line

read request is fetched and usage of HPI to stop the packing that is

already transferred.

Quoted 2 lines
Quoted 2 lines

To summarize -
We recommend including the write packing in 3.6 due to the following

reasons:

Quoted 3 lines
Quoted 3 lines

1. It significantly improves the write throughput
2. In some of the cases it even decreases the read latency
3. The read degradation in simultaneous read-write flows already exist,

even without this feature

Quoted 1 line
Quoted 1 line

As for the write packing control, it can be included in 3.6 to supply a

partial solution for the read degradation or we can postpone it to 3.7 and

Quoted 6 lines
Quoted 6 lines

integrate it as part of the complete solution.
Thanks,
Maya

Quoted 2 lines

My sense is that there's no way we can solve all of these to satisfaction in the next week (which is when the merge window will

open), but that by waiting a cycle we might come up with some good

answers.

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

What do other people think? If you're excited about these patchsets,

now would be a fine time to come forward with your benchmarking results

and to help understand the reads-during-writes regression.

Quoted 1 line

--
Sent by consultant of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of 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

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

Since the original trace logs are to big to be sent, I'm sending a parsed version of the files.
Please let me know if the original trace logs are still required.

Quoted 265 lines · On Tue, July 24, 2012 1:23 pm, [email protected] wrote:

Attached are the trace logs for parallel read and write lmdd operations.

Quoted 250 lines · On Tue, July 24, 2012 1:44 am, [email protected] wrote:
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 1 line

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 1 line

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means that
we should probably plan on holding off merging it until after 3.6.

Quoted 1 line

Here are the open issues; please correct any misunderstandings: With

Seungwon's patchset ("Support packed write command"):

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

* I still don't have a good set of representative benchmarks showing what kind of performance changes come with this patchset. It seems

like we've had a small amount of testing on one controller/eMMC part combo
from Seungwon, and an entirely different test from Maya, and the

results

Quoted 1 line
Quoted 1 line

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and after the patchset.

Quoted 2 lines
Quoted 2 lines

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 4 lines
Quoted 4 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace before

trying to fix it. Maya has a theory about writes overwhelming reads, but
Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 1 line
Quoted 1 line

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 3 lines
Quoted 3 lines

since it allows the MMC to fetch many write requests in a row, instead of
fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can be

Quoted 3 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 8 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next blk_fetch_request should get the next read and continue as before.

Quoted 3 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for the
first write request completion before fetching another write request. During this time the read request could be inserted into the CFQ and since
it has higher priority than the async write it will be dispatched in the next fetch. So, the result would be 2 write requests followed by one read
request and the read would have to wait for completion of only 2 write requests.
With packing, all the 5 write requests will be fetched in a row, and then
the read will arrive and be dispatched in the next fetch. Then the read will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can "aggregate" several requests to be inserted into the scheduler before waking the MMC queue thread.
This leads to a situation where there are several write requests in the CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then I agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the packing stopped due to an empty queue, meaning that the read was inserted
to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped the
packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 2 lines

And I requested blktrace to confirm that this is indeed the behaviour.

The trace logs show that in case of no packing, there are maximum of 3-4 requests issued before a read request, while with packing there are also cases of 6 and 7 requests dispatched before a read request.

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and let
us know if you reach other conclusions.

Thanks,
Maya

Quoted 2 lines

Your rest of the arguments anyway depend on this assertion, so can you

please clarify this.

Quoted 7 lines
Quoted 7 lines

To overcome this behavior, the solution would be to stop the write packing
when a read request is fetched, and this is the algorithm suggested by the
write packing control.
Let's also keep in mind that lmdd benchmarking doesn't fully reflect

the

Quoted 2 lines
Quoted 2 lines

real life in which there are not many scenarios that cause massive read

and write operations. In our user-common-scenarios tests we saw that in many cases the write packing decreases the read latency. It can happen in

Quoted 3 lines
Quoted 3 lines

cases where the same amount of write requests is fetched with and without
packing. In such a case the write packing decreases the transfer time

of

Quoted 8 lines
Quoted 8 lines

the write requests and causes the read request to wait for a shorter time.

Quoted 3 lines

With Maya's patchset ("write packing control"):
* Venkat thinks that HPI should be used, and the number-of-requests metric is too coarse, and it doesn't let you disable packing at the

right time, and you're essentially implementing a new I/O scheduler inside
the MMC subsystem without understanding the root cause for why that's

necessary.

Quoted 1 line
Quoted 1 line

According to our measurements the stop transmission (CMD12) + HPI is a

heavy operation that may take up to several milliseconds. Therefore, a massive usage of HPI can cause a degradation of performance.

Quoted 3 lines
Quoted 3 lines

In addition, it doesn’t provide a complete solution for read during write
since it doesn’t solve the problem of “what to do with the interrupted

write request remainder?”. That is, a common interrupting read request will usually be followed by another one. If we just continue to write the

Quoted 1 line
Quoted 1 line

interrupted write request remainder we will probably get another HPI

due

Quoted 4 lines
Quoted 4 lines

to the second read request, so eventually we may end up with lots of HPIs
and write retries. A complete solution will be: stop the current write,

change packing mode to non-packing, serve the read request, push back the

Quoted 1 line
Quoted 1 line

write remainders to the block I/O scheduler and let him schedule them

again probably after the read burst ends (this requires block layer support of course).

Quoted 1 line
Quoted 1 line

Regarding the packing control, there seem to be a confusion since the

number-of-requests is the trigger for *enabling* the packing (after it was

Quoted 1 line
Quoted 1 line

disabled), while a single read request disable packing. Therefore, the

packing is stopped at the right time.

Quoted 2 lines
Quoted 2 lines

The packing control doesn't add any scheduling policy to the MMC layer.

The write packing feature is the one changing the scheduling policy by fetching many write requests in a row without a delay that allows read requests to come in the middle.

Quoted 3 lines
Quoted 3 lines

By disabling the write packing, the write packing control returns the old
scheduling policy. It causes the MMC to fetch the requests one by one,

thus read requests are served as before.

Quoted 1 line
Quoted 1 line

It is correct that the trigger for enabling the write packing control

should be adjusted per platform and doesn't give a complete solution. As

Quoted 2 lines
Quoted 2 lines

I
mentioned above, the complete solution will include the usage of write

packing control, a re-insert of the write packed to the scheduler when a

Quoted 1 line
Quoted 1 line

read request is fetched and usage of HPI to stop the packing that is

already transferred.

Quoted 2 lines
Quoted 2 lines

To summarize -
We recommend including the write packing in 3.6 due to the following

reasons:

Quoted 4 lines
Quoted 4 lines

1. It significantly improves the write throughput
2. In some of the cases it even decreases the read latency
3. The read degradation in simultaneous read-write flows already exist,

even without this feature

Quoted 2 lines
Quoted 2 lines

As for the write packing control, it can be included in 3.6 to supply a

partial solution for the read degradation or we can postpone it to 3.7 and

Quoted 6 lines
Quoted 6 lines

integrate it as part of the complete solution.
Thanks,
Maya

Quoted 2 lines

My sense is that there's no way we can solve all of these to satisfaction in the next week (which is when the merge window will

open), but that by waiting a cycle we might come up with some good

answers.

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

What do other people think? If you're excited about these patchsets,

now would be a fine time to come forward with your benchmarking results

and to help understand the reads-during-writes regression.

Quoted 1 line

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

Quoted 5 lines

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

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

Signature · 2 lines
Sent by consultant of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

15,176 lines not shown · raw message

Part of this message is not shown here. View the raw message.

#3 lore raw
In reply to [email protected]
Quoted 122 lines · On Tue, Jul 24, 2012 at 2:14 PM, <[email protected]> wrote:
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 1 line

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 1 line

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means that we should probably plan on holding off merging it until after 3.6.

Quoted 1 line

Here are the open issues; please correct any misunderstandings: With

Seungwon's patchset ("Support packed write command"):

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

* I still don't have a good set of representative benchmarks showing what kind of performance changes come with this patchset. It seems

like we've had a small amount of testing on one controller/eMMC part combo from Seungwon, and an entirely different test from Maya, and the

results

Quoted 1 line
Quoted 1 line

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and after the patchset.

Quoted 1 line
Quoted 1 line

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 11 lines
Quoted 11 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 3 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace before

trying to fix it. Maya has a theory about writes overwhelming reads, but Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 1 line
Quoted 1 line

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 2 lines
Quoted 2 lines

since it allows the MMC to fetch many write requests in a row, instead of fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can be

Quoted 3 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 8 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next blk_fetch_request should get the next read and continue as before.

Quoted 2 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for the first write request completion before fetching another write request. During this time the read request could be inserted into the CFQ and since it has higher priority than the async write it will be dispatched in the next fetch. So, the result would be 2 write requests followed by one read request and the read would have to wait for completion of only 2 write requests.
With packing, all the 5 write requests will be fetched in a row, and then the read will arrive and be dispatched in the next fetch. Then the read will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can "aggregate" several requests to be inserted into the scheduler before waking the MMC queue thread.
This leads to a situation where there are several write requests in the CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then I agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the packing stopped due to an empty queue, meaning that the read was inserted to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped the packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 2 lines

And I requested blktrace to confirm that this is indeed the behaviour.

Quoted 8 lines

The trace logs show that in case of no packing, there are maximum of 3-4 requests issued before a read request, while with packing there are also cases of 6 and 7 requests dispatched before a read request.

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and let us know if you reach other conclusions.

Thanks for the brief. I don't have the eMMC4.5 device with me yet, so I can't reproduce the result. The problem you describe is most likely applicable
to any block device driver with a large queue depth ( any queue depth >1). I'll check to see what knobs in block affect the result.
Speaking of it, what is the host controller you use to test this ? I was wondering if host->max_seg_size is taken into account while packed command is in use. If not, shouldn't it be ? - it could act as a better throttle for "packing density".

Thanks,
Venkat.

#4 lore raw
Quoted 139 lines · Venkatraman
Quoted 138 lines · On Tue, Jul 24, 2012 at 2:14 PM, <[email protected]> wrote:
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 1 line

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 1 line

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means that
we should probably plan on holding off merging it until after 3.6.

Quoted 1 line

Here are the open issues; please correct any misunderstandings: With

Seungwon's patchset ("Support packed write command"):

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

* I still don't have a good set of representative benchmarks showing what kind of performance changes come with this patchset. It seems

like we've had a small amount of testing on one controller/eMMC part combo
from Seungwon, and an entirely different test from Maya, and the

results

Quoted 1 line
Quoted 1 line

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and after the patchset.

Quoted 2 lines
Quoted 2 lines

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 4 lines
Quoted 4 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace before

trying to fix it. Maya has a theory about writes overwhelming reads, but
Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 1 line
Quoted 1 line

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 3 lines
Quoted 3 lines

since it allows the MMC to fetch many write requests in a row, instead of
fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can be

Quoted 3 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 8 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next blk_fetch_request should get the next read and continue as before.

Quoted 3 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for the
first write request completion before fetching another write request. During this time the read request could be inserted into the CFQ and since
it has higher priority than the async write it will be dispatched in the next fetch. So, the result would be 2 write requests followed by one read
request and the read would have to wait for completion of only 2 write requests.
With packing, all the 5 write requests will be fetched in a row, and then
the read will arrive and be dispatched in the next fetch. Then the read will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can "aggregate" several requests to be inserted into the scheduler before waking the MMC queue thread.
This leads to a situation where there are several write requests in the CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then I agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the packing stopped due to an empty queue, meaning that the read was inserted
to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped the
packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 2 lines

And I requested blktrace to confirm that this is indeed the behaviour.

The trace logs show that in case of no packing, there are maximum of 3-4 requests issued before a read request, while with packing there are also cases of 6 and 7 requests dispatched before a read request.

Quoted 7 lines
Quoted 5 lines

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and let
us know if you reach other conclusions.

Thanks for the brief. I don't have the eMMC4.5 device with me yet, so I can't reproduce the result.

I sent the trace logs of both packing and non packing. Please let me know if you have additional questions after reviewing them.

The problem you describe is most likely

Quoted 4 lines

applicable
to any block device driver with a large queue depth ( any queue depth >1). I'll check to see what knobs in block affect the result. Speaking of it, what is the host controller you use to test this ?

The controller I use is msm_sdcc.

Quoted 4 lines

I was wondering if host->max_seg_size is taken into account while packed command
is in use. If not, shouldn't it be ? - it could act as a better throttle for "packing density".

The max segments (which is calculated from host->max_seg_size) is taking into account when preparing the packed list (so that the whole packed won't exceed the max number of segments).
I'm not sure I understand how host->max_seg_size can be used as a throttle for "packing density". Can you please explain?

Quoted 8 lines

Thanks,
Venkat.
--
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

Thanks,
Maya

Signature · 2 lines
Sent by consultant of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
#5 lore raw
Quoted 165 lines · On Fri, Jul 27, 2012 at 12:24 AM, <[email protected]> wrote:
Quoted 139 lines · Venkatraman
Quoted 138 lines · On Tue, Jul 24, 2012 at 2:14 PM, <[email protected]> wrote:
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 1 line

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 1 line

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means that
we should probably plan on holding off merging it until after 3.6.

Quoted 1 line

Here are the open issues; please correct any misunderstandings: With

Seungwon's patchset ("Support packed write command"):

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

* I still don't have a good set of representative benchmarks showing what kind of performance changes come with this patchset. It seems

like we've had a small amount of testing on one controller/eMMC part combo
from Seungwon, and an entirely different test from Maya, and the

results

Quoted 1 line
Quoted 1 line

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and after the patchset.

Quoted 2 lines
Quoted 2 lines

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 4 lines
Quoted 4 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace before

trying to fix it. Maya has a theory about writes overwhelming reads, but
Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 1 line
Quoted 1 line

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 3 lines
Quoted 3 lines

since it allows the MMC to fetch many write requests in a row, instead of
fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can be

Quoted 3 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 8 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next blk_fetch_request should get the next read and continue as before.

Quoted 3 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for the
first write request completion before fetching another write request. During this time the read request could be inserted into the CFQ and since
it has higher priority than the async write it will be dispatched in the next fetch. So, the result would be 2 write requests followed by one read
request and the read would have to wait for completion of only 2 write requests.
With packing, all the 5 write requests will be fetched in a row, and then
the read will arrive and be dispatched in the next fetch. Then the read will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can "aggregate" several requests to be inserted into the scheduler before waking the MMC queue thread.
This leads to a situation where there are several write requests in the CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then I agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the packing stopped due to an empty queue, meaning that the read was inserted
to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped the
packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 2 lines

And I requested blktrace to confirm that this is indeed the behaviour.

The trace logs show that in case of no packing, there are maximum of 3-4 requests issued before a read request, while with packing there are also cases of 6 and 7 requests dispatched before a read request.

Quoted 7 lines
Quoted 5 lines

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and let
us know if you reach other conclusions.

Thanks for the brief. I don't have the eMMC4.5 device with me yet, so I can't reproduce the result.

I sent the trace logs of both packing and non packing. Please let me know if you have additional questions after reviewing them.

The problem you describe is most likely

Quoted 4 lines

applicable
to any block device driver with a large queue depth ( any queue depth >1). I'll check to see what knobs in block affect the result. Speaking of it, what is the host controller you use to test this ?

The controller I use is msm_sdcc.

Quoted 4 lines

I was wondering if host->max_seg_size is taken into account while packed command
is in use. If not, shouldn't it be ? - it could act as a better throttle for "packing density".

Quoted 6 lines

The max segments (which is calculated from host->max_seg_size) is taking into account when preparing the packed list (so that the whole packed won't exceed the max number of segments).
I'm not sure I understand how host->max_seg_size can be used as a throttle for "packing density". Can you please explain?

Ok - I overlooked that max_segments is indeed used to limit the number of requests
that are packed.(And this corresponds to max_seg_size, which is what I intended) I should be getting my MMC4.5 test gear in a couple of days - I'll run it through
on some hosts and can either provide more feedback or Ack this patch. Regards,
Venkat.

#6 lore raw
Quoted 194 lines · Venkatraman
Quoted 186 lines · On Fri, Jul 27, 2012 at 12:24 AM, <[email protected]> wrote:
Quoted 157 lines · Venkatraman
Quoted 156 lines · On Tue, Jul 24, 2012 at 2:14 PM, <[email protected]> wrote:
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 1 line

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 1 line

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means that
we should probably plan on holding off merging it until after 3.6.

Quoted 2 lines

Here are the open issues; please correct any misunderstandings:
With

Seungwon's patchset ("Support packed write command"):

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

* I still don't have a good set of representative benchmarks showing
what kind of performance changes come with this patchset. It
seems

like we've had a small amount of testing on one controller/eMMC part combo
from Seungwon, and an entirely different test from Maya, and the

results

Quoted 1 line
Quoted 1 line

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and after the patchset.

Quoted 2 lines
Quoted 2 lines

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 8 lines
Quoted 8 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 4 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace
before

Quoted 7 lines
Quoted 7 lines

trying to fix it. Maya has a theory about writes overwhelming reads,
but
Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 2 lines
Quoted 2 lines

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 5 lines
Quoted 5 lines

since it allows the MMC to fetch many write requests in a row, instead
of
fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can be

Quoted 3 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 8 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next blk_fetch_request should get the next read and continue as before.

Quoted 3 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for the
first write request completion before fetching another write request. During this time the read request could be inserted into the CFQ and since
it has higher priority than the async write it will be dispatched in the
next fetch. So, the result would be 2 write requests followed by one read
request and the read would have to wait for completion of only 2 write requests.
With packing, all the 5 write requests will be fetched in a row, and then
the read will arrive and be dispatched in the next fetch. Then the read
will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can "aggregate" several requests to be inserted into the scheduler before waking the MMC queue thread.
This leads to a situation where there are several write requests in the
CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then I
agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the
packing stopped due to an empty queue, meaning that the read was inserted
to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped the
packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 3 lines

And I requested blktrace to confirm that this is indeed the behaviour.

The trace logs show that in case of no packing, there are maximum of 3-4
requests issued before a read request, while with packing there are also
cases of 6 and 7 requests dispatched before a read request.

Quoted 7 lines
Quoted 5 lines

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and let
us know if you reach other conclusions.

Thanks for the brief. I don't have the eMMC4.5 device with me yet, so I can't reproduce the result.

I sent the trace logs of both packing and non packing. Please let me know
if you have additional questions after reviewing them.

The problem you describe is most likely

Quoted 5 lines

applicable
to any block device driver with a large queue depth ( any queue depth

Quoted 1 line

1).

I'll check to see what knobs in block affect the result. Speaking of it, what is the host controller you use to test this ?

The controller I use is msm_sdcc.

Quoted 5 lines

I was wondering if host->max_seg_size is taken into account while packed
command
is in use. If not, shouldn't it be ? - it could act as a better throttle for "packing density".

Quoted 7 lines

The max segments (which is calculated from host->max_seg_size) is taking into account when preparing the packed list (so that the whole packed won't exceed the max number of segments).
I'm not sure I understand how host->max_seg_size can be used as a throttle
for "packing density". Can you please explain?

Quoted 9 lines

Ok - I overlooked that max_segments is indeed used to limit the number of requests
that are packed.(And this corresponds to max_seg_size, which is what I intended)
I should be getting my MMC4.5 test gear in a couple of days - I'll run it through
on some hosts and can either provide more feedback or Ack this patch. Regards,
Venkat.

Hi Venkat,

Do you have additional questions/comments?

Thanks,
Maya

Signature · 2 lines
Sent by consultant of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
#7 lore raw
Quoted 206 lines · On Mon, Aug 27, 2012 at 11:58 PM, <[email protected]> wrote:
Quoted 194 lines · Venkatraman
Quoted 186 lines · On Fri, Jul 27, 2012 at 12:24 AM, <[email protected]> wrote:
Quoted 157 lines · Venkatraman
Quoted 156 lines · On Tue, Jul 24, 2012 at 2:14 PM, <[email protected]> wrote:
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 1 line

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 1 line

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means that
we should probably plan on holding off merging it until after 3.6.

Quoted 2 lines

Here are the open issues; please correct any misunderstandings:
With

Seungwon's patchset ("Support packed write command"):

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

* I still don't have a good set of representative benchmarks showing
what kind of performance changes come with this patchset. It
seems

like we've had a small amount of testing on one controller/eMMC part combo
from Seungwon, and an entirely different test from Maya, and the

results

Quoted 1 line
Quoted 1 line

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and after the patchset.

Quoted 2 lines
Quoted 2 lines

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 8 lines
Quoted 8 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 4 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace
before

Quoted 7 lines
Quoted 7 lines

trying to fix it. Maya has a theory about writes overwhelming reads,
but
Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 2 lines
Quoted 2 lines

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 5 lines
Quoted 5 lines

since it allows the MMC to fetch many write requests in a row, instead
of
fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can be

Quoted 3 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 8 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next blk_fetch_request should get the next read and continue as before.

Quoted 3 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for the
first write request completion before fetching another write request. During this time the read request could be inserted into the CFQ and since
it has higher priority than the async write it will be dispatched in the
next fetch. So, the result would be 2 write requests followed by one read
request and the read would have to wait for completion of only 2 write requests.
With packing, all the 5 write requests will be fetched in a row, and then
the read will arrive and be dispatched in the next fetch. Then the read
will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can "aggregate" several requests to be inserted into the scheduler before waking the MMC queue thread.
This leads to a situation where there are several write requests in the
CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then I
agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the
packing stopped due to an empty queue, meaning that the read was inserted
to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped the
packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 3 lines

And I requested blktrace to confirm that this is indeed the behaviour.

The trace logs show that in case of no packing, there are maximum of 3-4
requests issued before a read request, while with packing there are also
cases of 6 and 7 requests dispatched before a read request.

Quoted 7 lines
Quoted 5 lines

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and let
us know if you reach other conclusions.

Thanks for the brief. I don't have the eMMC4.5 device with me yet, so I can't reproduce the result.

I sent the trace logs of both packing and non packing. Please let me know
if you have additional questions after reviewing them.

The problem you describe is most likely

Quoted 5 lines

applicable
to any block device driver with a large queue depth ( any queue depth

Quoted 1 line

1).

I'll check to see what knobs in block affect the result. Speaking of it, what is the host controller you use to test this ?

The controller I use is msm_sdcc.

Quoted 5 lines

I was wondering if host->max_seg_size is taken into account while packed
command
is in use. If not, shouldn't it be ? - it could act as a better throttle for "packing density".

Quoted 7 lines

The max segments (which is calculated from host->max_seg_size) is taking into account when preparing the packed list (so that the whole packed won't exceed the max number of segments).
I'm not sure I understand how host->max_seg_size can be used as a throttle
for "packing density". Can you please explain?

Quoted 9 lines

Ok - I overlooked that max_segments is indeed used to limit the number of requests
that are packed.(And this corresponds to max_seg_size, which is what I intended)
I should be getting my MMC4.5 test gear in a couple of days - I'll run it through
on some hosts and can either provide more feedback or Ack this patch. Regards,
Venkat.

Quoted 4 lines

Hi Venkat,

Do you have additional questions/comments?

None. I am just running some stress tests on BKOPS patches right now and after tomorrow I'll start testing packed command. Will all the patches apply on top of current mmc-next ? If not, it would be great if
you can send an updated version.

Thanks,
Venkat.

#8 lore raw

Hi Venkat,

Sorry for the late response. I came back from a long vacation and had many issues to take care of.
If you still need a rebased version of the packed commands patches, I can send a rebased version of the write packing control patch once Seungwon Jeon will send the rebased version of the packing patches. Please let us know if you ran into conflicts and it is required.

Thanks,
Maya

Quoted 244 lines · Venkatraman
Quoted 226 lines · On Mon, Aug 27, 2012 at 11:58 PM, <[email protected]> wrote:
Quoted 214 lines · Venkatraman
Quoted 205 lines · On Fri, Jul 27, 2012 at 12:24 AM, <[email protected]> wrote:
Quoted 175 lines · Venkatraman
Quoted 174 lines · On Tue, Jul 24, 2012 at 2:14 PM, <[email protected]> wrote:
Quoted 3 lines · Venkatraman
Quoted 2 lines · On Mon, Jul 23, 2012 at 5:13 PM, <[email protected]> wrote:
Quoted 1 line · Chris Ball

Hi, [removing Jens and the documentation list, since now we're

talking about the MMC side only]

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · On Wed, Jul 18 2012, [email protected] wrote:
Quoted 2 lines

Is there anything else that holds this patch from being pushed to

mmc-next?

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Yes, I'm still uncomfortable with the write packing patchsets for a

couple of reasons, and I suspect that the sum of those reasons means
that
we should probably plan on holding off merging it until after 3.6.

Quoted 2 lines

Here are the open issues; please correct any misunderstandings:
With

Seungwon's patchset ("Support packed write command"):

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

* I still don't have a good set of representative benchmarks showing
what kind of performance changes come with this patchset. It
seems

like we've had a small amount of testing on one controller/eMMC part
combo
from Seungwon, and an entirely different test from Maya, and the

results

Quoted 2 lines
Quoted 2 lines

aren't documented fully anywhere to the level of describing what the

hardware was, what the test was, and what the results were before and
after the patchset.

Quoted 2 lines
Quoted 2 lines

Currently, there is only one card vendor that supports packed commands.

Following are our sequential write (LMDD) test results on 2 of our targets

Quoted 8 lines
Quoted 8 lines

(in MB/s):
No packing packing

Target 1 (SDR 50MHz)     15               25
Target 2 (DDR 50MHz)     20               30
Quoted 4 lines

With the reads-during-writes regression:
* Venkat still has open questions about the nature of the read regression, and thinks we should understand it with blktrace
before

Quoted 7 lines
Quoted 7 lines

trying to fix it. Maya has a theory about writes overwhelming reads,
but
Venkat doesn't understand why this would explain the observed bandwidth drop.
The degradation of read due to writes is not a new behavior and exists

also without the write packing feature (which only increases the degradation). Our investigation of this phenomenon led us to the Conclusion that a new scheduling policy should be used for mobile devices,

Quoted 2 lines
Quoted 2 lines

but this is not related to the current discussion of the write packing

feature.

Quoted 1 line
Quoted 1 line

The write packing feature increases the degradation of read due to

write

Quoted 5 lines
Quoted 5 lines

since it allows the MMC to fetch many write requests in a row, instead
of
fetching only one at a time. Therefore some of the read requests will

have to wait for the completion of more write requests before they can
be

Quoted 4 lines
Quoted 1 line

issued.

I am a bit puzzled by this claim. One thing I checked carefully when

reviewing write packing patches from SJeon was that the code didn't plough through a mixed list of reads and writes and selected only writes.

Quoted 1 line

This section of the code in "mmc_blk_prep_packed_list()", from v8

patchset..

Quoted 9 lines

<Quote>

(quoted diff) +4 -0
+               if (rq_data_dir(cur) != rq_data_dir(next)) {
+                       put_back = 1;
+                       break;
+               }

</Quote>

means that once a read is encountered in the middle of write packing,

the packing is stopped at that point and it is executed. Then the next
blk_fetch_request should get the next read and continue as before.

Quoted 3 lines

IOW, the ordering of reads and writes is _not_ altered when using packed

commands.

Quoted 2 lines

For example if there were 5 write requests, followed by 1 read, followed by 5 more write requests in the request_queue, the first 5

writes will be executed as one "packed command", then the read will be
executed, and then the remaining 5 writes will be executed as one "packed command". So the read does not have to wait any more than it waited before (packing feature)

Let me try to better explain with your example.
Without packing the MMC layer will fetch 2 write requests and wait for
the
first write request completion before fetching another write request.
During this time the read request could be inserted into the CFQ and since
it has higher priority than the async write it will be dispatched in the
next fetch. So, the result would be 2 write requests followed by one read
request and the read would have to wait for completion of only 2 write
requests.
With packing, all the 5 write requests will be fetched in a row, and then
the read will arrive and be dispatched in the next fetch. Then the read
will have to wait for the completion of 5 write requests.

Few more clarifications:
Due to the plug list mechanism in the block layer the applications can
"aggregate" several requests to be inserted into the scheduler before
waking the MMC queue thread.
This leads to a situation where there are several write requests in the
CFQ queue when MMC starts to do the fetches.

If the read was inserted while we are building the packed command then
I
agree that we should have seen less effect on the read performance. However, the write packing statistics show that in most of the cases the
packing stopped due to an empty queue, meaning that the read was inserted
to the CFQ after all the pending write requests were fetched and packed.

Following is an example for write packing statistics of a READ/WRITE parallel scenario:
write packing statistics:
Packed 1 reqs - 448 times
Packed 2 reqs - 38 times
Packed 3 reqs - 23 times
Packed 4 reqs - 30 times
Packed 5 reqs - 14 times
Packed 6 reqs - 8 times
Packed 7 reqs - 4 times
Packed 8 reqs - 1 times
Packed 10 reqs - 1 times
Packed 34 reqs - 1 times
stopped packing due to the following reasons:
2 times: wrong data direction (meaning a READ was fetched and stopped
the
packing)
1 times: flush or discard
565 times: empty queue (meaning blk_fetch_request returned NULL)

Quoted 3 lines

And I requested blktrace to confirm that this is indeed the behaviour.

The trace logs show that in case of no packing, there are maximum of 3-4
requests issued before a read request, while with packing there are also
cases of 6 and 7 requests dispatched before a read request.

Quoted 8 lines
Quoted 6 lines

I'm waiting for an approval for sharing the block trace logs. Since this is a simple test to run you can collect the trace logs and
let
us know if you reach other conclusions.

Thanks for the brief. I don't have the eMMC4.5 device with me yet, so I can't reproduce the result.

I sent the trace logs of both packing and non packing. Please let me know
if you have additional questions after reviewing them.

The problem you describe is most likely

Quoted 5 lines

applicable
to any block device driver with a large queue depth ( any queue depth

Quoted 1 line

1).

I'll check to see what knobs in block affect the result. Speaking of it, what is the host controller you use to test this ?

The controller I use is msm_sdcc.

Quoted 5 lines

I was wondering if host->max_seg_size is taken into account while packed
command
is in use. If not, shouldn't it be ? - it could act as a better throttle for "packing density".

Quoted 8 lines

The max segments (which is calculated from host->max_seg_size) is taking
into account when preparing the packed list (so that the whole packed won't exceed the max number of segments).
I'm not sure I understand how host->max_seg_size can be used as a throttle
for "packing density". Can you please explain?

Quoted 9 lines

Ok - I overlooked that max_segments is indeed used to limit the number of requests
that are packed.(And this corresponds to max_seg_size, which is what I intended)
I should be getting my MMC4.5 test gear in a couple of days - I'll run it through
on some hosts and can either provide more feedback or Ack this patch. Regards,
Venkat.

Quoted 4 lines

Hi Venkat,

Do you have additional questions/comments?

None. I am just running some stress tests on BKOPS patches right now and after tomorrow I'll start testing packed command. Will all the patches apply on top of current mmc-next ? If not, it would be great if
you can send an updated version.

Thanks,
Venkat.
--
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

Signature · 2 lines
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation