Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2717888imi; Mon, 25 Jul 2022 06:34:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sPC9k9aZz/46wtn/pMuG00eiw+XZ2xT/mo3g2a8czfharKDX71sl46alaaI5PtZNTHJDk/ X-Received: by 2002:a05:6808:1717:b0:333:513e:650e with SMTP id bc23-20020a056808171700b00333513e650emr5685939oib.23.1658756069897; Mon, 25 Jul 2022 06:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658756069; cv=none; d=google.com; s=arc-20160816; b=ntGuJ7xWqDqvsaa+EeRnWL3I6dQGoHRhhEQlYVswY65sI85Shto7gs/00qF/oJW3Qo KOBJsO7LYwqyXbgldTIwlx3QEj2obAoZBk40udCwY4OG2mmhqM0WDNwwA1UBzT9zoDpL xllBcnBiyHuRw+m3x2NuPRBRxi2jNiGiLsquB6Zdfk19BrMLAdoQ5eInf02vMiIrVzKb GnwezfdsOZ5JH6cOv+jHubS4qmiYoFuP5S5njGwCCwPwDhWdlYE297mRwPSCXlNHnXcX F8x6PBfoJjcT75Ro2OkQAJ9CuNFjBrxUdUeoS0IyyzofDXSwZ8g2QZYStyPI9PfU/p4S N2Ew== 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=kqgRYaQ+5Ei5P1sHb0JfmZ6zpThHEKr7E+RUOHeaoYM=; b=fbA5i0Ck3JTPNTQ+KcjpQWiJVPo2EK4s6c0bx4dfDOMqIiG5CTtWKSiHyBP2L2c/4k 1dTNrRf0meLNU/LlCdMdMWvpzT2mPDtsunPs8AeGrH1wgpc2yS/JmgNAl4FvWOoGhdQo bekOnnkOipLSrpSwfJMD9YoGYXpKGm4wX5M5R1w8RZdgCbfS21ga5/GN2BJNe8Foo1W6 cnubZhffx5nm9DG78Q6t/Ak3qaxNPaxv+AFbZXpokYs85oxKXPIjNWzoSumwHPPa8afm AArZYfAwbS/je5erWdTp415IDWL1xDlWHmb0FnY78eFToOaRRSrLeuslNECVr9/5o0O7 hs9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=jy6Ofg3I; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a9d0191000000b0061cbdb5a60esi10147059ote.66.2022.07.25.06.34.15; Mon, 25 Jul 2022 06:34:29 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=jy6Ofg3I; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234382AbiGYNa4 (ORCPT + 99 others); Mon, 25 Jul 2022 09:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbiGYNay (ORCPT ); Mon, 25 Jul 2022 09:30:54 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F07F8D11D for ; Mon, 25 Jul 2022 06:30:52 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id v2so2290917ilm.4 for ; Mon, 25 Jul 2022 06:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=kqgRYaQ+5Ei5P1sHb0JfmZ6zpThHEKr7E+RUOHeaoYM=; b=jy6Ofg3IZ4r4qf3yeNRhJBzx3l0jYTUvPpUQxq9PzqtaRD5mYFBt27ndkR5BopQFDq PJKLlVqdlkVPeCmFpp7LFGlCrHLts4jS8J9KyCpYTEscdTQaFpSBg75OaFNOEWEKsCG1 ekNRnLJP3HClMuPZiFlGhJCRs9Mo5mcYiCHj9W99lrh2JkzOHiVq//SorMjsnVNegZvU ed2eMd6CYWmY7q3zoeGDpG32aanOs7hpRCAVlH4AJ+rj0r3EWVc7flluL0scu+cVjh2o CHzt3i1f214fyDZgk+n7lwVjQugC8qOhB7UFJvxpyS+gHUgxj/SzyFD6hvxok626BOEq VZ8w== 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:content-transfer-encoding; bh=kqgRYaQ+5Ei5P1sHb0JfmZ6zpThHEKr7E+RUOHeaoYM=; b=V2oLXVKxvToSxd0SKlmKDlHmxCe6Vismn+Cxg8O3wfDxnIDZb/xRYDtsPa96SYja8r zTyVHIXN778HoIFB4+3atLrbh0afYHQi8FY4OfDzM2XLWsAAjLMZp8oLp7sfHRxQhouh bTJQA/CilQmH/fEJkxZLbJ75zIx6R6V2zGPSPom0b3DelJTJ0XrCAUNZfvWficVTW5j5 vhnRtoNzonl74pjFrbnO6+rK1YG+BaWeBnYFYJYMimBuGDWkmxsvqlbW+HKZHArAaAAk h21qH4EGMYGWoJwIzNF0kvBod2s+2qy7FLSaNDNrbZljYdUbILhgL8kCWoiUszOUWsEN nzjQ== X-Gm-Message-State: AJIora8tadEWzu7Pteuc6S89Rdl+S2VTy1i2Nf4619ZiiApy1LjN70uF 8+Vtxud/VOhLbiLS485OGU+HGU8ILK3rYobuIJx0Xg== X-Received: by 2002:a05:6e02:5a6:b0:2dd:164c:15a2 with SMTP id k6-20020a056e0205a600b002dd164c15a2mr4895579ils.105.1658755852411; Mon, 25 Jul 2022 06:30:52 -0700 (PDT) MIME-Version: 1.0 References: <20220725083904.56552-1-huangjie.albert@bytedance.com> <20220725083904.56552-2-huangjie.albert@bytedance.com> In-Reply-To: From: =?UTF-8?B?6buE5p2w?= Date: Mon, 25 Jul 2022 21:30:41 +0800 Message-ID: Subject: Re: [External] Re: [PATCH 1/4] kexec: reuse crash kernel reserved memory for normal kexec To: "Jason A. Donenfeld" Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Eric Biederman , Masahiro Yamada , Michal Marek , Nick Desaulniers , "Kirill A. Shutemov" , Kuppuswamy Sathyanarayanan , Michael Roth , Nathan Chancellor , Ard Biesheuvel , Joerg Roedel , Mark Rutland , Peter Zijlstra , Sean Christopherson , Kees Cook , linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-kbuild@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 Jason A. Donenfeld =E4=BA=8E2022=E5=B9=B47=E6=9C=8825=E6= =97=A5=E5=91=A8=E4=B8=80 20:02=E5=86=99=E9=81=93=EF=BC=9A > > Hi Albert, > > On Mon, Jul 25, 2022 at 04:38:53PM +0800, Albert Huang wrote: > > The kexec userspace tool also needs to add parameter options(-r) that > > support the use of reserved memory (see another patch for kexec) > > > > [...] > > > > - if (kexec_on_panic) { > > + if (kexec_on_panic && kexec_on_reserved) { > > Two small questions related to this: > > - Why does kexec-tools need an option, or more specifically, why does > userspace need to communicate about this at all? Can't the kernel just > automatically use the available reserved memory in the case that's not > already being used by the panic handler kernel? I'm curious about > whether there are caveats that would make this occasionally > undesirable, hence suggesting an option. Because the crash kernel will also use this part of the memory, so do not use this mechanism unless explicitly specified. So I tend to add an option > > - I don't totally understand how this works, so I might be a bit off > here, but is there any chance that this could be made to co-exist with > kexec_on_panic? Can a larger region just be reserved, specifically for > this, rather than piggy backing on the panic handler region? > > > +static struct page *kimage_alloc_reserverd_control_pages(struct kimage= *image, > > + case KEXEC_TYPE_RESERVED_MEM: > > + pages =3D kimage_alloc_reserverd_control_pages(image, ord= er); > > Nit: > reserverd -> reserved thanks for that, I will correct it > > Jason