From patchwork Mon Feb 13 18:26:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 56442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2503447wrn; Mon, 13 Feb 2023 10:31:46 -0800 (PST) X-Google-Smtp-Source: AK7set+dGedVDHeag/Vdj3zoZXxJe12pX/9ZKK70GCEx7iL8EeSe4lo3FFWU63jLVXoVowyn8Fuv X-Received: by 2002:a17:907:2cc9:b0:88d:ba89:1839 with SMTP id hg9-20020a1709072cc900b0088dba891839mr18732078ejc.10.1676313105844; Mon, 13 Feb 2023 10:31:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313105; cv=none; d=google.com; s=arc-20160816; b=G0x8jU9lnmW/bRwKM70KMc/pSTUHJf3uVV8J6sFimJ68UvRYK+OPL+azDnpXZqwXnY 4O6hXvavN5hUlo5A5/+5MUXZMmUyaFjg5WUDo+fcFMp5I2L26HIQWvgg5h4HemcfMBE1 dqiMQmcEFf7b7xFoMkGBourZsUJUTsdbxkF0v7qUM8JnxeCw1E5Di+Vk7VvtnTpL2Qrj FtAIq/IHIxWGibgKxmKVRsQVyrRrvym3qlMYBc2JNTOb8thJYrDdtE9GWWKM4ZJik2eu WNfopIkD73jZ0MTfurAwMrKXiFfX+rFtYkUOaZYrIvGWo/rrJ6lpuiZChhli+WT5ZBG7 KeKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=zBhCRTh8osu7xSxgDbCZKBz8vh3/bGHBs81Gav2hZ2w=; b=FXstCZ3vfqw+T45nN1SEDOKOfHRRRam3dQRHYYVBJmknc52rt+ysNVYVUL0sc1wtPB tgME3Rz3CUkCGm9+5ulxSm3UjH1t5x9CiB9KEBv3hbiBFNeAZ6Aa3yEaSYzue40x8fXL VYZc8BMIOsuq2VJnEX7K9nltYqsuo4c++wGWVNaXaevsPcGx0nmkcIHQ4GJN6gxLsd6p bXPmO9Vya3uOgt7ZtGkU8n8NUYEKeode952XkE4xIvXA8NwOO8O2hkfXlX1gwp04R6iW TA5tBStssAlzi8tLeGEXFDebmAHbIL0y+pVldGcCu7KF+SZmN+RIWwhZwrp06P+pqVzp Bb9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=f9C7H+9u; dkim=neutral (no key) header.i=@linutronix.de header.b="KrO/9O3u"; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020aa7d90e000000b0046bb35e06e6si14488925edr.149.2023.02.13.10.31.22; Mon, 13 Feb 2023 10:31:45 -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=@linutronix.de header.s=2020 header.b=f9C7H+9u; dkim=neutral (no key) header.i=@linutronix.de header.b="KrO/9O3u"; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231374AbjBMS1K (ORCPT + 99 others); Mon, 13 Feb 2023 13:27:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230293AbjBMS03 (ORCPT ); Mon, 13 Feb 2023 13:26:29 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38586F1; Mon, 13 Feb 2023 10:26:28 -0800 (PST) Date: Mon, 13 Feb 2023 18:26:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1676312785; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zBhCRTh8osu7xSxgDbCZKBz8vh3/bGHBs81Gav2hZ2w=; b=f9C7H+9uFWfaEFbMdrA64RhrmSH9ZRv3dckMTM263JBuSLTwtCFikmaQuRFUF5QxbZwFRu GtxnEPDWKCu6QOUgwgMyqtHmJTbhJB0Z63EmmUGTr4pj05C032Z90MXzXQ9eO4qOzC5nE1 cA75Z4+JEPfqpJGL3C750xObESa3eOmw95Q1BhvPKex6xiOuC+DFTU1dKdZei5thxfv6hY WFfN3O3l9Yl+FjNil/ww8On9Wn8y6ZQ6SBhvo9I+MN3IVLY1y/QIlRUjbTJcDwRIASRB+x 4cI1Tzk8bsDN9iNHw+Am4MmJsSxIYZgZg2Zoyurd+Ujj/b8ryzbvUU4BDOa+ZQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1676312785; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zBhCRTh8osu7xSxgDbCZKBz8vh3/bGHBs81Gav2hZ2w=; b=KrO/9O3uNW1aYZ63NPoJ26Ha4f2f6UpHYm/sigW2yMyeJ/7AWpnKXtp/EgBC+VfrzywTFh KLyifKKLtpfkivDA== From: "tip-bot2 for Conor Dooley" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] RISC-V: time: initialize hrtimer based broadcast clock event device Cc: Samuel Holland , Conor Dooley , Anup Patel , Palmer Dabbelt , Daniel Lezcano , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230103141102.772228-2-apatel@ventanamicro.com> References: <20230103141102.772228-2-apatel@ventanamicro.com> MIME-Version: 1.0 Message-ID: <167631278533.4906.4080664832019272480.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754010886158600308?= X-GMAIL-MSGID: =?utf-8?q?1757741690946684447?= The following commit has been merged into the timers/core branch of tip: Commit-ID: 8b3b8fbb4896984b5564789a42240e4b3caddb61 Gitweb: https://git.kernel.org/tip/8b3b8fbb4896984b5564789a42240e4b3caddb61 Author: Conor Dooley AuthorDate: Tue, 03 Jan 2023 19:41:00 +05:30 Committer: Daniel Lezcano CommitterDate: Mon, 13 Feb 2023 13:10:16 +01:00 RISC-V: time: initialize hrtimer based broadcast clock event device Similarly to commit 022eb8ae8b5e ("ARM: 8938/1: kernel: initialize broadcast hrtimer based clock event device"), RISC-V needs to initiate hrtimer based broadcast clock event device before C3STOP can be used. Otherwise, the introduction of C3STOP for the RISC-V arch timer in commit 232ccac1bd9b ("clocksource/drivers/riscv: Events are stopped during CPU suspend") leaves us without any broadcast timer registered. This prevents the kernel from entering oneshot mode, which breaks timer behaviour, for example clock_nanosleep(). A test app that sleeps each cpu for 6, 5, 4, 3 ms respectively, HZ=250 & C3STOP enabled, 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 Link: https://lore.kernel.org/linux-riscv/YzYTNQRxLr7Q9JR0@spud/ Fixes: 232ccac1bd9b ("clocksource/drivers/riscv: Events are stopped during CPU suspend") Suggested-by: Samuel Holland Signed-off-by: Conor Dooley Signed-off-by: Anup Patel Reviewed-by: Samuel Holland Acked-by: Palmer Dabbelt Link: https://lore.kernel.org/r/20230103141102.772228-2-apatel@ventanamicro.com Signed-off-by: Daniel Lezcano --- arch/riscv/kernel/time.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/kernel/time.c b/arch/riscv/kernel/time.c index 8217b0f..1cf21db 100644 --- a/arch/riscv/kernel/time.c +++ b/arch/riscv/kernel/time.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -29,6 +30,8 @@ void __init time_init(void) of_clk_init(NULL); timer_probe(); + + tick_setup_hrtimer_broadcast(); } void clocksource_arch_init(struct clocksource *cs)