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 C0710D6DDEA for ; Fri, 15 Nov 2024 08:46:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E69116B0082; Fri, 15 Nov 2024 03:46:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E18EB6B0085; Fri, 15 Nov 2024 03:46:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE0726B0089; Fri, 15 Nov 2024 03:46:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B397B6B0082 for ; Fri, 15 Nov 2024 03:46:44 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3EBC6C13F9 for ; Fri, 15 Nov 2024 08:46:44 +0000 (UTC) X-FDA: 82787695578.20.C844325 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 09973C0006 for ; Fri, 15 Nov 2024 08:45:45 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DNvcV98o; spf=pass (imf22.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731660206; h=from:from:sender: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iU3AwiO23RxdWGWn7Yp7jp33a5YtE5yN//tDV9uC5Ss=; b=L6aLor+jYG0nYi3mAcnUjWs4UBtcZRr+zYKOCljid6ri+W/UfNiVGByBg2fJUInh7ESfYF 1TU+Gjrm2gXFlKpD9LBPmCx9KvXuszOh/2ruLAR6URc7ZROfTz1++zWUxatGPLdrCdHD8X xOhuCLJt042cy/k7yR0/b5h6+shZ54g= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DNvcV98o; spf=pass (imf22.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731660206; a=rsa-sha256; cv=none; b=D0GKgwVz3gIUuSv96D5F5lorLPolGm3L6mFecCkx7NROy0Vc3uLhWT7GX0P4C/yvKzNJoE UT7wzNnjaMzEzOKroL6a0lCkDEKCcOSodt5df+h/UvvDbDHEwulGVSd/OX0k9Tg4EvqNJr s5I8fiMI5Oomop3rsFZQ5XEyYPG/Do4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731660401; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iU3AwiO23RxdWGWn7Yp7jp33a5YtE5yN//tDV9uC5Ss=; b=DNvcV98o95278eYdFS1fxbZWTBdd+ftk0xI+ACyvgbNcnHigC5VNIp/BQj+DbiSpjs97pZ RBw+hdC9CWy/jjyjbZUHjnzAReCYclgkEARqjWH8fR9ECuwgO/Ed1xjfOauoNW/fA47oGh P/76ZS8viMMPgjyUTGpfIZ7KWfDFmMw= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-119-Ae3uHm1KMM642lvste8crA-1; Fri, 15 Nov 2024 03:46:37 -0500 X-MC-Unique: Ae3uHm1KMM642lvste8crA-1 X-Mimecast-MFC-AGG-ID: Ae3uHm1KMM642lvste8crA Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C2E31955F41; Fri, 15 Nov 2024 08:46:35 +0000 (UTC) Received: from localhost (unknown [10.72.113.10]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A99EE1956054; Fri, 15 Nov 2024 08:46:32 +0000 (UTC) Date: Fri, 15 Nov 2024 16:46:27 +0800 From: Baoquan He To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, kexec@lists.infradead.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Vivek Goyal , Dave Young , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , Eric Farman , Andrew Morton Subject: Re: [PATCH v1 00/11] fs/proc/vmcore: kdump support for virtio-mem on s390 Message-ID: References: <20241025151134.1275575-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20241025151134.1275575-1-david@redhat.com> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 09973C0006 X-Stat-Signature: 4gq6ybfocosujy58jaz5d8tmk5yrs43b X-Rspam-User: X-HE-Tag: 1731660345-661735 X-HE-Meta: U2FsdGVkX18w7p4SWh1lCOx8toCPsWOIs3RV+BIlsV9GT03buG1C/fgi4vczhVw9xO2eYVfZOzW2pYFYu4TF/17MezWLDukjh0WWU7WjrtQJLN5CkJ3GB39iyF9t0MXZ4AKr+RPz/8PpzLnXgXUFlFEO3atkQubkbfM5YQ2eiNOHyRI0E2p4CxNmBLz3UC1ohlyz3KRMPKLa2MZBhx9UUGasT/hSsTHru/dhDsaqHmCe0WfR2jXciEUc7Q3Bxx0kQU3A7Ghb27NMi9yNUL77U9/ZxXgv+SI1L7oF5dO0nZLDPoSAipavfy6PuB4iodJVVoDHShUlGvh490MHaG1d9uEV96RNZOnElNJMIM98gEEAIGNvPwAt0eK7BL1SWw4Y/fsydA68kvlqM0rQsroyV5Xvneh9lyEX3eBXvmDVDxK9Q5urLv/vO9LClcYdTXcU5R1YqkAAUtdyy7XYkvjvgTXNEfdOWwmOffOmaljivnKKLdCv0vAkBOOI6oRbLkSpOpUsw7l6I0a151EkauB/gRcY/pZKcGUzH4YwlDCjcWKCkxHKREabuVtFPqTZJZeIwcc0FqIcQVSh9F3Mlooto1XrHMgzNTI1QvyWDkf0Y78op9R2HoJR3GpxCluAvjot595emSY6zcfHg+rwie/c3i9JH3SAfTxr/NGf/tiBYzXEnuxkPETYJHDK5ZlVuNn8bva7ruM4P61G8kVlWYpt7yPdem71to0RXFtrfQtyTzuSDZnU5Xg5OP1eHHjfEQ7AMKgJYcWdmhklFvEEQdSnAN8gguEeehsgU0bgHVWfQywDeO4FCI2/6rh3Uvgthhd908VjPLugLWomluKf5XMyZbnFvoPqgiRPIKrdrF1d/p/djN/JjwO3b3G2KSTz6/QH5ckJET+/rSdiIdkfCKZ1+NDuNSx47hKrxWw1rBVzUu44rGpYoOysZJJ79BBpts3Ft5vhO2+Bw0N8jnOOsVa 0/sCbfyp 2N3hpN4WJAyq2b4SRInSODj+E/pmgpxUlSBV8ZCdR/0swHwiITFiKRBH4cTiCbPIa+z+DXduTvhftZJb6yBMv0xgTIdFH91lFn3/giFpA9Dsdr1dmf9wSrIQEqtLDLFmEJpDyc86foJFCfYaevgk3+f5Wal0pb7LunDD/txaLSnlRafgmb8Btp+86KKIhr48Q/GDl93Gi9CNrrpwp+5FOovzs+kXW40VkLY4MAELTwB463JNmUOJ9Tl1vhJyWY5wpqNdu3GleR1mbSOnrTgMstPj54bLrEsJpC8RjdV/ktEhJhz/Ii2+9Wwfqq6C5+CasC5yaWDqewvq6xjA3fflTI2nPj4X7nDk9QfmU4U6GOmi9Y1J+PFNI/JbfO3ggmnBtDlA74FsynCbjTLJfPWwnlH3kvXNrmJi09ecM2LwJt4x/IhihGS9s9vrdfEvS5R8p7sMOPXfjT/kAJoWt4w8nQnLXabvzmwHp7HZ0BCk0yFGwfHkkf2KdVvwPpfLsOaPWMm+OKdm+NWTYXIhOPITplwRxOUT7VSrwLdWJo7Xx2R+QXCI= 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: List-Subscribe: List-Unsubscribe: On 10/25/24 at 05:11pm, David Hildenbrand wrote: > This is based on "[PATCH v3 0/7] virtio-mem: s390 support" [1], which adds > virtio-mem support on s390. > > The only "different than everything else" thing about virtio-mem on s390 > is kdump: The crash (2nd) kernel allocates+prepares the elfcore hdr > during fs_init()->vmcore_init()->elfcorehdr_alloc(). Consequently, the > crash kernel must detect memory ranges of the crashed/panicked kernel to > include via PT_LOAD in the vmcore. > > On other architectures, all RAM regions (boot + hotplugged) can easily be > observed on the old (to crash) kernel (e.g., using /proc/iomem) to create > the elfcore hdr. > > On s390, information about "ordinary" memory (heh, "storage") can be > obtained by querying the hypervisor/ultravisor via SCLP/diag260, and > that information is stored early during boot in the "physmem" memblock > data structure. > > But virtio-mem memory is always detected by as device driver, which is > usually build as a module. So in the crash kernel, this memory can only be ~~~~~~~~~~~ Is it 1st kernel or 2nd kernel? Usually we call the 1st kernel as panicked kernel, crashed kernel, the 2nd kernel as kdump kernel. > properly detected once the virtio-mem driver started up. > > The virtio-mem driver already supports the "kdump mode", where it won't > hotplug any memory but instead queries the device to implement the > pfn_is_ram() callback, to avoid reading unplugged memory holes when reading > the vmcore. > > With this series, if the virtio-mem driver is included in the kdump > initrd -- which dracut already takes care of under Fedora/RHEL -- it will > now detect the device RAM ranges on s390 once it probes the devices, to add > them to the vmcore using the same callback mechanism we already have for > pfn_is_ram(). Do you mean on s390 virtio-mem memory region will be detected and added to vmcore in kdump kernel when virtio-mem driver is initialized? Not sure if I understand it correctly. > > To add these device RAM ranges to the vmcore ("patch the vmcore"), we will > add new PT_LOAD entries that describe these memory ranges, and update > all offsets vmcore size so it is all consistent. > > Note that makedumfile is shaky with v6.12-rcX, I made the "obvious" things > (e.g., free page detection) work again while testing as documented in [2]. > > Creating the dumps using makedumpfile seems to work fine, and the > dump regions (PT_LOAD) are as expected. I yet have to check in more detail > if the created dumps are good (IOW, the right memory was dumped, but it > looks like makedumpfile reads the right memory when interpreting the > kernel data structures, which is promising). > > Patch #1 -- #6 are vmcore preparations and cleanups > Patch #7 adds the infrastructure for drivers to report device RAM > Patch #8 + #9 are virtio-mem preparations > Patch #10 implements virtio-mem support to report device RAM > Patch #11 activates it for s390, implementing a new function to fill > PT_LOAD entry for device RAM > > [1] https://lkml.kernel.org/r/20241025141453.1210600-1-david@redhat.com > [2] https://github.com/makedumpfile/makedumpfile/issues/16 > > Cc: Heiko Carstens > Cc: Vasily Gorbik > Cc: Alexander Gordeev > Cc: Christian Borntraeger > Cc: Sven Schnelle > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: Xuan Zhuo > Cc: "Eugenio Pérez" > Cc: Baoquan He > Cc: Vivek Goyal > Cc: Dave Young > Cc: Thomas Huth > Cc: Cornelia Huck > Cc: Janosch Frank > Cc: Claudio Imbrenda > Cc: Eric Farman > Cc: Andrew Morton > > David Hildenbrand (11): > fs/proc/vmcore: convert vmcore_cb_lock into vmcore_mutex > fs/proc/vmcore: replace vmcoredd_mutex by vmcore_mutex > fs/proc/vmcore: disallow vmcore modifications after the vmcore was > opened > fs/proc/vmcore: move vmcore definitions from kcore.h to crash_dump.h > fs/proc/vmcore: factor out allocating a vmcore memory node > fs/proc/vmcore: factor out freeing a list of vmcore ranges > fs/proc/vmcore: introduce PROC_VMCORE_DEVICE_RAM to detect device RAM > ranges in 2nd kernel > virtio-mem: mark device ready before registering callbacks in kdump > mode > virtio-mem: remember usable region size > virtio-mem: support CONFIG_PROC_VMCORE_DEVICE_RAM > s390/kdump: virtio-mem kdump support (CONFIG_PROC_VMCORE_DEVICE_RAM) > > arch/s390/Kconfig | 1 + > arch/s390/kernel/crash_dump.c | 39 +++-- > drivers/virtio/Kconfig | 1 + > drivers/virtio/virtio_mem.c | 103 +++++++++++++- > fs/proc/Kconfig | 25 ++++ > fs/proc/vmcore.c | 258 +++++++++++++++++++++++++--------- > include/linux/crash_dump.h | 47 +++++++ > include/linux/kcore.h | 13 -- > 8 files changed, 396 insertions(+), 91 deletions(-) > > -- > 2.46.1 >