From patchwork Fri Mar 1 00:43:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 15179 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 C3E9D23E1A for ; Fri, 1 Mar 2013 00:44:18 +0000 (UTC) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by fiordland.canonical.com (Postfix) with ESMTP id 7C40BA1959D for ; Fri, 1 Mar 2013 00:44:18 +0000 (UTC) Received: by mail-vc0-f176.google.com with SMTP id fk10so1609706vcb.21 for ; Thu, 28 Feb 2013 16:44:17 -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=cCII73tCYbeEHSB2e9D5jpXyLRFMVaYCuy8DQJKdqwM=; b=pG7bhdC4KHsfdu23Waa3yyaL2/JtwwHEF+vfMDl/LCSu92kpXJ+qNDhB43xokoYDpb Fnl/Cjw8LIuPqS8EeDy2CYnDpnQgm6fFyCTRfAD4DOfiqS4kg3O4Pm2N74kq8xI3ZL5X i/z/cUcTKE96VzfueUwkKCnB6H6a/cpAQG04auMgvtLRuuvXOTcfvC+GuGAbSHqLeDTo NMwqKMY10jpKsVaITLxB9STuClBiPkX7rjdJRk30NRwDdZ5yIywAzLw85tZGPCQVc8+p Er9dZjHBnvEspluAc/XvB1Qo+HK+O+ymbrHwBmufWbUaFuto2nZ/mh9qChF/2qVy2N3F p8fw== X-Received: by 10.221.11.135 with SMTP id pe7mr3318744vcb.41.1362098657684; Thu, 28 Feb 2013 16:44:17 -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 st5csp668veb; Thu, 28 Feb 2013 16:44:17 -0800 (PST) X-Received: by 10.68.230.225 with SMTP id tb1mr11950467pbc.86.1362098656649; Thu, 28 Feb 2013 16:44:16 -0800 (PST) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by mx.google.com with ESMTPS id uc1si3691222pbc.291.2013.02.28.16.44.16 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:44:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.41; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.41 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-pa0-f41.google.com with SMTP id fb11so1467995pad.28 for ; Thu, 28 Feb 2013 16:44:16 -0800 (PST) X-Received: by 10.66.218.2 with SMTP id pc2mr7182566pac.150.1362098656087; Thu, 28 Feb 2013 16:44:16 -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.14 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:44:15 -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 23/30] staging: sync: Update new fence status with sync_fence_signal_pt Date: Thu, 28 Feb 2013 16:43:19 -0800 Message-Id: <1362098606-26469-24-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: ALoCoQmCaIsAh0rREWpkVcR7kVMvY343z/BpgUOy255MSnqIwN9rnOgQGmh6uxP6jat5fcO+C5PE From: Erik Gilling If a fence's pt is signaled before sync_fence_create is called, the fence will never transition into the signaled state. This also address a tiny race if a merged fence's pt after sync_fence_get_status checks it's status and before fence->status is updated. 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 Signed-off-by: John Stultz --- drivers/staging/android/sync.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 2394189..889ca6e 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -295,6 +295,12 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) list_add(&pt->pt_list, &fence->pt_list_head); sync_pt_activate(pt); + /* + * signal the fence in case pt was activated before + * sync_pt_activate(pt) was called + */ + sync_fence_signal_pt(pt); + return fence; } EXPORT_SYMBOL(sync_fence_create); @@ -457,7 +463,13 @@ struct sync_fence *sync_fence_merge(const char *name, if (err < 0) goto err; - fence->status = sync_fence_get_status(fence); + /* + * signal the fence in case one of it's pts were activated before + * they were activated + */ + sync_fence_signal_pt(list_first_entry(&fence->pt_list_head, + struct sync_pt, + pt_list)); return fence; err: