From: Rob Clark Subject: [PATCH 2/3] drm/omap: avoid aquiring mutex in atomic context Date: Thu, 15 Dec 2011 21:05:16 -0600 Message-ID: <1324004717-20595-2-git-send-email-rob.clark@linaro.org> References: <1324004717-20595-1-git-send-email-rob.clark@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-gy0-f177.google.com (mail-gy0-f177.google.com [209.85.160.177]) by gabe.freedesktop.org (Postfix) with ESMTP id AFAD5A0BFD for ; Thu, 15 Dec 2011 19:05:14 -0800 (PST) Received: by ghrr15 with SMTP id r15so151812ghr.36 for ; Thu, 15 Dec 2011 19:05:14 -0800 (PST) In-Reply-To: <1324004717-20595-1-git-send-email-rob.clark@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org Cc: Greg KH , Rob Clark , patches@linaro.org List-Id: dri-devel@lists.freedesktop.org From: Rob Clark omap_gem_roll() could be called by fbcon in atomic context. Avoid aquiring mutex, or calling tiler_pin() (which itself is not safe for atomic context) in these cases. Signed-off-by: Rob Clark --- drivers/staging/omapdrm/omap_gem.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/staging/omapdrm/omap_gem.c b/drivers/staging/omapdrm/omap_gem.c index 9684891..2bc570a 100644 --- a/drivers/staging/omapdrm/omap_gem.c +++ b/drivers/staging/omapdrm/omap_gem.c @@ -538,10 +538,22 @@ int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll) return -EINVAL; } - mutex_lock(&obj->dev->struct_mutex); - omap_obj->roll = roll; + if (in_atomic()) { + /* this can get called from fbcon in atomic context.. so + * just ignore it and wait for next time called from + * interruptible context to update the PAT.. the result + * may be that user sees wrap-around instead of scrolling + * momentarily on the screen. If we wanted to be fancier + * we could perhaps schedule some workqueue work at this + * point. + */ + return 0; + } + + mutex_lock(&obj->dev->struct_mutex); + /* if we aren't mapped yet, we don't need to do anything */ if (omap_obj->block) { struct page **pages; -- 1.7.5.4