From patchwork Fri Apr 12 10:42:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 788751 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2386F20310 for ; Fri, 12 Apr 2024 10:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712918546; cv=none; b=igWWgggQwFgAmiUBVyDbWWQaVq8BpzndDJHoicepL1wivz3KQ1pQoFdBbbUpfesSCH9lxhhMuNd/zH5W9ljwdWV2V9mq34xV9CEDhDt0oPnIzgZ0PWW5USFoYmdr3mfEIHKUTjDCo8/lLDoi23RK8KAonEIkUB4LvqB3MDrPO+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712918546; c=relaxed/simple; bh=UIokhiS5Rj3MPlQ+/XRMF9ng6qEkITKXuZOWx3vpGv4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Zr7WzZNlKGOrOqD1cZuauDWkq0GiLsvmc53iTxCBcj8dY7lAqJ1B7AnOJIOJdGLrrqYw6k5wuDeeGp/yqZN5UvYAI4uNEpWImXbQdR/v8jg5yLTTWmobLGd6/gXzyZyBFZrl4nRyumOOgywFlWjHIKa/JV4iI7qtpn1uboaHkfE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Gl1lzpBX; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Gl1lzpBX" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-518931f8d23so188307e87.3 for ; Fri, 12 Apr 2024 03:42:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712918543; x=1713523343; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0yzFF7XLEaVBUn6zqt63Jmp6pMmz0w4BTjsr5ZlkzWs=; b=Gl1lzpBXgTsaFqFsrX3lBEI8SggK4N06IMkg7smvtCkA5kGOdnjGKYtNVGEEIaD4u3 0LrMk2t+tOH8G0PvZQY+UdUI0VnCCyWfIBODAdjz0aN+Je0XYvorJP6qzBCEVGZrylGj tAh1gIvpCOxzg+AXb3maMxxVlugEQDFnPNcQ/RSFbGsQSnEZmFOIw4s/geSl3rywlY2A s2YpCKZLLNafI89Zn+onk7oEX/Tdhssg7TYwjnYdfeUgToWqNceZQkLtpqkYmxdFy4m7 yJFZdRa0CZngOx3CDzWBNqQTS3N1ehaMe3YU06KgwmcZ6Lms0JRT0W3bQbkuymi+lW2K ppxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712918543; x=1713523343; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0yzFF7XLEaVBUn6zqt63Jmp6pMmz0w4BTjsr5ZlkzWs=; b=YmBbhTMNYauWpV5D4dZGd7cm3tdAKU6sKl/v8G71fdyrrnz9U8JmXIaZRQTdcyqF7Q Yi1h1Lbs2BtOUaJksRj0MN3RApFF8W3pOVZ0/IkTXaBY2xKQkoEcbzI206XNUX8ASopy Vb2jbgqnKCNu3sWfoasEDXIdNCADIJPxi1l8NlICM4tXpHf1saiottuPMAYv0Zm7TAYr CZ/huD9YF3ezZWsK1gestNlxTcIpckDhoL1+U0bR0eMFxwziftbUns1FrRh3qfKzNztd ea4iVDdNf6OjNduup5wf0qWVCQd5OyQCaKRwrjMdvT/7bNtOL1HdpSg+GaGPzlopjVZx pA4A== X-Forwarded-Encrypted: i=1; AJvYcCXvFVqEau7qsMBm/fztpCfxoKTzZCgxFcy8ImWnyPZlVRtSu2kJH3IVXKetpKH4K2BjYQHd/wQVVOtvvUM21PpZ/NTK/L6POAo= X-Gm-Message-State: AOJu0YxQfWQclRwVF16x3NimeZXuIPZ55JD7Cz82DaYEfvs7EOSpof21 EImdOqgcpN0a7bqgLdVH4Qit/x5+CtDdL2uOzW8RVlOvdWG1sP41avmDHo5cJLc= X-Google-Smtp-Source: AGHT+IFEu4dnjTinOwWdQUMez8s60WK/1nUwKuFkVdaWfd4AmIZ0Ku0mYf4Xc1K806sEPp0uonGS3g== X-Received: by 2002:a05:6512:609:b0:518:9964:a7a6 with SMTP id b9-20020a056512060900b005189964a7a6mr1218lfe.42.1712918543246; Fri, 12 Apr 2024 03:42:23 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id v10-20020a05651203aa00b005135f60f486sm493689lfp.112.2024.04.12.03.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 03:42:22 -0700 (PDT) From: Ulf Hansson To: Ulf Hansson , linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Nikunj Kela , Prasad Sodagudi , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] pmdomain: core: Update the rejected/usage counters at system suspend too Date: Fri, 12 Apr 2024 12:42:07 +0200 Message-Id: <20240412104208.74361-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 During system suspend we may try to enter a low power-state for the genpd in question. Let's take this into account for the statistics too, by updating the rejected/usage counters for the corresponding state. Signed-off-by: Ulf Hansson --- drivers/pmdomain/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 4215ffd9b11c..903ea0c193e1 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -1178,8 +1178,12 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock, /* Choose the deepest state when suspending */ genpd->state_idx = genpd->state_count - 1; - if (_genpd_power_off(genpd, false)) + if (_genpd_power_off(genpd, false)) { + genpd->states[genpd->state_idx].rejected++; return; + } else { + genpd->states[genpd->state_idx].usage++; + } genpd->status = GENPD_STATE_OFF; From patchwork Fri Apr 12 10:42:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 788536 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83CC13D547 for ; Fri, 12 Apr 2024 10:42:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712918548; cv=none; b=hcdFZENQssYglvUDLR1CTEIfobKkew5x/A3XEbRuhglsk0TPxQ5tXJvi3knyQVmGAG7ys/RNqrshWgG7mbRleMiiXSgP//cabxj6yyML77Uo2mbHiTU6c211A7i+ve19E6pjx/tSMa54+HXITWtOKCE5AM5iFLbAYBjthELoI8Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712918548; c=relaxed/simple; bh=0H0hMWcNgkbz+OoHU/6BAy/ktYGB04j8mn1Ne/MmgnY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZGPOdAZOD84O1/RDQN/AmI8ZPJxR5fKkEdA+PxZP5APsEDsmUfgLrR5hlFTo6GD4eB0H23gniNSmp6nYGo3/gS+Kpqr5sbgbDnKfhGHbw/DXgPf8hcgmAi8f8p/s8B0yhwrqIICOee5sErnEesuM0yYRmcoBtrzG/7OQpC2bKbk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=zldM/5bq; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zldM/5bq" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-516cbf3fd3dso923708e87.2 for ; Fri, 12 Apr 2024 03:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712918545; x=1713523345; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x9dyIX2GIRxyxtjQgoTbfebK6wI7hUKbyAEauzQCGs4=; b=zldM/5bqFFiNufQFSrHeHapYinsMtGL7tZVHfyElLRSyCPrBJgXygR978S8mTx54j3 5Ach93SDlvlBjUAdK0hw8NI49wOjqEviXhMx3Rh4ek2L35iXhwO4xJ7SoP616brTngYk S8MiBArMQ8P4UcHmkc9WYN+ClT6J0rl+twXaGjwN4YnDU5aCFW7GMK7wdFCD62DJwDCA cggEqD+5j5kgpTP/HkRM/Gf/gwOkP0r3FwqnRBGwsUC83IWhTzHAlzI6whh9Yk/rKuda nEfkyQwNx1C8B1dLzcMmQNPpGUxLuPhFTcqR6ZpQxBKtWg2YuwkrvGBgCFKG10jmHnem r1bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712918545; x=1713523345; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x9dyIX2GIRxyxtjQgoTbfebK6wI7hUKbyAEauzQCGs4=; b=NvGNjS9wHZCciZ/LKQ2vVOP9peoi1tU6K/x/s+eJ2qEzJxIzcqBGiMLkbOz4KMaMEJ JEEelz3iFKakPLzUEpceigEOAm9eWpi0zocaLBWYXxujJEEZ1U+UlSpdF7rMq4XkWw0G vGkLGcqdP/tbFCm7MatyQ/0ZjF4Ssr0IEojpVukwtSh5Oq8KD9dclj9348EV2gBieIjc xTqhXYuIFtkiJ9UZugfNwIhYSh0lushywv5QT0iI29LXdcayUMyG3ZpfozzSduJCf7Z3 f0+AXNw2uysxmbEu37Jn1OpzRVcu39UUzP8KAi7PiMKZntiJIKBrCgtICKauQbAnhmaY J0/A== X-Forwarded-Encrypted: i=1; AJvYcCX4OvAc4U53dFGZ9wVdPaKaPwE7K8wgjfZ9uxF4TCh/c8j+oqO2UqOGPyJvZX13q5l3ZMsVHkgalkWIAlY3ZAvrfDy5SW+a9KU= X-Gm-Message-State: AOJu0YxK3PMMiL3Ff5GDxWRYMewmnwtSCbieQizvtaIDRLTkHWiJaaXv HanTBtPD7HoCowenu43j7v8vG/DdDhlt0/Pf6ELxD+CkqIOdYQch7dExidnb97U= X-Google-Smtp-Source: AGHT+IEZwUht8/pnBTEaDnGWHh3CxFUN2Na4wDCS6x/BRz79j0pltI+VYdSu7+r0i6OuXZDbWru1Tw== X-Received: by 2002:ac2:5982:0:b0:515:af1f:5bab with SMTP id w2-20020ac25982000000b00515af1f5babmr1431306lfn.40.1712918544283; Fri, 12 Apr 2024 03:42:24 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id v10-20020a05651203aa00b005135f60f486sm493689lfp.112.2024.04.12.03.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 03:42:23 -0700 (PDT) From: Ulf Hansson To: Ulf Hansson , linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Nikunj Kela , Prasad Sodagudi , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] pmdomain: core: Don't clear suspended_count at genpd_prepare() Date: Fri, 12 Apr 2024 12:42:08 +0200 Message-Id: <20240412104208.74361-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412104208.74361-1-ulf.hansson@linaro.org> References: <20240412104208.74361-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There is no longer any need to clear genpd->suspended_count in genpd_prepare(), as it should be correctly incremented and decremented for all cases. In fact, if the counter isn't correctly managed we would be hiding a problem that we shouldn't. Therefore, let's not clear it. Signed-off-by: Ulf Hansson --- drivers/pmdomain/core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 903ea0c193e1..342779464c0d 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -1255,10 +1255,7 @@ static int genpd_prepare(struct device *dev) return -EINVAL; genpd_lock(genpd); - - if (genpd->prepared_count++ == 0) - genpd->suspended_count = 0; - + genpd->prepared_count++; genpd_unlock(genpd); ret = pm_generic_prepare(dev);