From patchwork Thu Mar 14 06:17:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seungwon Jeon X-Patchwork-Id: 2267851 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 76215DFB79 for ; Thu, 14 Mar 2013 06:17:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753266Ab3CNGRQ (ORCPT ); Thu, 14 Mar 2013 02:17:16 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:57007 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084Ab3CNGRQ (ORCPT ); Thu, 14 Mar 2013 02:17:16 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJN0088K04BAQ20@mailout4.samsung.com> for linux-mmc@vger.kernel.org; Thu, 14 Mar 2013 15:17:14 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.47]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id C4.BC.20872.A6B61415; Thu, 14 Mar 2013 15:17:14 +0900 (KST) X-AuditID: cbfee68d-b7f786d000005188-76-51416b6ac0dc Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 75.DB.17838.A6B61415; Thu, 14 Mar 2013 15:17:14 +0900 (KST) Received: from DOTGIHJUN01 ([12.23.118.161]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJN00DOA04QOQ70@mmp2.samsung.com>; Thu, 14 Mar 2013 15:17:14 +0900 (KST) From: Seungwon Jeon To: linux-mmc@vger.kernel.org Cc: 'Chris Ball' , 'Johan Rudholm' , 'Konstantin Dorfman' Subject: [PATCH] mmc: block: fix the host's claim-release in special request Date: Thu, 14 Mar 2013 15:17:13 +0900 Message-id: <001101ce207b$91e60440$b5b20cc0$%jun@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac4ge5Ga9PxMh9p2Q0uMbOkan3OyOg== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsVy+t8zfd2sbMdAg4bH4hbbX29kszg0+zyz xc4zj9gsjvzvZ3Rg8bjc18vksXPWXXaPQ1fWMnp83iQXwBLFZZOSmpNZllqkb5fAlfHw7Gn2 goPCFRu+/WVtYFwu0MXIySEhYCLxqXUJC4QtJnHh3nq2LkYuDiGBZYwSq69MYIQp6lwxlw3E FhKYzihx4Fo4RNEfRomHz56DFbEJaEn8ffOGGcQWEZCV+PnnAlgDs0ClxJRjd8BqhAV8JG7c /s4OYrMIqEp8+rGfFcTmFbCVaPv0nQXCFpT4MfkeC0SvusSkeYuYIWx5ic1r3gLZHEAHqUs8 +qsLsUpPYtEDiPHMAiIS+168YwS5TUJgE7vEh3vb2CB2CUh8m3yIBaJXVmLTAWaIvyQlDq64 wTKBUWwWks2zkGyehWTzLCQrFjCyrGIUTS1ILihOSi8y1CtOzC0uzUvXS87P3cQIibLeHYy3 D1gfYkwGWj+RWUo0OR8YpXkl8YbGZkYWpiamxkbmlmakCSuJ86q1WAcKCaQnlqRmp6YWpBbF F5XmpBYfYmTi4JRqYEzfvvKCDNN3gx+/wpcteSCzpuhX43RZsfbMaVceiMqvbz/8x4PnZgYf 86YlhZNesM1fd8h//zGJGIYDng2zGt5mv95mf+dXeYjcMcFv0WZR7wrn/mGWr7at9RMR8tpY taio88Hpnz8Tfx5zWmZgsehz/o9lbQcjOpJWb9Y1aD6g5Din8fB5m9tKLMUZiYZazEXFiQA8 zE2byAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEKsWRmVeSWpSXmKPExsVy+t9jQd2sbMdAg1PHhC22v97IZnFo9nlm i51nHrFZHPnfz+jA4nG5r5fJY+esu+weh66sZfT4vEkugCWqgdEmIzUxJbVIITUvOT8lMy/d Vsk7ON453tTMwFDX0NLCXEkhLzE31VbJxSdA1y0zB2inkkJZYk4pUCggsbhYSd8O04TQEDdd C5jGCF3fkCC4HiMDNJCwjjHj4dnT7AUHhSs2fPvL2sC4XKCLkZNDQsBEonPFXDYIW0ziwr31 YLaQwHRGiQPXwrsYuYDsP4wSD589ZwRJsAloSfx984YZxBYRkJX4+ecCWAOzQKXElGN3wGqE BXwkbtz+zg5iswioSnz6sZ8VxOYVsJVo+/SdBcIWlPgx+R4LRK+6xKR5i5ghbHmJzWveAtkc QAepSzz6qwuxSk9i0QOI8cwCIhL7XrxjnMAoMAvJpFlIJs1CMmkWkpYFjCyrGEVTC5ILipPS cw31ihNzi0vz0vWS83M3MYJj+JnUDsaVDRaHGAU4GJV4eA/0OwQKsSaWFVfmHmKU4GBWEuH1 9HIMFOJNSaysSi3Kjy8qzUktPsSYDPToRGYp0eR8YHrJK4k3NDYxM7I0MrMwMjE3J01YSZz3 QKt1oJBAemJJanZqakFqEcwWJg5OqQZGFu8LJiWFgtsY7386cVh116lNrb9X/n/et15F6s6E W5M0DpQFzlHgEWE2Vd2uuXeTg9TbsNZJjKnRbpMFImKrzwUZz9+TVX33xXRJicr7j/U/6D3/ eet4/0m2gld1wo/UuuLuzZwj3X26Ze+NSdZflKcFblgWECvDe2G6UMLjw/c6xZfauL46o8RS nJFoqMVcVJwIAJ0VQ0MlAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org For normal request mmc_blk_issue_rq is called twice with asynchronous transfer(cur and prev). Host's claim and release can be done in each mmc_blk_issue_rq. However, Special request is currently excluded in asynchronous transfer. After special request is finished, if there is no new request, mmc_release_host won't be called in mmc_blk_issue_rq. The problem is founded during mmc_suspend. [] (__schedule+0x0/0x78c) from [] (schedule+0x38/0x78) [] (schedule+0x0/0x78) from [] (__mmc_claim_host+0xac/0x1b4) [] (__mmc_claim_host+0x0/0x1b4) from [] (mmc_suspend+0x28/0x9c) [] (mmc_suspend+0x0/0x9c) from [] (mmc_suspend_host+0xb4/0x194) ... Reported-by: Johan Rudholm Signed-off-by: Seungwon Jeon Tested-by: Johan Rudholm --- drivers/mmc/card/block.c | 10 ++++++++-- drivers/mmc/card/queue.c | 3 --- drivers/mmc/card/queue.h | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 5bab73b..71c5ce7 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1932,8 +1932,14 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) } out: - if (!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) - /* release host only when there are no more requests */ + if (!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST) || + req && (req->cmd_flags & MMC_REQ_SPECIAL_MASK)) + /* + * Release host when there are no more requests + * and after special request(discard, flush) is done. + * In case sepecial request, there is no reentry to + * the 'mmc_blk_issue_rq' with 'mqrq_prev->req'. + */ mmc_release_host(card->host); return ret; } diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index fa4e44e..9447a0e 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c @@ -22,9 +22,6 @@ #define MMC_QUEUE_BOUNCESZ 65536 - -#define MMC_REQ_SPECIAL_MASK (REQ_DISCARD | REQ_FLUSH) - /* * Prepare a MMC request. This just filters out odd stuff. */ diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h index 031bf63..5752d50 100644 --- a/drivers/mmc/card/queue.h +++ b/drivers/mmc/card/queue.h @@ -1,6 +1,8 @@ #ifndef MMC_QUEUE_H #define MMC_QUEUE_H +#define MMC_REQ_SPECIAL_MASK (REQ_DISCARD | REQ_FLUSH) + struct request; struct task_struct;