Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1475968lqa; Mon, 29 Apr 2024 09:26:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXJ3260htiFA3rE304/0ODP3owU09AXuJKr3GxbQMSG5OngYzwRA5Ml34L0GF++iqcWZ6T3nGfPEZfh2LIS9IeJMideb3gM0j5IdqZrw== X-Google-Smtp-Source: AGHT+IF/gbVyyrbbFlcjnz3Vc9ILG8NW4G2El0LL1i8Jw71FXlhwn4N2fTXLNrQceB54bf87zwCe X-Received: by 2002:a17:90a:bf82:b0:2b2:5875:44ec with SMTP id d2-20020a17090abf8200b002b2587544ecmr519306pjs.13.1714407990991; Mon, 29 Apr 2024 09:26:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714407990; cv=pass; d=google.com; s=arc-20160816; b=QJ+48WyQHo5kbkIsVDqzdfa3izv7/zNofsUShvG1czqB2j3mB1HuOPcV/6fbClp0BQ IL0YpT1TaRlm/zEZaVa5RPSsv7CN65XIx3lPSBiDI1mB0iNno0Y+2zc8vKjDbAXLhnfh NsTbbvYkBV1rqdfs/0tZAeebw9nJjMSDzityo8Z/Pq3enT9SHDasIv/qXjrnVOloMEH4 djnpuSbguuH8kgsYDEf2cEoaM5AgADcoekTjmyANRv2Ej/G5mf2y8loNdJJI0JsnFhRB rD11oaXcFiSZgTYcRUqIvsYw3MqMb8HuteFeIiGyFO5o4TBURo0lYYiJ3QbnYW7lImim zpXg== 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=CrS8Hh3nfWDYBnimGcOfd9CKdp//ogZ+PunEhiC75hs=; fh=a5xZ0IbrcvBd0PWlkSb6x2BvflzOfyOfbEZhBSwI/Ps=; b=I7CLa3wH6FUb+bVOYu/QCZHbPdH714+eoGZhhrYFE7p5rucmCdjxsthpn2N9/Uxozt lldjIbeR9alHpeBXQKJdzd/8+eUY2XHPX7Suq5aNcHDX+Svbw9NV9HRhkcO7crRK155h SOroUe/ZKO5vm8ZdCn+Digj3wJN/OaVJAifX5Wz4JcNgkRQjSvFw9rwkCD6amBzOXCSj crRUONxlgfiDAQf/KJoSqiZY8ji1rdsGs+/WK5wRrfnmNQ3numHBBYOA5+vYfaflHbI+ 8tBQMmzAR7eqBDBlm6AGxdqjus1MwiN7k5K2YSEozfdtz1fiOBwPloTVIAoGfPHMaZof E0kA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=OldT80tI; 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-162683-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162683-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bt21-20020a17090af01500b002b1a587f549si2053499pjb.128.2024.04.29.09.26.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 09:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162683-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=OldT80tI; 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-162683-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162683-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 885C22811A8 for ; Mon, 29 Apr 2024 16:26:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAE9C84D39; Mon, 29 Apr 2024 16:26:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="OldT80tI" Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (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 60C3884D02 for ; Mon, 29 Apr 2024 16:26:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714407984; cv=none; b=JhXNXkKqa64fnMpHoZ/Ark7+UX8GjQdq7J/LOp0bCOefOM7Tqzd7mHsq26v6PB/LI1GsAeKBOtGNgFGjdpqtmp/cgVY+N0Yb7xC7+tCI5SNqoMN0ngbGCB4cHSj0wGxbb25KAbv3DU1rYuvw2HKG4LvtvBsNBZ6iSVsLA7aNFtk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714407984; c=relaxed/simple; bh=ktMyEGwewq1kTXaW7guowY90Cmzku2j4e6Z/N7wvSzw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=iUU3aSC9xhj/J5Pb2i2gawsgeUEUdJ2vTOcuW+iHAZoj1l9F6KGZ2wSUIxCxa7bDeoiBDJb+xnid0GRn7To1CKVJThs2ot89IgdJYz9vhMkkBl3NWZwDf6cWBitygoCJtMGCvKC1AicXYqDfCYEfewBBtLA4d5wbrlE9HMoRHLU= 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=OldT80tI; arc=none smtp.client-ip=209.85.219.170 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-yb1-f170.google.com with SMTP id 3f1490d57ef6-de5a7b18acdso3875824276.3 for ; Mon, 29 Apr 2024 09:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1714407982; x=1715012782; 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=CrS8Hh3nfWDYBnimGcOfd9CKdp//ogZ+PunEhiC75hs=; b=OldT80tIQqlxOyo7ZmBG/JbYe4CHq5uivvQhZr9MbUz6q2lLHB0KwE7TCd77ldjpAM 304QXAnVweuqD2PSBIYQq0jSAVZ7rLMqMf9DCvtvdWdAEDkLkuHaQQ/kbaNoVywagqmQ 4BwgndWqI12zFgrZFNXeAejQ8W5u1kp8dYUhaP8sI72PRxc+W9V0ShR9wtFVhCBNPObB kEImzZravs+K/aVkrz+t0jcit/SvgQHHNjdUkQiyHAqrgK3eBK3qWcGue7k4MupJzcml ETM7otxmMaQuM2krHmGKSvplJ2Fd44fjegAblzr+3QSFXne3qGyobRFC6uEriQCvIPJh 5/JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714407982; x=1715012782; 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=CrS8Hh3nfWDYBnimGcOfd9CKdp//ogZ+PunEhiC75hs=; b=NAwEFv7NVLnUzRdNZIn/9vxPjSlW0tVfcv2TsQVPgac5dNCEs7vYRZD0bCuIKMIcIT vWubx8ohOyhQ85ZV46U3FZxQediRW039Wv/c0QhwXd6x0b5hHUtB04KlJsKwN8FsZ+Cf NaeeMCFEPHCTX4or/hwofXBHfdbzBk/xJdVc6WZTmpXtd2714CMMaXUJcgbjNgaSxp3T fdCDJb1ommU5MmSqZLwCIXgTMt/AtJfQUWk8Q6IHPRrAzVIMXvacVcsncb2ZHsI5Td+d Tm0f73WLjulThfvInW55y+dzxp13TMp11Os8bXwoaJgY02bpKZ1chXnxRHrY4m8yX/kT 5pfg== X-Forwarded-Encrypted: i=1; AJvYcCW4libXzb2cNZ2om2NSQbir1CafHWiK+F+XgLVuildZc3b0V7+jLZQl0nhGkDYwHR/2ygB0YoBWp1xJZ9mXFUZ9eJfGVb34jq9ktAJ1 X-Gm-Message-State: AOJu0Ywg2GNKt1j/MgNKMhaSAcqW9vVpJ8yE0waXUirmoMWJC82y0g0D QFy6oowqBi0Pypcz5yOZNgvZutxBwzSI91Dnp0UqFOR7R1c+J0YqPZeKnKgDPZAYjlVg5vGx9ww WuZlQ4SXI4u1WwuxmjegbDUjRNFtnHWLLkmxojQ== X-Received: by 2002:a05:6902:510:b0:de5:c619:3f6b with SMTP id x16-20020a056902051000b00de5c6193f6bmr7236404ybs.59.1714407982421; Mon, 29 Apr 2024 09:26:22 -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, 30 Apr 2024 00:26:11 +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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 30, 2024 at 12:22=E2=80=AFAM Nick Hu wrote= : > > 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 kern= el > > > might put the cluster into a deeper low power state. Call the > > > cluster_pm_enter() before entering the low power state and call the > > > 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 up > > recently. Sorry for not noticing earlier. > > > > If not too late, can you please drop/revert it? We should really move > > 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/cpuidle/cp= uidle-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 generi= c_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 gener= ic_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 the > 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 the same cluster are idle and the cluster could be powered down? > > > > Kind regards > > Uffe