Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp206593pxu; Tue, 5 Jan 2021 08:45:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxU9PBBDA31XxM8vBk4yWF1XqV7baEN5nKYXxDTBsNAZK9Gj4B1Z9220bPlbEJaKdHfPlEO X-Received: by 2002:a17:906:c45:: with SMTP id t5mr41060ejf.370.1609865123360; Tue, 05 Jan 2021 08:45:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609865123; cv=none; d=google.com; s=arc-20160816; b=frZiABpcnFC5OKCE/XmSmxpeTkjbKC7ALQWG6X5AIOHYuvTP2jhl83iccykd0UEOfz x6r5NW9My5qGN/Go628Dn2x2NANH6nNaga4g11jeydKfaB7SX+kPYGcXzCWr9+yCL78J KSEd5m2h7GSExhOmBD33O3K+6ntYX7eT0ortKnrJPgWcj6Fy477N4wMlKXK9AiB//Wjt +Z41rEXcmXLyShnQ2cv4TRteFVLSzjAxg17uAfME5feBwrPXrmNuHV5VgL0+JFhv10YB keoaKGwL+NiuCpo2w/Mrejvvph7uKDZ2t5iIrccO14RiaWMT0SPaF6kbAaqn8YuncOV1 kYXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=gZcWyApPWcr1q8zXve2mqIhlu1wWUZ69sKU0LSNvAJU=; b=emUYpCjBZ74GBl5EXttxFkyNuCiUfKkLPNrv1zKTOjW7vHhDutJdovVoWPENQAJNFV DVdJrWastCO1pK6Rf+goLzFwgTw4zIFBNlbneZo5YjyezS2cRVmn4d9FEaP7TXFojL4V s+UEg5QnefTzJ4FudeVrQ8riPmMnztCZrIprCfR2ZJ8xHTqE7jOol2c3mA+0crsgYRjb C6vuyO3En0FZLfucwR+mpRTyYDw4IPYr0O+0rWHtGc6tyko17jlJBczVHCBHtwem3fbY kcSwHNqJlXzXC5YhP9yQvbheVPvlCnWa2vp6szqA79a8g2oTW0zJrwzogDAlj3XJO2O3 jnVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs21si31002312ejb.468.2021.01.05.08.45.00; Tue, 05 Jan 2021 08:45:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729953AbhAEQmO (ORCPT + 99 others); Tue, 5 Jan 2021 11:42:14 -0500 Received: from foss.arm.com ([217.140.110.172]:57440 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729138AbhAEQmO (ORCPT ); Tue, 5 Jan 2021 11:42:14 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A9D4F11D4; Tue, 5 Jan 2021 08:41:28 -0800 (PST) Received: from e123648.arm.com (unknown [10.57.0.99]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C6AA13F70D; Tue, 5 Jan 2021 08:41:26 -0800 (PST) From: Lukasz Luba To: linux-kernel@vger.kernel.org, airlied@linux.ie, daniel@ffwll.ch, dri-devel@lists.freedesktop.org Cc: robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com Subject: [PATCH] drm/panfrost: Use delayed timer as default in devfreq profile Date: Tue, 5 Jan 2021 16:41:11 +0000 Message-Id: <20210105164111.30122-1-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Devfreq framework supports 2 modes for monitoring devices. Use delayed timer as default instead of deferrable timer in order to monitor the GPU status regardless of CPU idle. Signed-off-by: Lukasz Luba --- Hi all, This is just a simple change but has impact on reliable polling mode with guaranteed sampling rate. The devfreq framework has 2 modes for checking the device status which updates the statistics. When the default mode is used (deferred work) it could happen that the framework won't check the device, if the CPU which was running devfreq code went idle. In deferred mode, the deferred timer is not fired, thus framework won't check the device status. The log below is taken when glxgears was running. It can be seen that periodic checks are missing (should be every 50ms). ---------------------------------------------------------------------- [ 128.046555] panfrost ff9a0000.gpu: busy 18029406 total 67940380 26 % freq 200 MHz [ 128.110538] panfrost ff9a0000.gpu: busy 7975930 total 63980997 12 % freq 200 MHz [ 128.210606] panfrost ff9a0000.gpu: busy 21148792 total 100074440 21 % freq 200 MHz [ 128.594638] panfrost ff9a0000.gpu: busy 53739467 total 384032219 13 % freq 200 MHz [ 129.178749] panfrost ff9a0000.gpu: busy 89206245 total 584111500 15 % freq 200 MHz [ 129.294601] panfrost ff9a0000.gpu: busy 16446118 total 115852915 14 % freq 200 MHz [ 129.762616] panfrost ff9a0000.gpu: busy 71481587 total 468015722 15 % freq 200 MHz [ 129.874762] panfrost ff9a0000.gpu: busy 15614112 total 112139938 13 % freq 200 MHz [ 130.026585] panfrost ff9a0000.gpu: busy 21397620 total 151821546 14 % freq 200 MHz [ 130.110536] panfrost ff9a0000.gpu: busy 21429365 total 83952016 25 % freq 200 MHz [ 130.178524] panfrost ff9a0000.gpu: busy 16458197 total 67989072 24 % freq 200 MHz [ 130.246528] panfrost ff9a0000.gpu: busy 9876225 total 68004030 14 % freq 200 MHz [ 130.310529] panfrost ff9a0000.gpu: busy 9211725 total 64000524 14 % freq 200 MHz [ 130.410528] panfrost ff9a0000.gpu: busy 21780828 total 99999250 21 % freq 200 MHz ---------------------------------------------------------------------- It has impact on devfreq cooling and thermal governor. They rely on these statistics, but sometimes the data is stale. This patch switches to more reliable devfreq mode, which uses delayed work. Regards, Lukasz drivers/gpu/drm/panfrost/panfrost_devfreq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index f44d28fad085..56b3f5935703 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -76,6 +76,7 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, } static struct devfreq_dev_profile panfrost_devfreq_profile = { + .timer = DEVFREQ_TIMER_DELAYED, .polling_ms = 50, /* ~3 frames */ .target = panfrost_devfreq_target, .get_dev_status = panfrost_devfreq_get_dev_status, -- 2.17.1