Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp755887lqp; Sat, 13 Apr 2024 19:54:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+io623UIXn7UYlUGLAReTGw+ySy1GT+u1Zq0mp4PRaJ1BZBfa2+LXJCiX/q0t4Ry3IIJazn+PTt+SQVd2UWilLMGDlr4K6Oy8GJxbLQ== X-Google-Smtp-Source: AGHT+IG2ZShXcvPf3hr+Bhubc/eBQhpMOK4Iz9mKOdcVoPqRfbl1SAYJvKKJ1kpcPl4OTNijCV+4 X-Received: by 2002:a05:622a:1494:b0:434:47e9:a53f with SMTP id t20-20020a05622a149400b0043447e9a53fmr8041418qtx.58.1713063271467; Sat, 13 Apr 2024 19:54:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713063271; cv=pass; d=google.com; s=arc-20160816; b=Xdu+oCfv0ZAEWilWP2z8qXEQ+keqHvjS4bJrmmixdILzC2mBdcRg4O/+kxQUO+H4MN GLzgQtPDT7rDfUmjJ2SWWxCz9kVn8TSiqjWOAUYtWAPPRyJWrdDG73A/flOHwsybOcYy UpPO+K+0PTtmll0kOT2MA9K+lhR7PA8wV8p/EFRzn6GcORzVLkIGEJ9E809ogPJ5KFOF 24W/I3rUJg1698PGu9UiBkyC2cwCNqClMzUKc2LtA6BgbGSNr6YDxQCp6QbqM5pm0JQn iWtJXCyFk03mi35AMokbfVo+haQh5J9lx6rc+n5raXtZTrHgPhlrUmz9PRmDpVU3GFYH aIyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OhLPL+Z8mhdNe67IKMsqNtqhIqypjsxI4KpmPg+trm4=; fh=V9aN7wYpw0lKkgLPDTa2XZOVWFaUq0ElPKt9DGPKlpU=; b=Y1n7C3fUpi3K3wWDWPD2HeeKAigU+OtGplzKHYcX9afaflLQpYU4n8kByj0yuk+Zfn D/6uOjK25zg6GOR+k2PRhrbfYVZSplj8hu5af6qvw//35vJ5CegNshBoxiVpInqYYCUG lIZY48Uz/3syNZkMvrCMv0t8CW7t04V42sG4rx9U2+cnYiauEkvt3RVOVeFZUPowfNOl u7yHwL0FO1LLFrxBqrtzn3VhFNNAK5Q20kLxx+v6Qt/Z3ySA2kCCeo56EwmzqMq5vDWD EnC4baQ5SfESF/fEdp8LWrOG86VWHXsBOmksqowtuf7H7ciS9DI+Ky+WSWZuoRn5njal uh8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Rl6yz7pL; 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-143945-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143945-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c13-20020ad45aed000000b0069b6b4c0ee4si1980461qvh.616.2024.04.13.19.54.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 19:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143945-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Rl6yz7pL; 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-143945-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143945-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 001DA1C21176 for ; Sun, 14 Apr 2024 02:54:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 139B4182AE; Sun, 14 Apr 2024 02:54:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Rl6yz7pL" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 24B5817BB7 for ; Sun, 14 Apr 2024 02:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713063264; cv=none; b=hUZTofHQ/gMUaNYfRths/MbhqKV9mvGxfNV1RfMt1WZ+Q7lYxxfbRrKAkHcWCXYKl+C8v1nMyxJ/XYQX+bs04wsLHtatTCV7iwTh7V9tCDdWZeB1tE6tItDA/zrMO3wQ+Ys39fk2Yxs9rHo+StjihBC6XOe0pCP6WOfOcNn5R1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713063264; c=relaxed/simple; bh=aIBjNNw2Keu9G7UDv6iOj4TLO0fqBpBoO4nzVGHm7UQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JRnswzdSzYcozMvkdWWp85ZzapjpxmkJlab22R8jIGprEoCKjGTGkJmf1yXOB05X95O+XjzMGKILsvTKTRZ8W9u+wRmYoOfNP1rtIomAXigLbCze6J53+5lRRG1dJc3/pKnN2prqUoRaD8RdFbCsmkSclBsdfOAqzHciWNMUozI= 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=Rl6yz7pL; arc=none smtp.client-ip=170.10.129.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=1713063260; 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: in-reply-to:in-reply-to:references:references; bh=OhLPL+Z8mhdNe67IKMsqNtqhIqypjsxI4KpmPg+trm4=; b=Rl6yz7pLX2ATCUcleAHpEKsJWanGW1QPbrPw1ZznghaxbdpABZY06uCWf0VInpJb/WdGgS aAJ8+Yhavt5p+InygWmQfIefh1NxWnRwrcZoqdLqfPH23sNq2gGgpTMCpn2Tz+DSsRa3iQ eUlhUNP4p0wPRwqwdXecGcSpnUhmOC0= 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-631-mzn0Pu1aNfCwCNMoXmM7hA-1; Sat, 13 Apr 2024 22:54:18 -0400 X-MC-Unique: mzn0Pu1aNfCwCNMoXmM7hA-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 9F0141C05AB5; Sun, 14 Apr 2024 02:54:17 +0000 (UTC) Received: from localhost (unknown [10.72.116.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA896492BC8; Sun, 14 Apr 2024 02:54:16 +0000 (UTC) Date: Sun, 14 Apr 2024 10:54:09 +0800 From: Baoquan He To: Dave Young Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, jirislaby@kernel.org Subject: Re: [PATCH v2] kexec: fix the unexpected kexec_dprintk() macro Message-ID: References: <20240409042238.1240462-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; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 Hi Dave, On 04/12/24 at 03:28pm, Dave Young wrote: > On Tue, 9 Apr 2024 at 12:23, Baoquan He wrote: > > > > Jiri reported that the current kexec_dprintk() always prints out > > debugging message whenever kexec/kdmmp loading is triggered. That is > > not wanted. The debugging message is supposed to be printed out when > > 'kexec -s -d' is specified for kexec/kdump loading. > > > > After investigating, the reason is the current kexec_dprintk() takes > > printk(KERN_INFO) or printk(KERN_DEBUG) depending on whether '-d' is > > specified. However, distros usually have defaulg log level like below: > > > > [~]# cat /proc/sys/kernel/printk > > 7 4 1 7 > > > > So, even though '-d' is not specified, printk(KERN_DEBUG) also always > > prints out. I thought printk(KERN_DEBUG) is equal to pr_debug(), it's > > not. > > > > Fix it by changing to use pr_info() instead which are expected to work. > > Could you also update the kernel/crash_core.c and > kernel/crash_reserve.c to include the filename prefix? > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt When I added pr_fmt() to kernel/crash_reserve.c and tested code, the printed boot log about crashkernel reservation is changed as below: [ +0.000000] crash_reserve: crashkernel reserved: 0x000000007d000000 - 0x0000000095000000 (384 MB) When I looked around, I noticed all other lines around don't have the module name printed out. Seems it's not appropriate to add one for crashkernel alone. And the kexec_dprintk() doesn't exist in kernel/crash_reserve.c. Furthermore, the kexec_dprintk() is added to enable debugging printing for kexec_file_load when loading kexec/kdump kernel. This crashkernel reservation may not be related. Combinbed these all, I would suggest not adding pr_fmt() for kernel/crash_reserve.c for now, let's add pr_fmt() for kernel/crash_core.c, what do you think? > > > > > Fixes: cbc2fe9d9cb2 ("kexec_file: add kexec_file flag to control debug printing") > > Signed-off-by: Baoquan He > > Reported-by: Jiri Slaby > > Closes: https://lore.kernel.org/all/4c775fca-5def-4a2d-8437-7130b02722a2@kernel.org > > --- > > v1->v2: > > - Change to use pr_info() only when "kexec -s -d" is specified. With > > this change, those debugging message for "kexec -c -d" of kexec_load > > will be missed. We'll see if we need add them for kexec_load too, if > > someone explicitly requests it. > > > > include/linux/kexec.h | 6 ++---- > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/include/linux/kexec.h b/include/linux/kexec.h > > index 060835bb82d5..f31bd304df45 100644 > > --- a/include/linux/kexec.h > > +++ b/include/linux/kexec.h > > @@ -461,10 +461,8 @@ static inline void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages) { > > > > extern bool kexec_file_dbg_print; > > > > -#define kexec_dprintk(fmt, ...) \ > > - printk("%s" fmt, \ > > - kexec_file_dbg_print ? KERN_INFO : KERN_DEBUG, \ > > - ##__VA_ARGS__) > > +#define kexec_dprintk(fmt, arg...) \ > > + do { if (kexec_file_dbg_print) pr_info(fmt, ##arg); } while (0) > > > > #else /* !CONFIG_KEXEC_CORE */ > > struct pt_regs; > > -- > > 2.41.0 > > > > >