Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5117711rdb; Tue, 12 Dec 2023 21:58:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdwF7pz+239JNgKR9Oj47OOaH8da6w0x1if0kpzluY8b3McCArRif2e5ceV56ZVezj/0N3 X-Received: by 2002:a05:6a20:918b:b0:18f:97c:8a34 with SMTP id v11-20020a056a20918b00b0018f097c8a34mr10450533pzd.95.1702447139545; Tue, 12 Dec 2023 21:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702447139; cv=none; d=google.com; s=arc-20160816; b=dD2dJSvZVeDsguUUDj0990B9KrU87jfTjBxoJhtNR/RfilD05/AaY2dx5Fs9X14qJ2 qHM0o0iOCwHCytc03YrYE8jQVy1w9d8hrtVjIs8rxyLJqR9Yi1+yNWBMghko5Zr/4B8e bokmlG6GxZWYugwnIK8Bxim2wBt19WOr17xftHPUKrBl48vtyF5orBvMVyqhDchMrQ0Z s18os8MP9g0T5Av34GVVaf5CWTuRMkZQn9q7Gze0MOamOXGXnLhEXN6A/ygjIqXxdCoi Y4IWSgB6l4nHaczeZKyNxqqM0AqC4Ff2cj8L/SZPmBZfQFcnnc8+8HzhG6R30JF2au5Y dBDA== 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=fRxSkAGnT4yFqSPEx0cIWjLNx9bSTNsfyZcjQu+z4G0=; fh=Hp23/yTs1prFnRvQlck2+XsDI7iq9YE2GFKxDKXVk2c=; b=BBU0myQU+svL1xZyRvwPN5WuP7EIWIymWyz+Zn3htQ4LnfacmbW+BpRszY1W3UAMzC 84eEDvJ7FWLYFK0TB8JJS1cd0iw5XHS3WZ1co5jGYT17peILMTDh3ivipnS743YapcUF XG1A57NThFOCfg0U+Yl582h1q10OFz7TVhH4plgnqceHJgt5sB/Xo6TGaI/JqfTEszwY ta/ojt+zTMVYK5aWaEpUiMtVLSOQNOABgf8yCPBt8SQvLxK7AiuWkhitW59kqRcBucrK M6rn/vXPmxZ0Lej6W8S1eh9p8g7B1yyEznL4jbH1Mki6kyj1walixmV/c9yeg5j+QVc9 EfJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fgd66BkG; 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 Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id kb4-20020a17090ae7c400b002871b0b4a11si9238988pjb.61.2023.12.12.21.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 21:58:59 -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=fgd66BkG; 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 9790280443AF; Tue, 12 Dec 2023 21:58:56 -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 S235303AbjLMF6i (ORCPT + 99 others); Wed, 13 Dec 2023 00:58:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235299AbjLMF6b (ORCPT ); Wed, 13 Dec 2023 00:58:31 -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 B68C91A2 for ; Tue, 12 Dec 2023 21:58:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702447108; 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=fRxSkAGnT4yFqSPEx0cIWjLNx9bSTNsfyZcjQu+z4G0=; b=fgd66BkG57BxEsIiJ3Kj4WEsbgqEM/POUQuv+XVHvOef+Ywp8kg5KaN3hzetvweWG0wcwm sS3H54H3FjI3HmFolQanqMeAoHDwcAD9V0QFkW0Mk4BqGaP7v6hibzRy56/vQooUKMhIBf sK/TjL+YzPbPiDlPyJD+i7lJER7bn2I= 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-149-xp-d7U5zMHS8PHJIR1CgUQ-1; Wed, 13 Dec 2023 00:58:24 -0500 X-MC-Unique: xp-d7U5zMHS8PHJIR1CgUQ-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 E9F0080BEC1; Wed, 13 Dec 2023 05:58:23 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42A091C060AF; Wed, 13 Dec 2023 05:58:18 +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, conor@kernel.org, Baoquan He Subject: [PATCH v4 5/7] kexec_file, ricv: print out debugging message if required Date: Wed, 13 Dec 2023 13:57:45 +0800 Message-ID: <20231213055747.61826-6-bhe@redhat.com> In-Reply-To: <20231213055747.61826-1-bhe@redhat.com> References: <20231213055747.61826-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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]); Tue, 12 Dec 2023 21:58:56 -0800 (PST) Then when specifying '-d' for kexec_file_load interface, loaded locations of kernel/initrd/cmdline etc can be printed out to help debug. Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also replace pr_notice() with kexec_dprintk() in elf_kexec_load() because loaded location of purgatory and device tree are only printed out for debugging, it doesn't make sense to always print them out. 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 | 11 ++++++----- arch/riscv/kernel/machine_kexec.c | 26 -------------------------- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c index e60fbd8660c4..5bd1ec3341fe 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,8 +251,8 @@ 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", - image->elf_load_addr, kbuf.bufsz, kbuf.memsz); + 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 */ modified_cmdline = setup_kdump_cmdline(image, cmdline, @@ -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)) -- 2.41.0