Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp780321rwb; Fri, 23 Sep 2022 04:11:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fb/5HQO3dvBpKOpH4+RBQvaxdzS0rTDjXZZaIpJXmnYvs2NYhsJGFg2rhg+nSRXLAxsFS X-Received: by 2002:a17:906:5a6a:b0:77c:2c7f:bd69 with SMTP id my42-20020a1709065a6a00b0077c2c7fbd69mr6623522ejc.283.1663931507134; Fri, 23 Sep 2022 04:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663931507; cv=none; d=google.com; s=arc-20160816; b=J+3CEfBGPEiyKjmmDKTzmeVHOyKmB20gwNdKDjWj2S2Jbwrs677BndrYHV/7LO5401 /50SjWqLq+4A82WBRwiHj2uXqA1Iu6VKTUnhWlpTNvqPzkIQmNlHPSnIeCPV07fjVLnK hsLy6u83wpTFXAKgbnsIs39qfIdKE5b5in2dG6ASrk1iaxFgkfkM1N3TqwSnPKtaNCsV 3OUB7t/WAx8UR5184r3mIU7SVBpMM8upxjUFSSVjEA01Cs1w9Qa1pF/8qqOlgHEhOH00 yc2ESWS/dcUEhWfpJ6aoB6uoIpFdD/HHLa0T8xQOQh5zvy76CKyNE82vQueFRW+H4d6f tFPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:to:from:cc:in-reply-to:subject:date :dkim-signature; bh=/40D11sTGBqxQ3T0htyIxT/7MS1k2znQcbc1Zb17/k8=; b=qUOWW/zxu8T9RqTq/ukpdtI99QzZrBpQqu8bnGlauovr1GXg2O5xNkdqIXYi2wWa/A 0TBW4IV/sQIX48qDhv83dckXPzlOwziMAnfzZxyGeVZzHWz/aNJKWBUW3U72PoZYh68R s9w1HGJh2jR74mC9j9bbxZMUt4oVcjaGLhCci2LaUJpmRJ6RciXhTFX+yJcWxkL7XXmo gGEsB8EJxxdtCPpLGYtA9MGRbYwRIJDquRoF6c4UsVlnEEhGB7yWUnLZDcoulbGZiz3a YVF5jXHpnAb3segD05Y7V8r6fm8hdchezglvCwHtWNoUoL/Z1vdlI8pTxgVIQkBQKKlF b/aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=4eax6Pge; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a056402280700b00448ab5d3ba3si8505746ede.1.2022.09.23.04.11.21; Fri, 23 Sep 2022 04:11:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=4eax6Pge; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231906AbiIWK46 (ORCPT + 99 others); Fri, 23 Sep 2022 06:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbiIWK4Z (ORCPT ); Fri, 23 Sep 2022 06:56:25 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9DD212B4BF for ; Fri, 23 Sep 2022 03:55:46 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id b23so12035704pfp.9 for ; Fri, 23 Sep 2022 03:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=message-id:to:from:cc:in-reply-to:subject:date:from:to:cc:subject :date; bh=/40D11sTGBqxQ3T0htyIxT/7MS1k2znQcbc1Zb17/k8=; b=4eax6Pge2DmiLZRQm4qb2nBq2xkb5JBoeP+DlilNmuEHsvidQGWYX31O54gDnnv7ox hr3tk6dgHG3YHW3gl8hr4K9BarDzq7NfS+0ZngZu+MXPIi25ZKUffWJZoIJA3PcILe95 LCnV8uuzOVRUUZxj2ixnurBOS+zbqBv1DP8v+WkAUfU9pFYHSvna9NHgWBeCx1ot3piY kmszE132EtS3yKkYx+LNqVynN95uLZInSn5bVNL4jxyrripICl5x6Gfp4pG51aUzUQjs oLISfVuoffDl/otgefCQtLSz8ecrLNhWu1aE57sYSY1IDqsj1uiGJwgTdvfi98IXMZik kAoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:to:from:cc:in-reply-to:subject:date:x-gm-message-state :from:to:cc:subject:date; bh=/40D11sTGBqxQ3T0htyIxT/7MS1k2znQcbc1Zb17/k8=; b=Tf0IBXx1RbAbsXw2Mca6OHQv+1wB0IHNilmxWC1nImnX06qzNeZCddM8q0qfuZ7svp RBY22rcvJ+Ai4DF4qp9Ne5VbZdiiT0sinEvaP7llOaSLn+OziNBYYi9fcihahHZdL+8W miuf93bzBq6aH1RdML3Vy5g3PqP0d0Z0GGGHOihaHyJ+k1t6xASejC7XeD5BSMo+SWBL FSDm/gOlBZu7VBt+P7f2VkkgN5lpGzaWDDXSs/kCnszpposAAanEAT5cm1sLEAP2LK7g OFkFV0VtzHFOE/lZ4mM/tJqSw7JvrFSxyoko2PcBzayWhHfEID7uQTichdVzsmeHGX6I 8NNw== X-Gm-Message-State: ACrzQf160NgPVyJyvcRzqvuHYNA1erNaDglXwK9HZvt8bQrJB4rNZ+7l HCvEDB3KzXDnMTJkK2bOCkpp3w== X-Received: by 2002:a05:6a00:27a1:b0:548:ea2e:885c with SMTP id bd33-20020a056a0027a100b00548ea2e885cmr8786790pfb.55.1663930546039; Fri, 23 Sep 2022 03:55:46 -0700 (PDT) Received: from localhost ([88.128.88.52]) by smtp.gmail.com with ESMTPSA id o5-20020a170902d4c500b00176b66954a6sm5747934plg.121.2022.09.23.03.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 03:55:45 -0700 (PDT) Date: Fri, 23 Sep 2022 03:55:45 -0700 (PDT) X-Google-Original-Date: Fri, 23 Sep 2022 03:55:41 PDT (-0700) Subject: Re: [PATCH] cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage In-Reply-To: CC: rafael@kernel.org, daniel.lezcano@linaro.org, Paul Walmsley , ulf.hansson@linaro.org, atishp@atishpatra.org, Alistair Francis , linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, apatel@ventanamicro.com From: Palmer Dabbelt To: anup@brainfault.org Message-ID: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Sep 2022 10:07:46 PDT (-0700), Palmer Dabbelt wrote: > On Sun, 28 Aug 2022 19:59:45 PDT (-0700), anup@brainfault.org wrote: >> Hi Palmer, >> >> On Mon, Jul 18, 2022 at 2:16 PM Anup Patel wrote: >>> >>> Currently, we are using CPU_PM_CPU_IDLE_ENTER_PARAM() for all SBI HSM >>> suspend types so retentive suspend types are also treated non-retentive >>> and kernel will do redundant additional work for these states. >>> >>> The BIT[31] of SBI HSM suspend types allows us to differentiate between >>> retentive and non-retentive suspend types so we should use this BIT >>> to call appropriate CPU_PM_CPU_IDLE_ENTER_xyz() macro. >>> >>> Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver") >>> Signed-off-by: Anup Patel >> >> Can you please take this patch through the RISC-V tree ? > > Sorry I missed this, I didn't realize you wanted me to merge it. It's > on fixes. Actually from reading this again, it's not really a fix: the kernel is correct without this change, it's just going to save/restore when it doesn't need to. So I'm queuing this into for-next instead. > >> >> Regards, >> Anup >> >>> --- >>> drivers/cpuidle/cpuidle-riscv-sbi.c | 7 ++++++- >>> 1 file changed, 6 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c >>> index 1151e5e2ba82..33c92fec4365 100644 >>> --- a/drivers/cpuidle/cpuidle-riscv-sbi.c >>> +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c >>> @@ -97,8 +97,13 @@ static int sbi_cpuidle_enter_state(struct cpuidle_device *dev, >>> struct cpuidle_driver *drv, int idx) >>> { >>> u32 *states = __this_cpu_read(sbi_cpuidle_data.states); >>> + u32 state = states[idx]; >>> >>> - return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, states[idx]); >>> + if (state & SBI_HSM_SUSP_NON_RET_BIT) >>> + return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, state); >>> + else >>> + return CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(sbi_suspend, >>> + idx, state); >>> } >>> >>> static int __sbi_enter_domain_idle_state(struct cpuidle_device *dev, >>> -- >>> 2.34.1 >>>