Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10068352rwb; Fri, 25 Nov 2022 00:11:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf4sXaiyEieD1r4HxO08LGF3bIGcPQVNsIeR5lns1bnBZRhf1/555u9d98js1IRtaYxJX2bq X-Received: by 2002:a17:906:2650:b0:7b2:c004:55fe with SMTP id i16-20020a170906265000b007b2c00455femr25512781ejc.742.1669363907005; Fri, 25 Nov 2022 00:11:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669363906; cv=none; d=google.com; s=arc-20160816; b=hxOsUTjvTDzMY4vGoRmIVbfAUeEJzCdm3/vHkNVbSbZVc5HS1h1N49QkQnqItrBiIj DzQw9uXZdxj6GRd+SiUwRYmtzQvBNVyo+izicit3O18gZU5xuBKd90eiQZGbe2ZjeeUV S9wRhx3ICliWDyl11qsYOhz5MJTGoEf/hcFUmrHQrBPIbi2NZrJQXbTO5NuH13XEOgVv NyNBB85lxN/hsbCXjNO65saJfttNG2lmogpvL+7C+/s5jia9rvZllPN/vTiPFYdan4TN F25i0fKjPY9gzl4T+XsgGKTpdrP4POVWbS7O6bTCHOfnTpxfAX9iD7YgzCiUz7+QdseH /XDA== 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=TRPsBSBQyhfeTTaChHcuZm+Fmx8hS4Qa4uHyK8Jl77Y=; b=u9HcVg1yR4V5h1qwGxPZvs2LtZoZh68qU/sPLiWt7hrnt1EiQOf5331ISM2NgTOOQY 6qODEJ9eiJR6UcP//QufDeNOh/RcVKczkHaNiKt2TGuMTFSsmbQ33UknItGuA9eVE/7R Pvnp5jDK+Dq1+auRevFYtc3flrWPOBtCXO36QPEyaVTGN1hlqRRlLzdRCV+yuJovNdqs iVC+CGK41tZllspIFcs3JKDxaYRJs/JF2xsG/32vDAghMNzIMiRRJ3+PZOyxcPW8vPCV GE7iX61uMf07JB+CsROzPkgXbPDK7BxybZzfI4lPWMnW5HE8Kg75+vTQvANdipVOQJMs aASQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ELkayWi2; 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 ec18-20020a170906b6d200b0078198611a45si1675218ejb.980.2022.11.25.00.11.07; Fri, 25 Nov 2022 00:11:46 -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=ELkayWi2; 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 S229527AbiKYHtR (ORCPT + 87 others); Fri, 25 Nov 2022 02:49:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbiKYHtQ (ORCPT ); Fri, 25 Nov 2022 02:49:16 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22BB51BEBB for ; Thu, 24 Nov 2022 23:48:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669362500; 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=TRPsBSBQyhfeTTaChHcuZm+Fmx8hS4Qa4uHyK8Jl77Y=; b=ELkayWi2evqwTowyYogmal+K8OT9r7hLGGznKw2gADG8gChPrCLBB7VlrxZ1i2XxW7DEtV j/MQn+s9/4L82wUBYhiqIyjEu48QPH0G/zfrigh23RDh5xkEstDpscDrnByYu+gJYeYm9V e7uOjCrs+8z/O20BPZBjz84F/PHZ+ZI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-616-Ynv4YcXcNXW3Tw_BrTn40w-1; Fri, 25 Nov 2022 02:48:17 -0500 X-MC-Unique: Ynv4YcXcNXW3Tw_BrTn40w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A429D180A38D; Fri, 25 Nov 2022 07:48:16 +0000 (UTC) Received: from localhost (ovpn-12-208.pek2.redhat.com [10.72.12.208]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E44D240C2064; Fri, 25 Nov 2022 07:48:15 +0000 (UTC) Date: Fri, 25 Nov 2022 15:48:12 +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.1 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 08:31am, Ricardo Ribalda wrote: > Hi > > On Fri, 25 Nov 2022 at 08:27, Baoquan He wrote: > > > > 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. > > If it is not valid, then this condition is not met. Yeah. BUT, even though it's valid, below condition could not be met either. They are not the same thing. > > /* Ensure we are within the crash kernel limits */ > if ((mstart < phys_to_boot_phys(crashk_res.start)) || > (mend > phys_to_boot_phys(crashk_res.end))) > return -EADDRNOTAVAIL; > > > > > > > -- > Ricardo Ribalda >