Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2589757lqo; Tue, 14 May 2024 03:32:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYsFwZlZR8Beem6/WVn5AvvkccI7bPPYg92kqKy4soO15srIE5G7NYmGdxF8tXnN7ZNto/aIi8Ve93US11E54coxuxpMv7Xw3bV1vN3Q== X-Google-Smtp-Source: AGHT+IGtn7xUI4aQIUpt3hO+RDw1jKUAwTE0wwkM6kGnK7G6D6UOZvJvrW3vmFiP3Xj9Rnn2cSYc X-Received: by 2002:a05:622a:144d:b0:43a:357c:322a with SMTP id d75a77b69052e-43dec3a85b1mr280608361cf.34.1715682724807; Tue, 14 May 2024 03:32:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715682724; cv=pass; d=google.com; s=arc-20160816; b=iCYkEZAxAhO0fN5fSmysc0QLj5V6p8hMZ5OGJ7UvQoyWy8RvAM8agZlVJieYXHCcMt rJow0YJrxCG5yNp9xL9nLz+okNUA6GREPPrshKOVE6UA15P2d/NWLTY9ci6I2s5dw/Ds Ze0wmXxNHpanB0oRF6H2zHo6kRN0Whf4igRkC/TL9fsREvHEnBd6q+f5NrZ4ti50HBUH ucGRdozKZ2XbEoRHglH5GE53bwP+oigw1At3MYY+6j1rz0Qm5N+4VI+zAkEBrWiZMEll 2WZujqcaJSK10gnqzZVkAe1ocN6lT5Fhru7DfMdYjnwO02/DVU1LdAhBGfDgGwCKIjTz SOWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=0wKHm6XT5EYm6vl/df7llbv2ZznYvQVbeTCwxvcThXU=; fh=LKrVHk176EbbI8+v5NR4TFQV7tou9tqR9kkenNw1y6Y=; b=Swbba53UM8H6BBeFknfrwviptbdTO8W6EKgW/3gxeo+0OBnJrqccaPj/oGRFlgjWPW SKxaq6tuO7feKWJAHUPUg0az1v2q3dRsjUHKMVc3mxSpn08+lWKRY4QeLti727AuXXZv fNyMiErWviIytrbfY0IcblkS9bCSPJ1tRs5y+UdgR6wrr5+X38C7jHNKWniJUP8989wU nDMiieaDNNndf4pWs9sy1OQKv5c60s4EMhB1m2rGan9Xmj4LXeOMd5HIjO8DD7HRpr/7 w5L8W58ui3+KkQ9a1h/ADxC2yqp/oayU5DmLT4Cj66dxKAZDv3bsem63pSAZE0jtb8B+ VtPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=gLhPoCXh; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-178529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178529-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43e18c431besi42602291cf.168.2024.05.14.03.32.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 03:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=gLhPoCXh; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-178529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178529-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 56C581C2096E for ; Tue, 14 May 2024 10:32:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B61E11386C9; Tue, 14 May 2024 09:50:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="gLhPoCXh" Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (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 207111386AB for ; Tue, 14 May 2024 09:50:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680248; cv=none; b=DV4msxpsORC96bbCuc1MlUT30tA6PSWLnhZhcJt2dECxaB9osQmxdGQ5iPjXk2ZIpVQDqp4l8IQf51esLNyE30RN21Du5DSzFGcPp7dgB3HZq0eIiuxqlYKGDa7QmM+ZMOr/Y70Ux2m+BQJmIkkU7dVBJH9LAbX+dagU20q7S4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680248; c=relaxed/simple; bh=TCkx6SaxQ1bT0hwpMFkeJTA63KBdnOB9RyvhqZLO2qY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=qwD0n6tASlPrPOSahv9OMRnazCcIzNkNIBiCZCvMSLp4tKib/tZhz40Ap12jLXD1z/s8Bmibr1/3FJRlDCnVWoC6oa/xbfd4TSwckzFt99MC3nHvoJp457leg80bSUciqmLlIgMvzkjyjM62huc7Mv/NZMoEWg8hZk2+nyChZWQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=gLhPoCXh; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3c9abbb9efbso595899b6e.1 for ; Tue, 14 May 2024 02:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1715680246; x=1716285046; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0wKHm6XT5EYm6vl/df7llbv2ZznYvQVbeTCwxvcThXU=; b=gLhPoCXh74TKJF46R2uNADuVzoDDobTXPFvICkjTqHemUIlkrZ04pow8cDTLxFzrQ/ Zn4r745jQulc6tYvCPUPT8v8wLl3yfER42aEcM98c+4+QmDtREUELOPLU17r+WZn8r7x qRn9Wv/1I4NzNix4Lu4twgRBUKjxIpdfj/Sb/7xFncQR0I5X2HHOtraWaL547peP+a0R O3/sq35ubxHeQ4ymEIZ1mA7Xoh5ZmXyc0PhB706rWN20bZUZ2ZmAJ+nRUGnLfpzSXbUW jWPaDfOHRNRIsDtXuTmlBErsrolx2O9EqqpwpWf9FWrkP1UJytUhFuOMbD5k1houMCxf rhKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715680246; x=1716285046; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0wKHm6XT5EYm6vl/df7llbv2ZznYvQVbeTCwxvcThXU=; b=gudtGjFeoujh02eQlBSt9uqUK7gxP5MttoPXU20W/6H3PX4Lxj3PUKIHstNDREpxzv jQBEIJRLwI0wQaCZsPXWjZkAS6P9i98UvFhWYpGvZQLDIVawOzeRBZEsobrflQDKtOx0 dG3MqjDzC3zLppzFA79GZuS0IjfojQldfZuXjjEztDCQlQkaiAthiVa9Pdve8+RbB9Kr K5GMREykAypGkYXCmgftpV4+2p5DyuR9b0DnNcs2M7mZYpJQZiDyWUL3lUZ+cX+qbhw0 GU5seaW1sS1OmhK8gHuInaz9V4+P7BX17vayepjRjxOpYOrqEPNFLXmJ/EOG+Ffxv9Pw Upig== X-Forwarded-Encrypted: i=1; AJvYcCU3MSMBMCfvn/rsNJoeQX2vxKJmYNCM+XKbazUDH2p5emjcgeDzTTj3yFv/Kflwrx8xxczMu0l2/7hfAALWjfJHm4vZO9Oh8qSRGCZ9 X-Gm-Message-State: AOJu0YyiXxzMdguSbtCliSrmZRfahiNUyPUbNHUZvzbL7WMAwNoN7vqF KDkTPO25JGArPyMKjvr7oPcyDJcAvpCqXvZjeYHt4Iqvlk6Y75lWjHeM935Ps3cuVJPwv5XnFy3 xxcpPKmZu3gyxiVVZZszVNT1CiyQEH/3UOQyZ9g== X-Received: by 2002:a05:6808:3099:b0:3c7:21b4:6e1 with SMTP id 5614622812f47-3c996c688b8mr6596851b6e.2.1715680244711; Tue, 14 May 2024 02:50:44 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240226065113.1690534-1-nick.hu@sifive.com> In-Reply-To: From: Nick Hu Date: Tue, 14 May 2024 17:50:34 +0800 Message-ID: Subject: Re: [PATCH] cpuidle: riscv-sbi: Add cluster_pm_enter()/exit() To: Ulf Hansson Cc: palmer@dabbelt.com, anup@brainfault.org, rafael@kernel.org, daniel.lezcano@linaro.org, paul.walmsley@sifive.com, linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, zong.li@sifive.com, Cyan Yang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Ulf, Thank you for your valuable suggestion. I sincerely apologize for the delay in responding to your message. We have diligently worked on experimenting with the suggestion you provided. As per your recommendation, we have incorporated the "power-domains=3D<> property" into the consumer's node, resulting in modifications to the DTS as illustrated below: cpus { ... domain-idle-states { CLUSTER_SLEEP:cluster-sleep { compatible =3D "domain-idle-state"; ... } } power-domains { ... ... CLUSTER_PD: clusterpd { domain-idle-states =3D <&CLUSTER_SLEEP>; }; } } soc { deviceA@xxx{ ... power-domains =3D <&CLUSTER_PD>; ... } } However, this adjustment has led to an issue where the probe for 'deviceA' is deferred by 'device_links_check_suppliers()' within 'really_probe()'. In an attempt to mitigate this issue, we experimented with a workaround by adding the attribute "status=3D"disabled"" to the 'CLUSTER_PD' node. This action aimed to prevent the creation of a device link between 'deviceA' and 'CLUSTER_PD'. Nevertheless, we remain uncertain about the appropriateness of this solution. Do you have suggestions on how to effectively address this issue? Regards, Nick On Tue, Apr 30, 2024 at 4:13=E2=80=AFPM Ulf Hansson wrote: > > On Mon, 29 Apr 2024 at 18:26, Nick Hu wrote: > > > > On Tue, Apr 30, 2024 at 12:22=E2=80=AFAM Nick Hu w= rote: > > > > > > Hi Ulf > > > > > > On Mon, Apr 29, 2024 at 10:32=E2=80=AFPM Ulf Hansson wrote: > > > > > > > > On Mon, 26 Feb 2024 at 07:51, Nick Hu wrote: > > > > > > > > > > When the cpus in the same cluster are all in the idle state, the = kernel > > > > > might put the cluster into a deeper low power state. Call the > > > > > cluster_pm_enter() before entering the low power state and call t= he > > > > > cluster_pm_exit() after the cluster woken up. > > > > > > > > > > Signed-off-by: Nick Hu > > > > > > > > I was not cced this patch, but noticed that this patch got queued u= p > > > > recently. Sorry for not noticing earlier. > > > > > > > > If not too late, can you please drop/revert it? We should really mo= ve > > > > away from the CPU cluster notifiers. See more information below. > > > > > > > > > --- > > > > > drivers/cpuidle/cpuidle-riscv-sbi.c | 24 ++++++++++++++++++++++-= - > > > > > 1 file changed, 22 insertions(+), 2 deletions(-) > > > > > > > > > > diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidl= e/cpuidle-riscv-sbi.c > > > > > index e8094fc92491..298dc76a00cf 100644 > > > > > --- a/drivers/cpuidle/cpuidle-riscv-sbi.c > > > > > +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c > > > > > @@ -394,6 +394,7 @@ static int sbi_cpuidle_pd_power_off(struct ge= neric_pm_domain *pd) > > > > > { > > > > > struct genpd_power_state *state =3D &pd->states[pd->state= _idx]; > > > > > u32 *pd_state; > > > > > + int ret; > > > > > > > > > > if (!state->data) > > > > > return 0; > > > > > @@ -401,6 +402,10 @@ static int sbi_cpuidle_pd_power_off(struct g= eneric_pm_domain *pd) > > > > > if (!sbi_cpuidle_pd_allow_domain_state) > > > > > return -EBUSY; > > > > > > > > > > + ret =3D cpu_cluster_pm_enter(); > > > > > + if (ret) > > > > > + return ret; > > > > > > > > Rather than using the CPU cluster notifiers, consumers of the genpd > > > > can register themselves to receive genpd on/off notifiers. > > > > > > > > In other words, none of this should be needed, right? > > > > > > > Thanks for the feedback! > > > Maybe I miss something, I'm wondering about a case like below: > > > If we have a shared L2 cache controller inside the cpu cluster power > > > domain and we add this controller to be a consumer of the power > > > domain, Shouldn't the genpd invoke the domain idle only after the > > > shared L2 cache controller is suspended? > > > Is there a way that we can put the L2 cache down while all cpus in th= e > > > same cluster are idle? > > > > [...] > > Sorry, I made some mistake in my second question. > > Update the question here: > > Is there a way that we can save the L2 cache states while all cpus in t= he > > same cluster are idle and the cluster could be powered down? > > If the L2 cache is a consumer of the cluster, the consumer driver for > the L2 cache should register for genpd on/off notifiers. > > The device representing the L2 cache needs to be enabled for runtime > PM, to be taken into account correctly by the cluster genpd. In this > case, the device should most likely remain runtime suspended, but > instead rely on the genpd on/off notifiers to understand when > save/restore of the cache states should be done. > > Kind regards > Uffe