Received: by 10.223.164.202 with SMTP id h10csp5310214wrb; Tue, 21 Nov 2017 07:51:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMbRGadQakh9Ilw2oVHWm7Rv/nrzC7wEkm3JgrmhyheQTkpbAEdoatINF7jtilqWtb/0vrv1 X-Received: by 10.98.236.16 with SMTP id k16mr13284180pfh.192.1511279463541; Tue, 21 Nov 2017 07:51:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511279463; cv=none; d=google.com; s=arc-20160816; b=OVfamJ2eEkaMsdd1YzH7zsIP/KE+8T7jM70Z7w1O9pZLNQQFnFBwZEDHZ/lEI/IWuJ D8JHHo69b1wkXvBh70tC1zko87rLi4gdULcq6O6TkjghL+0Y3OnsG6yyIlcHOnb15Rnk PBc7PihMYGLC1RtFlqcc5XyA2/X69No3f8T0eFgdSXOxAJrBwsrqNyEIsdms9KB+Nu1g wdq7H5SboJYGtF7V1w4u7FbYfdMCfNILTHuWFkcsoeNRBlfrJWxqiRZ4wRZ6WO0y80eL wZfMHqlGX4jlgkX+n9cqKxoLPzlTcxNh6QmMe+2Bx2JGFURagEL7habOPjH8FmdpeA5D YjoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=hcXvhPjs86s3/K9UgW1bYxP5CWgIjfFZ4GQQhSmOqio=; b=wLpL5ahKdLnIDCz69uqcUV+jqLp9z9yeX58mlB94caOvM0Cf1/feau0BiwxdQaqRs/ 21PypViM0U3sXlG2S15Qz/xJzG3Wbht/FqRD+s1Mxn9vnBPE8D1X7mafxI5f9QAFsmZN 2N2kbs8iF+1cVOIHdeNifipamjjio3I2VkuVemhYQjkBUlCOv82Q2bQmCXUM/Q2c+bLJ mvjEjgQS9rCh5LupmAvws4NteOAWiZFjDug7LbJ4+UTVOJZPXWTApSaSiJ1Kn3j2uQxy AALUy5HwjY+QlQxjbRN7K7+kJfciQMZZz7zaTgGL+3LcPK3J8U+Jr7cfKYyysFVHAsXq eD4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nXeyYqhu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k4si11089391pgs.459.2017.11.21.07.50.52; Tue, 21 Nov 2017 07:51:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nXeyYqhu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751347AbdKUPuB (ORCPT + 76 others); Tue, 21 Nov 2017 10:50:01 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:45695 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbdKUPt7 (ORCPT ); Tue, 21 Nov 2017 10:49:59 -0500 Received: by mail-wm0-f66.google.com with SMTP id 9so4366381wme.4; Tue, 21 Nov 2017 07:49:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=hcXvhPjs86s3/K9UgW1bYxP5CWgIjfFZ4GQQhSmOqio=; b=nXeyYqhupfbw/cX2RL1FeRNSd1iIX+xLHf/u0heHT83q+wrp7rS5LJH0oruhhGBjiW /m2J/9oze2Mqp0Fbg60G9RbvMlMWeYke0N3FvF/mW96B3FZY+sZEHboLWT8niv9JM3/v nnURadPMX5zfbAB2ZDTZAE8/MlA6oeTbYytW9U4krGwMyh9TX8yVnU8dJSkScPMHGQm1 t7cldK+hBrAPNqqxOK3qXAU+9c6GnlwW6Qh8ooZL43CZl/yhV775jRUWJDCKKu2AP5Pp 55cyh1MEDav03U5QtuiwgwS4Gf1vON3wu55RODRCenFXssFFzQ/tBdUMYyfsguiIvYce VVFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=hcXvhPjs86s3/K9UgW1bYxP5CWgIjfFZ4GQQhSmOqio=; b=qen4lKMLPoqnn/7k3gsjhHYwoaWYWU+8j9msLlbNxJAkfNQdm/cNGs3BwXQYDmZ9ki kf3aOHXIbwjqTBIp3nunN5QmdtZMPdqF81QQd29gyu9uGlAGfxG73SXryKYphXUzbptx I/BT3qeZ3S0YmwAS33KTB4cv5amqK3uD48BkX79KFagKklGrP6PAQJ4NUZGMeiOJvj/T p5HnqZm+VOK8eBmzbYR928fCs/bvZl9Qbt0kkGbEDrY9beru/NGhYXjuiSYjXUiE4Unx Qo1q9ynsN7qBDD3Peh0eI/ovkzBtIFpvVJ40IanZl2Tb4FmztobZLds44NhDT/ut3pdK IfHw== X-Gm-Message-State: AJaThX7XArg3wI0ipmDV45CQbfCwopLdvMlR2iLKwqCCaOJKZzXfY2sF uccay5VNQ/l8t2YAP8F1duzDIIYJ X-Received: by 10.28.49.195 with SMTP id x186mr1699509wmx.116.1511279397464; Tue, 21 Nov 2017 07:49:57 -0800 (PST) Received: from ?IPv6:2a02:908:1251:7981:fcc0:d6fe:33e7:da04? ([2a02:908:1251:7981:fcc0:d6fe:33e7:da04]) by smtp.gmail.com with ESMTPSA id r195sm964677wmb.5.2017.11.21.07.49.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Nov 2017 07:49:56 -0800 (PST) Reply-To: christian.koenig@amd.com Subject: Re: [PATCH] reservation: don't wait when timeout=0 To: Rob Clark , Chris Wilson Cc: "linaro-mm-sig@lists.linaro.org" , Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" , "linux-media@vger.kernel.org" References: <20171121140850.23401-1-robdclark@gmail.com> <151127508188.436.3320065005004428970@mail.alporthouse.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <83c7c887-0d40-69b5-2ad2-67d0af6eda71@gmail.com> Date: Tue, 21 Nov 2017 16:49:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 21.11.2017 um 15:59 schrieb Rob Clark: > On Tue, Nov 21, 2017 at 9:38 AM, Chris Wilson wrote: >> Quoting Rob Clark (2017-11-21 14:08:46) >>> If we are testing if a reservation object's fences have been >>> signaled with timeout=0 (non-blocking), we need to pass 0 for >>> timeout to dma_fence_wait_timeout(). >>> >>> Plus bonus spelling correction. >>> >>> Signed-off-by: Rob Clark >>> --- >>> drivers/dma-buf/reservation.c | 11 +++++++++-- >>> 1 file changed, 9 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c >>> index dec3a815455d..71f51140a9ad 100644 >>> --- a/drivers/dma-buf/reservation.c >>> +++ b/drivers/dma-buf/reservation.c >>> @@ -420,7 +420,7 @@ EXPORT_SYMBOL_GPL(reservation_object_get_fences_rcu); >>> * >>> * RETURNS >>> * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or >>> - * greater than zer on success. >>> + * greater than zero on success. >>> */ >>> long reservation_object_wait_timeout_rcu(struct reservation_object *obj, >>> bool wait_all, bool intr, >>> @@ -483,7 +483,14 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, >>> goto retry; >>> } >>> >>> - ret = dma_fence_wait_timeout(fence, intr, ret); >>> + /* >>> + * Note that dma_fence_wait_timeout() will return 1 if >>> + * the fence is already signaled, so in the wait_all >>> + * case when we go through the retry loop again, ret >>> + * will be greater than 0 and we don't want this to >>> + * cause _wait_timeout() to block >>> + */ >>> + ret = dma_fence_wait_timeout(fence, intr, timeout ? ret : 0); >> One should ask if we should just fix the interface to stop returning >> incorrect results (stop "correcting" a completion with 0 jiffies remaining >> as 1). A timeout can be distinguished by -ETIME (or your pick of errno). > perhaps -EBUSY, if we go that route (although maybe it should be a > follow-on patch, this one is suitable for backport to stable/lts if > one should so choose..) > > I think current approach was chosen to match schedule_timeout() and > other such functions that take a timeout in jiffies. Not making a > judgement on whether that is a good or bad reason.. We intentionally switched away from that to be in sync with the wait_event_* interface. Returning 1 when a function with a zero timeout succeeds is actually quite common in the kernel. Regards, Christian. > BR, > -R > >> -Chris > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel From 1584688173487425314@xxx Tue Nov 21 15:00:10 +0000 2017 X-GM-THRID: 1584685078993396088 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread