Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp913473rdg; Wed, 11 Oct 2023 08:53:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfoJjWPlOz45x7pwPnzZo3/f+EnA8ypGG4j5DFwlpANZ6L5C7k3Iz9dUsYEVQqyhs0xDc3 X-Received: by 2002:a17:902:ab13:b0:1c3:eb95:2d27 with SMTP id ik19-20020a170902ab1300b001c3eb952d27mr18981376plb.48.1697039606756; Wed, 11 Oct 2023 08:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697039606; cv=none; d=google.com; s=arc-20160816; b=nHLhC3V4hpZC/fdbkIkIQRS/usSUbh9GhjMNH8wDb37TqxozHlhNm/TVah/YDQU3Rd cwjBkBoVT6auSwUKA4CoBG/XYL+kn1KpKCs5Q9ZE2zUqVExhaTfbq3BZHYCY4nxvrlWA pen/x0VBZ+PBRCMrcdEUoKNbl09z44200DQKKte8HZe/v85yRqclzTk/rya5YjKjd6Em k4NiTueVuSJCbecqxtFNQXylG8g21jCBeycUqUzQULJLlGCJXeVYpqVtp73pkLUN1PX0 L35znWl5KWZ1NzZGIKckPOhHYHOIZUgUNSuZWXH39wJicfzr0TtTgCGuvq7kURN0LIsj 8+Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=gHhDRJtv88GUtolhSfk/M6EnhLggiBTlRi1I9TUAYxE=; fh=EK5j4NE3tdK2qtiZ4GqEgPMWRvXaVAEy+Qf+/JiMopo=; b=NCAt2mRnp8aJYwIcGnC3Cq8M3zwTWrLgsmdboXta1l5NVSJKg5Q/OKDiPRk7LfTBo2 hmNCz6DOP4d9foyLZVD2dUGtimVCrAz7mZchoD4Ft2N75ee9mXfCemcRvKxdWQZZHQj/ 7Ve+WlKtEUaq3n2pjzp2u0wk6zRbIf4LAh2H030nPFsYlB56mtkW04q1MtbMFVrTR2B1 72B9aMwTvNbRQc8MV6sRC/1eFxrlxYZrEOhdUMNy5E8LB55Y6gg930pjiUNg9GOPYVZ6 dGrWDiMIwvvu2/Iikx5IY9DBA2ivd5tljzGFxPKd/UXK8KHe078cVyIYRSvZ3iOMf+Ky b8TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=co58F206; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x15-20020a170902a38f00b001c0727658c3si1262766pla.259.2023.10.11.08.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 08:53:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=co58F206; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BDF3680E8FDD; Wed, 11 Oct 2023 08:53:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234961AbjJKPxN (ORCPT + 99 others); Wed, 11 Oct 2023 11:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232739AbjJKPxM (ORCPT ); Wed, 11 Oct 2023 11:53:12 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1CB891 for ; Wed, 11 Oct 2023 08:53:10 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2c1886777d9so83891091fa.0 for ; Wed, 11 Oct 2023 08:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1697039589; x=1697644389; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gHhDRJtv88GUtolhSfk/M6EnhLggiBTlRi1I9TUAYxE=; b=co58F206CZ9+NcaDf4wM4feBhvMARKMv8mlCrVgeTav2i25nnvWVrKRowIBWkNEqRE ifhVdsNvZSLRVqpbu3RK4mxV968et59q3cCrjLG5mrGRfgw7SOO5DbUb36otU6yiIB7M p4kOmn5//QjnD0KXcaSa/Z52FOw2rbFoABLwA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697039589; x=1697644389; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gHhDRJtv88GUtolhSfk/M6EnhLggiBTlRi1I9TUAYxE=; b=fh+u2ik/dg1vVBKf+IP9QtgeH3mAJc88fmDcOw5TXykMns64Y1OpSSJUww8W4b8Nji Jgn8WM8eIxeh6AhA+rCfbUFsosSp11Z/GTvew+h8H3cYrQBVl2eG+AlnXshl+ZVEhjqQ 6rsKKdcFz17XJiuNAX8JB7QY6wTCl9cj0el8obhpX7Jt6vt7uRnlKuX6bMKRw51GIcfL RQM1HH1RUUFq4TEG0vNrsMR882Bo+/oQ/pg6AKiEgvS8s6pmYVxZM3NDCg42tFjYrXN+ IaWkgDMqkFQMXeCKlM5gCvoJYl8t03EIm4RUYlkQnOtmpNRBEEnhoyjhnGY3gPC6vVzF 7Mdw== X-Gm-Message-State: AOJu0Yzc+Lb2MIn0kSStxVp+W8SURiUQQLvbz5+/FZACjDUFqIKtUZgs HDl1r1heH3XAzhmkKnaltsWIn4A/ntEEY3UrAeQDcA== X-Received: by 2002:a2e:b781:0:b0:2c2:c38b:2141 with SMTP id n1-20020a2eb781000000b002c2c38b2141mr17098551ljo.49.1697039588905; Wed, 11 Oct 2023 08:53:08 -0700 (PDT) MIME-Version: 1.0 References: <20230929021213.2364883-1-joel@joelfernandes.org> <87bkdl55qm.fsf@email.froward.int.ebiederm.org> <87il7fzusf.fsf@email.froward.int.ebiederm.org> <87fs2ii3tf.fsf@email.froward.int.ebiederm.org> In-Reply-To: <87fs2ii3tf.fsf@email.froward.int.ebiederm.org> From: Joel Fernandes Date: Wed, 11 Oct 2023 11:52:58 -0400 Message-ID: Subject: Re: [PATCH] kexec: Fix reboot race during device_shutdown() To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, Steven Rostedt , Ricardo Ribalda , Ross Zwisler , Rob Clark , Linus Torvalds , kexec@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 11 Oct 2023 08:53:21 -0700 (PDT) X-Spam-Level: ** On Tue, Oct 10, 2023 at 5:08=E2=80=AFPM Eric W. Biederman wrote: > > Joel Fernandes writes: [...] > >> That way you can get the orderly shutdown > >> of userspace daemons/services along with an orderly shutdown of > >> everything the kernel is responsible for. > > > > Fixing in userspace is an option but people are not happy that the > > kernel can crash like that. > > In a kexec on panic scenario the kernel needs to perform that absolute > bare essential shutdown before calling kexec (basically nothing). > During kexec-on-panic nothing can be relied upon because we don't know > what is broken. If that is what you care about (as suggested by the > unit test) you need to fix the device initialization. > > In a normal kexec scenario the whole normal reboot process is expected. > I have no problems with fixing the kernel to handle that scenario, > but in the real world the entire orderly shutdown both, kernel > and userspace should be performed. Sounds good. Since you mentioned you have no problem with fixing regular reboot in the kernel, we will work on reproducing the issue with regular reboot as well and fix that. I think a syscall causing the kernel to crash instead of operate normally is a cause of concern, so let us fix the kernel as well (other than improving the test case as you mentioned). > >> At the kernel level a kexec reboot and a normal reboot have been > >> deliberately kept as close as possible. Which is why I say we should > >> fix it in reboot. > > > > You mean fix it in userspace? > > No. I mean in the kernel the orderly shutdown for a kexec reboot and an > ordinary reboot are kept as close to the same as possible. > > It should be the case that the only differences between the two is that > in once case system firmware takes over after the orderly shutdown, > and in the other case a new kernel takes over after the orderly shutdown. Agreed. thanks, - Joel