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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA61FC433F5 for ; Fri, 30 Sep 2022 16:51:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CB688D0002; Fri, 30 Sep 2022 12:51:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 154008D0001; Fri, 30 Sep 2022 12:51:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F36308D0002; Fri, 30 Sep 2022 12:51:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DDBCD8D0001 for ; Fri, 30 Sep 2022 12:51:16 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7F7D4121586 for ; Fri, 30 Sep 2022 16:51:16 +0000 (UTC) X-FDA: 79969342152.19.F7FC3AF Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf27.hostedemail.com (Postfix) with ESMTP id 0E4C140017 for ; Fri, 30 Sep 2022 16:51:07 +0000 (UTC) Received: from zn.tnic (p200300ea9733e70a329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e70a:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 521CF1EC04DA; Fri, 30 Sep 2022 18:50:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1664556659; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=tP9Z9kALkJplQ//X4pAwQj/9u9C0dERnBu4DmkUwjxM=; b=c5NyopsCGhoBd1uFmWvBwlikJDwE9xijsQuDUsK2MmV90jGTOcm63idZOnV6Lj4D4e39P9 v61pX3A4xPk6l3MtmFUWpfWQtk+mOYlIUb/P9iMve1okkWXLYa8XM4GmjXSHmiQ3q/Ddaa ZeUxI7kH5Q5VUgJQuc7SssTEQA+hucI= Date: Fri, 30 Sep 2022 18:50:55 +0200 From: Borislav Petkov To: Eric DeVolder , Oscar Salvador , Andrew Morton , david@redhat.com Cc: linux-kernel@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, ebiederm@xmission.com, dyoung@redhat.com, bhe@redhat.com, vgoyal@redhat.com, tglx@linutronix.de, mingo@redhat.com, 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, sourabhjain@linux.ibm.com, linux-mm@kvack.org Subject: Re: [PATCH v12 7/7] x86/crash: Add x86 crash hotplug support Message-ID: References: <20220909210509.6286-1-eric.devolder@oracle.com> <20220909210509.6286-8-eric.devolder@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0E4C140017 Authentication-Results: imf27.hostedemail.com; dkim=temperror ("DNS error when getting key") header.d=alien8.de header.s=dkim header.b=c5NyopsC; spf=temperror (imf27.hostedemail.com: error in processing during lookup of bp@alien8.de: DNS error) smtp.mailfrom=bp@alien8.de; dmarc=temperror reason="query timed out" header.from=alien8.de (policy=temperror) X-Stat-Signature: f73d7cspr3yabwh4k73sw7f8uk9s7ehc X-HE-Tag: 1664556667-155607 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Sep 30, 2022 at 10:36:49AM -0500, Eric DeVolder wrote: > > Your help text talks about System RAM entries in /proc/iomem which means > > that those entries are present somewhere in the kernel and you can read > > them out and do the proper calculations dynamically instead of doing the > > static CONFIG_NR_CPUS_DEFAULT + CONFIG_CRASH_MAX_MEMORY_RANGES thing. > > The intent is to compute the max size buffer needed to contain a maximum > populated elfcorehdr, which is primarily based on the number of CPUs and > memory regions. Thus far I (and others involved) have not found a kernel > method to determine the maximum number of memory regions possible (if you > are aware of one, please let me know!). Thus CONFIG_CRASH_MAX_MEMORY_RANGES > was born (rather borrowed from kexec-tools). Let's ask some mm folks. mm folks, is there a way to enumerate all the memory regions a machine has? It looks to me like register_memory_resource() in mm/memory_hotplug.c does register the resource so there should be a way to count that list of resources or at least maintain a count somewhere so that kexec/crash code can know how big its elfcodehdr buffer should be instead of doing a clumsy Kconfig item where people would need to guess... Hmm. > > +#ifdef CONFIG_CRASH_MAX_MEMORY_RANGES > So I think the use of CONFIG_CRASH_MAX_MEMORY_RANGES is not correct; it > still needs to be based on the cpu or memory hotplug options. You're kidding, right? +config CRASH_MAX_MEMORY_RANGES + depends on CRASH_DUMP && KEXEC_FILE && (HOTPLUG_CPU || MEMORY_HOTPLUG) ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > @@ -622,6 +622,15 @@ static int __init crash_save_vmcoreinfo_init(void) > > subsys_initcall(crash_save_vmcoreinfo_init); > > #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG) > > + > > +void __weak *arch_map_crash_pages(unsigned long paddr, unsigned long size) > > +{ > > + return NULL; > > +} > > + > > +void __weak arch_unmap_crash_pages(void **ptr) { } > > +void __weak arch_crash_handle_hotplug_event(struct kimage *image, unsigned int hp_action) { } > > + > I was asked by Baoquan He to eliminate the use of __weak Because? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette