From patchwork Thu Sep 7 19:02:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9942751 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 41841602B3 for ; Thu, 7 Sep 2017 19:03:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B370A2003F for ; Thu, 7 Sep 2017 19:03:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0A1B1FF22; Thu, 7 Sep 2017 19:03:12 +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 E22332003F for ; Thu, 7 Sep 2017 19:03:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CDB36E9BE; Thu, 7 Sep 2017 19:02:57 +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 ACB646E9BE for ; Thu, 7 Sep 2017 19:02:56 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id q8so362433qtb.1 for ; Thu, 07 Sep 2017 12:02:56 -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=nCs+aVIVAU09gq472oqiXjE/KE86PKiRcMb37MNiQiU=; b=nBq/urXkKhh3JDbrCoCOinweBcEF0sLAXoh5TevFCZo4WR4/utABDKGfgp2zcfFZcI M1tLC+eJuwtATWXn06WyRaKTzStP7kUcOa52lb6bcmS/s/vfohpIr4v0Nlv7b3T4udYZ EVB4+/AO7PvZ+dTj+hf/AH4TAgoH8LKQ8V2ZppOnPrDtHj/VodKQnLcHcmGcgjXmoMIx mo/15WqcGkvO78X6LxqlBURaL0rayvyyqIaZfo+LWoCOHVdcsIixq6iCorWayfA7VAIY yvzt4zzHrt4pg7b01HtUSY/t8ZpIdrNmOF195R7s4uGDQGV7x9U48wGV9P84ROnDCW1P cKCw== X-Gm-Message-State: AHPjjUhGrNK81UpRWUyJoKJe4wCF7WN9URAdp5nfkIXmqucedWqkHiKl zKgOa5NJbzq99QuB84U= X-Google-Smtp-Source: AOwi7QCzOmSEEwqJ4KnhP0fOo9PRTAZYa77TrpqCkjSC4JrZNffCjev2QbzsTFnoaOBiJw4p0/uORg== X-Received: by 10.200.25.78 with SMTP id g14mr559116qtk.48.1504810975680; Thu, 07 Sep 2017 12:02:55 -0700 (PDT) Received: from localhost.localdomain ([187.10.21.246]) by smtp.gmail.com with ESMTPSA id k2sm16244qkc.36.2017.09.07.12.02.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 12:02:55 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/2] dma-buf/sw_sync: force signal all unsignaled fences on dying timeline Date: Thu, 7 Sep 2017 16:02:46 -0300 Message-Id: <20170907190246.16425-2-gustavo@padovan.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907190246.16425-1-gustavo@padovan.org> References: <20170907190246.16425-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. v2: Do not bother with cleanup do the list (Chris Wilson) Signed-off-by: Dominik Behr Signed-off-by: Gustavo Padovan Reviewed-by: Chris Wilson --- drivers/dma-buf/sw_sync.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c index 38cc7389a6c1..f183eef074fd 100644 --- a/drivers/dma-buf/sw_sync.c +++ b/drivers/dma-buf/sw_sync.c @@ -321,9 +321,19 @@ 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); + } + + spin_unlock_irq(&obj->lock); + sync_timeline_put(obj); return 0; }