Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2699708imi; Mon, 25 Jul 2022 06:08:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ufmcYd2gCUuOVR1FQwYj0ivlKk39OIWgq3q/hVmeiF4pjWReYzqtRjk7vkxlrdLsWCcTCe X-Received: by 2002:a05:6402:48d:b0:43a:cccd:89d9 with SMTP id k13-20020a056402048d00b0043acccd89d9mr13539354edv.257.1658754483638; Mon, 25 Jul 2022 06:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658754483; cv=none; d=google.com; s=arc-20160816; b=sTWtxchuODn7Y3hF33SyS4tjb52PqtcahhbKzaomBrzQWlMvY7nJ4ag88T2UtfbZxN 7DLT0aK/mcBUKmAQHlBh2oUO5T//sVqWL5aGmuxT7HeWKN7XSF7jBV3o+CYLEMWXTxso FQKpt/MEhk0gyemL/d1PiAvNW9pZeKlAE28MDJMGIEfl1n5HWidh/SsFVFuWQIj9uWjl MAUtptdEy8ku/2HtVMLSq02BVe7aE1T4Yc1YJyobrF8VkJlRt1klKUsIqn4gdnuwKuKi DgAFspMHUZMoxWQiY49gNoSZSZ9YT1MTnRYc3n4iVAASSAUm7r7RCBpHInIGL0qrNBGK oZfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:to:subject:message-id :date:from:in-reply-to:references:mime-version:dkim-signature; bh=K1ITrs/3nl+xE/Yfbk4CyeI9gLu4fBlugQ+Op18RwEo=; b=u4IRHheqRBhGSW2FVxEk1A7Wu0iBoDkdYrzzf538gFhfI/BKpMbrb4NEs7KkO5ZgL8 jqVLC1MqQGZYDccChEBpvDyRvmdukPXAznxccvbGiqPQcKQ8ijK2DlAtJQovJMIBZy3d eArlhrv+/1ag6u5l3joTYX1LpQjQYan9c1y1CQCmfZxjzUoBtLBEftcy9jcFAHMb9ty5 ZM8fRZGjju39kCUgnwrptTSGs+9Oqndo5xe/XKuqcnzPOGs4nypoIXnFQWfKfcxUQqqo q1+M8kcj4PXW3oK4tL7TDxqME9fSOH3wsUvHGdky9tP2ycqU8kqDHcJEVkiZSHhk3KTd oOog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=Viks4IIR; 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 sg12-20020a170907a40c00b00718d0604af4si15802044ejc.604.2022.07.25.06.07.37; Mon, 25 Jul 2022 06:08: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; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=Viks4IIR; 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 S235333AbiGYM4Q (ORCPT + 99 others); Mon, 25 Jul 2022 08:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235347AbiGYM4O (ORCPT ); Mon, 25 Jul 2022 08:56:14 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB14E10555 for ; Mon, 25 Jul 2022 05:56:12 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id h16so5634674ila.2 for ; Mon, 25 Jul 2022 05:56:12 -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 :content-transfer-encoding; bh=K1ITrs/3nl+xE/Yfbk4CyeI9gLu4fBlugQ+Op18RwEo=; b=Viks4IIRJYdGaRdNNhZJSS4QCZuro1vO5jXzwN1XMWCzk1AhqLIHLomoCiKA3REMQ3 7Y3RUhcK0DcpGy8C9t0AwgJ5DPii3RP7ZKCBbp9bwJGbuBoC93nYqDdI9KmkucZel15H tomJCRRcJd+f93KkHYrlArxcw3p+xT+wOAXHIxlNm6/G8MQH0aY53XIv12kisSjKQvjg +zSkL28kOhwo/5mQNmOPDrmOnf4dUCoGsdtWNIJPjAisx2JSk2vaB5MC9+3wZFQrcRTx 2BIAW0DcAmfL2As8NYMPBsGkqX4xuvNdUXoBt/D+A37peS9DDUdXV+X0LNh0++NCW+wd F0+A== 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:content-transfer-encoding; bh=K1ITrs/3nl+xE/Yfbk4CyeI9gLu4fBlugQ+Op18RwEo=; b=hGXfTTtflNI453spWmhB+j9pei1ntkhY4nMPVrokEIDaxHB7Hs9PmPb7mvvMnvHg/m giOsewi/dDCHdYyiXCSyayUda8Eh2dRBGwZbONDUeEAaKtjIK1jptltQtRHQX1NWarSZ r0EenBFiM0hdU6hUbRCEB+5XePRjA/lxxreW9fBkWXLmWtmt3FePTpk1pL7hMY30dfU4 blzlKBprKcG4kGiwn+K+VSHiND9vfnYrW268pTTe2S1X7OtE+dnMp/iajNEDoHLpqO+o FGcffhTpPtQnWO+ldBBCEBopzBgLSskWqPOePteFPJAbymdinVZx8u3vfe+EE6v6tBoZ KSXQ== X-Gm-Message-State: AJIora9IrqKRYDQwCaoIg5J5IZwuiTvSVEzvrgH6AIWrGw48HBTu5QB/ pu3dIJzpkYR4p5ZYVcXYXE1SlHMOGyDpfqsDXDKJQaubWHQ= X-Received: by 2002:a05:6e02:1e04:b0:2dd:46f6:87ae with SMTP id g4-20020a056e021e0400b002dd46f687aemr2398727ila.36.1658753772107; Mon, 25 Jul 2022 05:56:12 -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 20:56:00 +0800 Message-ID: Subject: Fwd: [External] Re: [PATCH 1/4] kexec: reuse crash kernel reserved memory for normal kexec To: linux-kernel 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 ---------- Forwarded message --------- =E5=8F=91=E4=BB=B6=E4=BA=BA=EF=BC=9A Jason A. Donenfeld Date: 2022=E5=B9=B47=E6=9C=8825=E6=97=A5=E5=91=A8=E4=B8=80 20:02 Subject: [External] Re: [PATCH 1/4] kexec: reuse crash kernel reserved memory for normal kexec To: Albert Huang Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , 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 , , , 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. - 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, order= ); Nit: reserverd -> reserved Jason