Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2921445rwl; Mon, 27 Mar 2023 07:06:02 -0700 (PDT) X-Google-Smtp-Source: AKy350YDulTBnji+hUA2+4z5V36bWPsb7Q9DEb3nDlH1C9NG3isLLrxt2FrkNCfLjwYPZ49YqJpp X-Received: by 2002:a17:907:a424:b0:93e:6f40:d141 with SMTP id sg36-20020a170907a42400b0093e6f40d141mr13288391ejc.40.1679925962471; Mon, 27 Mar 2023 07:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679925962; cv=none; d=google.com; s=arc-20160816; b=vyZPwXCtZAR559o32nJBjHen057KA4RUOm57tktYKkYaPYbWtWvhax+GaqDYssJL2G saB5uFdNaCawH8yUSJFzyY0IOafI58fumdHB808Jo5Y2AD5+o6zeJmzveaMnHCR+CPfR yy4DVaGLWExrGFV17rNKW5cOsrJlgsIp70KCHSpkqdEv6Yl1toXqTSvIrGEUOF9peqtX uAZtftXKw/AnSVHMI99t3kHFaMz4/bcUs0snct1jXTC1sIma9pbhffz7Tjy5n3I6dUnX slMqScHFS23PkvWNSQdhE1g9NdS5sINgZqE6jQJ1e1FL7C5CaQfKMGovQUquBQYMHcyO BisA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=RbQS5zutEzfJYNaqkxdL9nLc8p49ExIzbuyhSxQJkfQ=; b=0uDbw3RcyYDhULx3CR2bY8cJ1aAAmPkxOsd/3FAT7I/ZR7f+w2yw9nEqd2v5h0RoF3 5A3GidUFNgi5NCMGyDbxFCpAsBK/kohE2DLQ5HfJ7MLi88ExwWAGndzz3Qd/VuaUqRkt TSgbUK9fb2UPMhNpcYz+mDgPqD8HBNXD5fEKtJOzbJ58B9F7e6lvUscW2AaAkMkB6iQp use5jw+O4lsEe0rrQMegzorvE1TwruS1U4gWLdlo2bWySO+JG/yPSq38A5q2KJjzvYxn e3imtNIlNaM/heoKcT5yqKAPJC6zrLOt6KB5nQH7Fno3ThI00j6+zV6e2DaQ4Gf2cXNV NWUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p5LsK61h; 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=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc9-20020a1709078a0900b009453c586fbcsi2345804ejc.135.2023.03.27.07.05.36; Mon, 27 Mar 2023 07:06:02 -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=@gmail.com header.s=20210112 header.b=p5LsK61h; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232904AbjC0N6x (ORCPT + 99 others); Mon, 27 Mar 2023 09:58:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232806AbjC0N6Z (ORCPT ); Mon, 27 Mar 2023 09:58:25 -0400 Received: from mail-ua1-x933.google.com (mail-ua1-x933.google.com [IPv6:2607:f8b0:4864:20::933]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43D8F40C6; Mon, 27 Mar 2023 06:58:25 -0700 (PDT) Received: by mail-ua1-x933.google.com with SMTP id r7so6422367uaj.2; Mon, 27 Mar 2023 06:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679925504; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RbQS5zutEzfJYNaqkxdL9nLc8p49ExIzbuyhSxQJkfQ=; b=p5LsK61hvAoejly5RT/XyubS4vTQm18wYHk3CjXYFXxwe5WX8NNfuS7Dr+gaiJkmks tkTOXdg6tNNvzI0lITqEyBjFK3TjIT6dSnriLci/3Vj96A1VGpXj1UG3oh2YWpyewNI9 D6Z8tbVj+drESfGNNqNPucxVRUq0PqKP0crtiLdrbDq28wXsArvatYR8o7YB0bqa2LSk gb6Aqs5nulHXHo/GOZl4zXkr7bIbCwzGdLScArHGNYNM/5ZRhjm8v8grrl/m3TfdoMz7 7Gv1XJmoLRIPN0198jz3giDHmhJZPS5ozrhk0fbu3RBqfXxgEJ3PaW32WXmRrFc1iq5i fUjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679925504; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RbQS5zutEzfJYNaqkxdL9nLc8p49ExIzbuyhSxQJkfQ=; b=Sb8GRT7XkIR0g69wStEboFMNTzqwlsSg+tWIxdNzZGl+Xn4m7Jj6+aIh5azBxWkPmZ KAC9J1DB1alHlZ5dY3yeqMEZQeYvbh0ha2jyTruPRWNuzyfGqpMmPYBaanHlXlBvMwE6 9iwZQ79fNutVyoCg/6pMHGX/c4kJw25wmqKAIHt7cpaie7MYYXfedrovXN0gWnp+/nPA D93ahTmoxO7caDXvhs6AQeODOUOlWQ1o4dW4yId1JZuXOSV1mLmG0n3UZwifJWVpQXkD gyD1M/CJAH2FxAAwdXiZMAPq89I70AbSlM3Q31POjJHmEl1x/dJfdNIVDZjrK6C+cE+g Lm2g== X-Gm-Message-State: AAQBX9dn1/VBg3/GirkIlFCDkr8yRoMfx7p0Ui2oEjo6k/1F43LKuscD YNjXZYTyKFpqNbu+bIfFBb0= X-Received: by 2002:a05:6122:1801:b0:432:6c1:3aa8 with SMTP id ay1-20020a056122180100b0043206c13aa8mr4715979vkb.16.1679925504296; Mon, 27 Mar 2023 06:58:24 -0700 (PDT) Received: from [127.0.1.1] ([91.230.2.244]) by smtp.gmail.com with ESMTPSA id 135-20020a1f198d000000b004367f3393b8sm2731072vkz.28.2023.03.27.06.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 06:58:24 -0700 (PDT) From: Benjamin Bara Date: Mon, 27 Mar 2023 15:57:43 +0200 Subject: [PATCH v3 1/4] kernel/reboot: emergency_restart: set correct system_state MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230327-tegra-pmic-reboot-v3-1-3c0ee3567e14@skidata.com> References: <20230327-tegra-pmic-reboot-v3-0-3c0ee3567e14@skidata.com> In-Reply-To: <20230327-tegra-pmic-reboot-v3-0-3c0ee3567e14@skidata.com> To: Wolfram Sang , Lee Jones , rafael.j.wysocki@intel.com Cc: dmitry.osipenko@collabora.com, jonathanh@nvidia.com, richard.leitner@linux.dev, treding@nvidia.com, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, Benjamin Bara , stable@vger.kernel.org X-Mailer: b4 0.12.2 X-Spam-Status: No, score=0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 From: Benjamin Bara As the emergency restart does not call kernel_restart_prepare(), the system_state stays in SYSTEM_RUNNING. This e.g. hinders i2c_in_atomic_xfer_mode() from becoming active, and therefore might lead to avoidable warnings in the restart handlers, e.g.: [ 12.667612] WARNING: CPU: 1 PID: 1 at kernel/rcu/tree_plugin.h:318 rcu_note_context_switch+0x33c/0x6b0 [ 12.676926] Voluntary context switch within RCU read-side critical section! ... [ 12.742376] schedule_timeout from wait_for_completion_timeout+0x90/0x114 [ 12.749179] wait_for_completion_timeout from tegra_i2c_wait_completion+0x40/0x70 ... [ 12.994527] atomic_notifier_call_chain from machine_restart+0x34/0x58 [ 13.001050] machine_restart from panic+0x2a8/0x32c Avoid these by setting the correct system_state. Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Benjamin Bara --- kernel/reboot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/reboot.c b/kernel/reboot.c index 3bba88c7ffc6..6ebef11c8876 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -74,6 +74,7 @@ void __weak (*pm_power_off)(void); void emergency_restart(void) { kmsg_dump(KMSG_DUMP_EMERG); + system_state = SYSTEM_RESTART; machine_emergency_restart(); } EXPORT_SYMBOL_GPL(emergency_restart); -- 2.34.1