From patchwork Fri Dec 16 03:05:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 5804 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 09A8A23E03 for ; Fri, 16 Dec 2011 03:05:17 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id F3DC9A1830F for ; Fri, 16 Dec 2011 03:05:16 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id k10so3123076eaa.11 for ; Thu, 15 Dec 2011 19:05:16 -0800 (PST) Received: by 10.204.156.208 with SMTP id y16mr2584175bkw.72.1324004716552; Thu, 15 Dec 2011 19:05:16 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.129.2 with SMTP id hg2cs59730bkc; Thu, 15 Dec 2011 19:05:16 -0800 (PST) Received: by 10.236.200.131 with SMTP id z3mr8883264yhn.129.1324004714585; Thu, 15 Dec 2011 19:05:14 -0800 (PST) Received: from mail-yw0-f50.google.com (mail-yw0-f50.google.com [209.85.213.50]) by mx.google.com with ESMTPS id a4si2250084anj.186.2011.12.15.19.05.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Dec 2011 19:05:14 -0800 (PST) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.213.50 as permitted sender) client-ip=209.85.213.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.213.50 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by yhoo22 with SMTP id o22so2843391yho.37 for ; Thu, 15 Dec 2011 19:05:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=WQXgeDxt+neH2qLqkd6eWbmoMEWcGKCl9BYcBDS3Ub8=; b=jdUvfulRjs7UcTiq/XbkmUzkLRCLOSUuXHa16By7cGBoigbd+ox5zSP+ZwI6GTnHj9 vJpNfSiyfDRLAR/iyHjLoNNuXdt2yd15coe2O4vS8qyAeCm3sMZyyt0UkZBRdrMamFxq ktII1ghjvneLNA3W6qvl7cVWz+CfvUZ9jNlxk= Received: by 10.236.22.136 with SMTP id t8mr9630446yht.30.1324004714129; Thu, 15 Dec 2011 19:05:14 -0800 (PST) Received: from localhost (ppp-70-253-156-7.dsl.rcsntx.swbell.net. [70.253.156.7]) by mx.google.com with ESMTPS id q52sm11960472yhh.3.2011.12.15.19.05.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Dec 2011 19:05:13 -0800 (PST) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, Greg KH , Tomi Valkeinen , 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> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1324004717-20595-1-git-send-email-rob.clark@linaro.org> References: <1324004717-20595-1-git-send-email-rob.clark@linaro.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;