Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2904312ioo; Tue, 24 May 2022 08:29:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXX6r6zrUoFkIbGorM7pauKP4vvuZMFhmgcJsodPPwc4bOjM6OWHju5Ac03CBIbHedYKwx X-Received: by 2002:a17:90a:64cd:b0:1df:d7e9:2eec with SMTP id i13-20020a17090a64cd00b001dfd7e92eecmr5194113pjm.160.1653406143635; Tue, 24 May 2022 08:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653406143; cv=none; d=google.com; s=arc-20160816; b=GMuwZLzULEBN0o8Y6OZR+PS+dsoa7k3DM10jyWVeX6x0FHAW3MAfzyfH35OK1SCazE r3PjoeI4Q0ZEpYKGr1VkJG1JW+w1QyWvBWHRu7Lb+mGwft6gYor+3I8+vHuwZaUuvWlZ xkhZQARe7VGed9Qark9XKAh8bz280mbiSevZK4euO9w6xc/jTpzIRWLjPFY47Gzyy18s YgYDCypB5CQbVqGEZK3ZgEl18W6UyAkLuiv9AicrhXYi8EGzkvQnTss7F19bS5WX+Gal /cw0OHeoFK3JDZLhDZCakfpt3Nw22dEBpLGTC0krpcVfBu/RkgSHwjgXbBrqbOV63VQ2 lrLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=S/pNo5ypsj8sjqbjG1l1gWrym6AVA3NFtAtotZSuvpI=; b=eJ0QLQy1Eye9h4r2lX5acDIfozSfXHC6StSoxTaHM6YtZRBXlyZEjoqc40tsZ6mqmA PLm5vDPOdRZ7LUeFGfpDyPgqlCrimFWccX8ibqlFHUH2xIO/b8NUy53AWDQ0XZqLU393 o3dY+4kgc8Brq1V0VwXiAbcrm20PwVkkmcGs4FplEtBxOaTtnQBtdafNLnhmv7ScLLS1 spKhK0dT4+celSYLyPXcu7SVwLXSztEDIguOfYw+i4NayHpAxAfbQy/Ny/xMQRfTihES vY2eaQK/YH8P7U8tTCgFG/6iDaK9hHF+cS80F+sh3ZLzjJzGxncme/wc4gWTvKBV3VdJ M9hw== ARC-Authentication-Results: i=1; mx.google.com; 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 h1-20020a170902f7c100b00153bc4c8388si13324274plw.499.2022.05.24.08.28.51; Tue, 24 May 2022 08:29:03 -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; 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 S237668AbiEXNPX (ORCPT + 99 others); Tue, 24 May 2022 09:15:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234130AbiEXNPT (ORCPT ); Tue, 24 May 2022 09:15:19 -0400 Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A758092D3C; Tue, 24 May 2022 06:15:16 -0700 (PDT) Received: by mail-vk1-f172.google.com with SMTP id i25so3509450vkr.8; Tue, 24 May 2022 06:15:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S/pNo5ypsj8sjqbjG1l1gWrym6AVA3NFtAtotZSuvpI=; b=Nlnp3Tt7ggn57HIpiVd8CvV+0ugogeUYN+jELykDDIxebKZC9XGaCn5KFR486E2X0k qTx3JF5rJfvLifnrCOLM80QF0/ZUXpj5nColqtphIzI++D/sVniQAqq5vQ+lPX47gGkA KBx1AgXROK6AfhviJCRB3xoaB4DF7ozHk+wv4BVfGJqH8XobD3FiaCb4UKX9nrOUzTXu i11tyLLgMm2rzWkr87NZCzemjsM24C4BE5tcLfHA0VpF2C3RHWIXr3h5xxSvYHSrcYbO 02uaWF3TKJSebcR1dNamHmOMRypwr41nJ2MOU+VFXixo2Hs3A9/C/H/yO/zDAFISzX/K 8GVw== X-Gm-Message-State: AOAM531yx760ja3yIFmW5n/5PG/ykmXFSNo0ablQ3Idb7/7i8Ujvq8Jr qylPGpq5obQlUylrePr1dcu1etL99R+xwmBf4bQ= X-Received: by 2002:a1f:2f8b:0:b0:357:8887:811 with SMTP id v133-20020a1f2f8b000000b0035788870811mr4393420vkv.0.1653398115473; Tue, 24 May 2022 06:15:15 -0700 (PDT) Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com. [209.85.222.52]) by smtp.gmail.com with ESMTPSA id x184-20020a1fe0c1000000b00352a7e95666sm1479777vkg.29.2022.05.24.06.15.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 May 2022 06:15:15 -0700 (PDT) Received: by mail-ua1-f52.google.com with SMTP id n24so6240512uap.13; Tue, 24 May 2022 06:15:14 -0700 (PDT) X-Received: by 2002:a25:e7ce:0:b0:64d:6028:96b9 with SMTP id e197-20020a25e7ce000000b0064d602896b9mr25151338ybh.365.1653398104009; Tue, 24 May 2022 06:15:04 -0700 (PDT) MIME-Version: 1.0 References: <20220509233235.995021-1-dmitry.osipenko@collabora.com> <20220509233235.995021-8-dmitry.osipenko@collabora.com> In-Reply-To: <20220509233235.995021-8-dmitry.osipenko@collabora.com> From: Geert Uytterhoeven Date: Tue, 24 May 2022 15:14:52 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 07/27] kernel/reboot: Add kernel_can_power_off() To: Dmitry Osipenko Cc: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "the arch/x86 maintainers" , "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Linux Kernel Mailing List , linux-csky@vger.kernel.org, "linux-ia64@vger.kernel.org" , linux-m68k , "open list:BROADCOM NVRAM DRIVER" , Parisc List , linux-riscv , Linux-sh list , xen-devel@lists.xenproject.org, ACPI Devel Maling List , Linux PM list , linux-tegra , Linux-Renesas Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Hi Dmitry, On Tue, May 10, 2022 at 1:33 AM Dmitry Osipenko wrote: > Add kernel_can_power_off() helper that replaces open-coded checks of > the global pm_power_off variable. This is a necessary step towards > supporting chained power-off handlers. > > Signed-off-by: Dmitry Osipenko Thanks for your patch, which is now commit 0e2110d2e910e44c ("kernel/reboot: Add kernel_can_power_off()") in pm/linux-next. This causes the "poweroff" command (Debian nfsroot) to no longer cleanly halt the system on arm32 systems, but fail with a panic instead: -reboot: System halted +reboot: Power down +Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000 +CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.18.0-rc7-shmobile-00007-g0e2110d2e910 #1274 +Hardware name: Generic R-Car Gen2 (Flattened Device Tree) + unwind_backtrace from show_stack+0x10/0x14 + show_stack from dump_stack_lvl+0x40/0x4c + dump_stack_lvl from panic+0xf4/0x330 + panic from do_exit+0x1c8/0x8e4 + do_exit from __do_sys_reboot+0x174/0x1fc + __do_sys_reboot from ret_fast_syscall+0x0/0x54 +Exception stack(0xf0815fa8 to 0xf0815ff0) +5fa0: 004e6954 00000000 fee1dead 28121969 4321fedc f0d94600 +5fc0: 004e6954 00000000 00000000 00000058 befa0c78 00000000 befa0c10 004e56f8 +5fe0: 00000058 befa0b6c b6ec8d45 b6e4a746 +---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000 ]--- On arm64, "poweroff" causes a clean "reboot: Power down" before/after. On both arm32 and arm64, the same handlers are registered: - SYS_OFF_MODE_POWER_OFF_PREPARE: legacy_pm_power_off_prepare - SYS_OFF_MODE_POWER_OFF: legacy_pm_power_off On both arm32 and arm64, legacy_pm_power_off_prepare() is called. On both arm32 and arm64, legacy_pm_power_off() does not seem to be called. On arm32, both pm_power_off_prepare and pm_power_off are NULL. On arm64, pm_power_off_prepare is NULL, and pm_power_off is psci_sys_poweroff. Do you have a clue? Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds