From patchwork Mon Sep 4 23:06:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9937637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C485260237 for ; Mon, 4 Sep 2017 23:06:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AABDB28767 for ; Mon, 4 Sep 2017 23:06:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DB6428811; Mon, 4 Sep 2017 23:06:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 04BA228767 for ; Mon, 4 Sep 2017 23:06:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC1DC6E398; Mon, 4 Sep 2017 23:06:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3293C6E389 for ; Mon, 4 Sep 2017 23:06:15 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id p55so1184135qtc.2 for ; Mon, 04 Sep 2017 16:06:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EznbWeIawYxu5kbIONnf3VAQawvfLHDJcMH6olA5Y9k=; b=pnrSQupwEDqeerFCT8E24DH3w1YIU2OdwZ3qA2Ulvyc0Pz5ZSttPKR4MtQxUG6BtSG bq7PnQ/SbhPrjv8oVz7Wf95uUAsTM/tb0uiDvI47FbAwLymakAiNXN9zAUWb/oUShWhe hjyQ/Lxfz0kl71tfS8iPcczV5be7noQ2kFMGxDMDsSyP5nRzZp/mh79bSTROEC18HwVy 2OoUip3HYInYe8P6X1aaFD2O5NWWas8iAHxrPfJ1y2FfjGZLx+T3XD+dBSCy2+GnYs1K cURXc5Gd+Y1JtISzvSe6NO9io7Swr7lfQZR1UstCC43Vs9K9cfiCe5rNtuiqfR3w2sSM PFvQ== X-Gm-Message-State: AHPjjUg91Fc39FjPBX/guSZEr2Q/wDnc7DSprG+Hzk7bfPsQHyZM4Ss+ sW7PqpQdYSiahqoTrx4= X-Google-Smtp-Source: ADKCNb6SHjPksOywjpeJyWU/2ABPHm3MJLakJewi0Gwf/3ikko2Icyn9i5nQoUGERuan9hAE3i1mcw== X-Received: by 10.200.39.185 with SMTP id w54mr2712836qtw.234.1504566374040; Mon, 04 Sep 2017 16:06:14 -0700 (PDT) Received: from localhost.localdomain ([187.10.21.246]) by smtp.gmail.com with ESMTPSA id s77sm743495qke.47.2017.09.04.16.06.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Sep 2017 16:06:13 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] dma-buf/sw_sync: force signal all unsignaled fences on dying timeline Date: Mon, 4 Sep 2017 20:06:04 -0300 Message-Id: <20170904230604.12757-2-gustavo@padovan.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170904230604.12757-1-gustavo@padovan.org> References: <20170904230604.12757-1-gustavo@padovan.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Dominik Behr To avoid hanging userspace components that might have been waiting on the active fences of the destroyed timeline we need to signal with error all remaining fences on such timeline. This restore the default behaviour of the Android sw_sync framework, which Android still relies on. It was broken on the dma fence conversion a few years ago and never fixed. Signed-off-by: Dominik Behr Signed-off-by: Gustavo Padovan --- drivers/dma-buf/sw_sync.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c index 38cc7389a6c1..a85198c75a1b 100644 --- a/drivers/dma-buf/sw_sync.c +++ b/drivers/dma-buf/sw_sync.c @@ -321,9 +321,21 @@ static int sw_sync_debugfs_open(struct inode *inode, struct file *file) static int sw_sync_debugfs_release(struct inode *inode, struct file *file) { struct sync_timeline *obj = file->private_data; + struct sync_pt *pt, *next; smp_wmb(); + spin_lock_irq(&obj->lock); + + list_for_each_entry_safe(pt, next, &obj->pt_list, link) { + dma_fence_set_error(&pt->base, -ENOENT); + dma_fence_signal_locked(&pt->base); + list_del_init(&pt->link); + rb_erase(&pt->node, &obj->pt_tree); + } + + spin_unlock_irq(&obj->lock); + sync_timeline_put(obj); return 0; }