From patchwork Fri Sep 28 07:29:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 14709 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1THV1J-0001op-Hf for patchwork@linuxtv.org; Fri, 28 Sep 2012 09:29:57 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for id 1THV1I-0000Ot-Ed; Fri, 28 Sep 2012 09:29:56 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753342Ab2I1H3v (ORCPT ); Fri, 28 Sep 2012 03:29:51 -0400 Received: from mail-oa0-f46.google.com ([209.85.219.46]:36783 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619Ab2I1H3u (ORCPT ); Fri, 28 Sep 2012 03:29:50 -0400 Received: by oagh16 with SMTP id h16so2672936oag.19 for ; Fri, 28 Sep 2012 00:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=eUNRI0Z2roWu4GKwN+UAMILAh26ckT4K8S3QNRwca3E=; b=Z3HQ4moN1qpsuBkKRq3y15tJCr6tFdHprNJw+aI2Ctxy3nC2815pJNav72yawLHcy1 QkpheczeDa+JWkYGgP0JHtufD5uexrRcl+ssFiWZrHDUP6TrcW+KQQkaLuGDfzoITOMY T9L0FKJnFYcx0ROztO1vHh80bdbVjKl5+phempvEWgDcfQ91UyIo/f5zLOaGdcmrhhn2 0BLmxGEsKGwGy07YioCe2FF9cM19z4HSrWOZV/yA/ri8pJi6N4DFGAwSTA2/BUm33Vx1 BA9pWhgHgGSq8rpaDy+pW209HoOO1IWRkHh7w05mEdNW6ECkO7bwfmrZaBli9EVyoHnh Zj8A== Received: by 10.60.170.241 with SMTP id ap17mr5341998oec.4.1348817390314; Fri, 28 Sep 2012 00:29:50 -0700 (PDT) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id th3sm7804592obb.6.2012.09.28.00.29.48 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 00:29:49 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org Cc: patches@linaro.org, daniel.vetter@ffwll.ch, sumit.semwal@linaro.org, maarten.lankhorst@canonical.com, Rob Clark Subject: [PATCH] dma-buf: might_sleep() in dma_buf_unmap_attachment() Date: Fri, 28 Sep 2012 09:29:43 +0200 Message-Id: <1348817383-30286-1-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.9.28.72416 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' From: Rob Clark We never really clarified if unmap could be done in atomic context. But since mapping might require sleeping, this implies mutex in use to synchronize mapping/unmapping, so unmap could sleep as well. Add a might_sleep() to clarify this. Signed-off-by: Rob Clark Acked-by: Daniel Vetter Reviewed-by: Maarten Lankhorst --- drivers/base/dma-buf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index c30f3e1..877eacb 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c @@ -298,6 +298,8 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, struct sg_table *sg_table, enum dma_data_direction direction) { + might_sleep(); + if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) return;