mmc: block: Fix tag condition with packed writes
PATCH 1/1 mmc: block: Fix tag condition with packed writes
Apparently a cut-and-paste error, 'do_data_tag' is using 'brq' for data size even though 'brq' has not been set up. Instead use blk_rq_sectors().
---
Hi
I don't know if anyone is actually using packed writes, but this is something I noticed.
Regards
Adrian
drivers/mmc/card/block.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/card/block.c +1 -2
@@ -1834,8 +1834,7 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, do_data_tag = (card->ext_csd.data_tag_unit_size) && (prq->cmd_flags &REQ_META ) && (rq_data_dir (prq) ==WRITE ) && - ((brq->data.blocks * brq->data.blksz) >= - card->ext_csd.data_tag_unit_size); +blk_rq_bytes (prq) >= card->ext_csd.data_tag_unit_size;/* Argument of CMD23 */ packed_cmd_hdr[(i *2 )] = (do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) |
Signature · 1 line
1.9.1
Hi Adrian,
Quoted 11 lines · Adrian Hunter
Apparently a cut-and-paste error, '
do_data_tag' is using 'brq' for data size even though 'brq' has not been set up. Instead useblk_rq_sectors().Signed-off-by Adrian Hunter <[email protected]>---
Hi
I don't know if anyone is actually using packed writes, but this is something I noticed.
I think if brq has not been set up, the we could meet another problem of checking the case of whether 4KB native sector is enabled. When fetching blk req from the queue, mmc_blk_issue_rw_rq already use brq there which is the same from your case, namely mq->mqrq_cur->brq, right?
Quoted 23 lines
Regards
Adriandrivers/mmc/card/block.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/mmc/card/block.c +1
-2@@ -1834,8 +1834,7 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, do_data_tag = (card->ext_csd.data_tag_unit_size) && (prq->cmd_flags &REQ_META ) && (rq_data_dir (prq) ==WRITE ) && - ((brq->data.blocks * brq->data.blksz) >= - card->ext_csd.data_tag_unit_size); +blk_rq_bytes (prq) >= card->ext_csd.data_tag_unit_size;/* Argument of CMD23 */ packed_cmd_hdr[(i *2 )] = (do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) |
Signature · 2 lines
Best Regards Shawn Lin
Quoted 16 lines · Shawn Lin
Hi Adrian,
Quoted 11 lines · Adrian Hunter
Apparently a cut-and-paste error, '
do_data_tag' is using 'brq' for data size even though 'brq' has not been set up. Instead useblk_rq_sectors().Signed-off-by Adrian Hunter <[email protected]>---
Hi
I don't know if anyone is actually using packed writes, but this is something I noticed.
Quoted 5 lines
I think if brq has not been set up, the we could meet another problem of checking the case of whether 4KB native sector is enabled. When fetching blk req from the queue,
mmc_blk_issue_rw_rqalready use brq there which is the same from your case, namelymq->mqrq_cur->brq, right?
Looks like that was that fixed by:
commit 3a6db10d86902491b759103ee97b2539175dd1dd
Author: Yuan, Juntao <[email protected]> Date: Fri May 13 07:59:24 2016 +0000
mmc: block: correct 4KB alignment check
In sectors alignment check, brq->data.blocks means sectors of the previous mqrq since data.blocks for mqrq_cur hasn't been updated yet. data.blocks will be updated later in mmc_blk_packed_hdr_wrq_prep or mmc_blk_rw_rq_prep.
static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, ......
......
struct mmc_blk_request *brq = &mq->mqrq_cur->brq;
There is also another fix in the SWCMDQ changes:
http://marc.info/?l=linux-mmc&m=146547356109940
Quoted 29 lines
Quoted 27 lines
Regards
Adriandrivers/mmc/card/block.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/mmc/card/block.c +1
-2@@ -1834,8 +1834,7 @@ static void mmc_blk_packed_hdr_wrq_prep(structmmc_queue_req *mqrq, do_data_tag = (card->ext_csd.data_tag_unit_size) && (prq->cmd_flags &REQ_META ) && (rq_data_dir (prq) ==WRITE ) && - ((brq->data.blocks * brq->data.blksz) >= - card->ext_csd.data_tag_unit_size); +blk_rq_bytes (prq) >= card->ext_csd.data_tag_unit_size;/* Argument of CMD23 */ packed_cmd_hdr[(i * 2)] =(do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) |
Shawn Lin
Reviewed-byQuoted 23 lines · Adrian Hunter
Quoted 16 lines · Shawn Lin
Hi Adrian,
Quoted 11 lines · Adrian Hunter
Apparently a cut-and-paste error, '
do_data_tag' is using 'brq' for data size even though 'brq' has not been set up. Instead useblk_rq_sectors().Signed-off-by Adrian Hunter <[email protected]>---
Hi
I don't know if anyone is actually using packed writes, but this is something I noticed.
Quoted 5 lines
I think if brq has not been set up, the we could meet another problem of checking the case of whether 4KB native sector is enabled. When fetching blk req from the queue,
mmc_blk_issue_rw_rqalready use brq there which is the same from your case, namelymq->mqrq_cur->brq, right?
Quoted 6 lines
Looks like that was that fixed by:
commit
3a6db10d86902491b759103ee97b2539175dd1ddAuthor: Yuan, Juntao <[email protected]> Date: Fri May 13 07:59:24 2016 +0000
Ahh.. yes, I see it now from Ulf's next.
But I'm wondering about why not cast the mqrq_cur->brq to NULL or memset it to be zero if it's expired after the completion. And a WARN_ON will prevent the brq from being used by mistake any more.
Anyway, you patch of course fix the problem. :)
Quoted 51 lines
mmc: block: correct 4KB alignment check
In sectors alignment check,
brq->data.blocksmeans sectors of the previous mqrq since data.blocks formqrq_curhasn't been updated yet. data.blocks will be updated later inmmc_blk_packed_hdr_wrq_prepormmc_blk_rw_rq_prep.static int mmc_blk_issue_rw_rq(struct
mmc_queue*mq, ......
......
structmmc_blk_request*brq =&mq->mqrq_cur->brq;Signed-off-by Yuan Juntao <[email protected]>Signed-off-by Ulf Hansson <[email protected]>There is also another fix in the SWCMDQ changes:
http://marc.info/?l=linux-mmc&m=146547356109940Quoted 29 lines
Quoted 27 lines
Regards
Adriandrivers/mmc/card/block.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/mmc/card/block.c +1
-2@@ -1834,8 +1834,7 @@ static void mmc_blk_packed_hdr_wrq_prep(structmmc_queue_req *mqrq, do_data_tag = (card->ext_csd.data_tag_unit_size) && (prq->cmd_flags &REQ_META ) && (rq_data_dir (prq) ==WRITE ) && - ((brq->data.blocks * brq->data.blksz) >= - card->ext_csd.data_tag_unit_size); +blk_rq_bytes (prq) >= card->ext_csd.data_tag_unit_size;/* Argument of CMD23 */ packed_cmd_hdr[(i * 2)] =(do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) |
Signature · 2 lines
Best Regards Shawn Lin
Ulf Hansson
AppliedQuoted 4 lines · Adrian Hunter
Apparently a cut-and-paste error, '
do_data_tag' is using 'brq' for data size even though 'brq' has not been set up. Instead useblk_rq_sectors().Signed-off-by Adrian Hunter <[email protected]>
Thanks, applied for next!
Kind regards
Uffe
Quoted 32 lines
---
Hi
I don't know if anyone is actually using packed writes, but this is something I noticed.
Regards
Adriandrivers/mmc/card/block.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/mmc/card/block.c +1
-3@@ -1834,8 +1834,7 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, do_data_tag = (card->ext_csd.data_tag_unit_size) && (prq->cmd_flags &REQ_META ) && (rq_data_dir (prq) ==WRITE ) && - ((brq->data.blocks * brq->data.blksz) >= - card->ext_csd.data_tag_unit_size); +blk_rq_bytes (prq) >= card->ext_csd.data_tag_unit_size;/* Argument of CMD23 */ packed_cmd_hdr[(i *2 )] = (do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) | --1.9.1