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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C30EC10F1B for ; Wed, 21 Dec 2022 13:43:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233685AbiLUNny (ORCPT ); Wed, 21 Dec 2022 08:43:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232455AbiLUNnv (ORCPT ); Wed, 21 Dec 2022 08:43:51 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9274A2037A for ; Wed, 21 Dec 2022 05:43:44 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id o15so11186312wmr.4 for ; Wed, 21 Dec 2022 05:43:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=2PpNtCpDSzPsflwXjljiwDro3Ig3Yd6W5cEBWGQHsHU=; b=MUPGmOoWU5FKo3PIgscvq/wlBf9WsS+MzmH1bFytWwftO3cs1RCgYaJF+e8jP15Ub+ pHneK+AatBhypXqVXohsw9jnnLKjoB378iojd2+Y8XXYS2/L4flDfR9+5Ly6wmpbSjJq OgYguaGxnb6Icgw5GEsVNTZFFx2b6vWKS92m+iBuV7B4xZkKFE/aD8zO31PRrGoL19Pd 7S+BXdpWX9nnzJqzl6MLkeENZ158iJBVRluV4Mo/QIkJkBZW6SGYBJjnhxQn6/aK3PWu jb5D3iwoxi5K1ov/PgyiHPALheOjtAueOPox1F8f5NeMDf4+MjUxwnLotQqtB/ryStQ4 2Wqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2PpNtCpDSzPsflwXjljiwDro3Ig3Yd6W5cEBWGQHsHU=; b=JwbzEpGhMDWQH7V5scQf0AbJgm0ZSXMPxE+wqwtuzzFIbB4jpTWVXjyYCXr6HOYNuH IMYgLErkfrYrueYSZXNQIr4dOucZ2Qc09PjY7U+alpfKNZ3kTqjNHnKdM9MrZOkXkA3v 1oHHCuaz7nI7kX7xrALMiA/Qeittz3W5epAnMGfDuEXAeGbNPHj+aEx+iKBFZ5Ffv2YD zPD3F4JlBP899rrG01tHqDADRCxYkah2yaioXqEe8GP6OalnUYdfXMB9OawqUPqh7BQG 1y8rBj+MXDPmoyJM0zODPdT5F2Pfl1sFXl86j2VaxRVpcidBbw6ZNUkJ00skEx1bIykI tKxw== X-Gm-Message-State: AFqh2kpwFXf2RZdnEpcK3EyUheCqnVBH8IvWdsVVQgNA/M/U3NzVpe0z MOVc1CudI6ssB8M6qLW9qL85jA== X-Google-Smtp-Source: AMrXdXtfM8xXfEIX4F72BRhv9jv0H3v+5tDr4GJoGD2yHYECtBSa2XlImRu6/9aMGAcIhgbgRXqh9w== X-Received: by 2002:a7b:ce89:0:b0:3d2:3239:2fd7 with SMTP id q9-20020a7bce89000000b003d232392fd7mr1655018wmj.41.1671630222970; Wed, 21 Dec 2022 05:43:42 -0800 (PST) Received: from [192.168.2.1] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id z13-20020a5d640d000000b002365730eae8sm15558523wru.55.2022.12.21.05.43.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Dec 2022 05:43:42 -0800 (PST) Message-ID: <5276e5b8-8596-2811-e03f-c4f3f0d3ab5b@linaro.org> Date: Wed, 21 Dec 2022 14:43:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [RFC][PATCH] thermal/idle_inject: Support 100% idle injection Content-Language: en-US To: Srinivas Pandruvada , rafael@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221209013640.943210-1-srinivas.pandruvada@linux.intel.com> From: Daniel Lezcano In-Reply-To: <20221209013640.943210-1-srinivas.pandruvada@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hi Srinivas, On 09/12/2022 02:36, Srinivas Pandruvada wrote: > The users of idle injection framework allow 100% idle injection. For > example: thermal/cpuidle_cooling.c driver. When the ratio set to 100%, > the runtime_duration becomes zero. > > In the function idle_inject_set_duration() in idle injection framework > run_duration_us == 0 is silently ignored, without any error (it is a > void function). So, the caller will assume that everything is fine and > 100% idle is effective. But in reality the idle inject will be whatever > set before. Good catch > There are two options: > - The caller change their max state to 99% instead of 100% and > document that 100% is not supported by idle inject framework > - Support 100% idle support in idle inject framework Yes, from my POV a CPU being impossible to cool down for any reason should end up by staying off. > Since there are other protections via RT throttling, this framework can > allow 100% idle. The RT throttling will be activated at 95% idle by > default. The caller disabling RT throttling and injecting 100% idle, > should be aware that CPU can't be used at all. Would it make sense to write a trace in this case ? > The idle inject timer is started for (run_duration_us + idle_duration_us) > duration. Hence replace (run_duration_us && idle_duration_us) with > (run_duration_us + idle_duration_us) in the function > idle_inject_set_duration(). Sounds good to me > Signed-off-by: Srinivas Pandruvada > --- > drivers/powercap/idle_inject.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/powercap/idle_inject.c b/drivers/powercap/idle_inject.c > index f48e71501429..4a4fe60d2563 100644 > --- a/drivers/powercap/idle_inject.c > +++ b/drivers/powercap/idle_inject.c > @@ -184,7 +184,7 @@ void idle_inject_set_duration(struct idle_inject_device *ii_dev, > unsigned int run_duration_us, > unsigned int idle_duration_us) > { > - if (run_duration_us && idle_duration_us) { > + if (run_duration_us + idle_duration_us) { > WRITE_ONCE(ii_dev->run_duration_us, run_duration_us); > WRITE_ONCE(ii_dev->idle_duration_us, idle_duration_us); > } -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog