From patchwork Mon Oct 14 14:46:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835140 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 9B514D1627E for ; Mon, 14 Oct 2024 14:46:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 347A06B0089; Mon, 14 Oct 2024 10:46:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F81B6B008A; Mon, 14 Oct 2024 10:46:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E6DD6B008C; Mon, 14 Oct 2024 10:46:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EBA5B6B0089 for ; Mon, 14 Oct 2024 10:46:45 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 98A1B1A0D29 for ; Mon, 14 Oct 2024 14:46:31 +0000 (UTC) X-FDA: 82672484202.05.32DC7F3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 560C340009 for ; Mon, 14 Oct 2024 14:46:38 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FMAjv6Is; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728917088; a=rsa-sha256; cv=none; b=ogICwcv7XO5/GRf54EVbLcq3D8UapyRsb9PAJXgckiE7v6TwpKsDOX7dGfmnHcGgu5wWJc 1yo3lw4TQcC6E4OjxrbU94mK0cx1pIeHyoeixZMarp024sOos9JCIOlv14yuWU7DYDQ2in La7PJYe3kR+UQV5L5Ga+Y67jhULcv+o= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FMAjv6Is; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728917088; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cvU7hgH0NcVyT2s8439e7eS1PoyrARDWsEuaW/yYTUo=; b=2jFhM8E6B2yKUG5QhHWCR/JKERDNcSkV3Ywi6i8kHL94qrn8M8fsFZgN35VDraDDas0J0E 7+UzHkLSQBFCPi6ttugaOa+klMYFgiTbnzeWiOU+koSeyoVjFl6CgTD5KJR6TtRCCbxeM9 WBdpxgjL2gwApxN7gsNlYbV/Donkq/0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cvU7hgH0NcVyT2s8439e7eS1PoyrARDWsEuaW/yYTUo=; b=FMAjv6IsJFvxAVYREyAhKZ9d8u9Cqyeuk5LcIFrNMUA9MyohtVOYgoynDtxsLRy0/SFLQT BewkZ8Tnb5bTv3klvKiMxwOnGnLc8aIu89KQzmQh4Q087cRpSKkYgDHn3lqcTrzb6nyDFR rCW3L1E1NviYu+K+2i06kCG+2qwAGMI= Received: from mx-prod-mc-02.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-651-d5FnqCvGOkSv9Gj83elS0A-1; Mon, 14 Oct 2024 10:46:41 -0400 X-MC-Unique: d5FnqCvGOkSv9Gj83elS0A-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5198B19560A7; Mon, 14 Oct 2024 14:46:39 +0000 (UTC) Received: from t14s.cit.tum.de (unknown [10.22.32.146]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1ADD21955E8F; Mon, 14 Oct 2024 14:46:31 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Andrew Morton , Jonathan Corbet , Mario Casquero Subject: [PATCH v2 1/7] s390/kdump: implement is_kdump_kernel() Date: Mon, 14 Oct 2024 16:46:13 +0200 Message-ID: <20241014144622.876731-2-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 560C340009 X-Stat-Signature: nqis9e1edsq5dnhsbc6tg47ndqcayyg3 X-Rspam-User: X-HE-Tag: 1728917198-545334 X-HE-Meta: U2FsdGVkX19otWN5kVFOSe2w55M5o7I6I3jYo20t/T5IT6YgpfQwbaLPN7fVqb+9+4ihH9ViYw9IIsMZbrIN5FZsO0Za4dlQ2nQyHKOLEqrkpoWBpa7A/i7culaU39HQuJY4ctxFesmdsJmyvUjEosFzbBZiPix1lAt2Dvv9z0Tjt1akFivjwMTx0opHuScWTEjxvpqkrTQNBYkBZB+S3mTfXLGo+GHJP02TdA+ZaffyUauQ0QxZ95ya15nE8t3TvJg0n5hXq58D3s7o5/+h0Cc0LmPednx1aMng0tePOGCoLvS2M/e/8lDrNRIF3YCiIVfowmRINJb+gPxO142pPddYHbyZcM6Vhxs/WOd5I4qBBs8R+gu3TIh1xri5D63Wt+KR/xOGl1cDVCdPId0LiUkAgDK7VOZaPw+w7PYxgz8X9qDTugjWQx0LgMuliOKdySnYHHzztT7psPAoPruihzDb+3W3e9EM8gut0QsZiHnd3Z+2HcbwBTCdwqrN2pZL83AjH9WUIp9AgJp+hgD3sHOwxoWzfotv5JyImvbV6SZ6FDtVqq47v4j2DR+N36++xE6/O+tLq+jRnYisdpfO+vhT+vOLQYQg7fg2EUcysLcv94ZH6A37mXtjXxnWrdEbhEIK6JnNMQKlUv5mydmmSQaoevBn+QDmo19P0vfnODTrSpFxV7BDzSNyND+rM6Ifamx7cnuHuDFrrELBdO0HDdylYs+SGo6JyEHYwWKp9dpk25nw8Bnoj3TjRa9mfZ+Zqjt6QEZqnq+LmNbPuQ7VN1mwuH6NeNJi66gOR03DxzP7sWxHmcEdwYo3GmOXbuQ4VkVVSfamFhfb5qmWTPt2q6fwG9w3PVDKYjctm335N5paxBZy4rGvSPxkfT8R7QzHOfSFOFGzIKTdvUD8rl1AzH5TOm8pn711HQxKMy5YKdvsvnrgORjp6Iq9E1reV7uxRlcMudxILKzkspo6EFE aesU1ZIJ rw6FzFeybCWazj7xsMZ50KgYkhs4AI+EQgHdbQ3nzfFXAi0tvk3F1njtjhTgfz1bgBBNdThC/zOhMuYr+4J8bDHASlxUaGlXZ3mxA1wOug4yAqKENGtG2D3IuIHIpDDFKVsmI80Qh+mdV5ZZq2lRLzOzcVntHosyr6Rv42rh3L2AUvm1P1Bc5xrwbHRzgIAUHOgqCzDOhHUz4ahcg/yivyWkjBWPHmAaldMf0fdkD9IwOr6ZtKFgqP2Fob7uyDybwBuMZm3ETTtzDeIuetPOLm8qIs5OfBV4vwmYeSwXDIOmLt6Bkzz7EOtK/aABLq6xpoqUVeqkBs+2tBmD9EVWCQS20morSXRTRryBeHXz/mhOLJ42iDMu8KNFXuA== 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: s390 currently always results in is_kdump_kernel() == false, because it sets "elfcorehdr_addr = ELFCORE_ADDR_MAX;" early during setup_arch to deactivate the elfcorehdr= kernel parameter. Let's follow the powerpc example and implement our own logic. This is required for virtio-mem to reliably identify a kdump environment to not try hotplugging memory. Tested-by: Mario Casquero Signed-off-by: David Hildenbrand Signed-off-by: David Hildenbrand Tested-by: Mario Casquero Signed-off-by: David Hildenbrand --- arch/s390/include/asm/kexec.h | 4 ++++ arch/s390/kernel/crash_dump.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/arch/s390/include/asm/kexec.h b/arch/s390/include/asm/kexec.h index 1bd08eb56d5f..bd20543515f5 100644 --- a/arch/s390/include/asm/kexec.h +++ b/arch/s390/include/asm/kexec.h @@ -94,6 +94,9 @@ void arch_kexec_protect_crashkres(void); void arch_kexec_unprotect_crashkres(void); #define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres + +bool is_kdump_kernel(void); +#define is_kdump_kernel is_kdump_kernel #endif #ifdef CONFIG_KEXEC_FILE @@ -107,4 +110,5 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, int arch_kimage_file_post_load_cleanup(struct kimage *image); #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup #endif + #endif /*_S390_KEXEC_H */ diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index edae13416196..cca1827d3d2e 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -237,6 +237,12 @@ int remap_oldmem_pfn_range(struct vm_area_struct *vma, unsigned long from, prot); } +bool is_kdump_kernel(void) +{ + return oldmem_data.start && !is_ipl_type_dump(); +} +EXPORT_SYMBOL_GPL(is_kdump_kernel); + static const char *nt_name(Elf64_Word type) { const char *name = "LINUX";