From patchwork Tue Sep 10 19:15:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13799279 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 67B83EDE9AB for ; Tue, 10 Sep 2024 19:16:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF4BE8D00A6; Tue, 10 Sep 2024 15:16:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA3958D0002; Tue, 10 Sep 2024 15:16:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6B748D00A6; Tue, 10 Sep 2024 15:16:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B4A988D0002 for ; Tue, 10 Sep 2024 15:16:05 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5F4B4A89F9 for ; Tue, 10 Sep 2024 19:16:05 +0000 (UTC) X-FDA: 82549783890.23.119A6E9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id A162710000B for ; Tue, 10 Sep 2024 19:16:03 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CH8d6O8j; dmarc=pass (policy=none) header.from=redhat.com; spf=temperror (imf05.hostedemail.com: error in processing during lookup of david@redhat.com: DNS error) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725995736; a=rsa-sha256; cv=none; b=48FR1QVXGanXqKcP4jPECzs5iwB4T6fv3bRPP2aIEpkwpS+uTXdGh3ApBTiVP0m6I8+xR1 j88uyNJfvp6eFhW4smXruW1Wb/b4fdiDJ7lS3cgzqfMOOWouT4bLEZI55QGp74gqaFBgY0 YpNri+K5QxVqHDaAprjTSpqGvlnU65c= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CH8d6O8j; dmarc=pass (policy=none) header.from=redhat.com; spf=temperror (imf05.hostedemail.com: error in processing during lookup of david@redhat.com: DNS error) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725995736; 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=ueb83hVIj3hVMTASy964Wv7fO6dBN/axyM8tuEYr7Bc=; b=N2pnD68T1t4G3yOosnFSsdWdwZKu0snO4nmbCF+243znKXpgPTzD3goST0/wNUOUEaGgMk ZGaS/HXWI7Wk+WN4Cnnv2LifBWAQ66EaQLhS3ZwP6LbF4/zRt45UNPvXLBXitdJrZk3o2v 0gyBLy9wxCfo4Hs2oK0hvsyAQllAOf8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725995763; 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=ueb83hVIj3hVMTASy964Wv7fO6dBN/axyM8tuEYr7Bc=; b=CH8d6O8jatP6972tZSXWot/ILOicPcipeQxzb42+UW7bm3kOeg83HEHvRhYiiuREmusn6q m3l+lxn0LQALC62hr7eX7Pt18Cev5ClYxRkDAaxOkvRst4wWIa+syTFU9sJX1USffrQacs QCaUX+LMKiumCEEs3BDV1SDk5nauDXc= Received: from mx-prod-mc-03.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-116-doxVM81dNx2G7XLtemTiQw-1; Tue, 10 Sep 2024 15:15:59 -0400 X-MC-Unique: doxVM81dNx2G7XLtemTiQw-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9738F1955F28; Tue, 10 Sep 2024 19:15:56 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.22.17.222]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E8F6E30001A1; Tue, 10 Sep 2024 19:15:50 +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, 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 Subject: [PATCH v1 1/5] s390/kdump: implement is_kdump_kernel() Date: Tue, 10 Sep 2024 21:15:35 +0200 Message-ID: <20240910191541.2179655-2-david@redhat.com> In-Reply-To: <20240910191541.2179655-1-david@redhat.com> References: <20240910191541.2179655-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on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GrG7Jv995ER/ujDFfqJZwyOt3C0z1pOME/o1NLm s5ql2GXg k7Bh+eWszfLKfepTE2tm4STwdaAbA/Va4dU5ZircrBjRxEglahhc8a+k8OQpOpiESV9fwE4uY6jyv7HJXt+2OdA72Un/1sY1pX1vWdFXrOtQqy71jUiC9ybve6fDtTmAw3dvzHbTSz0pEA9w3nMvmJop1DFwNtTTBscVujHhtAfZJPM/WatD6lfSCbn8I/TBEvXdAH7Lgm4RAeiX2ZD1mQK6qJNn6M1QSGpA+19HMJCMr6t6Pn0BzaNEz4IxoiwVZ/BRzDGEVUqZ7BdWXFQ2vwMGtYKbLx0+fOOdng7LNg03kWNSgxor1cID1DY6Wu7gAhLDJURQi3Zj771Hq313OTwZmNC0wY82KAZo5wCI2O+7Z9TfV+BjY9thGbQ== 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: s390x 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. 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";