From patchwork Fri Nov 13 15:36:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 7620371 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5306C9F392 for ; Mon, 16 Nov 2015 02:31:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91AFD2053C for ; Mon, 16 Nov 2015 02:31:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2E44F2053B for ; Mon, 16 Nov 2015 02:31:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F0296E50D; Sun, 15 Nov 2015 18:31:25 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io0-f169.google.com (mail-io0-f169.google.com [209.85.223.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2130B6F0B2 for ; Fri, 13 Nov 2015 07:36:44 -0800 (PST) Received: by ioc74 with SMTP id 74so100710374ioc.2 for ; Fri, 13 Nov 2015 07:36:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel_dk.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; bh=D6M8JeB6W1dOGXUgFn/zOU4THbuwWHdR6QIH3HzxmVo=; b=cwY5HIJtSeHzaqyT0gijAt6MxEiz9BXXa1Pu3pj4T0/0MUOgz2lyh0fwmvucbZOxTl 1MhmRM6fUTaOYZm+uk+km3jb0yHw0MtUsABx6ZbtVGEYxwx/1c6Nei4ArwEYoweCALgt Xen8aZszVRJYxb7JARHkb0N6qvx5JUk/d+mv6IgnKukpl7z8KbRztRdhk4T6eCPhAQ+x vrmMIQqBgM0Er0kqLN1RGsO68Jg5aW4bHZL3x9LS44iSCC7GW1m6jKC5JXAr+xSrNh/S 9I5RvNg4cHso6AsTye5fjVhzljdADHWxQsctl+4jkNy8x17jMv9iBF7H8LRRkOsLIxDS hPig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to; bh=D6M8JeB6W1dOGXUgFn/zOU4THbuwWHdR6QIH3HzxmVo=; b=NxfS7JE6s+HP/IcyQ1YQcRjzfPDzIJ2AWDPAi327hcCB4JK1WiRncjA6AhC85XhUth 2zudbPabLdjX19YwVvtgOPPkk0+sblCKLTW/27vNeLS0cE0SJZY1DEcig9RNh5rzkEeD FRIGGQQ9OH4GYyv0gFa71IuN6k/M6yidQUn7UL2wtGrTNmkHNMLGhNrI6jAMAprTMGDU QsDehR0/rC4ifwN18zCxT8acENgB+qr6NMgxx1mmp+0w4/n5cPYpqQfM9CHReTAgtwnp ypFxGwO/yt8CosWr20AY3sntOJpSITU5Q8zHiMq5z+pBPRoyG8vbWCertU5bJOGgkU5A v1Yw== X-Gm-Message-State: ALoCoQkdeMqA/SrKWAfc6dseZt4B+4R2QHYoeCc0GbIysRClmMIpfAbhln6EC2GDzbJ5JflmSEHe X-Received: by 10.107.169.29 with SMTP id s29mr22092719ioe.190.1447429003422; Fri, 13 Nov 2015 07:36:43 -0800 (PST) Received: from localhost ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id e25sm7009118iod.2.2015.11.13.07.36.30 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Nov 2015 07:36:31 -0800 (PST) Date: Fri, 13 Nov 2015 08:36:29 -0700 From: Jens Axboe To: Chris Wilson Subject: Re: __i915_spin_request() sucks Message-ID: <20151113153629.GB8939@kernel.dk> References: <5644F850.2060803@kernel.dk> <5644F941.9090505@kernel.dk> <20151112221908.GA26194@nuc-i3427.alporthouse.com> <56451812.2050704@kernel.dk> <20151113091558.GN6247@nuc-i3427.alporthouse.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151113091558.GN6247@nuc-i3427.alporthouse.com> X-Mailman-Approved-At: Sun, 15 Nov 2015 18:31:21 -0800 Cc: Daniel Vetter , LKML , DRI Development 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-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Previous patch was obvious pre-coffee crap, this should work for using ktime to spin max 1usec. diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 5cf4a1998273..21192e55c33c 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1148,17 +1148,18 @@ static bool missed_irq(struct drm_i915_private *dev_priv, static int __i915_spin_request(struct drm_i915_gem_request *req) { - unsigned long timeout; + ktime_t timeout; if (i915_gem_request_get_ring(req)->irq_refcount) return -EBUSY; - timeout = jiffies + 1; + timeout = ktime_get(); + ktime_add_us(timeout, 1); while (!need_resched()) { if (i915_gem_request_completed(req, true)) return 0; - if (time_after_eq(jiffies, timeout)) + if (ktime_after(ktime_get(), timeout)) break; cpu_relax_lowlatency();