From patchwork Thu Sep 22 13:57:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 9345333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E378607D0 for ; Thu, 22 Sep 2016 13:58:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F0622AAE3 for ; Thu, 22 Sep 2016 13:58:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82E182AAE7; Thu, 22 Sep 2016 13:58:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5979A2AAE3 for ; Thu, 22 Sep 2016 13:57:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933641AbcIVN5r (ORCPT ); Thu, 22 Sep 2016 09:57:47 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:56566 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933640AbcIVN5p (ORCPT ); Thu, 22 Sep 2016 09:57:45 -0400 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ODW01H6US45AX50@mailout1.samsung.com>; Thu, 22 Sep 2016 22:57:43 +0900 (KST) X-AuditID: cbfee61a-f79656d00000762f-9b-57e3e357f18f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id A8.73.30255.753E3E75; Thu, 22 Sep 2016 22:57:43 +0900 (KST) Received: from AMDC1976.DIGITAL.local ([106.120.53.102]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ODW00IPYS3US950@mmp1.samsung.com>; Thu, 22 Sep 2016 22:57:43 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Linus Walleij Cc: Ulf Hansson , Greg KH , Paolo Valente , Jens Axboe , Hannes Reinecke , Tejun Heo , Omar Sandoval , Christoph Hellwig , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH PoC 1/7] mmc-mq: add debug printks Date: Thu, 22 Sep 2016 15:57:04 +0200 Message-id: <1474552630-28314-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1474552630-28314-1-git-send-email-b.zolnierkie@samsung.com> References: <1474552630-28314-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrELMWRmVeSWpSXmKPExsVy+t9jAd3wx4/DDY4uVbb4v+cYm8XGGetZ LZoXr2ezWPBmL5vFytVHmSym/FnOZHF51xw2iyP/+xkt9hw5w2jx6s9eJotfy48yWhxfG+7A 4zGx+R27x6ZVnWwed67tYfPYP3cNu8fumw1sHnP+HGT26NuyitFj/ZarLB6fN8kFcEZx2aSk 5mSWpRbp2yVwZbxY18NScMKq4uBskQbGr3pdjJwcEgImEru332OGsMUkLtxbz9bFyMUhJLCU UWLD6+eMEM4vRommvbvZQKrYBKwkJravYgSxRQR0JLq3/WQFKWIW+MgksffJfrCEsICRRNPi T2ANLAKqEh+/dbGA2LwCHhIPNnQwQqyTkzh5bDJQMwcHp4CnxO2d9iBhIaCSE/uXsU9g5F3A yLCKUSK1ILmgOCk91zAvtVyvODG3uDQvXS85P3cTIzhkn0ntYDy4y/0QowAHoxIPr8LFx+FC rIllxZW5hxglOJiVRHg17wOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8z7+vy5MSCA9sSQ1OzW1 ILUIJsvEwSnVwLj8b77aYc2S3wXic/8+Y2D++krY09Z0p0hy897Ge0XKNxkYeH8cetzsHmKy 3jEiTSzl3Rm9I4ELa28aFhc9jdiUIVMbM5OtPuFGxh7vAL6mlpVrm7P2f15y59RmuavNgm1J YhuyvRdv0Zu8SDbaTz5kho611+S+jc9yt88NavAQO+56vuTKDiWW4oxEQy3mouJEAJ//tS1V AgAA Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/mmc/card/block.c | 18 ++++++++++++++++-- drivers/mmc/core/core.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 7d733d0..ce56930 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1995,6 +1995,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) const u8 packed_nr = 2; u8 reqs = 0; + pr_info("%s: enter\n", __func__); if (rqc) { mqrq_cur = mmc_queue_req_find(mq, rqc); if (!mqrq_cur) { @@ -2004,8 +2005,10 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) } } - if (!mq->qcnt) + if (!mq->qcnt) { + pr_info("%s: exit (0) (!mq->qcnt)\n", __func__); return 0; + } if (mqrq_cur) reqs = mmc_blk_prep_packed_list(mq, mqrq_cur); @@ -2035,8 +2038,10 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) } else areq = NULL; areq = mmc_start_req(card->host, areq, (int *) &status); - if (!areq) + if (!areq) { + pr_info("%s: exit (0) (!areq)\n", __func__); return 0; + } mq_rq = container_of(areq, struct mmc_queue_req, mmc_active); brq = &mq_rq->brq; @@ -2150,6 +2155,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) mmc_queue_req_free(mq, mq_rq); + pr_info("%s: exit (1)\n", __func__); return 1; cmd_abort: @@ -2184,6 +2190,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) mmc_queue_req_free(mq, mq_rq); + pr_info("%s: exit (0)\n", __func__); return 0; } @@ -2194,10 +2201,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) struct mmc_card *card = md->queue.card; unsigned int cmd_flags = req ? req->cmd_flags : 0; + pr_info("%s: enter\n", __func__); + if (req && !mq->qcnt) /* claim host only for the first request */ mmc_get_card(card); + pr_info("%s: mmc_blk_part_switch\n", __func__); ret = mmc_blk_part_switch(card, md); if (ret) { if (req) { @@ -2208,6 +2218,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) } if (cmd_flags & REQ_DISCARD) { + pr_info("%s: DISCARD rq\n", __func__); /* complete ongoing async transfer before issuing discard */ if (mq->qcnt) mmc_blk_issue_rw_rq(mq, NULL); @@ -2216,11 +2227,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) else ret = mmc_blk_issue_discard_rq(mq, req); } else if (cmd_flags & REQ_FLUSH) { + pr_info("%s: FLUSH rq\n", __func__); /* complete ongoing async transfer before issuing flush */ if (mq->qcnt) mmc_blk_issue_rw_rq(mq, NULL); ret = mmc_blk_issue_flush(mq, req); } else { + pr_info("%s: RW rq\n", __func__); ret = mmc_blk_issue_rw_rq(mq, req); } @@ -2228,6 +2241,7 @@ out: /* Release host when there are no more requests */ if (!mq->qcnt) mmc_put_card(card); + pr_info("%s: exit\n", __func__); return ret; } diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9be42691..d2d8d9b 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -219,6 +219,8 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) { int err; + pr_info("%s: enter\n", __func__); + /* Assumes host controller has been runtime resumed by mmc_claim_host */ err = mmc_retune(host); if (err) { @@ -256,6 +258,8 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) trace_mmc_request_start(host, mrq); host->ops->request(host, mrq); + + pr_info("%s: exit\n", __func__); } static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) @@ -264,6 +268,7 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) unsigned int i, sz; struct scatterlist *sg; #endif + pr_info("%s: enter\n", __func__); mmc_retune_hold(host); if (mmc_card_removed(host->card)) @@ -327,6 +332,7 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) led_trigger_event(host->led, LED_FULL); __mmc_start_request(host, mrq); + pr_info("%s: exit\n", __func__); return 0; } @@ -466,6 +472,8 @@ static int __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq) { int err; + pr_info("%s: enter\n", __func__); + mmc_wait_ongoing_tfr_cmd(host); init_completion(&mrq->completion); @@ -480,6 +488,8 @@ static int __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq) complete(&mrq->completion); } + pr_info("%s: exit\n", __func__); + return err; } @@ -502,10 +512,14 @@ static int mmc_wait_for_data_req_done(struct mmc_host *host, struct mmc_context_info *context_info = &host->context_info; int err; + pr_info("%s: enter\n", __func__); + while (1) { wait_event_interruptible(context_info->wait, +// context_info->is_done_rcv); (context_info->is_done_rcv || context_info->is_new_req)); + pr_info("%s: waiting done\n", __func__); context_info->is_waiting_last_req = false; if (context_info->is_done_rcv) { context_info->is_done_rcv = false; @@ -527,11 +541,14 @@ static int mmc_wait_for_data_req_done(struct mmc_host *host, continue; /* wait for done/new event again */ } } else if (context_info->is_new_req) { - if (!next_req) + if (!next_req) { + pr_info("%s: exit (!next_req)\n", __func__); return MMC_BLK_NEW_REQUEST; + } } } mmc_retune_release(host); + pr_info("%s: exit (err=%d)\n", __func__, err); return err; } @@ -539,8 +556,11 @@ void mmc_wait_for_req_done(struct mmc_host *host, struct mmc_request *mrq) { struct mmc_command *cmd; + pr_info("%s: enter\n", __func__); + while (1) { wait_for_completion(&mrq->completion); + pr_info("%s: waiting done\n", __func__); cmd = mrq->cmd; @@ -567,7 +587,7 @@ void mmc_wait_for_req_done(struct mmc_host *host, struct mmc_request *mrq) mmc_retune_recheck(host); - pr_debug("%s: req failed (CMD%u): %d, retrying...\n", + pr_info("%s: req failed (CMD%u): %d, retrying...\n", mmc_hostname(host), cmd->opcode, cmd->error); cmd->retries--; cmd->error = 0; @@ -575,6 +595,8 @@ void mmc_wait_for_req_done(struct mmc_host *host, struct mmc_request *mrq) } mmc_retune_release(host); + + pr_info("%s: exit\n", __func__); } EXPORT_SYMBOL(mmc_wait_for_req_done); @@ -656,6 +678,10 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host, int start_err = 0; struct mmc_async_req *data = host->areq; + pr_info("%s: enter\n", __func__); + + pr_info("%s: areq=%p host->areq=%p\n", __func__, areq, host->areq); + /* Prepare a new request */ if (areq && !areq->pre_req_done) { areq->pre_req_done = true; @@ -671,6 +697,7 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host, * The previous request was not completed, * nothing to return */ + pr_info("%s: exit (NULL)\n", __func__); return NULL; } /* @@ -714,6 +741,7 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host, if (error) *error = err; + pr_info("%s: exit (data=%p)\n", __func__, data); return data; } EXPORT_SYMBOL(mmc_start_req);