mmc: core: Support packed command for eMMC4.5 device
Subsystems (2)
Quoted 2 lines · On Thu, Nov 10, 2011 Maya Erez wrote:
Quoted 1 line · Venkatraman
On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+static u8 mmc_blk_chk_packable(struct
mmc_queue*mq, structrequest *req)
The function prepares the checkable list and not only checks if packing is possible, therefore I think its name should change to reflect its real action.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ if (!(md->flags &
MMC_BLK_CMD23) &&
+ !card->ext_csd.packed_event_en)
+ gotono_packed;
Having the condition with a && can lead to cases where CMD23 is not supported and we send packed commands. Therfore the condition should be changed to || or be splitted to 2 separate checks.
Also, according to the standard the generic error flag in PACKED_COMMAND_STATUS is set in case of any error and having PACKED_EVENT_EN is only optional. Therefore, I don't think that setting the packed_event_en should be a mandatory condition for using packed coammnds.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
+ if (
mmc_req_rel_wr(cur)&&
+ (md->flags&MMC_BLK_REL_WR) &&
+ !en_rel_wr) {
+ gotono_packed;
+ }
Can you please explain this condition and its purpose?
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not packable and
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loop will
never terminate.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are packable.
Ideally, you'd need to pack all neighbouring requests into one packed command.
Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would return all
outstanding
Quoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced dispatch) It
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O scheduler?
If all requests are drained from scheduler queue forcedly,
Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may take the
CFQ's duty.
Quoted 1 line
Basically, this patch accommodates the origin order requests from I/O
scheduler.
Quoted 1 line
In order to better utilize the packed commands feature and achieve the best performance improvements I think that the command packing should be done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the device to receive a request list and its constrains (such as maximum number of requests, max number of sectors etc) and use this information as a factor to its algorithm.
This way you keep the decision making in the hands of the scheduler while the MMC layer will only have to send this list as a packed command.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+ if (rqc)
+ reqs =mmc_blk_chk_packable(mq, rqc);
It would be best to keep all the calls to blk_fetch_request in the same location. Therefore, I suggest to move the call to mmc_blk_chk_packable to mmc/card/queue.c after the first request is fetched.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
cmd_abort:
-spin_lock_irq(&md->lock);
- while (ret)
- ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
-
spin_unlock_irq(&md->lock);
+ if (mq_rq->packed_cmd!=MMC_PACKED_NONE) {
This should be the case for MMC_PACKED_NONE.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+
spin_lock_irq(&md->lock);
+ while (ret)
+ ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));
Do we need the while or should it be an if? In other cases where __blk_end_request is called there is no such while.
Thanks,
Maya Erez
Consultant for Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
Quoted 10 lines · Maya Erez
Quoted 2 lines · On Thu, Nov 10, 2011 Maya Erez wrote:
Quoted 1 line · Venkatraman
On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+static u8 mmc_blk_chk_packable(struct
mmc_queue*mq, structrequest *req)
The function prepares the checkable list and not only checks if packing is possible, therefore I think its name should change to reflect its real action
I labored at naming. Isn't it proper? :)
Do you have any recommendation?group_pack_req?
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ if (!(md->flags &
MMC_BLK_CMD23) &&
+ !card->ext_csd.packed_event_en)
+ gotono_packed;
Quoted 8 lines
Having the condition with a && can lead to cases where CMD23 is not supported and we send packed commands. Therfore the condition should be changed to || or be splitted to 2 separate checks.
Also, according to the standard the generic error flag inPACKED_COMMAND_STATUSis set in case of any error and havingPACKED_EVENT_ENis only optional. Therefore, I don't think that setting thepacked_event_enshould be a mandatory condition for using packed coammnds.
... cases where CMD23 is not supported and we send packed commands? Packed command must not be allowed in such a case.
It works only with predefined mode which is essential fator. And spec doesn't mentioned PACKED_EVENT_EN must be set. So Packed command can be sent regardless PACKED_EVENT_EN, but it's not complete without reporting of error.
Then host driver may suffer error recovery.
Why packed command is used without error reporting?
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ if (
mmc_req_rel_wr(cur)&&
+ (md->flags&MMC_BLK_REL_WR) &&
+ !en_rel_wr) {
+ gotono_packed;
+ }Can you please explain this condition and its purpose?
In the case where reliable write is request but enhanced reliable write is not supported, write access must be partial according to reliable write sector count. Because even a single request can be split, packed command is not allowed in this case.
Quoted 33 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not packable and
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loop willnever terminate.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are packable.
Ideally, you'd need to pack all neighbouring requests into one packed command.
Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would return all
outstanding
Quoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced dispatch) It
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O scheduler?
If all requests are drained from scheduler queue forcedly,
Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may take the
CFQ's duty.
Quoted 1 line
Basically, this patch accommodates the origin order requests from I/O
scheduler.
Quoted 1 line
Quoted 10 lines
In order to better utilize the packed commands feature and achieve the best performance improvements I think that the command packing should be done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the device to receive a request list and its constrains (such as maximum number of requests, max number of sectors etc) and use this information as a factor to its algorithm.
This way you keep the decision making in the hands of the scheduler while the MMC layer will only have to send this list as a packed command.
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among same direction(read/write)? Currently I/O scheduler may know device constrains which MMC driver informs with the exception of order information for packed command.
But I think the dependency of I/O scheduler may be able to come up.
How can MMC layer treat packed command with I/O scheduler which doesn't support this?
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+ if (rqc)
+ reqs =mmc_blk_chk_packable(mq, rqc);It would be best to keep all the calls to
blk_fetch_requestin the same location. Therefore, I suggest to move the call tommc_blk_chk_packabletommc/card/queue.cafter the first request is fetched.
At the first time, I considered that way.
I'll do more, if possible.
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
cmd_abort:
-spin_lock_irq(&md->lock);
- while (ret)
- ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
-
spin_unlock_irq(&md->lock);
+ if (mq_rq->packed_cmd!=MMC_PACKED_NONE) {This should be the case for
MMC_PACKED_NONE.
Right, I missed it.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+
spin_lock_irq(&md->lock);
+ while (ret)
+ ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Do we need the while or should it be an if? In other cases where
__blk_end_requestis called there is no such while.
This part is not only the new but also origin code which is moved in this patch. Maybe...,'If' case is used for a whole of remained bytes and 'while' case is used for partial report of remained bytes.
Thank you for review.
Best regards,
Seugwon Jeon.
Quoted 13 lines
Thanks,
Maya Erez
Consultant for 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
Quoted 94 lines · Seungwon Jeon
Quoted 10 lines · Maya Erez
Quoted 2 lines · On Thu, Nov 10, 2011 Maya Erez wrote:
Quoted 1 line · Venkatraman
On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+static u8 mmc_blk_chk_packable(struct
mmc_queue*mq, structrequest *req)
The function prepares the checkable list and not only checks if packing is possible, therefore I think its name should change to reflect its real action
I labored at naming. Isn't it proper? :)
Do you have any recommendation?group_pack_req?Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ if (!(md->flags &
MMC_BLK_CMD23) &&
+ !card->ext_csd.packed_event_en)
+ gotono_packed;Quoted 8 lines
Having the condition with a && can lead to cases where CMD23 is not supported and we send packed commands. Therfore the condition should be changed to || or be splitted to 2 separate checks.
Also, according to the standard the generic error flag inPACKED_COMMAND_STATUSis set in case of any error and havingPACKED_EVENT_ENis only optional. Therefore, I don't think that setting thepacked_event_enshould be a mandatory condition for using packed coammnds.... cases where CMD23 is not supported and we send packed commands? Packed command must not be allowed in such a case.
It works only with predefined mode which is essential fator. And spec doesn't mentionedPACKED_EVENT_ENmust be set. So Packed command can be sent regardlessPACKED_EVENT_EN, but it's not complete without reporting of error.
Then host driver may suffer error recovery.
Why packed command is used without error reporting?Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ if (
mmc_req_rel_wr(cur)&&
+ (md->flags&MMC_BLK_REL_WR) &&
+ !en_rel_wr) {
+ gotono_packed;
+ }Can you please explain this condition and its purpose?
In the case where reliable write is request but enhanced reliable write is not supported, write access must be partial according to reliable write sector count. Because even a single request can be split, packed command is not allowed in this case.
Quoted 33 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not packable and
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loop willnever terminate.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are packable.
Ideally, you'd need to pack all neighbouring requests into one packed command.
Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would return all
outstanding
Quoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced dispatch) It
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O scheduler?
If all requests are drained from scheduler queue forcedly,
Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may take the
CFQ's duty.
Quoted 1 line
Basically, this patch accommodates the origin order requests from I/O
scheduler.
Quoted 1 line
Quoted 10 lines
In order to better utilize the packed commands feature and achieve the best performance improvements I think that the command packing should be done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the device to receive a request list and its constrains (such as maximum number of requests, max number of sectors etc) and use this information as a factor to its algorithm.
This way you keep the decision making in the hands of the scheduler while the MMC layer will only have to send this list as a packed command.
Quoted 6 lines
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among same direction(read/write)? Currently I/O scheduler may know device constrains which MMC driver informs with the exception of order information for packed command.
But I think the dependency of I/O scheduler may be able to come up.
How can MMC layer treat packed command with I/O scheduler which doesn't support this?
The very act of packing presumes some sorting and re-ordering at the I/O scheduler level.
When no such sorting is done (ex. noop), MMC should resort to non-packed execution, respecting the system configuration choice.
Looking deeper into this, I think a better approach would be to set the prep_rq_fn of the request_queue, with a custom mmc function that decides if the requests are packable or not, and return a BLKPREP_DEFER for those that can't be packed.
Quoted 52 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ if (rqc)
+ reqs =mmc_blk_chk_packable(mq, rqc);It would be best to keep all the calls to
blk_fetch_requestin the same location. Therefore, I suggest to move the call tommc_blk_chk_packabletommc/card/queue.cafter the first request is fetched.At the first time, I considered that way.
I'll do more, if possible.Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
cmd_abort:
-spin_lock_irq(&md->lock);
- while (ret)
- ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
-
spin_unlock_irq(&md->lock);
+ if (mq_rq->packed_cmd!=MMC_PACKED_NONE) {This should be the case for
MMC_PACKED_NONE.Right, I missed it.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+
spin_lock_irq(&md->lock);
+ while (ret)
+ ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Do we need the while or should it be an if? In other cases where
__blk_end_requestis called there is no such while.This part is not only the new but also origin code which is moved in this patch. Maybe...,'If' case is used for a whole of remained bytes and 'while' case is used for partial report of remained bytes.
Thank you for review.
Best regards,
Seugwon Jeon.Quoted 13 lines
Thanks,
Maya Erez
Consultant for 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
Quoted 31 lines
Quoted 29 lines · Seungwon Jeon
Quoted 11 lines · Maya Erez
Quoted 2 lines · On Thu, Nov 10, 2011 Maya Erez wrote:
Quoted 1 line · Venkatraman
On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+static u8 mmc_blk_chk_packable(struct
mmc_queue*mq, structrequest *req)
The function prepares the checkable list and not only checks if packing is
possible, therefore I think its name should change to reflect its real actionI labored at naming. Isn't it proper? :)
Do you have any recommendation?group_pack_req?Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ if (!(md->flags &
MMC_BLK_CMD23) &&
+ !card->ext_csd.packed_event_en)
+ gotono_packed;Having the condition with a && can lead to cases where CMD23 is not supported and we send packed commands. Therfore the condition should be changed to || or be splitted to 2 separate checks.
Also, according to the standard the generic error flag inPACKED_COMMAND_STATUSis set in case of any error and havingPACKED_EVENT_ENis only optional. Therefore, I don't think that setting thepacked_event_enshould be a mandatory condition for using packed coammnds.
Quoted 8 lines
Quoted 8 lines
... cases where CMD23 is not supported and we send packed commands? Packed command must not be allowed in such a case.
It works only with predefined mode which is essential fator. And spec doesn't mentionedPACKED_EVENT_ENmust be set. So Packed command can be sent regardlessPACKED_EVENT_EN, but it's not complete without reporting of error.
Then host driver may suffer error recovery.
Why packed command is used without error reporting?
Let me better explain my comment:
If the first condition (!(md->flags & MMC_BLK_CMD23) is 1 (meaning MMC_BLK_CMD23 flag is not set), then in case card->ext_csd.packed_event_en is 1 the second condition will be 0 and we won't "goto no_packed;". In this case, CMD_23 is not supported but we don't exit the function. If you want both conditions to be mandatory you need to use here an ||.
Quoted 81 lines
Quoted 66 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
+ if (
mmc_req_rel_wr(cur)&&
+ (md->flags&MMC_BLK_REL_WR) &&
+ !en_rel_wr) {
+ gotono_packed;
+ }Can you please explain this condition and its purpose?
In the case where reliable write is request but enhanced reliable write is not supported, write access must be partial according to reliable write sector count. Because even a single request can be split, packed command is not allowed in this case.
Quoted 37 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not packable and
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loop willnever terminate.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are
packable.
Ideally, you'd need to pack all neighbouring requests into one packed command.Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would return
all
outstandingQuoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced dispatch) It
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O
scheduler?
If all requests are drained from scheduler queue forcedly,Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may take
the
CFQ's duty.Quoted 1 line
Basically, this patch accommodates the origin order requests from I/O
scheduler.
Quoted 1 line
Quoted 14 lines
In order to better utilize the packed commands feature and achieve the best performance improvements I think that the command packing should be
done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the device to
receive a request list and its constrains (such as maximum number of requests, max number of sectors etc) and use this information as a factor
to its algorithm.
This way you keep the decision making in the hands of the scheduler while
the MMC layer will only have to send this list as a packed command.Quoted 9 lines
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among same direction(read/write)?
Currently I/O scheduler may know device constrains which MMC driver informs
with the exception of order information for packed command. But I think the dependency of I/O scheduler may be able to come up. How can MMC layer treat packed command with I/O scheduler which doesn't support this?The very act of packing presumes some sorting and re-ordering at the I/O scheduler level.
When no such sorting is done (ex. noop), MMC should resort to non-packed execution, respecting the system configuration choice.
Quoted 60 lines
Looking deeper into this, I think a better approach would be to set the
prep_rq_fnof therequest_queue, with a custom mmc function that decides if the requests are packable or not, and return aBLKPREP_DEFERfor those that can't be packed.Quoted 54 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ if (rqc)
+ reqs =mmc_blk_chk_packable(mq, rqc);It would be best to keep all the calls to
blk_fetch_requestin the same location. Therefore, I suggest to move the call tommc_blk_chk_packabletommc/card/queue.cafter the first request is fetched.At the first time, I considered that way.
I'll do more, if possible.Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
cmd_abort:
-spin_lock_irq(&md->lock);
- while (ret)
- ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
-
spin_unlock_irq(&md->lock);
+ if (mq_rq->packed_cmd!=MMC_PACKED_NONE) {This should be the case for
MMC_PACKED_NONE.Right, I missed it.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+
spin_lock_irq(&md->lock);
+ while (ret)
+ ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Do we need the while or should it be an if? In other cases where
__blk_end_requestis called there is no such while.This part is not only the new but also origin code which is moved in this patch.
Maybe...,'If' case is used for a whole of remained bytes and 'while' case is used for partial report of remained bytes.Thank you for review.
Best regards,
Seugwon Jeon.Quoted 13 lines
Thanks,
Maya Erez
Consultant for 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
Thanks,
Maya Erez
Consultant for Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
Quoted 16 lines
Quoted 16 lines
Quoted 14 lines · Seungwon Jeon
Quoted 13 lines · Maya Erez
Quoted 2 lines · On Thu, Nov 10, 2011 Maya Erez wrote:
Quoted 1 line · Venkatraman
On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+static u8 mmc_blk_chk_packable(struct
mmc_queue*mq, structrequest *req)
The function prepares the checkable list and not only checks if packing
is
possible, therefore I think its name should change to reflect its real action
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I labored at naming. Isn't it proper? :)
Do you have any recommendation?group_pack_req?
How about mmc_blk_prep_packed_list?
Thanks,
Maya Erez
Consultant for Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
Quoted 107 lines · Venkatraman
Quoted 94 lines · Seungwon Jeon
Quoted 10 lines · Maya Erez
Quoted 2 lines · On Thu, Nov 10, 2011 Maya Erez wrote:
Quoted 1 line · Venkatraman
On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+static u8 mmc_blk_chk_packable(struct
mmc_queue*mq, structrequest *req)
The function prepares the checkable list and not only checks if packing is possible, therefore I think its name should change to reflect its real action
I labored at naming. Isn't it proper? :)
Do you have any recommendation?group_pack_req?Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ if (!(md->flags &
MMC_BLK_CMD23) &&
+ !card->ext_csd.packed_event_en)
+ gotono_packed;Quoted 8 lines
Having the condition with a && can lead to cases where CMD23 is not supported and we send packed commands. Therfore the condition should be changed to || or be splitted to 2 separate checks.
Also, according to the standard the generic error flag inPACKED_COMMAND_STATUSis set in case of any error and havingPACKED_EVENT_ENis only optional. Therefore, I don't think that setting thepacked_event_enshould be a mandatory condition for using packed coammnds.... cases where CMD23 is not supported and we send packed commands? Packed command must not be allowed in such a case.
It works only with predefined mode which is essential fator. And spec doesn't mentionedPACKED_EVENT_ENmust be set. So Packed command can be sent regardlessPACKED_EVENT_EN, but it's not complete without reporting of error.
Then host driver may suffer error recovery.
Why packed command is used without error reporting?Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ if (
mmc_req_rel_wr(cur)&&
+ (md->flags&MMC_BLK_REL_WR) &&
+ !en_rel_wr) {
+ gotono_packed;
+ }Can you please explain this condition and its purpose?
In the case where reliable write is request but enhanced reliable write is not supported, write access must be partial according to reliable write sector count. Because even a single request can be split, packed command is not allowed in this case.
Quoted 33 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not packable and
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loop willnever terminate.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are packable.
Ideally, you'd need to pack all neighbouring requests into one packed command.
Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would return all
outstanding
Quoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced dispatch) It
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O scheduler?
If all requests are drained from scheduler queue forcedly,
Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may take the
CFQ's duty.
Quoted 1 line
Basically, this patch accommodates the origin order requests from I/O
scheduler.
Quoted 1 line
Quoted 10 lines
In order to better utilize the packed commands feature and achieve the best performance improvements I think that the command packing should be done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the device to receive a request list and its constrains (such as maximum number of requests, max number of sectors etc) and use this information as a factor to its algorithm.
This way you keep the decision making in the hands of the scheduler while the MMC layer will only have to send this list as a packed command.Quoted 6 lines
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among same direction(read/write)? Currently I/O scheduler may know device constrains which MMC driver informs with the exception of order information for packed command.
But I think the dependency of I/O scheduler may be able to come up.
How can MMC layer treat packed command with I/O scheduler which doesn't support this?The very act of packing presumes some sorting and re-ordering at the I/O scheduler level.
When no such sorting is done (ex. noop), MMC should resort to non-packed execution, respecting the system configuration choice.
Quoted 4 lines
Looking deeper into this, I think a better approach would be to set the
prep_rq_fnof therequest_queue, with a custom mmc function that decides if the requests are packable or not, and return aBLKPREP_DEFERfor those that can't be packed.
MMC layer anticipates the favorable requests for packing from I/O scheduler. Obviously request order from I/O scheduler might be poor for packing and requests can't be packed. But that doesn't mean mmc layer need to wait a better pack-case.BLKPREP_DEFER may give rise to I/O latency. Top of request will be deferred next time. If request can't be packed, it'd rather be sent at once than delayed
by returning a BLKPREP_DEFER for better responsiveness.
Thanks.
Seungwon Jeon.
Quoted 57 lines
Quoted 30 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ if (rqc)
+ reqs =mmc_blk_chk_packable(mq, rqc);It would be best to keep all the calls to
blk_fetch_requestin the same location. Therefore, I suggest to move the call tommc_blk_chk_packabletommc/card/queue.cafter the first request is fetched.At the first time, I considered that way.
I'll do more, if possible.Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
cmd_abort:
-spin_lock_irq(&md->lock);
- while (ret)
- ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
-
spin_unlock_irq(&md->lock);
+ if (mq_rq->packed_cmd!=MMC_PACKED_NONE) {This should be the case for
MMC_PACKED_NONE.Right, I missed it.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+
spin_lock_irq(&md->lock);
+ while (ret)
+ ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Do we need the while or should it be an if? In other cases where
__blk_end_requestis called there is no such while.Quoted 23 lines
This part is not only the new but also origin code which is moved in this patch. Maybe...,'If' case is used for a whole of remained bytes and 'while' case is used for partial report of remained bytes.
Thank you for review.
Best regards,
Seugwon Jeon.Quoted 13 lines
Thanks,
Maya Erez
Consultant for 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--
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
Quoted 39 lines · Maya Erez
Quoted 31 lines
Quoted 29 lines · Seungwon Jeon
Quoted 11 lines · Maya Erez
Quoted 2 lines · On Thu, Nov 10, 2011 Maya Erez wrote:
Quoted 1 line · Venkatraman
On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+static u8 mmc_blk_chk_packable(struct
mmc_queue*mq, structrequest *req)
The function prepares the checkable list and not only checks if packing is
possible, therefore I think its name should change to reflect its real actionI labored at naming. Isn't it proper? :)
Do you have any recommendation?group_pack_req?Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ if (!(md->flags &
MMC_BLK_CMD23) &&
+ !card->ext_csd.packed_event_en)
+ gotono_packed;Having the condition with a && can lead to cases where CMD23 is not supported and we send packed commands. Therfore the condition should be changed to || or be splitted to 2 separate checks.
Also, according to the standard the generic error flag inPACKED_COMMAND_STATUSis set in case of any error and havingPACKED_EVENT_ENis only optional. Therefore, I don't think that setting thepacked_event_enshould be a mandatory condition for using packed coammnds.Quoted 8 lines
Quoted 8 lines
... cases where CMD23 is not supported and we send packed commands? Packed command must not be allowed in such a case.
It works only with predefined mode which is essential fator. And spec doesn't mentionedPACKED_EVENT_ENmust be set. So Packed command can be sent regardlessPACKED_EVENT_EN, but it's not complete without reporting of error.
Then host driver may suffer error recovery.
Why packed command is used without error reporting?
Quoted 6 lines
Let me better explain my comment:
If the first condition (!(md->flags &MMC_BLK_CMD23) is 1 (meaningMMC_BLK_CMD23flag is not set), then in casecard->ext_csd.packed_event_enis 1 the second condition will be 0 and we won't "gotono_packed;". In this case,CMD_23is not supported but we don't exit the function. If you want both conditions to be mandatory you need to use here an ||.
Thank you for clearing comment.
This condition will be fixed.
Quoted 90 lines
Quoted 90 lines
Quoted 66 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
+ if (
mmc_req_rel_wr(cur)&&
+ (md->flags&MMC_BLK_REL_WR) &&
+ !en_rel_wr) {
+ gotono_packed;
+ }Can you please explain this condition and its purpose?
In the case where reliable write is request but enhanced reliable write is not supported, write access must be partial according to reliable write sector count. Because even a single request can be split, packed command is not allowed in this case.
Quoted 37 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not packable and
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loop willnever terminate.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are
packable.
Ideally, you'd need to pack all neighbouring requests into one packed command.Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would return
all
outstandingQuoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced dispatch) It
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O
scheduler?
If all requests are drained from scheduler queue forcedly,Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may take
the
CFQ's duty.Quoted 1 line
Basically, this patch accommodates the origin order requests from I/O
scheduler.
Quoted 1 line
Quoted 14 lines
In order to better utilize the packed commands feature and achieve the best performance improvements I think that the command packing should be
done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the device to
receive a request list and its constrains (such as maximum number of requests, max number of sectors etc) and use this information as a factor
to its algorithm.
This way you keep the decision making in the hands of the scheduler while
the MMC layer will only have to send this list as a packed command.Quoted 9 lines
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among same direction(read/write)?
Currently I/O scheduler may know device constrains which MMC driver informs
with the exception of order information for packed command. But I think the dependency of I/O scheduler may be able to come up. How can MMC layer treat packed command with I/O scheduler which doesn't support this?The very act of packing presumes some sorting and re-ordering at the I/O scheduler level.
When no such sorting is done (ex. noop), MMC should resort to non-packed execution, respecting the system configuration choice.Looking deeper into this, I think a better approach would be to set the
prep_rq_fnof therequest_queue, with a custom mmc function that decides if the requests are packable or not, and return aBLKPREP_DEFERfor those that can't be packed.Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ if (rqc)
+ reqs =mmc_blk_chk_packable(mq, rqc);
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
It would be best to keep all the calls to
blk_fetch_requestin the same location. Therefore, I suggest to move the call tommc_blk_chk_packabletommc/card/queue.cafter the first request is fetched.At the first time, I considered that way.
I'll do more, if possible.
I considered more.
I think that mmc_blk_chk_packable would rather be called only for r/w type than all request type(e.g. discard, flush).
Quoted 54 lines
Quoted 37 lines
Quoted 37 lines
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
cmd_abort:
-spin_lock_irq(&md->lock);
- while (ret)
- ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
-
spin_unlock_irq(&md->lock);
+ if (mq_rq->packed_cmd!=MMC_PACKED_NONE) {This should be the case for
MMC_PACKED_NONE.Right, I missed it.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+
spin_lock_irq(&md->lock);
+ while (ret)
+ ret = __blk_end_request(req,-EIO,
blk_rq_cur_bytes(req));Do we need the while or should it be an if? In other cases where
__blk_end_requestis called there is no such while.This part is not only the new but also origin code which is moved in this patch.
Maybe...,'If' case is used for a whole of remained bytes and 'while' case is used for partial report of remained bytes.Thank you for review.
Best regards,
Seugwon Jeon.Quoted 9 lines
Thanks,
Maya Erez
Consultant for Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora ForumQuoted 7 lines
Quoted 6 lines
Quoted 4 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.htmlThanks,
Maya Erez
Consultant for 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
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+ if (rqc)
+ reqs =mmc_blk_chk_packable(mq, rqc);It would be best to keep all the calls to
blk_fetch_requestin thesame
Quoted 1 line
Quoted 1 line
Quoted 1 line
location. Therefore, I suggest to move the call to
mmc_blk_chk_packable
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
to
mmc/card/queue.cafter the first request is fetched.At the first time, I considered that way.
I'll do more, if possible.I considered more.
I think thatmmc_blk_chk_packablewould rather be called only for r/w type than all request type(e.g. discard, flush).
mmc_blk_chk_packable can check the cmd_flags of the request to verify it's not a flush/disacrad etc. In such cases will not pack.
Quoted 86 lines
Quoted 71 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not packable
and
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loopwill
Quoted 7 lines
Quoted 7 lines
never terminate.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are
packable.
Quoted 3 lines
Quoted 3 lines
Ideally, you'd need to pack all neighbouring requests into one packed command.
Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would return
all
Quoted 2 lines
Quoted 2 lines
outstanding
Quoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced dispatch)
It
Quoted 5 lines
Quoted 5 lines
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O
scheduler?
Quoted 3 lines
Quoted 3 lines
If all requests are drained from scheduler queue forcedly,
Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may take
the
Quoted 2 lines
Quoted 2 lines
CFQ's duty.
Quoted 1 line
Basically, this patch accommodates the origin order requests from
I/O
Quoted 4 lines
Quoted 4 lines
scheduler.
Quoted 1 line
In order to better utilize the packed commands feature and achieve
the
Quoted 1 line
Quoted 1 line
best performance improvements I think that the command packing should
be
Quoted 2 lines
Quoted 2 lines
done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the
device to
Quoted 2 lines
Quoted 2 lines
receive a request list and its constrains (such as maximum number of requests, max number of sectors etc) and use this information as a
factor
Quoted 2 lines
Quoted 2 lines
to its algorithm.
This way you keep the decision making in the hands of the schedulerwhile
Quoted 4 lines
Quoted 2 lines
the MMC layer will only have to send this list as a packed command.
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among samedirection(read/write)?
Quoted 1 line
Currently I/O scheduler may know device constrains which MMC driver
informs
Quoted 3 lines
with the exception of order information for packed command. But I think the dependency of I/O scheduler may be able to come up. How can MMC layer treat packed command with I/O scheduler which
doesn't support this?
The very act of packing presumes some sorting and re-ordering at the I/O scheduler level.
When no such sorting is done (ex. noop), MMC should resort to non-packed execution, respecting the system configuration choice.Quoted 4 lines
Looking deeper into this, I think a better approach would be to set the
prep_rq_fnof therequest_queue, with a custom mmc function that decides if the requests are packable or not, and return aBLKPREP_DEFERfor those that can't be packed.MMC layer anticipates the favorable requests for packing from I/O scheduler.
Obviously request order from I/O scheduler might be poor for packing and requests can't be packed.
But that doesn't mean mmc layer need to wait a better pack-case.BLKPREP_DEFERmay give rise to I/O latency. Top of request will be deferred next time.
If request can't be packed, it'd rather be sent at once than delayed by returning aBLKPREP_DEFERfor better responsiveness.
Quoted 2 lines
Thanks.
Seungwon Jeon.
The decision whether a request is packable or not should not be made per request, therefore I don't see the need for using req_prep_fn. The MMC layer can peek each request and decide if to pack it or not when preparing the packed list (as suggested in this patch). The scheduler changes will improve the probability of getting a list that can be packed. My suggestion for the scheduler change is:
The block layer will be notified of the packing limits via new queue limits (in blk-settings). We can make it generic to allow all kinds of requests lists. Example for the new queue limits can be:Is_reqs_list_supportedMax_num_of_read_reqs_in_listMax_num_of_write_reqs_in_listmax_blk_cnt_in_listIs_list_interleaved (optional - to support read and write requests to be linked together, not the case for eMMC4.5)
The scheduler, that will have all the required info in the queue limits, will be able to decide which requests can be in the same list and move all of them to the dispatch queue (in one elevator_dispatch_fn call).
I see 2 options for preparing the list:
Option 1. blk_fetch_request will prepare the list and return a list of requests (will require a change in struct request to include the list but can be more generic).
Option 2. The MMC layer will prepare the list. After fetching one request the MMC layer can call blk_peek_request and check if the next request is packable or not. By keeping all the calls to blk_peek_request under the same queue lock we can guarantee to get the requests that the scheduler pushed to the dispatch queue (this requires mmc_blk_chk_packable to move to block.c). If the request is packable the MMC layer will call blk_start_request to dequeue the request. This way there is no need to re-queue the requests that cannot be packed.
Going back to this patch - the usage of blk_peek_request+blk_start_request instead of blk_fetch_request can be done in mmc_blk_chk_packable in order to eliminate the need to requeue commands and loose performance.
Thanks,
Maya Erez
Consultant for Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
Quoted 10 lines · Maya Erez
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+ if (rqc)
+ reqs =mmc_blk_chk_packable(mq, rqc);It would be best to keep all the calls to
blk_fetch_requestin thesame
Quoted 1 line
Quoted 1 line
Quoted 1 line
location. Therefore, I suggest to move the call to
mmc_blk_chk_packableQuoted 3 lines
Quoted 3 lines
Quoted 2 lines
to
mmc/card/queue.cafter the first request is fetched.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
At the first time, I considered that way.
I'll do more, if possible.I considered more.
I think thatmmc_blk_chk_packablewould rather be called only for r/w type than all request type(e.g. discard, flush).
mmc_blk_chk_packablecan check thecmd_flagsof the request to verify it's not a flush/disacrad etc. In such cases will not pack.
Yes. It must be checked, but omitted.
I already have added this check. It will be applied next.
Thanks,
Seungwon Jeon.
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
Quoted 98 lines · Maya Erez
Quoted 86 lines
Quoted 71 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not packable
and
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loopwill
Quoted 7 lines
Quoted 7 lines
never terminate.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are
packable.
Quoted 3 lines
Quoted 3 lines
Ideally, you'd need to pack all neighbouring requests into one packed command.
Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would return
all
Quoted 2 lines
Quoted 2 lines
outstanding
Quoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced dispatch)
It
Quoted 5 lines
Quoted 5 lines
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O
scheduler?
Quoted 3 lines
Quoted 3 lines
If all requests are drained from scheduler queue forcedly,
Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may take
the
Quoted 2 lines
Quoted 2 lines
CFQ's duty.
Quoted 1 line
Basically, this patch accommodates the origin order requests from
I/O
Quoted 4 lines
Quoted 4 lines
scheduler.
Quoted 1 line
In order to better utilize the packed commands feature and achieve
the
Quoted 1 line
Quoted 1 line
best performance improvements I think that the command packing should
be
Quoted 2 lines
Quoted 2 lines
done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the
device to
Quoted 2 lines
Quoted 2 lines
receive a request list and its constrains (such as maximum number of requests, max number of sectors etc) and use this information as a
factor
Quoted 2 lines
Quoted 2 lines
to its algorithm.
This way you keep the decision making in the hands of the schedulerwhile
Quoted 4 lines
Quoted 2 lines
the MMC layer will only have to send this list as a packed command.
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among samedirection(read/write)?
Quoted 1 line
Currently I/O scheduler may know device constrains which MMC driver
informs
Quoted 3 lines
with the exception of order information for packed command. But I think the dependency of I/O scheduler may be able to come up. How can MMC layer treat packed command with I/O scheduler which
doesn't support this?
The very act of packing presumes some sorting and re-ordering at the I/O scheduler level.
When no such sorting is done (ex. noop), MMC should resort to non-packed execution, respecting the system configuration choice.Quoted 4 lines
Looking deeper into this, I think a better approach would be to set the
prep_rq_fnof therequest_queue, with a custom mmc function that decides if the requests are packable or not, and return aBLKPREP_DEFERfor those that can't be packed.MMC layer anticipates the favorable requests for packing from I/O scheduler.
Obviously request order from I/O scheduler might be poor for packing and requests can't be packed.
But that doesn't mean mmc layer need to wait a better pack-case.BLKPREP_DEFERmay give rise to I/O latency. Top of request will be deferred next time.
If request can't be packed, it'd rather be sent at once than delayed by returning aBLKPREP_DEFERfor better responsiveness.Quoted 2 lines
Thanks.
Seungwon Jeon.The decision whether a request is packable or not should not be made per request, therefore I don't see the need for using
req_prep_fn. The MMC layer can peek each request and decide if to pack it or not when preparing the packed list (as suggested in this patch). The scheduler changes will improve the probability of getting a list that can be packed. My suggestion for the scheduler change is:
The block layer will be notified of the packing limits via new queue limits (in blk-settings). We can make it generic to allow all kinds of requests lists. Example for the new queue limits can be:Is_reqs_list_supported
Quoted 8 lines
Max_num_of_read_reqs_in_listMax_num_of_write_reqs_in_listmax_blk_cnt_in_listIs_list_interleaved(optional - to support read and write requests to be linked together, not the case for eMMC4.5)
The scheduler, that will have all the required info in the queue limits, will be able to decide which requests can be in the same list and move all of them to the dispatch queue (in oneelevator_dispatch_fncall).
If probability of packing gets higher, it would be nice. We need to think more.
Quoted 16 lines
I see 2 options for preparing the list:
Option 1.
blk_fetch_requestwill prepare the list and return a list of requests (will require a change in struct request to include the list but can be more generic).Option 2. The MMC layer will prepare the list. After fetching one request the MMC layer can call
blk_peek_requestand check if the next request is packable or not. By keeping all the calls toblk_peek_requestunder the same queue lock we can guarantee to get the requests that the scheduler pushed to the dispatch queue (this requiresmmc_blk_chk_packableto move toblock.c). If the request is packable the MMC layer will callblk_start_requestto dequeue the request. This way there is no need to re-queue the requests that cannot be packed.
Quoted 3 lines
Going back to this patch - the usage of blk_peek_request+blk_start_request instead of
blk_fetch_requestcan be done inmmc_blk_chk_packablein order to eliminate the need to requeue commands and loose performance.
Do you think blk_requeue_request() is heavy work?
Currently queue_lock was missed using blk_fetch_request. It will be fixed. Anyway, if we use a set of blk_peek_request+blk_start_request,
there is no necessity for requeuing the request.
But during preparing several request for the list, queue_lock will be held in mmc layer. Then queue_lock time of mmc layer might be more increased than before.
Thank you for suggestion.
Seungwon Jeon.
Quoted 10 lines
Thanks,
Maya Erez
Consultant for 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
mmc: sdio: runtime PM and 8686 problems
In reply to Seungwon JeonI have a GUMSTIX Overo (OMAP35xx) with a Marvel 8686 WiFi attached via SDIO (ok, I think it's actually a Wi2Wi W2CBW003 module containing an 8686).
Up to the 3.1 mainline kernel WiFi worked just fine! I could boot the kernel and load the libertas module successfully:
(during boot)
[ 3.193176] mmc1: new SDIO card at address 0001
(when loading module)
# modprobe libertas_sdio [ 30.817749] lib80211: common routines for IEEE802.11 drivers [ 31.143951] cfg80211: Calling CRDA to update world regulatory domain [ 31.375823] libertas_sdio: Libertas SDIO driver [ 31.380737] libertas_sdio: Copyright Pierre Ossman [ 32.035186] libertas_sdio mmc1:0001:1: (unregistered net_device): 00:19:88:3e:4f:f9, fw 9.70.3p36, cap 0x00000303 [ 32.129943] libertas_sdio mmc1:0001:1: wlan0: Marvell WLAN 802.11 adapter
However it seems that runtime PM has now been turned on by default (by setting MMC_CAP_POWER_OFF_CARD in drivers/mmc/core/host.c), and the WiFi has stopped working!
So, if I run the 3.2-rc2 (or rc1 for that matter) I get the following:
(during boot)
[ 3.486541] mmc1: new SDIO card at address 0001
(when loading module)
# modprobe libertas_sdio [ 34.015350] lib80211: common routines for IEEE802.11 drivers [ 34.345092] cfg80211: Calling CRDA to update world regulatory domain [ 34.574096] libertas_sdio: Libertas SDIO driver [ 34.578979] libertas_sdio: Copyright Pierre Ossman [ 34.637481] libertas_sdio: probe of mmc1:0001:1 failed with error -16
Looking at arch/arm/mach-omap2/overo.c you can see that GPIO16 (OVERO_GPIO_W2W_NRESET) is the nRESET line for the 8686. This is held low for 10usecs during boot (see overo.c line 530 to 533).
I'm not 100% sure how power is connected to the SD8686 as GUMSTIX don't release schematics for their modules.
If I disable runtime PM (by commenting out the setting of MMC_CAP_POWER_OFF_CARD) everything works as before.
I can see plenty of threads relating to getting the SD8686 working for OLPC, and that some workarounds have made it in to the mainline kernel. From what I understand the problem is that runtime PM removes power from the 8686 after boot and before the loading of the libertas module.
Are these workarounds expected to be enough for runtime PM to just "work"?
Is there anything special I should be doing with the nRESET line other than that which is done by default in the board file (holding nRESET low for 10usecs)?
Cheers,
Joe
Quoted 155 lines
Quoted 111 lines · Maya Erez
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+
phys_segments+= next->nr_phys_segments;
+ if (phys_segments>max_phys_segs) {
+blk_requeue_request(q, next);
+ break;
+ }I mentioned this before - if the next request is not
packable
Quoted 6 lines
Quoted 6 lines
and
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
requeued,
Quoted 1 line
Quoted 1 line
blk_fetch_requestwill retrieve it again and this while loopwill
Quoted 2 lines
Quoted 2 lines
never terminate.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
If next request is not packable, it is requeued and 'break'
terminates
Quoted 3 lines
Quoted 3 lines
this loop.
Quoted 1 line
So it not infinite.
Right !! But that doesn't help finding the commands that are
packable.
Quoted 1 line
Quoted 1 line
Ideally, you'd need to pack all neighbouring requests into one
packed
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
command.
Quoted 1 line
Quoted 1 line
The way CFQ works, it is not necessary that the fetch would
return
Quoted 3 lines
Quoted 3 lines
all
Quoted 2 lines
Quoted 2 lines
outstanding
Quoted 1 line
Quoted 1 line
requests that are packable (unless you invoke a forced
dispatch)
Quoted 10 lines
Quoted 10 lines
It
Quoted 5 lines
Quoted 5 lines
would be good to see some numbers on the number of pack hits / misses
Quoted 3 lines
Quoted 2 lines
that
you would encounter with this logic, on a typical usecase.Is it considered only for CFQ scheduler? How about other I/O
scheduler?
Quoted 3 lines
Quoted 3 lines
If all requests are drained from scheduler queue forcedly,
Quoted 2 lines
the number of candidate to be packed can be increased. However we may lose the unique CFQ's strength and MMC D/D may
take
Quoted 3 lines
Quoted 3 lines
the
Quoted 2 lines
Quoted 2 lines
CFQ's duty.
Quoted 1 line
Basically, this patch accommodates the origin order requests
from
Quoted 7 lines
Quoted 7 lines
I/O
Quoted 4 lines
Quoted 4 lines
scheduler.
Quoted 1 line
In order to better utilize the packed commands feature and achieve
the
Quoted 1 line
Quoted 1 line
best performance improvements I think that the command packing
should
Quoted 5 lines
Quoted 5 lines
be
Quoted 2 lines
Quoted 2 lines
done in the block layer, according to the scheduler policy. That is, the scheduler should be aware of the capability of the
device to
Quoted 1 line
Quoted 1 line
receive a request list and its constrains (such as maximum number
of
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
requests, max number of sectors etc) and use this information as a
factor
Quoted 2 lines
Quoted 2 lines
to its algorithm.
This way you keep the decision making in the hands of thescheduler
Quoted 2 lines
Quoted 2 lines
while
Quoted 1 line
Quoted 1 line
the MMC layer will only have to send this list as a packed
command.
Quoted 16 lines
Quoted 16 lines
Quoted 3 lines
Quoted 1 line
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among samedirection(read/write)?
Quoted 1 line
Currently I/O scheduler may know device constrains which MMC driver
informs
Quoted 3 lines
with the exception of order information for packed command. But I think the dependency of I/O scheduler may be able to come up. How can MMC layer treat packed command with I/O scheduler which
doesn't support this?
The very act of packing presumes some sorting and re-ordering at the I/O scheduler level.
When no such sorting is done (ex. noop), MMC should resort to non-packed execution, respecting the system configuration choice.Quoted 8 lines
Quoted 4 lines
Looking deeper into this, I think a better approach would be to set the
prep_rq_fnof therequest_queue, with a custom mmc function that decides if the requests are packable or not, and return aBLKPREP_DEFERfor those that can't be packed.MMC layer anticipates the favorable requests for packing from I/O scheduler.
Obviously request order from I/O scheduler might be poor for packingand
Quoted 9 lines
requests can't be packed.
But that doesn't mean mmc layer need to wait a better pack-case.BLKPREP_DEFERmay give rise to I/O latency. Top of request will be deferred next time.
If request can't be packed, it'd rather be sent at once than delayed by returning aBLKPREP_DEFERfor better responsiveness.Thanks.
Seungwon Jeon.The decision whether a request is packable or not should not be made per request, therefore I don't see the need for using
req_prep_fn. The MMC layer can peek each request and decide if to pack it or not when preparing
the packed list (as suggested in this patch). The scheduler changes will improve the probability of getting a list that can be packed. My suggestion for the scheduler change is:
The block layer will be notified of the packing limits via new queue limits (in blk-settings). We can make it generic to allow all kinds of requests lists. Example for the new queue limits can be:Is_reqs_list_supportedMax_num_of_read_reqs_in_listQuoted 8 lines
Max_num_of_write_reqs_in_listmax_blk_cnt_in_listIs_list_interleaved(optional - to support read and write requests to be linked together, not the case for eMMC4.5)
The scheduler, that will have all the required info in the queue limits, will be able to decide which requests can be in the same list and move all
of them to the dispatch queue (in oneelevator_dispatch_fncall).If probability of packing gets higher, it would be nice. We need to think more.
Quoted 18 lines
I see 2 options for preparing the list:
Option 1.
blk_fetch_requestwill prepare the list and return a list of requests (will require a change in struct request to include the list but
can be more generic).Option 2. The MMC layer will prepare the list. After fetching one request
the MMC layer can callblk_peek_requestand check if the next request is packable or not. By keeping all the calls toblk_peek_requestunder the same queue lock we can guarantee to get the requests that the scheduler pushed to the dispatch queue (this requiresmmc_blk_chk_packableto move toblock.c). If the request is packable the MMC layer will callblk_start_requestto dequeue the request. This way there is no need to re-queue the requests that cannot be packed.Quoted 5 lines
Going back to this patch - the usage of blk_peek_request+blk_start_request
instead ofblk_fetch_requestcan be done inmmc_blk_chk_packablein order
to eliminate the need to requeue commands and loose performance.Do you think
blk_requeue_request()is heavy work?
Currentlyqueue_lockwas missed usingblk_fetch_request. It will be fixed. Anyway, if we use a set of blk_peek_request+blk_start_request, there is no necessity for requeuing the request.
But during preparing several request for the list,queue_lockwill be held in mmc layer.
Thenqueue_locktime of mmc layer might be more increased than before.
Quoted 3 lines
Thank you for suggestion.
Seungwon Jeon.Quoted 1 line
Yes, I think that if we can avoid redundant dequeue and requeue it would be better. Please note that the re-queue also requires locking the queue_lock.
I agree that in case of preparing the packed list the queue_lock will be taken for a longer time but I don't see any way to avoid it.
Thanks,
Maya Erez
Consultant for Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum