Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10038073rwb; Thu, 24 Nov 2022 23:43:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf4+oz0Dpt+uIvAA63RAdLdmCbC772rnSDlVKOCeuadmzk7Ia2bOVxllUhGt+dBG5tiBOgR5 X-Received: by 2002:a17:907:a801:b0:7b9:e634:ca0d with SMTP id vo1-20020a170907a80100b007b9e634ca0dmr9680723ejc.146.1669362223636; Thu, 24 Nov 2022 23:43:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669362223; cv=none; d=google.com; s=arc-20160816; b=DFTT+4KsPJOnZmnZ5lfRZKmz302w24mCd5m/ApuRM4Ix6hv4HqJmytdT/8QE+9c5Yh GQ6nzgC0WkPLqCQg8GCr+dDETSbzyzmAxL+WA00aCzDQhlPTMfWkxR/W7lJU6P6IKjwj krbqGcd95vShCmHDCyQc3QFEXtvoWFw9d4VfPCI99U6XoMtwaJFu+pekQ2tLG2m6+qzX Wcb+vP2rFjr5LtEG9b9fqk/9Ex25FelVqDSlaq3aF+wMa4q7dgElxYqXOVd3Hc6jQm6K kfepmhdFSYv/x9nFeWnsyZFOvzgRPw5fw4meadgwQ91waXQFX4SCwb3hYZjDuvQY7Y/q Fskw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Or7i4dKnedRAsO/2QFJniL+oZldKo89g5PbGYo46z1g=; b=Me4x19oXDmBj60hUxFQPjd2FoVf+ApCXV2pyhr+fEtUNMzMUDn3njZZb+K87nhWl39 6A5VGvAIfGHZwBQUOqe+uj/A5pIqM1o4+PM/tNQHILYd587CfdBoSYW5S4ktJhGZXCsn 89oVKbRJn34K0bMRHFJX0Kh0NgGU9M8OyH/IrcIoqRXUbSSdRIGazKyudidVRbzWLSk1 Uvbzm5KZKgML1oXSq7MIMbfkHdKUvnYrCunYk+YeZN2IijTagOw1GXgViBscRB/NKvSr 1aY3Lr2DNdzKv7QOSPS0T/I1rQyypz03noOEiOBL28043rierKvKGsxyJjsBtofZN7FY xMwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h0+ZYtpI; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a170906974900b0078223ff2756si2955921ejy.244.2022.11.24.23.43.21; Thu, 24 Nov 2022 23:43:43 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=h0+ZYtpI; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbiKYH2s (ORCPT + 88 others); Fri, 25 Nov 2022 02:28:48 -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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 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.