From patchwork Fri Mar 1 00:43:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 15175 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 5FFA123E1A for ; Fri, 1 Mar 2013 00:44:12 +0000 (UTC) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by fiordland.canonical.com (Postfix) with ESMTP id 147C4A1959D for ; Fri, 1 Mar 2013 00:44:11 +0000 (UTC) Received: by mail-ve0-f171.google.com with SMTP id b10so2424849vea.2 for ; Thu, 28 Feb 2013 16:44:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=5r9aWl88rIsQTnU7GmK3UESaSQ0Hli/iz5SWauugzJc=; b=D2MnLOwOvadPHkxqdLJmxmzu69YJH/abz+E4Zq2dmaT1v98pWElggAl6UHYbk226T6 fFBsZxvQ6NediuO9GZ19zK6n3rUhiMlI8kiDSX6E1qfUgSy3McI4WQvCYGvxbgZN/SF5 10qBmxgekgZUNSuLETswK4QFcRj6KFgRBuy16F4gUAyVHaX72tJt/oo8eQ39u5MvJfZi h6na8b5erV65PayG9pGsNrDCUH3MiibBzlf47EgRDyBvnrzRc24t/rahZqGLTPF+Vpz+ q3izadGWfYTLabNMYFsFOK6ur9pyA/lz013f4H5f4v7JzW20z/HAhiBFArFRiDGdxyRA yHcA== X-Received: by 10.58.84.164 with SMTP id a4mr3456199vez.9.1362098651531; Thu, 28 Feb 2013 16:44:11 -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.58.145.101 with SMTP id st5csp660veb; Thu, 28 Feb 2013 16:44:11 -0800 (PST) X-Received: by 10.66.228.72 with SMTP id sg8mr16187062pac.186.1362098650666; Thu, 28 Feb 2013 16:44:10 -0800 (PST) Received: from mail-da0-f50.google.com (mail-da0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id zt7si10247840pbc.302.2013.02.28.16.44.10 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:44:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: by mail-da0-f50.google.com with SMTP id h15so1094296dan.23 for ; Thu, 28 Feb 2013 16:44:10 -0800 (PST) X-Received: by 10.68.189.234 with SMTP id gl10mr6453301pbc.53.1362098650189; Thu, 28 Feb 2013 16:44:10 -0800 (PST) Received: from localhost.localdomain (c-24-21-54-107.hsd1.or.comcast.net. [24.21.54.107]) by mx.google.com with ESMTPS id dx17sm10914892pac.17.2013.02.28.16.44.08 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:44:09 -0800 (PST) From: John Stultz To: lkml Cc: Erik Gilling , Maarten Lankhorst , Daniel Vetter , Rob Clark , Sumit Semwal , Greg KH , dri-devel@lists.freedesktop.org, Android Kernel Team , John Stultz Subject: [PATCH 19/30] staging: sync: Dump sync state to console on timeout Date: Thu, 28 Feb 2013 16:43:15 -0800 Message-Id: <1362098606-26469-20-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362098606-26469-1-git-send-email-john.stultz@linaro.org> References: <1362098606-26469-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQkixztVb28barnnmTMwBxwTuo1tZlP+2XDw/mlSLO/0wieGnCdWQWmNfKUsiYHE9cu3whS+ From: Erik Gilling If we hit a timeout, dump sync state to console Cc: Maarten Lankhorst Cc: Erik Gilling Cc: Daniel Vetter Cc: Rob Clark Cc: Sumit Semwal Cc: Greg KH Cc: dri-devel@lists.freedesktop.org Cc: Android Kernel Team Signed-off-by: Erik Gilling [jstultz: Add commit message, whitespace fixups] Signed-off-by: John Stultz --- drivers/staging/android/sync.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 7fccfcd..d54fa8d 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -31,6 +31,7 @@ static void sync_fence_signal_pt(struct sync_pt *pt); static int _sync_pt_has_signaled(struct sync_pt *pt); static void sync_fence_free(struct kref *kref); +static void sync_dump(void); static LIST_HEAD(sync_timeline_list_head); static DEFINE_SPINLOCK(sync_timeline_list_lock); @@ -574,8 +575,10 @@ int sync_fence_wait(struct sync_fence *fence, long timeout) if (fence->status < 0) return fence->status; - if (fence->status == 0) + if (fence->status == 0) { + sync_dump(); return -ETIME; + } return 0; } @@ -914,7 +917,34 @@ static __init int sync_debugfs_init(void) debugfs_create_file("sync", S_IRUGO, NULL, NULL, &sync_debugfs_fops); return 0; } - late_initcall(sync_debugfs_init); +#define DUMP_CHUNK 256 +static char sync_dump_buf[64 * 1024]; +void sync_dump(void) +{ + struct seq_file s = { + .buf = sync_dump_buf, + .size = sizeof(sync_dump_buf) - 1, + }; + int i; + + sync_debugfs_show(&s, NULL); + + for (i = 0; i < s.count; i += DUMP_CHUNK) { + if ((s.count - i) > DUMP_CHUNK) { + char c = s.buf[i + DUMP_CHUNK]; + s.buf[i + DUMP_CHUNK] = 0; + pr_cont("%s", s.buf + i); + s.buf[i + DUMP_CHUNK] = c; + } else { + s.buf[s.count] = 0; + pr_cont("%s", s.buf + i); + } + } +} +#else +static void sync_dump(void) +{ +} #endif