From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B80BC05027 for ; Wed, 8 Feb 2023 11:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/o0s4rg+e2mzXx+wLisKHF+9klGCZtcC1t4Ur5+dwFk=; b=AM1vVPFSP4+GWg SJw6MWIsGNuNqlstd7GUXJTxnVu1qZHtQoTwjPoi2zoAVOCNxBoaOL4UcoEuE2HQ1fdRVDJ2F5zTk SXyRDI8D+oAuAMD9cYr+j8uFcsMRw5JMWV9OrwH3xun17+ABdSDev/xeSlfCikBg/q2jmZ1b8YCAo t46W6kIgXKr5OIL1TLcqs1WzfoApIyZc1Olc3ZN6EXvHSu637LNt8JXNwwfQVVe9YKLc1Pjxiu837 dHR9bbnjrz0YMT+9wEC2rWXdQHg6Oib0RkBKkXcIkKgBcLIiRfV1qYBO+6bovLogd+7ZadavDWpHg Slq71FVarE8T0DTlib+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPiVK-00FS9L-Pt; Wed, 08 Feb 2023 11:20:46 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPiVH-00FS7e-JZ for linux-arm-kernel@lists.infradead.org; Wed, 08 Feb 2023 11:20:45 +0000 Received: by mail-pl1-x62c.google.com with SMTP id g17so1380610ply.11 for ; Wed, 08 Feb 2023 03:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=fso3u+DXawZ5Dg96ItXFwx17vVhh+JjQUrLK3cPFxXA=; b=cQHSMKrLWqQTtCWNcCZz5MRxhBqndzS4nDdsJ1ulEaUQaBlkwz6HvMz8jN6zGB9pVY bFSP28DG8JaIdTfrPvili2beREzVUcGEC5ARfMzRQo0TOzSMbOaCXvQZ2sNCxQjAswmT Pk2jBTi+/QgEmKDhvoE4cjwdl9dzNaqI+Llo4w+eQ6h04on3mQCJq1f8WtQGEHzWX/CF RFCLSla740o5g5GpEmOUJW6NLKDx9pJeXEwk+rClwlPj7PTEz57hz0FAlXDWC6LixXjy 11ekGzktunr5VfzsAcXAHrKtkx03PaK7Q/68d64LTtyR1AVxs9OnBhSzasszFYQJBzn2 HC4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fso3u+DXawZ5Dg96ItXFwx17vVhh+JjQUrLK3cPFxXA=; b=u/lQ9Mv3pHc8nDWzVQ2Eod+2glVrSL2dR38EeD3yv529Fdl6Arlcs1BI+Ydprds6dE vqloJ1aFh0GvJzUg7mPkssILJuOy3Ga1HHPUdfwYxsb6TCabmkwjiNLFm59eZ/NEWQRc mmemxzDuMNFqQW9mhnbg53OghB4xK8cFJ8EPOlPuk+LBZHlQyhvaDjvAedF8jj93Rnpr eHbjYTh4+fXuFe2/DgDFpPYjCT05XjHXGILxpq7n2vDMYTiHVm1hukBgsObIMWtFm/QX 6WnH9JlkJdQMryfzrtQrxf3JmD3mDCCTRhg5jMuTCsCVuMs10+zHBteqtTrTGhMhW0KN FtIQ== X-Gm-Message-State: AO0yUKVLVZX4O4uJH5N3f/xpK06DKOSPCLRw/7KN6Npx2B6zLAmo1jYn HQnf9U2+hOkGdTXSQI2gmb8= X-Google-Smtp-Source: AK7set9VBHl6MNgHsPHaCu5Y1XOfNohh/XCFSbB9YFhbzntGLB9Ov5WP+YNQXbnBp9rrXE7f2SIGJg== X-Received: by 2002:a17:90a:e7c6:b0:230:9106:18ec with SMTP id kb6-20020a17090ae7c600b00230910618ecmr7994156pjb.43.1675855236689; Wed, 08 Feb 2023 03:20:36 -0800 (PST) Received: from kazuki-mac ([2400:4051:ea3:5910::19a]) by smtp.gmail.com with ESMTPSA id gq17-20020a17090b105100b0020dc318a43esm1305791pjb.25.2023.02.08.03.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 03:20:36 -0800 (PST) From: Kazuki X-Google-Original-From: Kazuki Date: Wed, 8 Feb 2023 20:20:31 +0900 To: Sudeep Holla Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "Rafael J. Wysocki" , Daniel Lezcano , Lorenzo Pieralisi , Hector Martin , Sven Peter , Len Brown , Pavel Machek Subject: Re: s2idle breaks on machines without cpuidle support Message-ID: <20230208112031.sdfuluajjerf4wwp@kazuki-mac> References: <20230204152747.drte4uitljzngdt6@kazuki-mac> <20230206101239.dret3fv65cnzpken@bogus> <20230207194818.exskn3dhyzqwr32v@kazuki-mac> <20230208103511.w7jzxw6spy6humdn@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230208103511.w7jzxw6spy6humdn@bogus> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230208_032043_667068_FF5966BF X-CRM114-Status: GOOD ( 29.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 08, 2023 at 10:35:11AM +0000, Sudeep Holla wrote: > On Wed, Feb 08, 2023 at 04:48:18AM +0900, Kazuki wrote: > > On Mon, Feb 06, 2023 at 10:12:39AM +0000, Sudeep Holla wrote: > > > > > > What do you mean by break ? More details on the observation would be helpful. > > For example, CLOCK_MONOTONIC doesn't stop even after suspend since > > these chain of commands don't get called. > > > > call_cpuidle_s2idle->cpuidle_enter_s2idle->enter_s2idle_proper->tick_freeze->sched_clock_suspend (Function that pauses CLOCK_MONOTONIC) > > > > Which in turn causes programs like systemd to crash since it doesn't > > expect this. > > Yes expected IIUC. The per-cpu timers and counters continue to tick in > WFI and hence CLOCK_MONOTONIC can't stop. Yes, but it shouldn't be the case when suspending[1]. Currently that's what happens when we enter s2idle without a cpuidle driver. This doesn't seem to happen with S3 sleep [2]. [1] Documentation/core-api/timekeeping.rst: .. c:function:: ktime_t ktime_get( void ) CLOCK_MONOTONIC Useful for reliable timestamps and measuring short time intervals accurately. Starts at system boot time but stops during suspend. [2] kernel/time/sched_clock.c: int sched_clock_suspend(void) { struct clock_read_data *rd = &cd.read_data[0]; update_sched_clock(); hrtimer_cancel(&sched_clock_timer); rd->read_sched_clock = suspended_sched_clock_read; return 0; } void sched_clock_resume(void) { struct clock_read_data *rd = &cd.read_data[0]; rd->epoch_cyc = cd.actual_read_sched_clock(); hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL_HARD); rd->read_sched_clock = cd.actual_read_sched_clock; } static struct syscore_ops sched_clock_ops = { .suspend = sched_clock_suspend, .resume = sched_clock_resume, }; static int __init sched_clock_syscore_init(void) { register_syscore_ops(&sched_clock_ops); return 0; } device_initcall(sched_clock_syscore_init); > > > > > > > > 2. Suspend actually works on ARM64 machines even without proper > > > > cpuidle (PSCI cpuidle) since they support wfi, so the assumption here is wrong > > > > on such machines > > > > > > > > > > Sorry I am bit confused here. Your point (2) contradicts the $subject. > > drivers/cpuidle/cpuidle.c: > > > > bool cpuidle_not_available(struct cpuidle_driver *drv, > > struct cpuidle_device *dev) > > { > > return off || !initialized || !drv || !dev || !dev->enabled; > > } > > > > The cpuidle framework reports ARM64 devices without PSCI cpuidle as > > "cpuidle not available" even when they support wfi, which causes suspend > > to fail, which shouldn't be happening since they do support idling. > > Yes with just WFI, there will be no active cpuidle driver. > > [...] > > > > Again, since s2idle is userspace driven, I don't understand what do you > > > mean by unbootable kernel in the context of s2idle. > > > > Sorry, I meant "attempts to fix this bug have all led to an unbootable > > kernel." > > Again I assume you mean kernel hang or crash and nothing to do with boot. > Once you enter s2i state with your changes/fix, it hangs or is unresponsive > as it might have either failed to enter or resume from the state. > > -- > Regards, > Sudeep Thanks, Kazuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel