Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp594907ybt; Wed, 24 Jun 2020 06:45:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8H56CEL4GdQRCs8fEFvajn43fIq4CbtGTh3i9Yk/csywvTvXPhM5yXgY5mKeI3AoM1DzX X-Received: by 2002:a50:b964:: with SMTP id m91mr28228766ede.37.1593006353231; Wed, 24 Jun 2020 06:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593006353; cv=none; d=google.com; s=arc-20160816; b=U8/2G/Q84bJcSmNVR9AoHWJ8aUZHwWaa1g2eTwP2vmFK6+IfSmhRNhsSNa/Ue52Vt0 nYIBdO1Ql5rQf0RF00/1DOFgvreBf2l2FpelRCrLpaVn6TcR6O8zhXK5kF2szmB1Abj8 kJoZ4Tou3zsGX2pf0Eagylpu0E4iRrvMKjHbbGiuVWHfbBZQ/RlhQ/KzZ8hLZfGyBEfG tP15uzvNL6a/V97AuaQWhsmelqCqLXRHAtIQSut74qAH4sfuCFDvA1BMQOhCyghZiFX3 eNnOuVJrO1m+ArcUmMhyY4rVq4dIUrw2zXDWPPkA81jhvJKn8nHtSVx/jxZzPC/b74Cz pT7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IFdNUzRRCvGat/IFG907Y+nJPCcMl4fsnCnI2xR7SG8=; b=wM4FXt6MtVuPonS2x9H/RThEpaTyz3XzXyJrZ4YrtRRT1PieM58rGWTjfRHo46UTm1 vYUPmN0TfFnLHefILWgcqpA2U/ApmjeDfLoXDE716KFsXRLmGvfsWC4rGCjWuo75AiEe cdp1KM4RdlBLD+ZWmPn8pQzjrNFbmStmEznS/v6qL8pBhAFLwPclt8Sku9558PKNMmDk 4ohTSj6F73rbO8+O7OIi8qWaknxWkh6/tMK4Ylldyj7EtlNzcAA2L8kgpxSgL4QfNU1m D8FW0TcN9iWxW6gROwfyOzbqMBjVQ2gFyq/xAuilZOsRLU3D5UcoyzmZmKvmd98nIpxV nKSw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si8343245edj.310.2020.06.24.06.45.29; Wed, 24 Jun 2020 06:45:53 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390964AbgFXNmO (ORCPT + 99 others); Wed, 24 Jun 2020 09:42:14 -0400 Received: from foss.arm.com ([217.140.110.172]:51184 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388453AbgFXNmO (ORCPT ); Wed, 24 Jun 2020 09:42:14 -0400 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 4B1B81F1; Wed, 24 Jun 2020 06:42:13 -0700 (PDT) Received: from [10.37.12.79] (unknown [10.37.12.79]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 97BAD3F6CF; Wed, 24 Jun 2020 06:42:10 -0700 (PDT) Subject: Re: brocken devfreq simple_ondemand for Odroid XU3/4? To: Krzysztof Kozlowski Cc: Kamil Konieczny , Willy Wolff , Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Kukjin Kim , linux-pm@vger.kernel.org, "linux-samsung-soc@vger.kernel.org" , linux-arm-kernel@lists.infradead.org, "linux-kernel@vger.kernel.org" References: <20200623164733.qbhua7b6cg2umafj@macmini.local> <20200623191129.GA4171@kozik-lap> <85f5a8c0-7d48-f2cd-3385-c56d662f2c88@arm.com> <828b0d63-4d01-48d6-5971-64855adebed2@samsung.com> <20200624120651.GA20813@pi3> <55772862-ff8f-1e1d-91ae-7b4d7c3be1b6@arm.com> <20200624131341.GA20905@pi3> From: Lukasz Luba Message-ID: Date: Wed, 24 Jun 2020 14:42:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200624131341.GA20905@pi3> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/24/20 2:13 PM, Krzysztof Kozlowski wrote: > On Wed, Jun 24, 2020 at 02:03:03PM +0100, Lukasz Luba wrote: >> >> >> On 6/24/20 1:06 PM, Krzysztof Kozlowski wrote: >>> My case was clearly showing wrong behavior. System was idle but not >>> sleeping - network working, SSH connection ongoing. Therefore at least >>> one CPU was not idle and could adjust the devfreq/DMC... but this did not >>> happen. The system stayed for like a minute in 633 MHz OPP. >>> >>> Not-waking up idle processors - ok... so why not using power efficient >>> workqueue? It is exactly for this purpose - wake up from time to time on >>> whatever CPU to do the necessary job. >> >> IIRC I've done this experiment, still keeping in devfreq: >> INIT_DEFERRABLE_WORK() >> just applying patch [1]. It uses a system_wq which should >> be the same as system_power_efficient_wq when >> CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set (our case). >> This wasn't solving the issue for the deferred work. That's >> why the patch 2/2 following patch 1/2 [1] was needed. >> >> The deferred work uses TIMER_DEFERRABLE in it's initialization >> and this is the problem. When the deferred work was queued on a CPU, >> next that CPU went idle, the work was not migrated to some other CPU. >> The former cpu is also not woken up according to the documentation [2]. > > Yes, you need either workqueue.power_efficient kernel param or CONFIG > option to actually enable it. But at least it could then work on any > CPU. > > Another solution is to use directly WQ_UNBOUND. > >> That's why Kamil's approach should be continue IMHO. It gives more >> control over important devices like: bus, dmc, gpu, which utilization >> does not strictly correspond to cpu utilization (which might be low or >> even 0 and cpu put into idle). >> >> I think Kamil was pointing out also some other issues not only dmc >> (buses probably), but I realized too late to help him. > > This should not be a configurable option. Why someone would prefer to > use one over another and decide about this during build or run time? > Instead it should be just *right* all the time. Always. I had the same opinion, as you can see in my explanation to those patches, but I failed. That's why I agree with Kamil's approach because had higher chance to get into mainline and fix at least some of the use cases. > > Argument that we want to save power so we will not wake up any CPU is > ridiculous if because of this system stays in high-power mode. > > If system is idle and memory going to be idle, someone should be woken > up to save more power and slow down memory controller. > > If system is idle but memory going to be busy, the currently busy CPU > (which performs some memory-intensive job) could do the job and ramp up > the devfreq performance. I agree. I think this devfreq mechanism was designed in the times where there was/were 1 or 2 CPUs in the system. After a while we got ~8 and not all of them are used. This scenario was probably not experimented widely on mainline platforms. That is a good material for improvements, for someone who has time and power. Regards, Lukasz > > Best regards, > Krzysztof >