Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18811C433C1 for ; Fri, 26 Mar 2021 10:32:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B5D8F61A49 for ; Fri, 26 Mar 2021 10:32:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5D8F61A49 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE7806F3A6; Fri, 26 Mar 2021 10:32:11 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5780D6F3A6; Fri, 26 Mar 2021 10:32:10 +0000 (UTC) IronPort-SDR: ipFTrS+dQNAZV/mk6ILT9vFOvZgVSx+efxxKNc5wJKnCW1SDSeBPk6cAaYOlvLcfD4Z8KpdCXw qSGrx8Zmz/ZA== X-IronPort-AV: E=McAfee;i="6000,8403,9934"; a="178670487" X-IronPort-AV: E=Sophos;i="5.81,280,1610438400"; d="scan'208";a="178670487" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2021 03:32:09 -0700 IronPort-SDR: 72EUJLuOhfNLDLQC8kuGNp2CcVNYRW3THdPZ0zXcmdoduOmGB9W/BHvL78D4IkusaPxaS+cMUU dQXUmJdespqw== X-IronPort-AV: E=Sophos;i="5.81,280,1610438400"; d="scan'208";a="453466691" Received: from andrewdo-mobl.ger.corp.intel.com (HELO [10.213.247.55]) ([10.213.247.55]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2021 03:32:07 -0700 Subject: Re: [PATCH 5/7] drm/i915: Request watchdog infrastructure To: Daniel Vetter References: <20210324121335.2307063-1-tvrtko.ursulin@linux.intel.com> <20210324121335.2307063-6-tvrtko.ursulin@linux.intel.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: Date: Fri, 26 Mar 2021 10:32:06 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel-gfx@lists.freedesktop.org, Matthew Auld , dri-devel@lists.freedesktop.org, Tvrtko Ursulin Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 26/03/2021 00:00, Daniel Vetter wrote: > On Wed, Mar 24, 2021 at 12:13:33PM +0000, Tvrtko Ursulin wrote: [snip] >> +static enum hrtimer_restart __rq_watchdog_expired(struct hrtimer *hrtimer) >> +{ >> + struct i915_request *rq = >> + container_of(hrtimer, struct i915_request, watchdog.timer); >> + struct intel_gt *gt = rq->engine->gt; >> + >> + if (!i915_request_completed(rq)) { >> + if (llist_add(&rq->watchdog.link, >->watchdog.list)) >> + schedule_work(>->watchdog.work); >> + } else { >> + i915_request_put(rq); >> + } >> + >> + return HRTIMER_NORESTART; >> +} >> + >> +static void __rq_arm_watchdog(struct i915_request *rq) >> +{ >> + struct i915_request_watchdog *wdg = &rq->watchdog; >> + struct intel_context *ce = rq->context; >> + >> + if (!ce->watchdog.timeout_us) >> + return; >> + >> + hrtimer_init(&wdg->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); >> + wdg->timer.function = __rq_watchdog_expired; >> + hrtimer_start_range_ns(&wdg->timer, >> + ns_to_ktime(ce->watchdog.timeout_us * >> + NSEC_PER_USEC), >> + NSEC_PER_MSEC, >> + HRTIMER_MODE_REL); >> + i915_request_get(rq); > > Shouldn't we grab the new reference before we arm the timer? Either way > since fairly academic I went ahead and applied, but if you agree pls do a > follow up patch. Absolutely true.. my bad. Regards, Tvrtko _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel