From patchwork Thu Apr 16 13:24:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 227607 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 0B2D7C2BB85 for ; Thu, 16 Apr 2020 15:35:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0DC922242 for ; Thu, 16 Apr 2020 15:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587051314; bh=bUmdvRDb5tEGK8fivtesnFXdfAqQuZ+XnKtGFowAmT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LqU/zilkSbTv/uyZQ/3pVxhNoEiahwAx/hMBgMO1hn21ql5DCwCblqggUEHLsSt4g i9LPDWKtTrpJO8ZOYbpAnAWd7FhnNT6xrnspAMJRLxQ8n2TttXEyWGQE3KLqaKCQEs 8sggTqFsl2WK28fyft6e/66hXBYFTeF8/MknuOdM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441864AbgDPPfG (ORCPT ); Thu, 16 Apr 2020 11:35:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:53368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898157AbgDPNkm (ORCPT ); Thu, 16 Apr 2020 09:40:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B1FC120732; Thu, 16 Apr 2020 13:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044442; bh=bUmdvRDb5tEGK8fivtesnFXdfAqQuZ+XnKtGFowAmT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QiYB6rB4urjCuW0RLN9jVORwOIvuyl7Fm5Xvcz7DUzXoNtQ/LHUDbAXp8HFKXch6c 8SteUEwkE9jKowXz65tgLFwy7Q31sAwF6ae2pp4tAAMPCYH3NVTZ0k1Wr4CW4uEKfR use/AjYtEa529Pv2YzixgyMWoJu45tDxuXyMywGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Andi Shyti , Lyude Paul , Rodrigo Vivi Subject: [PATCH 5.5 220/257] drm/i915/gt: Treat idling as a RPS downclock event Date: Thu, 16 Apr 2020 15:24:31 +0200 Message-Id: <20200416131353.462369462@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131325.891903893@linuxfoundation.org> References: <20200416131325.891903893@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chris Wilson commit 98479ada421a8fd2123b98efd398a6f1379307ab upstream. If we park/unpark faster than we can respond to RPS events, we never will process a downclock event after expiring a waitboost, and thus we will forever restart the GPU at max clocks even if the workload switches and doesn't justify full power. Closes: https://gitlab.freedesktop.org/drm/intel/issues/1500 Fixes: 3e7abf814193 ("drm/i915: Extract GT render power state management") Signed-off-by: Chris Wilson Cc: Andi Shyti Cc: Lyude Paul Reviewed-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/20200322163225.28791-1-chris@chris-wilson.co.uk Cc: # v5.5+ (cherry picked from commit 21abf0bf168dffff1192e0f072af1dc74ae1ff0e) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gt/intel_rps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/gpu/drm/i915/gt/intel_rps.c +++ b/drivers/gpu/drm/i915/gt/intel_rps.c @@ -763,6 +763,19 @@ void intel_rps_park(struct intel_rps *rp intel_uncore_forcewake_get(rps_to_uncore(rps), FORCEWAKE_MEDIA); rps_set(rps, rps->idle_freq); intel_uncore_forcewake_put(rps_to_uncore(rps), FORCEWAKE_MEDIA); + + /* + * Since we will try and restart from the previously requested + * frequency on unparking, treat this idle point as a downclock + * interrupt and reduce the frequency for resume. If we park/unpark + * more frequently than the rps worker can run, we will not respond + * to any EI and never see a change in frequency. + * + * (Note we accommodate Cherryview's limitation of only using an + * even bin by applying it to all.) + */ + rps->cur_freq = + max_t(int, round_down(rps->cur_freq - 1, 2), rps->min_freq); } void intel_rps_boost(struct i915_request *rq)