Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp911120rdb; Tue, 23 Jan 2024 21:15:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUJvm9WtQtkpOTV9VDhjQf6i7j4HqDFDTmEkwCI1nUwoXWZucBSpsD7sN4uYAjfUFa6RUJ X-Received: by 2002:a05:6a21:339d:b0:19b:7ff8:8a58 with SMTP id yy29-20020a056a21339d00b0019b7ff88a58mr477277pzb.24.1706073324937; Tue, 23 Jan 2024 21:15:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706073324; cv=pass; d=google.com; s=arc-20160816; b=CdEX9T/N/dsqnI62+C98RyzMW/eAfLU/FrplyISu5+bCEKUQvYZC2SviOJgaL2aTfA Q9myNIUol/m71/jVzAjNmVmAbi8PeWl6aA925Kp3seiuRnhJ78WWbw9tJWJnDpPBWTCB HrkOA6Y68400i+PT0VcqHPRsRrM3UAnJFbyIIESUkFohYj2Ar9rrjyYygiNbrPYTfBGr qfqY1X6Th4dC47UfBpj0Y8Bpl+T90/fb71tY69OTdQGJBVzYz0Ul4GGZRlV7wc3Xllj9 U1OokgOgyGl0xi90JmDUi+eJis+1pgIMf5c+GtUMEjL38AKgrZD2ogxcz0IzsXTrqB2Y DBWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Phdml9nXkCmStja6K/ul2BV3Rap702N5eGmMqDodNlo=; fh=zRw2lYWZmEZ+xk8Dyhrd0rqHIpogjnUXaVblO2ikfrI=; b=jiw9qSUJ03b0LYnsppUepCSAByLuZugLL4SvwetbDhfzCaSw90fCsXey0f/JDm2zMW dnE2QxzUytD5kJAQjBL+Hs2LWWShSXFjJOkIROR63wcDLlVtC1Zn3bvpe7wGw4LnqKVk HPaXVlNh/si5PRSbd2HcrB7MdaK32sXREM1Q9C1oNk9K3vWws7ELUUk26fBRdFe8OXV/ +3O2iEJZljlNm/JEUwEAh14UFe20okCaUyVEXqHqvLyplCV8zXk9x9OVLpWZOCpNnIWR OnayC2a9RMVwqElKHY8rJscbPBAOLDaonb3BAzWoczx3+qSARmKoeAkwtADetH+C4YTH onQg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iGQKsgA3; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-36456-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36456-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n61-20020a17090a2cc300b00290f643ac56si305396pjd.146.2024.01.23.21.15.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 21:15:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36456-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iGQKsgA3; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-36456-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36456-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A56D28E17D for ; Wed, 24 Jan 2024 05:15:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C69F17541; Wed, 24 Jan 2024 05:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iGQKsgA3" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 106F3168CC for ; Wed, 24 Jan 2024 05:14:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706073244; cv=none; b=UUlC2tiMVpdcv/HUE/UAm5+Z0w6/Rx4+tdEzCEIf+Wzei9NWu8WnKK5qDdjSuHCYF3VNl0Mez+uqjiPhgInf9LEzis9pfe9VcJTTpSHuFuFhu1unaa4Mmg8MHUKJA5Pa3PKWztCwngwxXtTUdL85+vcllKGS83m3eSe1/nzcgrk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706073244; c=relaxed/simple; bh=SwKTYhqF3vapdayBBHL5fa8lI3JifUYyDl1bRGMZKPc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=dBi/pZnpFBbIiisavnJfOi9rRbyZZXimogm7sm/tVZJ6diJ+65pCKhylMyIQEnc186kGMq5J/a5IwLR0HKd4kS+3GT6c24dgjD0+nYWKWzCYlEk493igifNm1lyv5C3kPTgt8LtZJeLlSFs1gDGJ/AhtRWY03LSHGxMjwwaWlC0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iGQKsgA3; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706073242; 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=Phdml9nXkCmStja6K/ul2BV3Rap702N5eGmMqDodNlo=; b=iGQKsgA3ceAx71XYIIhRzWqf8KQxsQwpDJOkp9kN5e7V8Bjxs0xvLW5Dog4yS2dLVfi1hE /XCpbAnLu9/JnrEUx2hPPKRCVOJql/j+Ryy2mTa7PGF6vhVtU21Ot9cm/jJBK6vJirYeC6 rkX+MZh93moInZ2Bh76MFR3huL4vza0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-578-zlaUeep3MaKZl_-kOvhPYQ-1; Wed, 24 Jan 2024 00:13:55 -0500 X-MC-Unique: zlaUeep3MaKZl_-kOvhPYQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 96BC0837225; Wed, 24 Jan 2024 05:13:54 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id E65CE1C060AF; Wed, 24 Jan 2024 05:13:48 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, loongarch@lists.linux.dev, akpm@linux-foundation.org, ebiederm@xmission.com, hbathini@linux.ibm.com, piliu@redhat.com, viro@zeniv.linux.org.uk, Baoquan He Subject: [PATCH linux-next v3 07/14] arm64, crash: wrap crash dumping code into crash related ifdefs Date: Wed, 24 Jan 2024 13:12:47 +0800 Message-ID: <20240124051254.67105-8-bhe@redhat.com> In-Reply-To: <20240124051254.67105-1-bhe@redhat.com> References: <20240124051254.67105-1-bhe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Now crash codes under kernel/ folder has been split out from kexec code, crash dumping can be separated from kexec reboot in config items on arm64 with some adjustments. Here wrap up crash dumping codes with CONFIG_CRASH_DUMP ifdeffery. Signed-off-by: Baoquan He --- arch/arm64/include/asm/kexec.h | 2 +- arch/arm64/kernel/machine_kexec.c | 2 +- arch/arm64/kernel/machine_kexec_file.c | 10 ++++++++-- arch/arm64/mm/init.c | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index 9ac9572a3bbe..4d9cc7a76d9c 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -80,7 +80,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs, } } -#if defined(CONFIG_KEXEC_CORE) && defined(CONFIG_HIBERNATION) +#if defined(CONFIG_CRASH_DUMP) && defined(CONFIG_HIBERNATION) extern bool crash_is_nosave(unsigned long pfn); extern void crash_prepare_suspend(void); extern void crash_post_resume(void); diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index b38aae5b488d..82e2203d86a3 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -255,7 +255,7 @@ void machine_crash_shutdown(struct pt_regs *regs) pr_info("Starting crashdump kernel...\n"); } -#ifdef CONFIG_HIBERNATION +#if defined(CONFIG_CRASH_DUMP) && defined(CONFIG_HIBERNATION) /* * To preserve the crash dump kernel image, the relevant memory segments * should be mapped again around the hibernation. diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index 0e017358f4ba..af1ca875c52c 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c @@ -39,6 +39,7 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image) return kexec_image_post_load_cleanup_default(image); } +#ifdef CONFIG_CRASH_DUMP static int prepare_elf_headers(void **addr, unsigned long *sz) { struct crash_mem *cmem; @@ -80,6 +81,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) kfree(cmem); return ret; } +#endif /* * Tries to add the initrd and DTB to the image. If it is not possible to find @@ -93,8 +95,8 @@ int load_other_segments(struct kimage *image, char *cmdline) { struct kexec_buf kbuf; - void *headers, *dtb = NULL; - unsigned long headers_sz, initrd_load_addr = 0, dtb_len, + void *dtb = NULL; + unsigned long initrd_load_addr = 0, dtb_len, orig_segments = image->nr_segments; int ret = 0; @@ -102,7 +104,10 @@ int load_other_segments(struct kimage *image, /* not allocate anything below the kernel */ kbuf.buf_min = kernel_load_addr + kernel_size; +#ifdef CONFIG_CRASH_DUMP /* load elf core header */ + void *headers; + unsigned long headers_sz; if (image->type == KEXEC_TYPE_CRASH) { ret = prepare_elf_headers(&headers, &headers_sz); if (ret) { @@ -130,6 +135,7 @@ int load_other_segments(struct kimage *image, kexec_dprintk("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", image->elf_load_addr, kbuf.bufsz, kbuf.memsz); } +#endif /* load initrd */ if (initrd) { diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 74c1db8ce271..c1f6213e77f3 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -100,7 +100,7 @@ static void __init arch_reserve_crashkernel(void) bool high = false; int ret; - if (!IS_ENABLED(CONFIG_KEXEC_CORE)) + if (!IS_ENABLED(CONFIG_CRASH_RESERVE)) return; ret = parse_crashkernel(cmdline, memblock_phys_mem_size(), -- 2.41.0