From patchwork Fri Nov 24 03:36:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 169162 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp876195vqx; Thu, 23 Nov 2023 19:38:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+Jicc3/RsOO/p8YNVee+I94SfKY0+IKGO2+XjVaRtSjMWIk1m+UZuTyXu7SrebW94MxWZ X-Received: by 2002:a17:90b:17c9:b0:27c:f1f8:2628 with SMTP id me9-20020a17090b17c900b0027cf1f82628mr1282731pjb.47.1700797102413; Thu, 23 Nov 2023 19:38:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700797102; cv=none; d=google.com; s=arc-20160816; b=jkh3dTL1slw2faxDOZmly549076Sfa3pGjkbwPt9qFH8iA0L1v2xmsmDlNCo21ZZeW b0mYOKWlTeVzOeWyxheJ9oBu5nHk2VivGJ9x2HZeiXpNoocL7iTv/HOSQsQgDn1+C6FD /QcXSWkJ91mWeIZr8pLoqcuoEPZd2E04X5K8hk5X02bTNvNTEFUg9SHnt1nXG77i+Xfo oYYLxHsB8A5Dfmv30sYbmnLGWoQtsXbspnU4fJIEgxBA5/++KxVvaGo15aBEHa8CkkmY Jr2cnjHfbyV/SNTVQvQnvFqIMh5emLZMAuBoEVgzufuk5HVYgmwm7rQuPdx/HUL2B/Gy 9R3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mRhf6yjEl6SoYtlH901fGSdzPcu9Tm5iYJM9D+81Yic=; fh=f9/4L5WTkyMs0HwKLVSZtc0UzQZDbbmz4se+5IAJiu4=; b=hLzOnFqM/eweD7nbEuTZj47Ns0UtTzsbsIImISprkcvvIWsO0IjCZryZ7RJ2ZPKgGE 8jy3qN0cHSLD5Frxf0I4EVEyqP/Y6ctki37tKHzOaSVtqic85j+3aOYHxxAKkViucVA2 R7ic6vfHIRl26mdqje66uWUJBy040G1JUCOwJXiyxxNzNbdlD98fIt3NCMrtta1c3SyL DdjU1IqzutIg9vzcWXhStHchl67Og7TpYend9wtQEpATt2n2ozqv74uUoKyjTn7WdxHI Dn08ndSjX1rblKtiGH1rU0w7u2uPTVAr3da3OwWb7KhUTRS33N3cGSEunIXZlKIaqaq+ /8ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f6Hsmm6d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b13-20020a17090a550d00b0028524e799b3si2548914pji.42.2023.11.23.19.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 19:38:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f6Hsmm6d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 804C982DDACD; Thu, 23 Nov 2023 19:37:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbjKXDg7 (ORCPT + 99 others); Thu, 23 Nov 2023 22:36:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjKXDgx (ORCPT ); Thu, 23 Nov 2023 22:36:53 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42B0BD59 for ; Thu, 23 Nov 2023 19:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700797019; 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=mRhf6yjEl6SoYtlH901fGSdzPcu9Tm5iYJM9D+81Yic=; b=f6Hsmm6datH5VXaNuLCM79waDctPtMSLVDkl1qjTnwQfef+NptZM0jxCM0uWB+s45nweok oMg5nEVEqfEqeXMually8kRDVM8UB97OuFBnxwqoxC6QO2puIeN4sI2kVnObHW9SSkDD0z wDasJQOZnedcu8fmYk3FKWRczmWr6bg= 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-500-54TtSm-JM8ed2wqZkmazOg-1; Thu, 23 Nov 2023 22:36:55 -0500 X-MC-Unique: 54TtSm-JM8ed2wqZkmazOg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 BCD1B811E7D; Fri, 24 Nov 2023 03:36:54 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46FE5492BE7; Fri, 24 Nov 2023 03:36:49 +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, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, akpm@linux-foundation.org, joe@perches.com, nathan@kernel.org, yujie.liu@intel.com, Baoquan He Subject: [PATCH v2 1/7] kexec_file: add kexec_file flag to control debug printing Date: Fri, 24 Nov 2023 11:36:36 +0800 Message-ID: <20231124033642.520686-2-bhe@redhat.com> In-Reply-To: <20231124033642.520686-1-bhe@redhat.com> References: <20231124033642.520686-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 23 Nov 2023 19:37:19 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783415022333803434 X-GMAIL-MSGID: 1783415022333803434 When specifying 'kexec -c -d', kexec_load interface will print loading information, e.g the regions where kernel/initrd/purgatory/cmdline are put, the memmap passed to 2nd kernel taken as system RAM ranges, and printing all contents of struct kexec_segment, etc. These are very helpful for analyzing or positioning what's happening when kexec/kdump itself failed. The debugging printing for kexec_load interface is made in user space utility kexec-tools. Whereas, with kexec_file_load interface, 'kexec -s -d' print nothing. Because kexec_file code is mostly implemented in kernel space, and the debugging printing functionality is missed. It's not convenient when debugging kexec/kdump loading and jumping with kexec_file_load interface. Now add KEXEC_FILE_DEBUG to kexec_file flag to control the debugging message printing. And add global variable kexec_file_dbg_print and macro kexec_dprintk() to facilitate the printing. This is a preparation, later kexec_dprintk() will be used to replace the existing pr_debug(). Once 'kexec -s -d' is specified, it will print out kexec/kdump loading information. If '-d' is not specified, it regresses to pr_debug(). Signed-off-by: Baoquan He --- include/linux/kexec.h | 10 +++++++++- include/uapi/linux/kexec.h | 1 + kernel/kexec_file.c | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 8227455192b7..66997efe36f1 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -264,6 +264,14 @@ arch_kexec_apply_relocations(struct purgatory_info *pi, Elf_Shdr *section, return -ENOEXEC; } #endif + +extern bool kexec_file_dbg_print; + +#define kexec_dprintk(fmt, ...) \ + printk("%s" fmt, \ + kexec_file_dbg_print ? KERN_INFO : KERN_DEBUG, \ + ##__VA_ARGS__) + #endif /* CONFIG_KEXEC_FILE */ #ifdef CONFIG_KEXEC_ELF @@ -403,7 +411,7 @@ bool kexec_load_permitted(int kexec_image_type); /* List of defined/legal kexec file flags */ #define KEXEC_FILE_FLAGS (KEXEC_FILE_UNLOAD | KEXEC_FILE_ON_CRASH | \ - KEXEC_FILE_NO_INITRAMFS) + KEXEC_FILE_NO_INITRAMFS | KEXEC_FILE_DEBUG) /* flag to track if kexec reboot is in progress */ extern bool kexec_in_progress; diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h index 01766dd839b0..c17bb096ea68 100644 --- a/include/uapi/linux/kexec.h +++ b/include/uapi/linux/kexec.h @@ -25,6 +25,7 @@ #define KEXEC_FILE_UNLOAD 0x00000001 #define KEXEC_FILE_ON_CRASH 0x00000002 #define KEXEC_FILE_NO_INITRAMFS 0x00000004 +#define KEXEC_FILE_DEBUG 0x00000008 /* These values match the ELF architecture values. * Unless there is a good reason that should continue to be the case. diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index f9a419cd22d4..4c35500ae40a 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -38,6 +38,8 @@ void set_kexec_sig_enforced(void) } #endif +bool kexec_file_dbg_print; + static int kexec_calculate_store_digests(struct kimage *image); /* Maximum size in bytes for kernel/initrd files. */ @@ -123,6 +125,8 @@ void kimage_file_post_load_cleanup(struct kimage *image) */ kfree(image->image_loader_data); image->image_loader_data = NULL; + + kexec_file_dbg_print = false; } #ifdef CONFIG_KEXEC_SIG @@ -278,6 +282,7 @@ kimage_file_alloc_init(struct kimage **rimage, int kernel_fd, if (!image) return -ENOMEM; + kexec_file_dbg_print = !!(flags & KEXEC_FILE_DEBUG); image->file_mode = 1; if (kexec_on_panic) { From patchwork Fri Nov 24 03:36:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 169158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp875999vqx; Thu, 23 Nov 2023 19:37:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNOfRKe1o/0wdcCgn6an6sAOgMS5PjXviudfIf5XuTBaS64LqYvjOcb3/l5+c/ukgwKKMs X-Received: by 2002:a05:6830:22e8:b0:6d3:2584:b093 with SMTP id t8-20020a05683022e800b006d32584b093mr1620325otc.11.1700797064487; Thu, 23 Nov 2023 19:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700797064; cv=none; d=google.com; s=arc-20160816; b=znC6W88XFgqLRamgibdbfp9a8lp9EKZfx2PkKadokP1OFXmqUxAqbG6Q4r1nFyhx1V drnDgXtbQLN1HHcTzlMUqldwvzfLcVGLs3hNuGk0NK4hPzERGaD+lOX3WGNkqPPW7DuC gmblf61139yBT3qeswIykeH+VtbjMq4nhfLnbhLC0DHYRUiWLRKrRMYm9f18XZEvGb+q C1mw1DCt99CtPhSBxFUFzQQJw169XwGqs8/mx+qUxgLZQL1mAk2sIBXBclZlPSlcvnBS eWzQQO3P+WAfDjxyXkrmPcwQtZYiY8P2qHSrvzHqwn9rH1dtpaiA7DuZAbzkAKOjjPOt 8gYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ypSBKOvs5nashSP3TmwrugZ2AS56bQmFrg9V7LWlVpY=; fh=f9/4L5WTkyMs0HwKLVSZtc0UzQZDbbmz4se+5IAJiu4=; b=K7QSVnbWcVwc8GxHREBfXsZ7Me7ge3MOoLI5/WVrp28XXVxYygocDM9/POUKelJmLs cTQT0xRz/vETPtEKo9dbbHqCq26tjH98iTr8XI9MbqYz5EqmDr0DbVTFIB6vjMCmDF7q Zlb8ToGHwMJiivBobzHHyUOV2ajfUjIf3ytLaf3bQBLCoTcjr2VtZwLDgEiDTLyEQKFL MO2kgj7g9XznIEj5yJPRGnPKelFH/AuS9lliQ9Y0DC7TxzuwNynwLicfueIIfkZpdLbI d6ILCPx/OQCzeMEpfrcDTVC0xroPNtjsTr1m0EDm+q/u0dFn3hZS5o5JPj0Vh+H60Sr4 O50A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f3acO70Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id a22-20020a631a56000000b005b9755fd511si2648220pgm.182.2023.11.23.19.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 19:37:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f3acO70Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BE848820D5F5; Thu, 23 Nov 2023 19:37:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231159AbjKXDhA (ORCPT + 99 others); Thu, 23 Nov 2023 22:37:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjKXDg6 (ORCPT ); Thu, 23 Nov 2023 22:36:58 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA4B310DD for ; Thu, 23 Nov 2023 19:37:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700797024; 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=ypSBKOvs5nashSP3TmwrugZ2AS56bQmFrg9V7LWlVpY=; b=f3acO70YNGFyhrx5czPYQ81PZX2fxnsyAfTmQ+xjK2E+GocrOxLZnRDNQsJdQFz6ypzvGL MhdxPyY1C2pFMtyY6auKhD1tSfJ8Xz+Jsm258gKrfWiHnywgVzcuXscDOl8m9FkNP8KAQ2 6a+VeXAxc6RSsHGpu3+G1QHFBkE3z48= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-j-to0uXUNdemQMs-yqzn9w-1; Thu, 23 Nov 2023 22:37:00 -0500 X-MC-Unique: j-to0uXUNdemQMs-yqzn9w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 DF59B1C0434A; Fri, 24 Nov 2023 03:36:59 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61AAB492BE7; Fri, 24 Nov 2023 03:36:55 +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, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, akpm@linux-foundation.org, joe@perches.com, nathan@kernel.org, yujie.liu@intel.com, Baoquan He Subject: [PATCH v2 2/7] kexec_file: print out debugging message if required Date: Fri, 24 Nov 2023 11:36:37 +0800 Message-ID: <20231124033642.520686-3-bhe@redhat.com> In-Reply-To: <20231124033642.520686-1-bhe@redhat.com> References: <20231124033642.520686-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 23 Nov 2023 19:37:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783414982904194650 X-GMAIL-MSGID: 1783414982904194650 Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also print out type/start/head of kimage and flags to help debug. Signed-off-by: Baoquan He --- kernel/crash_core.c | 5 ++++- kernel/kexec_file.c | 7 ++++++- security/integrity/ima/ima_kexec.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index efe87d501c8c..1485fd7bb67f 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -551,9 +551,12 @@ int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, phdr->p_filesz = phdr->p_memsz = mend - mstart + 1; phdr->p_align = 0; ehdr->e_phnum++; - pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n", +#ifdef CONFIG_KEXEC_FILE + kexec_dprintk("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, " + "sz=0x%llx e_phnum=%d p_offset=0x%llx\n", phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz, ehdr->e_phnum, phdr->p_offset); +#endif phdr++; } diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 4c35500ae40a..7ae1b0901aa4 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -206,6 +206,8 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, if (ret < 0) return ret; image->kernel_buf_len = ret; + kexec_dprintk("kernel: %p kernel_size: %#lx\n", + image->kernel_buf, image->kernel_buf_len); /* Call arch image probe handlers */ ret = arch_kexec_kernel_image_probe(image, image->kernel_buf, @@ -389,11 +391,12 @@ SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd, if (ret) goto out; + kexec_dprintk("nr_segments = %lu\n", image->nr_segments); for (i = 0; i < image->nr_segments; i++) { struct kexec_segment *ksegment; ksegment = &image->segment[i]; - pr_debug("Loading segment %d: buf=0x%p bufsz=0x%zx mem=0x%lx memsz=0x%zx\n", + kexec_dprintk("segment[%d]: buf=0x%p bufsz=0x%zx mem=0x%lx memsz=0x%zx\n", i, ksegment->buf, ksegment->bufsz, ksegment->mem, ksegment->memsz); @@ -408,6 +411,8 @@ SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd, if (ret) goto out; + kexec_dprintk("kexec_file_load: type:%u, start:0x%lx head:0x%lx flags:0x%lx\n", + image->type, image->start, image->head, flags); /* * Free up any temporary buffers allocated which are not needed * after image has been loaded diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c index ad133fe120db..e692624bcab3 100644 --- a/security/integrity/ima/ima_kexec.c +++ b/security/integrity/ima/ima_kexec.c @@ -129,7 +129,7 @@ void ima_add_kexec_buffer(struct kimage *image) image->ima_buffer_size = kexec_segment_size; image->ima_buffer = kexec_buffer; - pr_debug("kexec measurement buffer for the loaded kernel at 0x%lx.\n", + kexec_dprintk("kexec measurement buffer for the loaded kernel at 0x%lx.\n", kbuf.mem); } #endif /* IMA_KEXEC */ From patchwork Fri Nov 24 03:36:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 169164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp876339vqx; Thu, 23 Nov 2023 19:38:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsSOLjXl0613slJrL/PL23l2Zo9H8QuVVXs9b+QMl5By3JsD7Bh5Wyunr8Mpf1VLattW3/ X-Received: by 2002:a05:6a00:1508:b0:6cb:d24b:8c1b with SMTP id q8-20020a056a00150800b006cbd24b8c1bmr2056324pfu.23.1700797127771; Thu, 23 Nov 2023 19:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700797127; cv=none; d=google.com; s=arc-20160816; b=QlkriKEd8zdrPaJ3HTah0CutP9AagdoUvlBIKWwpR0vM90v4rNQXk08a8cFl+tImBX JY+FQT1z/nkIW/AJwPKCfrsF7mVviJ3SZnQq0fiOdqiVDlUFVsa0dzI2Ko4PgPCQQVWw W1ncrg5V45eQXaSdu1JGnUK99PYtsD0P1d6FgUCAiQbiyu6ZR75XJ3VsECWMJnrCpCwy j/mcvRwj3o4t4slrgJV3owXbzSNzCr0FLW4j5TM6k4UzVhEmzbc0ZrReI0DS1W2iLtnI wmI2bWxHLL8WkVmaingT/BNnlwU6bYhgF4BIt4gg+LA9Rb6U2/2nEtnSDLi8yNccgJt0 9dfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3oH4a1eMA3o2aCIb7hj/C0FDGAKl9TVykYxTnGxkMIo=; fh=f9/4L5WTkyMs0HwKLVSZtc0UzQZDbbmz4se+5IAJiu4=; b=oEUzrPl1nLckAMQS1eBq5gQommR65XPwWq/KsF36JQarz/1v52UR3QLyXCUEU23vjd bA9M3PAclhtohVB8knmfJeuLqR2ZDN2Cyu78EEGw1wotMjKgjzw8DQNUaNa0OG9AoneV arugXgJnHWE88CpF/gbKWUkk4cbc7qfYS/+CC4fFNZYvxWz5mHObSunnyikEzwDNM9/j PaHWPTO5yxWUlZ9IvphTNpOvFUqRp9qxGqe+VwfAFzRkymhyL0nLdqJf33PfaoAy8uOr g5KbetQW6hOBgkgkIcJvIOI9ls1iEVNAr3A3tTuj/dlUPq0UR6tJsrsFR8cTa6BjagXM Djaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M4dkEdK5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d16-20020a63ed10000000b005ab7b51ab5bsi2492189pgi.110.2023.11.23.19.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 19:38:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M4dkEdK5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 107008048691; Thu, 23 Nov 2023 19:37:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231389AbjKXDhJ (ORCPT + 99 others); Thu, 23 Nov 2023 22:37:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbjKXDhD (ORCPT ); Thu, 23 Nov 2023 22:37:03 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2EBD10E4 for ; Thu, 23 Nov 2023 19:37:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700797029; 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=3oH4a1eMA3o2aCIb7hj/C0FDGAKl9TVykYxTnGxkMIo=; b=M4dkEdK5KlDW3DCdYGqD7Ykf75XI6CNjKABOANow2Y3bTgJY6wCLCsPtwDE2FXsaXhWvjB gCUHeXNfTXaDDTuFdGyhClTS/ff6UySDnC+uHRNVWy8Cd1R0/Vp+L6n/nsM+7cSSwo5X0p M+Vvqri0xccdCGjGHfQrsczgVqWyPaQ= 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-60-Js8XAS9MOZ2h9k-HTQUu3w-1; Thu, 23 Nov 2023 22:37:05 -0500 X-MC-Unique: Js8XAS9MOZ2h9k-HTQUu3w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 068C5185A782; Fri, 24 Nov 2023 03:37:05 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85F5A492BE7; Fri, 24 Nov 2023 03:37:00 +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, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, akpm@linux-foundation.org, joe@perches.com, nathan@kernel.org, yujie.liu@intel.com, Baoquan He Subject: [PATCH v2 3/7] kexec_file, x86: print out debugging message if required Date: Fri, 24 Nov 2023 11:36:38 +0800 Message-ID: <20231124033642.520686-4-bhe@redhat.com> In-Reply-To: <20231124033642.520686-1-bhe@redhat.com> References: <20231124033642.520686-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 23 Nov 2023 19:37:29 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783415049019270857 X-GMAIL-MSGID: 1783415049019270857 Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also print out e820 memmap passed to 2nd kernel just as kexec_load interface has been doing. Signed-off-by: Baoquan He --- arch/x86/kernel/crash.c | 2 +- arch/x86/kernel/kexec-bzimage64.c | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index c92d88680dbf..df4dbd3aa08c 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -386,7 +386,7 @@ int crash_load_segments(struct kimage *image) if (ret) return ret; image->elf_load_addr = kbuf.mem; - pr_debug("Loaded ELF headers at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + kexec_dprintk("Loaded ELF headers at 0x%lx bufsz=0x%lx memsz=0x%lx\n", image->elf_load_addr, kbuf.bufsz, kbuf.memsz); return ret; diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index a61c12c01270..e9ae0eac6bf9 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -82,7 +82,7 @@ static int setup_cmdline(struct kimage *image, struct boot_params *params, cmdline_ptr[cmdline_len - 1] = '\0'; - pr_debug("Final command line is: %s\n", cmdline_ptr); + kexec_dprintk("Final command line is: %s\n", cmdline_ptr); cmdline_ptr_phys = bootparams_load_addr + cmdline_offset; cmdline_low_32 = cmdline_ptr_phys & 0xffffffffUL; cmdline_ext_32 = cmdline_ptr_phys >> 32; @@ -272,7 +272,12 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, nr_e820_entries = params->e820_entries; + kexec_dprintk("E820 memmap:\n"); for (i = 0; i < nr_e820_entries; i++) { + kexec_dprintk("%016llx-%016llx (%d)\n", + params->e820_table[i].addr, + params->e820_table[i].addr + params->e820_table[i].size - 1, + params->e820_table[i].type); if (params->e820_table[i].type != E820_TYPE_RAM) continue; start = params->e820_table[i].addr; @@ -424,7 +429,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, * command line. Make sure it does not overflow */ if (cmdline_len + MAX_ELFCOREHDR_STR_LEN > header->cmdline_size) { - pr_debug("Appending elfcorehdr= to command line exceeds maximum allowed length\n"); + kexec_dprintk("Appending elfcorehdr= to command line exceeds maximum allowed length\n"); return ERR_PTR(-EINVAL); } @@ -445,7 +450,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, return ERR_PTR(ret); } - pr_debug("Loaded purgatory at 0x%lx\n", pbuf.mem); + kexec_dprintk("Loaded purgatory at 0x%lx\n", pbuf.mem); /* @@ -490,8 +495,8 @@ static void *bzImage64_load(struct kimage *image, char *kernel, if (ret) goto out_free_params; bootparam_load_addr = kbuf.mem; - pr_debug("Loaded boot_param, command line and misc at 0x%lx bufsz=0x%lx memsz=0x%lx\n", - bootparam_load_addr, kbuf.bufsz, kbuf.bufsz); + kexec_dprintk("Loaded boot_param, command line and misc at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + bootparam_load_addr, kbuf.bufsz, kbuf.bufsz); /* Load kernel */ kbuf.buffer = kernel + kern16_size; @@ -505,8 +510,8 @@ static void *bzImage64_load(struct kimage *image, char *kernel, goto out_free_params; kernel_load_addr = kbuf.mem; - pr_debug("Loaded 64bit kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n", - kernel_load_addr, kbuf.bufsz, kbuf.memsz); + kexec_dprintk("Loaded 64bit kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + kernel_load_addr, kbuf.bufsz, kbuf.memsz); /* Load initrd high */ if (initrd) { @@ -520,8 +525,8 @@ static void *bzImage64_load(struct kimage *image, char *kernel, goto out_free_params; initrd_load_addr = kbuf.mem; - pr_debug("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n", - initrd_load_addr, initrd_len, initrd_len); + kexec_dprintk("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + initrd_load_addr, initrd_len, initrd_len); setup_initrd(params, initrd_load_addr, initrd_len); } From patchwork Fri Nov 24 03:36:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 169159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp876049vqx; Thu, 23 Nov 2023 19:37:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjZNezz3Jp5NQnvNUXdPw8fbJ+sCdarz6f8H69BbwNsUAEMk4yEI+J8kKvg5lmwAgdXL/E X-Received: by 2002:a05:6870:d8cc:b0:1f0:edce:184c with SMTP id of12-20020a056870d8cc00b001f0edce184cmr1673586oac.54.1700797070969; Thu, 23 Nov 2023 19:37:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700797070; cv=none; d=google.com; s=arc-20160816; b=KYYTrW5rLi7FHCWcunmUx4eiYRsIsu6r/S/CoK7DHfV9lRqTC0NVcLfiXp58gjy9an uu+dIHfzYpaQY5W53VvUX+cw1HGgoxzK/nC5GjAoycv39v8g1wYBaQ3tAWRX4s0mY+px h5OBDsoZLyZHxJD4ssKNHq3qoS9voZzK9kNq7+MLKGAI1+Aj2z3dI/hAVOV4gMqBMnrr dYBKn9vrYgJSo8O7W2XQz/JWa0rpaIsya8sK8XCrfIcdzT+0drztsrO705lJtYkpsZ03 hUgblfvWn/MhXi+VjLGVRsz3QoHp/VZSpvT/lMaeongtsnF/e6z2AikuRnro+qzF8gzv S+NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KF9bfgcu6bElrANFusvIx8X6eyNFwMmAeJtPRaeeIEU=; fh=f9/4L5WTkyMs0HwKLVSZtc0UzQZDbbmz4se+5IAJiu4=; b=GTeR7ZoaEupPtI4Py9BaAwUb7R7l40Vg15zaU3luuLkrs7y94tH82NeQ1W6AxWbBAG OgrG0Ik8ICGeYXXL3IYgb69pZxgy/KyJV+i7EPXGClWeX74zxeaIksV+0ZlEm2BkkB7F YuadaVF/zta50zUdCE7kmF31Xun4Oi3nqjSmOgUSPBzuGrVCvP1g6eNK+2aePYEnAOUv 6kfVxwJbbyHgR4rhXqq+Hv6CyW6pdxdRWf+5IfLROYfeV5V2oDbW/0zzSSQMVBxblUAB rYq3uxi4tG4i/9C6ex6K9zMPe2RUAMS1B/wJPLVuoLLk3hBCWvvNnone2u4C2RqdlkkM 0OUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AG0L2NjF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id y31-20020a056a00181f00b006cba887e119si2729305pfa.145.2023.11.23.19.37.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 19:37:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AG0L2NjF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 271D0829B881; Thu, 23 Nov 2023 19:37:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229453AbjKXDhV (ORCPT + 99 others); Thu, 23 Nov 2023 22:37:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231922AbjKXDhM (ORCPT ); Thu, 23 Nov 2023 22:37:12 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69BEC1724 for ; Thu, 23 Nov 2023 19:37:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700797035; 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=KF9bfgcu6bElrANFusvIx8X6eyNFwMmAeJtPRaeeIEU=; b=AG0L2NjF/8qyRSYxjv6Mm7t2z7FgENItTnpDV8YEXxboTveQQr7rjA4HalxEBtSgM8aLUW nwwBxPqYb78IvzMjxfRi6sDbFmewnNBBq8+QL7pIIk3ra6RTd6xQrU+qEDlCfLAs9zLEHj AtmZaV8vJaffLhjcAl9JDIbV4FYI7og= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-fIjiuphYN7SH2UI09nZQug-1; Thu, 23 Nov 2023 22:37:10 -0500 X-MC-Unique: fIjiuphYN7SH2UI09nZQug-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 5E7E81C0434A; Fri, 24 Nov 2023 03:37:10 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F381492BE7; Fri, 24 Nov 2023 03:37:05 +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, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, akpm@linux-foundation.org, joe@perches.com, nathan@kernel.org, yujie.liu@intel.com, Baoquan He Subject: [PATCH v2 4/7] kexec_file, arm64: print out debugging message if required Date: Fri, 24 Nov 2023 11:36:39 +0800 Message-ID: <20231124033642.520686-5-bhe@redhat.com> In-Reply-To: <20231124033642.520686-1-bhe@redhat.com> References: <20231124033642.520686-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 23 Nov 2023 19:37:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783414989565620788 X-GMAIL-MSGID: 1783414989565620788 Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also remove the kimage->segment[] printing because the generic code has done the printing. Signed-off-by: Baoquan He --- arch/arm64/kernel/kexec_image.c | 2 +- arch/arm64/kernel/machine_kexec.c | 26 ++++++-------------------- arch/arm64/kernel/machine_kexec_file.c | 6 +++--- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c index 636be6715155..df71965178f5 100644 --- a/arch/arm64/kernel/kexec_image.c +++ b/arch/arm64/kernel/kexec_image.c @@ -122,7 +122,7 @@ static void *image_load(struct kimage *image, kernel_segment->memsz -= text_offset; image->start = kernel_segment->mem; - pr_debug("Loaded kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + kexec_dprintk("Loaded kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n", kernel_segment->mem, kbuf.bufsz, kernel_segment->memsz); diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index 078910db77a4..b38aae5b488d 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -32,26 +32,12 @@ static void _kexec_image_info(const char *func, int line, const struct kimage *kimage) { - unsigned long i; - - pr_debug("%s:%d:\n", func, line); - pr_debug(" kexec kimage info:\n"); - pr_debug(" type: %d\n", kimage->type); - pr_debug(" start: %lx\n", kimage->start); - pr_debug(" head: %lx\n", kimage->head); - pr_debug(" nr_segments: %lu\n", kimage->nr_segments); - pr_debug(" dtb_mem: %pa\n", &kimage->arch.dtb_mem); - pr_debug(" kern_reloc: %pa\n", &kimage->arch.kern_reloc); - pr_debug(" el2_vectors: %pa\n", &kimage->arch.el2_vectors); - - for (i = 0; i < kimage->nr_segments; i++) { - pr_debug(" segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages\n", - i, - kimage->segment[i].mem, - kimage->segment[i].mem + kimage->segment[i].memsz, - kimage->segment[i].memsz, - kimage->segment[i].memsz / PAGE_SIZE); - } + kexec_dprintk("%s:%d:\n", func, line); + kexec_dprintk(" kexec kimage info:\n"); + kexec_dprintk(" type: %d\n", kimage->type); + kexec_dprintk(" head: %lx\n", kimage->head); + kexec_dprintk(" kern_reloc: %pa\n", &kimage->arch.kern_reloc); + kexec_dprintk(" el2_vectors: %pa\n", &kimage->arch.el2_vectors); } void machine_kexec_cleanup(struct kimage *kimage) diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index a11a6e14ba89..9f82401d99f4 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c @@ -127,7 +127,7 @@ int load_other_segments(struct kimage *image, image->elf_load_addr = kbuf.mem; image->elf_headers_sz = headers_sz; - pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + kexec_dprintk("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", image->elf_load_addr, kbuf.bufsz, kbuf.memsz); } @@ -148,7 +148,7 @@ int load_other_segments(struct kimage *image, goto out_err; initrd_load_addr = kbuf.mem; - pr_debug("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + kexec_dprintk("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n", initrd_load_addr, kbuf.bufsz, kbuf.memsz); } @@ -179,7 +179,7 @@ int load_other_segments(struct kimage *image, image->arch.dtb = dtb; image->arch.dtb_mem = kbuf.mem; - pr_debug("Loaded dtb at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + kexec_dprintk("Loaded dtb at 0x%lx bufsz=0x%lx memsz=0x%lx\n", kbuf.mem, kbuf.bufsz, kbuf.memsz); return 0; From patchwork Fri Nov 24 03:36:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 169160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp876055vqx; Thu, 23 Nov 2023 19:37:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVXSTEvd6jAX1g8LWSnMfULcG6YiYndYXY6SMXF3rIG7qj1c9Lig+Bm3631sefEK1+355h X-Received: by 2002:a05:6a20:914e:b0:18b:1a31:ee6a with SMTP id x14-20020a056a20914e00b0018b1a31ee6amr5841393pzc.23.1700797071805; Thu, 23 Nov 2023 19:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700797071; cv=none; d=google.com; s=arc-20160816; b=UOpRGmUpo1OnCpNMajoAsXcewh17EeVQxRVG9BCJowtejqYLb3lnluFxkPTDsZiJLG sVt3tzXFYBXEkSbrn7+pR9Qyg8SrNdxKPONVvhKYS4s+1a2KYIG76jeqI6H7pB61b49+ 3dW5ov5rRE0E69Mzol4DmpZK/Sg0JLGZQsDKp6cQfdIXgrJGGzgLlq0WXCI63sy1X5Mc PzdKp4jOHrIfhlCd0YSThMFi6+HNGATHv0AIPVVVZVXf9AvHpq2bCiCcNLYJ7Mb5vQmq 8md8pfN3uqUtDldARNdqWjbvJ6JsDIJVIeQldk/sNIgjknvi1BicNQWuMRNzfAvhx1nc v6ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kkmRVng/H+5xvIfC3pnGSESqdAmeGP3BqYdDpZBh2K4=; fh=f9/4L5WTkyMs0HwKLVSZtc0UzQZDbbmz4se+5IAJiu4=; b=rUFELF6nBx+jzJ5zdbjZciYoKlpjSu1XbPRmhYrEj8QICmXbTZel2JIGywLdEVAaTY tsylJ+T1ZCNMLsQa1AvaUh9xSknjjo9ksIbK8P60yIa8DtfnaTAmF98gYC39lyJHRPv1 YdQ9IoievtUB+m9ZLqWkHrTtCqp/qeuXcPFs9fE5KoTw3TzTfBMs4TEDKKH0TZtQcaRk qtBCJvWLnEEJKk+jlAGOtO6/U0ycqwuNA3ZkNj9i9/Fb4z0+PiGLpFT9FJpiT9hyaIEP ng2T68Od3eagRCGRszEZ5aSHRGEwNTHN7U4S+9kWk9ULznB72yw8/ztCvocC5NcJmE1B b9Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P0JCGSKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 1-20020a631541000000b005c1cc7273bcsi2670287pgv.731.2023.11.23.19.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 19:37:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P0JCGSKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 2347F8364297; Thu, 23 Nov 2023 19:37:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232601AbjKXDh1 (ORCPT + 99 others); Thu, 23 Nov 2023 22:37:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbjKXDhS (ORCPT ); Thu, 23 Nov 2023 22:37:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DBF2172B for ; Thu, 23 Nov 2023 19:37:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700797039; 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=kkmRVng/H+5xvIfC3pnGSESqdAmeGP3BqYdDpZBh2K4=; b=P0JCGSKQxHOum2own8n5BYqM85zHHDQ5aDgyBJMeh3iiFc1ITuq+aEyyc+dbIJcdtNNcDu Sf3xlwv6b58XHAdGfI/8SnZMDAtaSZiIU9mJmrrI/13pDQTvvp2hknx9xA6A+zwvLWyCnW sGhl8mNyPPlao7/JD3l/vCi3kQHCGzc= 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-213-Xw2wknElN-CG8sxYL3DIWg-1; Thu, 23 Nov 2023 22:37:16 -0500 X-MC-Unique: Xw2wknElN-CG8sxYL3DIWg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 754F1101A529; Fri, 24 Nov 2023 03:37:15 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02E47492BE7; Fri, 24 Nov 2023 03:37:10 +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, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, akpm@linux-foundation.org, joe@perches.com, nathan@kernel.org, yujie.liu@intel.com, Baoquan He Subject: [PATCH v2 5/7] kexec_file, ricv: print out debugging message if required Date: Fri, 24 Nov 2023 11:36:40 +0800 Message-ID: <20231124033642.520686-6-bhe@redhat.com> In-Reply-To: <20231124033642.520686-1-bhe@redhat.com> References: <20231124033642.520686-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 23 Nov 2023 19:37:49 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783414990061613235 X-GMAIL-MSGID: 1783414990061613235 Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also remove kexec_image_info() because the content has been printed out in generic code. Signed-off-by: Baoquan He --- arch/riscv/kernel/elf_kexec.c | 9 +++++---- arch/riscv/kernel/machine_kexec.c | 26 -------------------------- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c index e60fbd8660c4..20d941e91b5e 100644 --- a/arch/riscv/kernel/elf_kexec.c +++ b/arch/riscv/kernel/elf_kexec.c @@ -216,7 +216,6 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, if (ret) goto out; kernel_start = image->start; - pr_notice("The entry point of kernel at 0x%lx\n", image->start); /* Add the kernel binary to the image */ ret = riscv_kexec_elf_load(image, &ehdr, &elf_info, @@ -252,7 +251,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, image->elf_load_addr = kbuf.mem; image->elf_headers_sz = headers_sz; - pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + kexec_dprintk("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", image->elf_load_addr, kbuf.bufsz, kbuf.memsz); /* Setup cmdline for kdump kernel case */ @@ -275,6 +274,8 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, pr_err("Error loading purgatory ret=%d\n", ret); goto out; } + kexec_dprintk("Loaded purgatory at 0x%lx\n", kbuf.mem); + ret = kexec_purgatory_get_set_symbol(image, "riscv_kernel_entry", &kernel_start, sizeof(kernel_start), 0); @@ -293,7 +294,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, if (ret) goto out; initrd_pbase = kbuf.mem; - pr_notice("Loaded initrd at 0x%lx\n", initrd_pbase); + kexec_dprintk("Loaded initrd at 0x%lx\n", initrd_pbase); } /* Add the DTB to the image */ @@ -318,7 +319,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, } /* Cache the fdt buffer address for memory cleanup */ image->arch.fdt = fdt; - pr_notice("Loaded device tree at 0x%lx\n", kbuf.mem); + kexec_dprintk("Loaded device tree at 0x%lx\n", kbuf.mem); goto out; out_free_fdt: diff --git a/arch/riscv/kernel/machine_kexec.c b/arch/riscv/kernel/machine_kexec.c index 2d139b724bc8..ed9cad20c039 100644 --- a/arch/riscv/kernel/machine_kexec.c +++ b/arch/riscv/kernel/machine_kexec.c @@ -18,30 +18,6 @@ #include #include -/* - * kexec_image_info - Print received image details - */ -static void -kexec_image_info(const struct kimage *image) -{ - unsigned long i; - - pr_debug("Kexec image info:\n"); - pr_debug("\ttype: %d\n", image->type); - pr_debug("\tstart: %lx\n", image->start); - pr_debug("\thead: %lx\n", image->head); - pr_debug("\tnr_segments: %lu\n", image->nr_segments); - - for (i = 0; i < image->nr_segments; i++) { - pr_debug("\t segment[%lu]: %016lx - %016lx", i, - image->segment[i].mem, - image->segment[i].mem + image->segment[i].memsz); - pr_debug("\t\t0x%lx bytes, %lu pages\n", - (unsigned long) image->segment[i].memsz, - (unsigned long) image->segment[i].memsz / PAGE_SIZE); - } -} - /* * machine_kexec_prepare - Initialize kexec * @@ -60,8 +36,6 @@ machine_kexec_prepare(struct kimage *image) unsigned int control_code_buffer_sz = 0; int i = 0; - kexec_image_info(image); - /* Find the Flattened Device Tree and save its physical address */ for (i = 0; i < image->nr_segments; i++) { if (image->segment[i].memsz <= sizeof(fdt)) From patchwork Fri Nov 24 03:36:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 169163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp876200vqx; Thu, 23 Nov 2023 19:38:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoW/0g2zyB/+s42Svz2y6Yv7XVaKvnMnYDZtjg1BpYSWoKw6opzCKjZL6CHo2AHUTJvKDU X-Received: by 2002:a05:6a20:6a11:b0:18b:a310:f7d6 with SMTP id p17-20020a056a206a1100b0018ba310f7d6mr1465921pzk.57.1700797103440; Thu, 23 Nov 2023 19:38:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700797103; cv=none; d=google.com; s=arc-20160816; b=NP/VdfnFbHlEAPO/Q6Y6K5Z/p2F7ezvH2L/E1BVdoPlubH1VfeS8QSAlS0IiEw8xZo ukEwaLC3qKQAThzTRsQKTTsWDSuMvV6ufy3R9zVcIB0sXsJh6r4iQntnikhOW1OPyGl5 nD+Hgn0rglPrIwyFodhBd7jFE4fDJt9GTzqopOwVffR8dXAFzkpKf8xg/Xt1avg7oKJv D079SfM0NM7s3UUXtzuMOPQSn8DX6NbLEWHm6Op+Ih/P/8GoEI/2GSBgN3ix35zCLnU/ EiIwhICzZROs/NNPdd1J5O8Q8QKgNoiPWV6XYHWOcXv9kdvxUG90oI07nwEY78/TQPNH xsfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ddYSvqzlkNogyoNHz/ZYeptUXFMRcqTi26tdLDKHB50=; fh=f9/4L5WTkyMs0HwKLVSZtc0UzQZDbbmz4se+5IAJiu4=; b=pyYh0zup6EARF/vJ9JsWmby1uh9zr+ACg3gAlY3+/v1pV95ENcmfwPVZAXLS+dV1ko v0xy1G34/6Ludow5Y+ya2blfv+bsPzGrb/A2gt8yQ4C5apEX3G5NlS69tRWrN1IQ2DHk 244p2DS/3qZEzujrd9dLYvvNlU0VIa0NPM4KEPlhUC33gDMMpuGwMn3ksqt5vpHBcpkk yJMrktHN2bm+FPWiEt4WwXTvmfxZjDy+1fhgt6kDwaikLzRD3lO4p+/d3auhww4Udl2R 1VxUIZ+BJlLE08WmCOJq/ErQpthqj3pMy/SKBL6aCnVknaEkOQ+2OIKnszqrNfalZe7B OeCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LNp5qHbI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a5-20020a170902ee8500b001c724f997ffsi2396011pld.131.2023.11.23.19.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 19:38:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LNp5qHbI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5EA8D82AE5C4; Thu, 23 Nov 2023 19:38:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230194AbjKXDiI (ORCPT + 99 others); Thu, 23 Nov 2023 22:38:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232910AbjKXDhv (ORCPT ); Thu, 23 Nov 2023 22:37:51 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C383170B for ; Thu, 23 Nov 2023 19:37:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700797075; 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=ddYSvqzlkNogyoNHz/ZYeptUXFMRcqTi26tdLDKHB50=; b=LNp5qHbIj+lwVWW0OwznynPPGb77GrSNXxXcT4EVCByxeisS8XsxCmckLp13CjjkpxKsUx P/t7PF00MxYYvXbXo1aL6mILUWGVwjq4j2pZA2mJ9atHL9ZBVLqeX4v2VLzzuAI/RM/ptV tRnjp8YevK5HpupAys+BCC9WDRes070= 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-50-8nebnkVBMhyBq-CpvVeZag-1; Thu, 23 Nov 2023 22:37:21 -0500 X-MC-Unique: 8nebnkVBMhyBq-CpvVeZag-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 8D23F185A782; Fri, 24 Nov 2023 03:37:20 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19020492BE7; Fri, 24 Nov 2023 03:37:15 +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, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, akpm@linux-foundation.org, joe@perches.com, nathan@kernel.org, yujie.liu@intel.com, Baoquan He Subject: [PATCH v2 6/7] kexec_file, power: print out debugging message if required Date: Fri, 24 Nov 2023 11:36:41 +0800 Message-ID: <20231124033642.520686-7-bhe@redhat.com> In-Reply-To: <20231124033642.520686-1-bhe@redhat.com> References: <20231124033642.520686-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 23 Nov 2023 19:38:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783415023719249407 X-GMAIL-MSGID: 1783415023719249407 Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. Signed-off-by: Baoquan He --- arch/powerpc/kexec/elf_64.c | 8 ++++---- arch/powerpc/kexec/file_load_64.c | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c index eeb258002d1e..904016cf89ea 100644 --- a/arch/powerpc/kexec/elf_64.c +++ b/arch/powerpc/kexec/elf_64.c @@ -59,7 +59,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, if (ret) goto out; - pr_debug("Loaded the kernel at 0x%lx\n", kernel_load_addr); + kexec_dprintk("Loaded the kernel at 0x%lx\n", kernel_load_addr); ret = kexec_load_purgatory(image, &pbuf); if (ret) { @@ -67,7 +67,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, goto out; } - pr_debug("Loaded purgatory at 0x%lx\n", pbuf.mem); + kexec_dprintk("Loaded purgatory at 0x%lx\n", pbuf.mem); /* Load additional segments needed for panic kernel */ if (image->type == KEXEC_TYPE_CRASH) { @@ -99,7 +99,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, goto out; initrd_load_addr = kbuf.mem; - pr_debug("Loaded initrd at 0x%lx\n", initrd_load_addr); + kexec_dprintk("Loaded initrd at 0x%lx\n", initrd_load_addr); } fdt = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr, @@ -132,7 +132,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, fdt_load_addr = kbuf.mem; - pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr); + kexec_dprintk("Loaded device tree at 0x%lx\n", fdt_load_addr); slave_code = elf_info.buffer + elf_info.proghdrs[0].p_offset; ret = setup_purgatory_ppc64(image, slave_code, fdt, kernel_load_addr, diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index 961a6dd67365..45089f53f875 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -577,7 +577,7 @@ static int add_usable_mem_property(void *fdt, struct device_node *dn, NODE_PATH_LEN, dn); return -EOVERFLOW; } - pr_debug("Memory node path: %s\n", path); + kexec_dprintk("Memory node path: %s\n", path); /* Now that we know the path, find its offset in kdump kernel's fdt */ node = fdt_path_offset(fdt, path); @@ -590,8 +590,8 @@ static int add_usable_mem_property(void *fdt, struct device_node *dn, /* Get the address & size cells */ n_mem_addr_cells = of_n_addr_cells(dn); n_mem_size_cells = of_n_size_cells(dn); - pr_debug("address cells: %d, size cells: %d\n", n_mem_addr_cells, - n_mem_size_cells); + kexec_dprintk("address cells: %d, size cells: %d\n", n_mem_addr_cells, + n_mem_size_cells); um_info->idx = 0; if (!check_realloc_usable_mem(um_info, 2)) { @@ -664,7 +664,7 @@ static int update_usable_mem_fdt(void *fdt, struct crash_mem *usable_mem) node = fdt_path_offset(fdt, "/ibm,dynamic-reconfiguration-memory"); if (node == -FDT_ERR_NOTFOUND) - pr_debug("No dynamic reconfiguration memory found\n"); + kexec_dprintk("No dynamic reconfiguration memory found\n"); else if (node < 0) { pr_err("Malformed device tree: error reading /ibm,dynamic-reconfiguration-memory.\n"); return -EINVAL; @@ -776,7 +776,7 @@ static void update_backup_region_phdr(struct kimage *image, Elf64_Ehdr *ehdr) for (i = 0; i < ehdr->e_phnum; i++) { if (phdr->p_paddr == BACKUP_SRC_START) { phdr->p_offset = image->arch.backup_start; - pr_debug("Backup region offset updated to 0x%lx\n", + kexec_dprintk("Backup region offset updated to 0x%lx\n", image->arch.backup_start); return; } @@ -850,7 +850,7 @@ int load_crashdump_segments_ppc64(struct kimage *image, pr_err("Failed to load backup segment\n"); return ret; } - pr_debug("Loaded the backup region at 0x%lx\n", kbuf->mem); + kexec_dprintk("Loaded the backup region at 0x%lx\n", kbuf->mem); /* Load elfcorehdr segment - to export crashing kernel's vmcore */ ret = load_elfcorehdr_segment(image, kbuf); @@ -858,7 +858,7 @@ int load_crashdump_segments_ppc64(struct kimage *image, pr_err("Failed to load elfcorehdr segment\n"); return ret; } - pr_debug("Loaded elf core header at 0x%lx, bufsz=0x%lx memsz=0x%lx\n", + kexec_dprintk("Loaded elf core header at 0x%lx, bufsz=0x%lx memsz=0x%lx\n", image->elf_load_addr, kbuf->bufsz, kbuf->memsz); return 0; From patchwork Fri Nov 24 03:36:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 169161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp876076vqx; Thu, 23 Nov 2023 19:37:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVwxxZUr94FRxPxkU5lOe18saqIZ275WVS0JM8WFOLnT20vOkL6FKOt5eFFauBEPpC5zTt X-Received: by 2002:a05:6a20:729c:b0:18b:826c:411b with SMTP id o28-20020a056a20729c00b0018b826c411bmr2079221pzk.17.1700797076840; Thu, 23 Nov 2023 19:37:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700797076; cv=none; d=google.com; s=arc-20160816; b=II9wGuzZ37fjHKW9Yie0h4LqzmYNm7St3KX1m9ENw7O7gS8E/7WGXW1CxyOJtFfWU5 IocDbW5kdcfBdLJFfVCFu6m/QF2EYbgvY+mZ+72Gm/8r0o2U5EidDBN/p4c8mzVFt9Yu BNlIkzE3s5/tdLMUITUFLmNK4rErZrvki69YfSWczgxS+U4UXzdlIhtS0tbL1G9z5N9E LPcDD8OvCPQexDSvuryfEk3XMae3+JCquoc63lJsAy/aDvgzDzxvhcd/+ejxkt6xJU8L 5BW9YARkirA1AP7+qOi/JAimuZpmwsQGWTad6RDaEyfAFhOgBUa0Lqd4/0ATtxhYiY9p txxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CfaOCzpQNXPNdiOU6+O8brbk3lbOzOfrbuJX1VTIoz4=; fh=f9/4L5WTkyMs0HwKLVSZtc0UzQZDbbmz4se+5IAJiu4=; b=QVWCbhh2OGc4bFoiNPnhA3cmzviblBUTWdFavFsGiTS3kMC8Ud3PBygPCLILNnjKvP UZATa3byEEBgBoa3BmbJzU+1Cbq+PHQqYB+BijMLhY7CktnCpRf907ssekMtFXRXye9L scb4BS4PQtFjaOCjxfzfdPUUiLf/ehH19iKF83bxRJKvPFR6A+jhx9VfnQdjn19/nKDo r/HUnr8y8snVp/utCuVVRfS7Yw7lvUUW9yTpc1foUWOkFth9Ulhir794DamKBsGotl86 wNRP1WHhWatnSrGFZFJ71WnqqD7LDnY0Ediq6L8IYPSGtus9RRRxa46dRcrU71IeOQfv 4W1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UkRT7gcP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id j15-20020a170903024f00b001c73732c1f2si2604497plh.223.2023.11.23.19.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 19:37:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UkRT7gcP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0C511805F4B6; Thu, 23 Nov 2023 19:37:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232271AbjKXDhp (ORCPT + 99 others); Thu, 23 Nov 2023 22:37:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbjKXDhc (ORCPT ); Thu, 23 Nov 2023 22:37:32 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 512FF10F3 for ; Thu, 23 Nov 2023 19:37:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700797050; 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=CfaOCzpQNXPNdiOU6+O8brbk3lbOzOfrbuJX1VTIoz4=; b=UkRT7gcP4+M58V5l0TgFtmlURRe9ja3jani/lyiQKfKJUYgGYlEGelY5YAXpbDHnO4jQVN mhkMRskT6YH/oD/G7Y4Ak7r2KxNhckQIhyeSDzQ5QpMlP8cd5BMVW8iZurPtr2U+8psJp0 Secif1FWEMsSEjJGFyo24nzbfyjwfsI= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-F2GfJlqvM5iLOFSDvp8tzg-1; Thu, 23 Nov 2023 22:37:26 -0500 X-MC-Unique: F2GfJlqvM5iLOFSDvp8tzg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 A55773813F26; Fri, 24 Nov 2023 03:37:25 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3262A492BE7; Fri, 24 Nov 2023 03:37:20 +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, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, akpm@linux-foundation.org, joe@perches.com, nathan@kernel.org, yujie.liu@intel.com, Baoquan He Subject: [PATCH v2 7/7] kexec_file, parisc: print out debugging message if required Date: Fri, 24 Nov 2023 11:36:42 +0800 Message-ID: <20231124033642.520686-8-bhe@redhat.com> In-Reply-To: <20231124033642.520686-1-bhe@redhat.com> References: <20231124033642.520686-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 23 Nov 2023 19:37:54 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783414995658948480 X-GMAIL-MSGID: 1783414995658948480 Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. Signed-off-by: Baoquan He --- arch/parisc/kernel/kexec_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/parisc/kernel/kexec_file.c b/arch/parisc/kernel/kexec_file.c index 8c534204f0fd..011545898da7 100644 --- a/arch/parisc/kernel/kexec_file.c +++ b/arch/parisc/kernel/kexec_file.c @@ -38,7 +38,7 @@ static void *elf_load(struct kimage *image, char *kernel_buf, for (i = 0; i < image->nr_segments; i++) image->segment[i].mem = __pa(image->segment[i].mem); - pr_debug("Loaded the kernel at 0x%lx, entry at 0x%lx\n", + kexec_dprintk("Loaded the kernel at 0x%lx, entry at 0x%lx\n", kernel_load_addr, image->start); if (initrd != NULL) { @@ -51,7 +51,7 @@ static void *elf_load(struct kimage *image, char *kernel_buf, if (ret) goto out; - pr_debug("Loaded initrd at 0x%lx\n", kbuf.mem); + kexec_dprintk("Loaded initrd at 0x%lx\n", kbuf.mem); image->arch.initrd_start = kbuf.mem; image->arch.initrd_end = kbuf.mem + initrd_len; } @@ -68,7 +68,7 @@ static void *elf_load(struct kimage *image, char *kernel_buf, if (ret) goto out; - pr_debug("Loaded cmdline at 0x%lx\n", kbuf.mem); + kexec_dprintk("Loaded cmdline at 0x%lx\n", kbuf.mem); image->arch.cmdline = kbuf.mem; } out: