Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4013847rwb; Fri, 30 Sep 2022 11:26:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4JZrHBR+UrsUmC3m4SL9Bj1WZgfix7i8zFAQhudVyCbDpunaHQ+2yCmGZFT9yqX7Mrb4cb X-Received: by 2002:a17:907:a044:b0:770:da0d:171d with SMTP id gz4-20020a170907a04400b00770da0d171dmr6987833ejc.742.1664562360111; Fri, 30 Sep 2022 11:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664562360; cv=none; d=google.com; s=arc-20160816; b=uX7bNrvfz6ytk/EEkinHegCNooqCqZCXUgfy1nTXoWTtw3Ax6W+5GQZOWKpi2szrMt WU6DigM+eMihrE5LmmzsyjSfFqVSlPGg559x0ExnMlOu0mfJKV4TFbtiBJHrBdIgyKHZ jadl0Fq8qbZsWn0iDxoCUNcms/81iPbR7tBEEGRRsbiZ/7JmR2mNUSoQLq5BeNji7m6b 1HKPBqknkBplkRxRH9icR6Cnyg1x1Jq7d3+roq2insSOa7Nu1JTi7AQQg85+2A/bwsaq 5lvRrsqevft3M3lxRmuDm1EHcQow0i+I0ooc2embKwrLlRPaf/To8+GjQrfvwA8E4IEy t+uw== 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=tP9Z9kALkJplQ//X4pAwQj/9u9C0dERnBu4DmkUwjxM=; b=BiJxoZx9kSGQEGP9STyY1Cy+T/Z2RTg7iLnLYiZc755/XxJxLiubmOllj20VtDvL5L FTNGOMAZuW+mRduvVQRIlWKaDKj+MniYdMaLT4uo+kNc50eTnaWUd8r+tJ+r3bXHcEWR 2Fb7mmQxzGmXjAG92bbS3EruwwsU4PqmeJow9cC2OvoF/fJzhCAm/oDVi64HiB+Amn/b GRWuuXikFS5BtFKdOnzdUYHACqal3hHMump7KQkjFTE5vqwbSD7qbuaa3mWQjo6Vk5PZ mFtV11FfZHsQD5YuJVYNEC95qQkJbAyQ+VA+Go0XIsw6GktP/tsfQ64IwcdjtnGrm1Vg SPJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=c5NyopsC; 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=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a50e609000000b00456d901922bsi2235223edm.510.2022.09.30.11.25.34; Fri, 30 Sep 2022 11:26:00 -0700 (PDT) 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=@alien8.de header.s=dkim header.b=c5NyopsC; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231180AbiI3QvK (ORCPT + 99 others); Fri, 30 Sep 2022 12:51:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230053AbiI3QvG (ORCPT ); Fri, 30 Sep 2022 12:51:06 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8F2E18B5EE for ; Fri, 30 Sep 2022 09:51:04 -0700 (PDT) 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 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