Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5458740pxb; Wed, 26 Jan 2022 12:27:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuCqWwAT8g5Vq58697IVwee91qz4AVMF8VUtu7Mmk96GDNSHTaKmxg4iH3Mj9Vb0/CK1jP X-Received: by 2002:a05:6a00:8d2:: with SMTP id s18mr27368pfu.5.1643228860635; Wed, 26 Jan 2022 12:27:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643228860; cv=none; d=google.com; s=arc-20160816; b=wvxR+PWQcEB6pGsiyzxr6A2cjvFfqHQuD5Dq3/fVKkqStTgcVJj2c4KeC3932j0bWD HlKahvd9XtAtnHnNn/1WE1UaV+HdmNzsNRNR4v+CuV0B+/5KH3/Ii/uuNxO0vAhbbHx0 vDtBQdYmnI9mV6VhpUynMJq8V+kYCmEiknDA5DabvQ/b9g3xLp6W9qtfTD9sQ5zQTjSe pJzEWS3IT7BV9DnjBrlmgTyv6XPrjCSU7nMmO2VSyILuvLSbI+pR+T1l7aDulMZIcixi 7aGYhPdYnJumy3M/wcW1wtplAMR8roI9gcIkJuBYcgjE80u/IazjiPzDqoqh1LcUozgB +OGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=fvJKg4WXAsf4HyeNc2iRJbr6i32jqgjlV0BRc9+sMuY=; b=HqxrX85ZTQsqYs0TgbuDFGIsVB8gQ/b0Wrz4/pGzlZTlHF5qN1Tj1MY44oDb/S0lUN YvUMFvxYoGm0fxi3+ZZjqymzVBWhcZMvOvOy6566TPoBZD0ArIoZu8toF1OFGUsgMdkG rR9h+q1bj7RHpE3yG/HUws5nj6n1M2orTJbGtdrRSmoqzpwv4QJB3Tdsh/jtnxWfQ0J/ iaGSNGvtU7b90EvRkn3ZDbGgNpLeZrmBt+/P7NUB9h/DPaQO6VCtX1hNbRH5Ueava9WF GpGrAkiBtuIy5rPA5aZ8fA5McMbg5bLe+LnGBt9gQyYkbOn7CF/N7lIJj+//+Vv7M+Go zaOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Md//PrjV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si231213plg.205.2022.01.26.12.27.27; Wed, 26 Jan 2022 12:27:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Md//PrjV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S238097AbiAZIDb (ORCPT + 99 others); Wed, 26 Jan 2022 03:03:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25358 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229947AbiAZIDa (ORCPT ); Wed, 26 Jan 2022 03:03:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643184210; 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=fvJKg4WXAsf4HyeNc2iRJbr6i32jqgjlV0BRc9+sMuY=; b=Md//PrjVjM8Suf4XvK/hvvsCtWwjd+19biHd6O2dgmjnr1frziNjTJ3jbEhrcpgMMXAMGd t9qRFfYj8kRfjX6cXJdbHbS37ZJkCC4rkELD0fOEtfxj4zeyG9il2rFV0UX4Iyl1mG3658 JwdFZMJSN4NULnBvRU6xPzlPll4TWrM= 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-148-Y93SYE7sNGmYh9zEO9s0FA-1; Wed, 26 Jan 2022 03:03:26 -0500 X-MC-Unique: Y93SYE7sNGmYh9zEO9s0FA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACA3F1006AA6; Wed, 26 Jan 2022 08:03:23 +0000 (UTC) Received: from localhost (ovpn-12-215.pek2.redhat.com [10.72.12.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D6AB4DC3C; Wed, 26 Jan 2022 08:03:03 +0000 (UTC) Date: Wed, 26 Jan 2022 16:03:00 +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 v3 3/6] crash hp: definitions and prototype changes Message-ID: <20220126080300.GA6588@MiWiFi-R3L-srv> References: <20220110195727.1682-1-eric.devolder@oracle.com> <20220110195727.1682-4-eric.devolder@oracle.com> <20220119082645.GA6349@MiWiFi-R3L-srv> <8af14bc9-7aab-433b-f741-494b3857226f@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8af14bc9-7aab-433b-f741-494b3857226f@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/21/22 at 07:48am, Eric DeVolder wrote: ...... > > > diff --git a/include/linux/kexec.h b/include/linux/kexec.h > > > index 0c994ae37729..068f853f1c65 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 > > > @@ -299,6 +300,13 @@ struct kimage { > > > /* Information for loading purgatory */ > > > struct purgatory_info purgatory_info; > > > + > > > +#ifdef CONFIG_CRASH_HOTPLUG > > > + bool hotplug_event; > > > + int offlinecpu; > > > + bool elf_index_valid; > > > + int elf_index; > > > > Do we really need elf_index_valid? Can we initialize elf_index to , e.g '-1', > > then check if the value is valid? > > These members become part of struct kimage, and when the kimage is > allocated, it is automatically zero'd. Wrt/ elf_index, 0 is a valid index, > and so it needs to be qualified. I initially had used -1, but that required > code and was fragile as I had to find the right place to do that. Using the > boolean elf_index_valid, the problems with -1 vanish, and for free! I also > found when examining the code that reading 'elf_index_valid' was better than > 'elf_index != -1', more clear. > > Let me know what you think. OK, I am fine with it. Will see if other people have comment.