From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 B992CC2D0EC for ; Tue, 7 Apr 2020 21:52:40 +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 940F620769 for ; Tue, 7 Apr 2020 21:52:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 940F620769 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C82D6E907; Tue, 7 Apr 2020 21:52:40 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 056936E907 for ; Tue, 7 Apr 2020 21:52:38 +0000 (UTC) IronPort-SDR: O9NrGkxd6aPoeQBlUW9ntLlBQsSFzOcxnk5KgKi+APAAWf0Psx1b2xoDDfleK8ZyVvWUgVB9dG Y1LsTSP9uIYA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2020 14:52:38 -0700 IronPort-SDR: qH8uLSdDfz3iMx4QKm8Rc/Q04qxYlUACf4c/t5qhHOtUNvJxTQLm1UAIPuolySJpRwNjEiGCzv RJ5WmXmoC5NQ== X-IronPort-AV: E=Sophos;i="5.72,356,1580803200"; d="scan'208";a="424904812" Received: from ideak-desk.fi.intel.com ([10.237.72.183]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2020 14:52:36 -0700 Date: Wed, 8 Apr 2020 00:52:26 +0300 From: Imre Deak To: "Souza, Jose" Message-ID: <20200407215226.GA23597@ideak-desk.fi.intel.com> References: <20200407011157.362092-1-jose.souza@intel.com> <20200407011157.362092-4-jose.souza@intel.com> <20200407154207.GD21484@ideak-desk.fi.intel.com> <953592d02bb1c6587b4a12cd5dabb2926e8f3da5.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <953592d02bb1c6587b4a12cd5dabb2926e8f3da5.camel@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [Intel-gfx] [PATCH v2 4/8] drm/i915/tc/icl: Implement TC cold sequences X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: imre.deak@intel.com Cc: "Chiou, Cooper" , "intel-gfx@lists.freedesktop.org" , "kai.heng.feng@canonical.com" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Tue, Apr 07, 2020 at 11:01:14PM +0300, Souza, Jose wrote: > [...] > > > + } while (ret == -EAGAIN); > > > > Let's protect against an endless loop. > > const ktime_t timeout = ktime_add_ms(ktime_get_raw(), 3); > int ret; > > do { > ret = sandybridge_pcode_write_timeout(i915, > ICL_PCODE_EXIT_TCCOLD, > 0, 250, 1); > } while (ret == -EAGAIN && ktime_compare(timeout, ktime_get_raw()) > 0); Why not just a simple trial = 0; while (1) { ret = pcode_write(); if (ret != -EAGAIN || ++trial == 3) break; msleep(1); } with the msleep(1), as if the PCODE run/busy flag didn't get cleared after the 1ms polling, it probably doesn't make sense to retry in a tight loop. --Imre _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx