mmc: block: disable the reliable write If the card does not support CMD23
PATCH 1/1 mmc: block: disable the reliable write If the card does not support CMD23
From: Yong Li <[email protected]>
--- drivers/mmc/card/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/card/block.c +2 -1
@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,bool do_rel_wr = ((req->cmd_flags &REQ_FUA ) || (req->cmd_flags &REQ_META )) && (rq_data_dir (req) ==WRITE ) && - (md->flags &MMC_BLK_REL_WR ); + (md->flags &MMC_BLK_REL_WR ) && + !(card->quirks &MMC_QUIRK_BLK_NO_CMD23 );memset (brq,0 ,sizeof (struct mmc_blk_request )); brq->mrq.cmd = &brq->cmd;
Signature · 1 line
2.1.0
Quoted 12 lines · 在 2015/8/14 15:30, [email protected] 写道:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>--- drivers/mmc/card/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/card/block.c +0
-0
drivers/mmc/card/block.c static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, · line 1370
Quoted 6 lines
drivers/mmc/card/block.c +2
-1@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,bool do_rel_wr = ((req->cmd_flags &REQ_FUA ) || (req->cmd_flags &REQ_META )) && (rq_data_dir (req) ==WRITE ) && - (md->flags &MMC_BLK_REL_WR ); + (md->flags &MMC_BLK_REL_WR ) && + !(card->quirks &MMC_QUIRK_BLK_NO_CMD23 );
Hi Yong,
pls check that code below.
MMC_BLK_REL_WR will not be enabled if we know this card CANNOT support CMD23 form SCR. AND, "card->quirks & MMC_QUIRK_BLK_NO_CMD23" would be checked here as well. So I think your code is unnecessary.
if ((md->flags & MMC_BLK_CMD23) && mmc_op_multi(brq->cmd.opcode) &&
(do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) ||
do_data_tag)) {
brq->sbc.opcode = MMC_SET_BLOCK_COUNT;
brq->sbc.arg = brq->data.blocks |
(do_rel_wr ? (1 << 31) : 0) |
(do_data_tag ? (1 << 29) : 0);
brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
brq->mrq.sbc = &brq->sbc;
}Thanks.
Shawn
Quoted 4 lines
drivers/mmc/card/block.c +0
-0memset (brq,0 ,sizeof (struct mmc_blk_request )); brq->mrq.cmd = &brq->cmd;
Signature · 1 line
Shawn Lin
Thanks Shawn. Please help to check the below in the mmc_blk_rw_rq_prep:
if (do_rel_wr) mmc_apply_rel_rw(brq, card, req);
I think we need to set the do_rel_wr to false( at the beginning of this function) if the card does not support the CMD23. The above code is executed before the "if ((md->flags & MMC_BLK_CMD23)" code.
Thanks,
Yong Li
----------------------------------------
Quoted 57 lines
Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
CC: [email protected]
From: [email protected]
Date: Fri, 14 Aug 2015 16:13:02 +0800Quoted 12 lines · 在 2015/8/14 15:30, [email protected] 写道:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>---
drivers/mmc/card/block.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/card/block.c +0
-0@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,Quoted 6 lines
bool
do_rel_wr= ((req->cmd_flags&REQ_FUA) ||
(req->cmd_flags&REQ_META)) &&
(rq_data_dir(req)== WRITE) &&
- (md->flags&MMC_BLK_REL_WR);
+ (md->flags&MMC_BLK_REL_WR) &&
+ !(card->quirks &MMC_QUIRK_BLK_NO_CMD23);Hi Yong,
pls check that code below.
MMC_BLK_REL_WRwill not be enabled if we know this card CANNOT support CMD23 form SCR. AND, "card->quirks&MMC_QUIRK_BLK_NO_CMD23" would be checked here as well. So I think your code is unnecessary.if ((
md->flags&MMC_BLK_CMD23) &&mmc_op_multi(brq->cmd.opcode)&& (do_rel_wr|| !(card->quirks &MMC_QUIRK_BLK_NO_CMD23) ||do_data_tag)) {brq->sbc.opcode=MMC_SET_BLOCK_COUNT;brq->sbc.arg=brq->data.blocks|
(do_rel_wr? (1 << 31) : 0) |
(do_data_tag? (1 << 29) : 0);brq->sbc.flags=MMC_RSP_R1|MMC_CMD_AC;brq->mrq.sbc=&brq->sbc;
}Thanks.
ShawnQuoted 4 lines
memset(brq, 0, sizeof(struct mmc_blk_request));brq->mrq.cmd=&brq->cmd;--
Shawn Lin
Quoted 6 lines · LIYONG
Thanks Shawn. Please help to check the below in the
mmc_blk_rw_rq_prep:if (do_rel_wr) mmc_apply_rel_rw(brq, card, req);I think we need to set the
do_rel_wrto false( at the beginning of this function) if the card does not support the CMD23. The above code is executed before the "if ((md->flags&MMC_BLK_CMD23)" code.
ok, it makes sense.:)
Quoted 62 lines
Thanks,
Yong Li
----------------------------------------Quoted 49 lines
Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
CC: [email protected]
From: [email protected]
Date: Fri, 14 Aug 2015 16:13:02 +0800Quoted 12 lines · 在 2015/8/14 15:30, [email protected] 写道:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>---
drivers/mmc/card/block.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/card/block.c +0
-0@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,Quoted 6 lines
bool
do_rel_wr= ((req->cmd_flags&REQ_FUA) ||
(req->cmd_flags&REQ_META)) &&
(rq_data_dir(req)== WRITE) &&
- (md->flags&MMC_BLK_REL_WR);
+ (md->flags&MMC_BLK_REL_WR) &&
+ !(card->quirks &MMC_QUIRK_BLK_NO_CMD23);Hi Yong,
pls check that code below.
MMC_BLK_REL_WRwill not be enabled if we know this card CANNOT support CMD23 form SCR. AND, "card->quirks&MMC_QUIRK_BLK_NO_CMD23" would be checked here as well. So I think your code is unnecessary.if ((
md->flags&MMC_BLK_CMD23) &&mmc_op_multi(brq->cmd.opcode)&& (do_rel_wr|| !(card->quirks &MMC_QUIRK_BLK_NO_CMD23) ||do_data_tag)) {brq->sbc.opcode=MMC_SET_BLOCK_COUNT;brq->sbc.arg=brq->data.blocks|
(do_rel_wr? (1 << 31) : 0) |
(do_data_tag? (1 << 29) : 0);brq->sbc.flags=MMC_RSP_R1|MMC_CMD_AC;brq->mrq.sbc=&brq->sbc;
}Thanks.
ShawnQuoted 1 line
Quoted 8 lines
Quoted 3 lines
memset(brq, 0, sizeof(struct mmc_blk_request));brq->mrq.cmd=&brq->cmd;--
Shawn LinN�����r��y���b�X��ǧv�^�){.n�+����{��g"��^n�r���z���h����&���G���h�(�階�ݢj"���m�����z�ޖ���f���h���~�mml==
Signature · 1 line
Shawn Lin
Quoted 12 lines · On 14 August 2015 at 09:30, <[email protected]> wrote:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>--- drivers/mmc/card/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/card/block.c +0
-0
drivers/mmc/card/block.c static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, · line 1370
Quoted 6 lines
drivers/mmc/card/block.c +2
-1@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,bool do_rel_wr = ((req->cmd_flags &REQ_FUA ) || (req->cmd_flags &REQ_META )) && (rq_data_dir (req) ==WRITE ) && - (md->flags &MMC_BLK_REL_WR ); + (md->flags &MMC_BLK_REL_WR ) && + !(card->quirks &MMC_QUIRK_BLK_NO_CMD23 );
Further down in mmc_blk_rw_rq_prep() we check for MMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this change, please remove that check as a part of this patch as well.
Quoted 6 lines
drivers/mmc/card/block.c +0
-1memset (brq,0 ,sizeof (struct mmc_blk_request )); brq->mrq.cmd = &brq->cmd; --2.1.0
Kind regards
Uffe
Hi Uffe,
The bool variable do_rel_wr is used on line 1408 and line 1436:
if (brq->data.blocks> 1 || do_rel_wr) {
/* SPI multiblock writes terminate using a special
* token, not a STOP_TRANSMISSION request.
*/
if (do_rel_wr)
mmc_apply_rel_rw(brq, card, req);If a card does not support CMD23, I think we need to set the do_rel_wr to false at the beginning of this mmc_blk_rw_rq_prep function
Thanks,
Yong Li
----------------------------------------
Quoted 39 lines
Date: Tue, 25 Aug 2015 14:06:43 +0200
Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
From: [email protected]
To: [email protected]
CC: [email protected]; [email protected]; [email protected]Quoted 12 lines · On 14 August 2015 at 09:30, <[email protected]> wrote:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>---
drivers/mmc/card/block.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/card/block.c +0
-0@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,Quoted 6 lines
bool
do_rel_wr= ((req->cmd_flags&REQ_FUA) ||
(req->cmd_flags&REQ_META)) &&
(rq_data_dir(req)== WRITE) &&
- (md->flags&MMC_BLK_REL_WR);
+ (md->flags&MMC_BLK_REL_WR) &&
+ !(card->quirks &MMC_QUIRK_BLK_NO_CMD23);Further down in
mmc_blk_rw_rq_prep()we check forMMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this change, please remove that check as a part of this patch as well.Quoted 6 lines
memset(brq, 0, sizeof(struct mmc_blk_request));brq->mrq.cmd=&brq->cmd;
--
2.1.0Kind regards
Uffe
Quoted 11 lines · LIYONG
Hi Uffe,
The bool variable
do_rel_wris used on line 1408 and line 1436:if (brq->data.blocks> 1 || do_rel_wr) { /* SPI multiblock writes terminate using a special * token, not a STOP_TRANSMISSION request. */ if (do_rel_wr) mmc_apply_rel_rw(brq, card, req);
Quoted 1 line
If a card does not support CMD23, I think we need to set the
do_rel_wrto false at the beginning of thismmc_blk_rw_rq_prepfunction
Hi Yong,
You miss the point, Ulf means you should remove "(do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23)" as well.
No need to check card->quirks & MMC_QUIRK_BLK_NO_CMD23 twice, you have did it while checking do_rel_wr, right?
bool do_rel_wr = ((req->cmd_flags & REQ_FUA) || (req->cmd_flags & REQ_META)) && (rq_data_dir(req) == WRITE) &&
- (md->flags & MMC_BLK_REL_WR);
+ (md->flags & MMC_BLK_REL_WR) &&
+ !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
Quoted 50 lines
Thanks,
Yong Li
----------------------------------------Quoted 31 lines
Date: Tue, 25 Aug 2015 14:06:43 +0200
Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
From: [email protected]
To: [email protected]
CC: [email protected]; [email protected]; [email protected]Quoted 12 lines · On 14 August 2015 at 09:30, <[email protected]> wrote:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>---
drivers/mmc/card/block.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/card/block.c +0
-0@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,Quoted 6 lines
bool
do_rel_wr= ((req->cmd_flags&REQ_FUA) ||
(req->cmd_flags&REQ_META)) &&
(rq_data_dir(req)== WRITE) &&
- (md->flags&MMC_BLK_REL_WR);
+ (md->flags&MMC_BLK_REL_WR) &&
+ !(card->quirks &MMC_QUIRK_BLK_NO_CMD23);Further down in
mmc_blk_rw_rq_prep()we check forMMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this change, please remove that check as a part of this patch as well.Quoted 1 line
Quoted 8 lines
Quoted 5 lines
memset(brq, 0, sizeof(struct mmc_blk_request));brq->mrq.cmd=&brq->cmd;
--
2.1.0Kind regards
Uffe--
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
Best Regards Shawn Lin
Thanks Shawn. I got your point. You mean we can remove the || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) at line 1468.
But considering this case: The do_rel_wr = false and the card does support CMD23. do_rel_wr = false;
!(card->quirks & MMC_QUIRK_BLK_NO_CMD23) = true;
At line 1468, do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) should be true;
If re remove the || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23), it will be false
It seems that we cannot modify the line 1468?
Thanks,
Yong Li
----------------------------------------
Quoted 91 lines
Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
To: [email protected]; [email protected]
CC: [email protected]; [email protected]; [email protected]; [email protected]
From: [email protected]
Date: Wed, 26 Aug 2015 15:20:11 +0800Quoted 8 lines · LIYONG
Hi Uffe,
The bool variable
do_rel_wris used on line 1408 and line 1436:
if (brq->data.blocks> 1 ||do_rel_wr) {
/* SPI multiblock writes terminate using a special
* token, not aSTOP_TRANSMISSIONrequest.
*/Quoted 4 lines
if (
do_rel_wr)mmc_apply_rel_rw(brq, card, req);If a card does not support CMD23, I think we need to set the
do_rel_wrto false at the beginning of thismmc_blk_rw_rq_prepfunctionHi Yong,
You miss the point, Ulf means you should remove "(
do_rel_wr|| !(card->quirks &MMC_QUIRK_BLK_NO_CMD23)" as well.No need to check
card->quirks&MMC_QUIRK_BLK_NO_CMD23twice, you have did it while checkingdo_rel_wr, right?bool
do_rel_wr= ((req->cmd_flags&REQ_FUA) ||
(req->cmd_flags&REQ_META)) &&
(rq_data_dir(req)== WRITE) &&
- (md->flags&MMC_BLK_REL_WR);
+ (md->flags&MMC_BLK_REL_WR) &&
+ !(card->quirks &MMC_QUIRK_BLK_NO_CMD23);Quoted 41 lines
Thanks,
Yong Li
----------------------------------------Quoted 37 lines
Date: Tue, 25 Aug 2015 14:06:43 +0200
Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
From: [email protected]
To: [email protected]
CC: [email protected]; [email protected]; [email protected]Quoted 12 lines · On 14 August 2015 at 09:30, <[email protected]> wrote:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>---
drivers/mmc/card/block.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/card/block.c +0
-0@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,Quoted 6 lines
bool
do_rel_wr= ((req->cmd_flags&REQ_FUA) ||
(req->cmd_flags&REQ_META)) &&
(rq_data_dir(req)== WRITE) &&
- (md->flags&MMC_BLK_REL_WR);
+ (md->flags&MMC_BLK_REL_WR) &&
+ !(card->quirks &MMC_QUIRK_BLK_NO_CMD23);Further down in
mmc_blk_rw_rq_prep()we check forMMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this change, please remove that check as a part of this patch as well.Quoted 6 lines
memset(brq, 0, sizeof(struct mmc_blk_request));brq->mrq.cmd=&brq->cmd;
--
2.1.0Quoted 9 lines
Quoted 2 lines
Kind regards
Uffe--
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--
Best Regards
Shawn Lin
Quoted 8 lines · Ulf Hansson
Quoted 7 lines · On 14 August 2015 at 09:30, <[email protected]> wrote:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>--- drivers/mmc/card/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 23 lines
drivers/mmc/card/block.c static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, · line 1370
Quoted 11 lines
drivers/mmc/card/block.c +2
-1@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,bool do_rel_wr = ((req->cmd_flags &REQ_FUA ) || (req->cmd_flags &REQ_META )) && (rq_data_dir (req) ==WRITE ) && - (md->flags &MMC_BLK_REL_WR ); + (md->flags &MMC_BLK_REL_WR ) && + !(card->quirks &MMC_QUIRK_BLK_NO_CMD23 );Further down in
mmc_blk_rw_rq_prep()we check forMMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this change, please remove that check as a part of this patch as well.Quoted 6 lines
drivers/mmc/card/block.c +0
-1memset (brq,0 ,sizeof (struct mmc_blk_request )); brq->mrq.cmd = &brq->cmd; --2.1.0
Please ignore my previous answer. MMC_QUIRK_BLK_NO_CMD23 is intended to indicate to the mmc block layer whether using CMD23 for regular block IO request could have a performance impact for some cards. If that's the case we don't use it - except when using reliable write!
So this patch is just plain wrong.
Kind regards
Uffe
Hi Uffe,
Since Reliable Write depends on the CMD23. I think we need to disable Reliable Write if the card does not support CMD23(due to performance impact issue), so I add this patch.
Do you think we still need to enable Reliable Write even if the card does not support CMD23?
Thanks,
Yong Li
----------------------------------------
Quoted 48 lines
Date: Thu, 27 Aug 2015 15:22:44 +0200
Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
From: [email protected]
To: [email protected]
CC: [email protected]; [email protected]; [email protected]Quoted 8 lines · Ulf Hansson
Quoted 7 lines · On 14 August 2015 at 09:30, <[email protected]> wrote:
From: Yong Li <[email protected]>
Signed-off-by Yong Li <[email protected]>---
drivers/mmc/card/block.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)Quoted 23 lines
Quoted 11 lines
drivers/mmc/card/block.c +0
-0@@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,bool
do_rel_wr= ((req->cmd_flags&REQ_FUA) ||
(req->cmd_flags&REQ_META)) &&
(rq_data_dir(req)== WRITE) &&
- (md->flags&MMC_BLK_REL_WR);
+ (md->flags&MMC_BLK_REL_WR) &&
+ !(card->quirks &MMC_QUIRK_BLK_NO_CMD23);Further down in
mmc_blk_rw_rq_prep()we check forMMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this change, please remove that check as a part of this patch as well.Quoted 6 lines
memset(brq, 0, sizeof(struct mmc_blk_request));brq->mrq.cmd=&brq->cmd;
--
2.1.0Please ignore my previous answer.
MMC_QUIRK_BLK_NO_CMD23is intended to indicate to the mmc block layer whether using CMD23 for regular block IO request could have a performance impact for some cards. If that's the case we don't use it - except when using reliable write!So this patch is just plain wrong.
Kind regards
Uffe
- Chris and LKML,
Quoted 5 lines · LIYONG
Hi Uffe,
Since Reliable Write depends on the CMD23. I think we need to disable Reliable Write if the card does not support CMD23(due to performance impact issue), so I add this patch.
Do you think we still need to enable Reliable Write even if the card does not support CMD23?
MMC_QUIRK_BLK_NO_CMD23 does *not* tell us whether the card support CMD23. Instead it tells us that the card may suffer a bit from performance point of view while using the "CMD23 way" to send requests.
Now, as reliable write needs to be sent in the "CMD23-way", then that's what we need to do - no matter of MMC_QUIRK_BLK_NO_CMD23.
[...]
Kind regards
Uffe