Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp354346pxm; Wed, 23 Feb 2022 01:40:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFZl13t5vj6V3PL2Zo3VOkT7Iw/uKCuqlw+yx8MHEIu5ZOXbAkuINg3s8ion1UrUZEnHYp X-Received: by 2002:a17:906:8349:b0:6a5:ee44:191a with SMTP id b9-20020a170906834900b006a5ee44191amr23168066ejy.754.1645609236675; Wed, 23 Feb 2022 01:40:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645609236; cv=none; d=google.com; s=arc-20160816; b=AzgUnMvmUcPhnyPjcYxEyo5j/UJTyQGeBPdjO60/VLzIl+HbMQGRinWpwagoyqY/rS JFRdx7qQUP5h7ZKYYyaX2bFE19Vkm3W4MoyUzplYI0UkoM2FNCSl6SWUn9fYg7XMyXsD 8xBULBfWKZ7bTNXbKXG3m1J1auFvBpuPMXDE2lDm0OdZzmq8Z5R74XcPcMCdwT1+4fWa jZaO4CTifohgJN4zFoQWpa4zTRcJE//vojbcycAVObp9a3pZiTM3qgVDFrX3d2dyQ6YZ RJ5C/0G9m6HL45O9j//+ns57oEcWcQ2yzwiCqyqoQHpA13bDekbjhH4Y9QY0wmi3ufjg n1/g== 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=IyrPqz1BsumJA1M6xQYUZkQ2C6LgRTDoH7fHGR94hxE=; b=ihVxIVeVwcqQ+V5wJ11t6X6xv/bOe/RtehjXfCWNTBieES29Z5bwoaui4s2Jdj++fe OJzjp6skeROwrQq1O+Ql1gh7xHuOhcsHJOOoiuen8INQUFx9B/3KjYOFbp2iGXJL0uPt us/W4AY2wEGTuyYCzWgRdU1LO/nvfnl/K00HeBaHvbPuf1cLrK82IQL54cSuFMqMNOot xkoNjXNvAqNZgQwgjD/1FguEHQbKr2OqBAnf8/vhpSasA+IXvL/i7++v1nFWd3V3pnNx rCnKSsPnABVFUbov9k8TtguXaCwKsvW9MF9tI0cyI0JljxLx8YFmkLYh9+GNXGcV6s9n sXpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cxpZWq68; 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 l19si15117294edq.198.2022.02.23.01.40.12; Wed, 23 Feb 2022 01:40:36 -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=cxpZWq68; 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 S234141AbiBWDrX (ORCPT + 99 others); Tue, 22 Feb 2022 22:47:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbiBWDrW (ORCPT ); Tue, 22 Feb 2022 22:47:22 -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 ESMTP id ADB5B60CCD for ; Tue, 22 Feb 2022 19:46:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645588014; 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=IyrPqz1BsumJA1M6xQYUZkQ2C6LgRTDoH7fHGR94hxE=; b=cxpZWq685acJl3ZaPoZ3Fz9ND3AkPwcjC+7wzAXMBuI91meT0i/cxruyqh5mC/78C+dKbG G/sGCSG3aQnTDxTtPnt5KTC6QZvbByK+cd8Bhr61tHIsCPk7fGJ0W3cN/n4YI53mSE7FBz kB4xAptlb+DNvXbfbcoROf2hy7ICDWg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-646-rFsA4Yg1Op6pT1x-pzdmWA-1; Tue, 22 Feb 2022 22:46:51 -0500 X-MC-Unique: rFsA4Yg1Op6pT1x-pzdmWA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7AD2480DE09; Wed, 23 Feb 2022 03:46:49 +0000 (UTC) Received: from localhost (ovpn-14-1.pek2.redhat.com [10.72.14.1]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A87624ABA9; Wed, 23 Feb 2022 03:46:28 +0000 (UTC) Date: Wed, 23 Feb 2022 11:46:26 +0800 From: Baoquan He To: Eric DeVolder Cc: linux-kernel@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, ebiederm@xmission.com, dyoung@redhat.com, vgoyal@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, nramas@linux.microsoft.com, thomas.lendacky@amd.com, robh@kernel.org, efault@gmx.de, rppt@kernel.org, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com Subject: Re: [PATCH v4 04/10] crash hp: prototype change for crash_prepare_elf64_headers Message-ID: References: <20220209195706.51522-1-eric.devolder@oracle.com> <20220209195706.51522-5-eric.devolder@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220209195706.51522-5-eric.devolder@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 02/09/22 at 02:57pm, Eric DeVolder wrote: > From within crash_prepare_elf64_headers() there is a need to > reference the struct kimage hotplug members. As such, this > change passes the struct kimage as a parameter to the > crash_prepare_elf64_headers(). One more sentence can be added" "This is preparation for later patch, no functionality change." Otherwise, this patch looks good to me. Acked-by: Baoquan He > > Signed-off-by: Eric DeVolder > --- > arch/arm64/kernel/machine_kexec_file.c | 6 +++--- > arch/powerpc/kexec/file_load_64.c | 2 +- > arch/x86/kernel/crash.c | 3 ++- > include/linux/kexec.h | 5 +++-- > kernel/kexec_file.c | 4 ++-- > 5 files changed, 11 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c > index 59c648d51848..7dbafb42ecf2 100644 > --- a/arch/arm64/kernel/machine_kexec_file.c > +++ b/arch/arm64/kernel/machine_kexec_file.c > @@ -39,7 +39,7 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image) > return kexec_image_post_load_cleanup_default(image); > } > > -static int prepare_elf_headers(void **addr, unsigned long *sz) > +static int prepare_elf_headers(struct kimage *image, void **addr, unsigned long *sz) > { > struct crash_mem *cmem; > unsigned int nr_ranges; > @@ -67,7 +67,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) > ret = crash_exclude_mem_range(cmem, crashk_res.start, crashk_res.end); > > if (!ret) > - ret = crash_prepare_elf64_headers(cmem, true, addr, sz); > + ret = crash_prepare_elf64_headers(image, cmem, true, addr, sz); > > kfree(cmem); > return ret; > @@ -96,7 +96,7 @@ int load_other_segments(struct kimage *image, > > /* load elf core header */ > if (image->type == KEXEC_TYPE_CRASH) { > - ret = prepare_elf_headers(&headers, &headers_sz); > + ret = prepare_elf_headers(image, &headers, &headers_sz); > if (ret) { > pr_err("Preparing elf core header failed\n"); > goto out_err; > diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c > index b4981b651d9a..07da6bf1cf24 100644 > --- a/arch/powerpc/kexec/file_load_64.c > +++ b/arch/powerpc/kexec/file_load_64.c > @@ -797,7 +797,7 @@ static int load_elfcorehdr_segment(struct kimage *image, struct kexec_buf *kbuf) > goto out; > > /* Setup elfcorehdr segment */ > - ret = crash_prepare_elf64_headers(cmem, false, &headers, &headers_sz); > + ret = crash_prepare_elf64_headers(image, cmem, false, &headers, &headers_sz); > if (ret) { > pr_err("Failed to prepare elf headers for the core\n"); > goto out; > diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c > index 9730c88530fc..9db41cce8d97 100644 > --- a/arch/x86/kernel/crash.c > +++ b/arch/x86/kernel/crash.c > @@ -265,7 +265,8 @@ static int prepare_elf_headers(struct kimage *image, void **addr, > goto out; > > /* By default prepare 64bit headers */ > - ret = crash_prepare_elf64_headers(cmem, IS_ENABLED(CONFIG_X86_64), addr, sz); > + ret = crash_prepare_elf64_headers(image, cmem, > + IS_ENABLED(CONFIG_X86_64), addr, sz); > > out: > vfree(cmem); > diff --git a/include/linux/kexec.h b/include/linux/kexec.h > index 13c238c2da48..b11d75a6b2bc 100644 > --- a/include/linux/kexec.h > +++ b/include/linux/kexec.h > @@ -221,8 +221,9 @@ struct crash_mem { > extern int crash_exclude_mem_range(struct crash_mem *mem, > unsigned long long mstart, > unsigned long long mend); > -extern int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map, > - void **addr, unsigned long *sz); > +extern int crash_prepare_elf64_headers(struct kimage *image, > + struct crash_mem *mem, int kernel_map, > + void **addr, unsigned long *sz); > #endif /* CONFIG_KEXEC_FILE */ > > #ifdef CONFIG_KEXEC_ELF > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > index 8347fc158d2b..801d0d0a5012 100644 > --- a/kernel/kexec_file.c > +++ b/kernel/kexec_file.c > @@ -1260,8 +1260,8 @@ int crash_exclude_mem_range(struct crash_mem *mem, > return 0; > } > > -int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map, > - void **addr, unsigned long *sz) > +int crash_prepare_elf64_headers(struct kimage *image, struct crash_mem *mem, > + int kernel_map, void **addr, unsigned long *sz) > { > Elf64_Ehdr *ehdr; > Elf64_Phdr *phdr; > -- > 2.27.0 >