From patchwork Mon Jan 22 19:32:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10179109 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 AC884601D5 for ; Mon, 22 Jan 2018 19:32:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AEAC284F1 for ; Mon, 22 Jan 2018 19:32:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F798284FF; Mon, 22 Jan 2018 19:32:44 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 1CDA1284F1 for ; Mon, 22 Jan 2018 19:32:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC1F86E2BC; Mon, 22 Jan 2018 19:32:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 614CB6E2BC for ; Mon, 22 Jan 2018 19:32:42 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id i186so18424067wmi.4 for ; Mon, 22 Jan 2018 11:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=LhsgugIcednFaD2Wy2XKcuUk8m6EjKRk0b4s5tmKNeM=; b=kMWkEA4k3/NXHCKvW4es4DXTc++5NO6+inESnetHxAn3WnIyOk9zaBw6NJQqFk5IaI rnZCVn2AubrrAFHvvaj0JJ8Wo8RHWUOpObQhZEo7uJYVdTiidrRupef910hKZJbiKVu+ aaweu+rxSJaYBQ3lfLWo7HCPo7Uy264jkdYR3nPVCSfY/+3s5iKi2gEuhU4ThbaesmZb LDBm0Ge3vXfSFsRsqyuS2gVl7kySqRbrXY/IIOu2X9w0gLeSiAxLtnQiJCb6sWpqecHC UHSsOEIbAz36OaMI0J2ma34yTgyV7+AC4rSh99Lz/rx3kzAyK6nB78vz+kZP7fVqm+cw 0H2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=LhsgugIcednFaD2Wy2XKcuUk8m6EjKRk0b4s5tmKNeM=; b=kHljqBuqbHKKxb1BH0J0SSKx3MgFM6fs3FPDuYWX+A28pWTKv0lGUoqgySsrRNRzI0 eDvfV5zbtdGYJC/4KjYshmZpM67B9lkxixevDbyEL5L7KWvrBqwgvGIMNK8VKzQmXawW V0xfFhsVrTr78eLg1QZ80fmQpl+hT0+l/uEQ1tCxnby723bKNGMmDtsaq4iTUAOxwomD rvBpitxfbF+Nu8Cph+yH4et7ExwF/6b40ROJKLw3lnHFHNGnHmKxnM76cgPbej0M805a zYXpRkaeeLg4P3C3ywnVJKimWuVCpPzxu0YiixxY8GAbN0UatqGCgmBaDy1QlFzyEGWt QUkQ== X-Gm-Message-State: AKwxyteFOnA2VE4qKPyh/pLPiGh2KdfV/c5VyHlZXftdBghYwLAaDHea Cma5xhtwKkQn+bjv15FdH2Lj9g== X-Google-Smtp-Source: AH8x225zCEJWpzXfBYvesJK5YXfP+k0Ge10HYoc7xU+58yZjSU0HlagYfAzHo8VREsdqkhxRjYAyLQ== X-Received: by 10.28.132.207 with SMTP id g198mr5789478wmd.118.1516649560567; Mon, 22 Jan 2018 11:32:40 -0800 (PST) Received: from baker.fritz.box ([2a02:908:1251:8fc0:d1b:905d:6615:3ead]) by smtp.gmail.com with ESMTPSA id c19sm6133543wmd.5.2018.01.22.11.32.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 11:32:40 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more Date: Mon, 22 Jan 2018 20:32:39 +0100 Message-Id: <20180122193239.7674-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We need to set shared_count even if we already have a fence to wait for. Signed-off-by: Christian König Tested-by: Lyude Paul Reviewed-by: Lyude Paul --- drivers/dma-buf/reservation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c index 461afa9febd4..649c0cebf5b1 100644 --- a/drivers/dma-buf/reservation.c +++ b/drivers/dma-buf/reservation.c @@ -506,14 +506,14 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, fence = NULL; } - if (!fence && wait_all) { + if (wait_all) { struct reservation_object_list *fobj = rcu_dereference(obj->fence); if (fobj) shared_count = fobj->shared_count; - for (i = 0; i < shared_count; ++i) { + for (i = 0; !fence && i < shared_count; ++i) { struct dma_fence *lfence = rcu_dereference(fobj->shared[i]); if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,