From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04F52C4332F for ; Fri, 25 Nov 2022 07:28:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229628AbiKYH2t (ORCPT ); Fri, 25 Nov 2022 02:28:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbiKYH2r (ORCPT ); Fri, 25 Nov 2022 02:28:47 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA61CE0E for ; Thu, 24 Nov 2022 23:27:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669361269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Or7i4dKnedRAsO/2QFJniL+oZldKo89g5PbGYo46z1g=; b=h0+ZYtpIVHL9f9dLP//yQ9vScqmtO7KPJicrgpd+SCekZknzOUZttej9O8QJQe/Dh9EAPB IDdZ9qmsRchzJfvtMbZGYzyRX6U38/sRa1kzzTNpNf509v2Ql4k2z2DZFCiCU+/XKv8dTT uWrPjdIV4bD7rcNxJcOUucLRCCtmm3M= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-MXX8RZuaNa--9zDbsU2MtA-1; Fri, 25 Nov 2022 02:27:46 -0500 X-MC-Unique: MXX8RZuaNa--9zDbsU2MtA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 936F53C0F7E7; Fri, 25 Nov 2022 07:27:45 +0000 (UTC) Received: from localhost (ovpn-12-208.pek2.redhat.com [10.72.12.208]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9DD82028E94; Fri, 25 Nov 2022 07:27:44 +0000 (UTC) Date: Fri, 25 Nov 2022 15:27:40 +0800 From: Baoquan He To: Ricardo Ribalda Cc: Eric Biederman , Philipp Rudo , Sergey Senozhatsky , Ross Zwisler , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kexec: Enable runtime allocation of crash_image Message-ID: References: <20221124-kexec-noalloc-v1-0-d78361e99aec@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/25/22 at 06:52am, Ricardo Ribalda wrote: > Hi Baoquan > > Thanks for your review! > > On Fri, 25 Nov 2022 at 03:58, Baoquan He wrote: > > > > On 11/24/22 at 11:23pm, Ricardo Ribalda wrote: > > > Usually crash_image is defined statically via the crashkernel parameter > > > or DT. > > > > > > But if the crash kernel is not used, or is smaller than then > > > area pre-allocated that memory is wasted. > > > > > > Also, if the crash kernel was not defined at bootime, there is no way to > > > use the crash kernel. > > > > > > Enable runtime allocation of the crash_image if the crash_image is not > > > defined statically. Following the same memory allocation/validation path > > > that for the reboot kexec kernel. > > > > We don't check if the crashkernel memory region is valid in kernel, but > > we do have done the check in kexec-tools utility. Since both kexec_load and > > kexec_file_load need go through path of kexec-tools loading, we haven't > > got problem with lack of the checking in kernel. > > Not sure if I follow you. > > We currently check if the crash kernel is in the right place at > sanity_check_segment_list() > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/kexec_core.c#n239 And it's not checking if crashkernel memory is valid in sanity_check_segment_list(), right? It's checking if the segments are placed correctly.