Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6891584rwb; Tue, 22 Nov 2022 22:01:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf7WQGowkbksyuiqGE5No0U2Vh/L5K8B1lLlhXzxGFb5A6MjvEpBnuJhBozleRgYcTn+VLdY X-Received: by 2002:a17:906:ca0e:b0:78c:1f2f:233e with SMTP id jt14-20020a170906ca0e00b0078c1f2f233emr7895939ejb.307.1669183269837; Tue, 22 Nov 2022 22:01:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669183269; cv=none; d=google.com; s=arc-20160816; b=ahU/6ZXie8JMKY/z3AwQSHDFuQ9JOdSlnr+1LBsoJqYW2e7mFlIuP8OZjg1VLX6IRl UEha5EM1+5BlWJ95esXz6tOvXUaE6y8ziqwQ8rbgqz9MbzWD6GFaRSIy+rR87oqhNwQz vvxEt4o1Pju0stjp3eCj85f+hk96l+wkdtEbIKKATXV9dxFkBRJ51sWrTXqsRBd5HVVQ IJW0av8/3sEdhvZ8vTay6GH9BIUAuD+9CjMvXcc/A8JZma0x8XQoRlXb6C2uSvAB7V4h 4MVHK8RQmfbiwLzucTAhunV3xsa56iCNP5rWABpbHrzE4MHMuRqwONDRSLemWV3z7oi4 KZ5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:feedback-id:dkim-signature:dkim-signature; bh=mBVtnDaBkuQcFRIzo1SOlDo6jVRm6UTP6X8KNYwdMJE=; b=e08tqqKtn2HFlAPxKQ1UtqkpXfkXZ072rPM+EtT3XgB5GjUWmvqR+YAzHxETw+EGh9 daDeKy7ULqBgNXEmXmCR9lh8GVgL9iYYX0hIlm4JBUcsXVU94b+fjbfMw4Fz6AxdWe18 UmKbhjmQ0x+36sljAU9D+LPM92beKlXRjw1xeYnB/zolXC+kbWIT6tMSxxYoKGbkWL4J zeCfnvYDgAHekmPwQa9hRRrTU/LHMyAbsTgodSLGn0K6bChWS4ZflcYoLg3Spp0KaDIW rk0xT5HR0QrVarlxpnUXHeLqyh9napGyVA7J0OPa0OEEAjy9qPgMvaWmygsyAMK8aAzd FOOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm2 header.b=HZz3mifb; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="FCjlyb/A"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv17-20020a17090760d100b0078dbd939dacsi13233309ejc.545.2022.11.22.22.00.45; Tue, 22 Nov 2022 22:01:09 -0800 (PST) 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=@sholland.org header.s=fm2 header.b=HZz3mifb; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="FCjlyb/A"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235805AbiKWFtz (ORCPT + 89 others); Wed, 23 Nov 2022 00:49:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbiKWFtx (ORCPT ); Wed, 23 Nov 2022 00:49:53 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 398E9F1DA2 for ; Tue, 22 Nov 2022 21:49:52 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id A8D675C01A8; Wed, 23 Nov 2022 00:49:51 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 23 Nov 2022 00:49:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1669182591; x= 1669268991; bh=mBVtnDaBkuQcFRIzo1SOlDo6jVRm6UTP6X8KNYwdMJE=; b=H Zz3mifbUFIUVLbv02TCGZLRukTLnclKvWTd9dVrjGSHwykx3MK1rkTvGdNLWZaiE 3ABtEvoUvkM8/y43GBztZojQUOqaEYiTqiEH4hOT2YTKzRE71K+hK3pgi9M6rp/b Fh8+JUQNmuTEvlxTHn4Q7Mp0aRr3Hst1sue4I4W+YU9fcIoLAqIO7UfLE1oz2Dby Xs3X8pFuYst+35l22uBbQBigxuWxmQ+R7XIOF4NGlUzEKuDs9xgfhN+9ghQ714p2 wQYrUbcmNq8jP/l2knmwRytY/s1zrxNj0Ps0u3yyo9NZeEB//M1qrDxByEmuSEPu A1U2r8tk+C/vuV6Lba/qg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1669182591; x= 1669268991; bh=mBVtnDaBkuQcFRIzo1SOlDo6jVRm6UTP6X8KNYwdMJE=; b=F Cjlyb/A2mVMfUg2HKISjGwIgr3mvFWS0kyTuDfiFgpfeHs3SR/X7TKtwvBhmHr21 4aklCAeGNNiCufAndXVGNAi2d4KAOF2v58R4Gpymz/RVsmKtVD65KeT8Mv/dab8z bSkFp07Gp5NqevVDLL/0d7QbDnVN2Y0yQe5ZHIVvaPIWkf5JYx4MdSUEl++rF9cq hLsNPlT46m703KzN6ChxeA1EzWK5tIYKqYbsEqvJ8fvLYvPz3Z3JqCnQ9+EciIgy t5mEBZNFEdVm5sTscBU+Rkyc97uD6VsB+YNo+9Vf0AnZwRCTevRQQe2+E2n+G8of ftq0uMZSuGsk2UeQvhrEA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedriedtgdekkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepteehheehtdegledtiedvfeeludekhfdtkeeuiefgfffhuedtjedt fffhfeelleeunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghdpghhithhhuhgsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgr mhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Nov 2022 00:49:50 -0500 (EST) Message-ID: Date: Tue, 22 Nov 2022 23:49:49 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux ppc64le; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v2] Revert "clocksource/drivers/riscv: Events are stopped during CPU suspend" Content-Language: en-US To: Conor Dooley , daniel.lezcano@linaro.org, tglx@linutronix.de Cc: Anup Patel , Palmer Dabbelt , Palmer Dabbelt , aou@eecs.berkeley.edu, atishp@atishpatra.org, dmitriy@oss-tech.org, paul.walmsley@sifive.com, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org References: <20221122121620.3522431-1-conor.dooley@microchip.com> From: Samuel Holland In-Reply-To: <20221122121620.3522431-1-conor.dooley@microchip.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,URIBL_BLACK autolearn=no 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 11/22/22 06:16, Conor Dooley wrote: > This reverts commit 232ccac1bd9b5bfe73895f527c08623e7fa0752d. > > On the subject of suspend, the RISC-V SBI spec states: >> Request the SBI implementation to put the calling hart in a platform >> specific suspend (or low power) state specified by the suspend_type >> parameter. The hart will automatically come out of suspended state and >> resume normal execution when it receives an interrupt or platform >> specific hardware event. > > This does not cover whether any given events actually reach the hart or > not, just what the hart will do if it receives an event. On PolarFire > SoC, and potentially other SiFive based implementations, events from the > RISC-V timer do reach a hart during suspend. This is not the case for > the implementation on the Allwinner D1 - there timer events are not > received during suspend. > > To fix this, the x86 C3STOP feature was enabled for the timer driver - C3STOP isn't inherently x86-specific. > but this has broken both RCU stall detection and timers generally on > PolarFire SoC (and potentially other SiFive based implementations). > > If an AXI read to the PCIe controller on PolarFire SoC times out, the > system will stall, however, with this patch applied, the system just > locks up without RCU stalling: > io scheduler mq-deadline registered > io scheduler kyber registered > microchip-pcie 2000000000.pcie: host bridge /soc/pcie@2000000000 ranges: > microchip-pcie 2000000000.pcie: MEM 0x2008000000..0x2087ffffff -> 0x0008000000 > microchip-pcie 2000000000.pcie: sec error in pcie2axi buffer > microchip-pcie 2000000000.pcie: ded error in pcie2axi buffer > microchip-pcie 2000000000.pcie: axi read request error > microchip-pcie 2000000000.pcie: axi read timeout > microchip-pcie 2000000000.pcie: sec error in pcie2axi buffer > microchip-pcie 2000000000.pcie: ded error in pcie2axi buffer > microchip-pcie 2000000000.pcie: sec error in pcie2axi buffer > microchip-pcie 2000000000.pcie: ded error in pcie2axi buffer > microchip-pcie 2000000000.pcie: sec error in pcie2axi buffer > microchip-pcie 2000000000.pcie: ded error in pcie2axi buffer > Freeing initrd memory: 7332K > > Similarly issues were reported with clock_nanosleep() - with a test app > that sleeps each cpu for 6, 5, 4, 3 ms respectively, HZ=250 & the blamed > commit in place, the sleep times are rounded up to the next jiffy: > > == CPU: 1 == == CPU: 2 == == CPU: 3 == == CPU: 4 == > Mean: 7.974992 Mean: 7.976534 Mean: 7.962591 Mean: 3.952179 > Std Dev: 0.154374 Std Dev: 0.156082 Std Dev: 0.171018 Std Dev: 0.076193 > Hi: 9.472000 Hi: 10.495000 Hi: 8.864000 Hi: 4.736000 > Lo: 6.087000 Lo: 6.380000 Lo: 4.872000 Lo: 3.403000 > Samples: 521 Samples: 521 Samples: 521 Samples: 521 > > Fortunately, the D1 has a second timer, which is "currently used in > preference to the RISC-V/SBI timer driver" so a revert here does not > hurt operation of D1 in it's current form. typo: its > Ultimately, a DeviceTree property (or node) will be added to encode the > behaviour of the timers, but until then revert the addition of > CLOCK_EVT_FEAT_C3STOP. > > Link: https://lore.kernel.org/linux-riscv/YzYTNQRxLr7Q9JR0@spud/ > Link: https://github.com/riscv-non-isa/riscv-sbi-doc/issues/98/ > Link: https://lore.kernel.org/linux-riscv/bf6d3b1f-f703-4a25-833e-972a44a04114@sholland.org/ > Fixes: 232ccac1bd9b ("clocksource/drivers/riscv: Events are stopped during CPU suspend") > CC: Samuel Holland > CC: Anup Patel > CC: Palmer Dabbelt > Reviewed-by: Palmer Dabbelt > Acked-by: Palmer Dabbelt > Signed-off-by: Conor Dooley > --- > > For v2, I have re-worked the commit message to (hopefully) add improved > context. > > CC: aou@eecs.berkeley.edu > CC: atishp@atishpatra.org > CC: daniel.lezcano@linaro.org > CC: dmitriy@oss-tech.org > CC: paul.walmsley@sifive.com > CC: tglx@linutronix.de > CC: linux-kernel@vger.kernel.org > CC: linux-riscv@lists.infradead.org > --- > drivers/clocksource/timer-riscv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c > index 969a552da8d2..a0d66fabf073 100644 > --- a/drivers/clocksource/timer-riscv.c > +++ b/drivers/clocksource/timer-riscv.c > @@ -51,7 +51,7 @@ static int riscv_clock_next_event(unsigned long delta, > static unsigned int riscv_clock_event_irq; > static DEFINE_PER_CPU(struct clock_event_device, riscv_clock_event) = { > .name = "riscv_timer_clockevent", > - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP, > + .features = CLOCK_EVT_FEAT_ONESHOT, > .rating = 100, > .set_next_event = riscv_clock_next_event, > }; Acked-by: Samuel Holland