Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp512811lqp; Sat, 13 Apr 2024 06:58:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxsFFCrvIMmEmq6KSMpffDXRmR0AuiTTGPR0LUw/1qGlAz5jxNKctQGFa+2NjSfKpVCb2JgoZuHw0MxFCSRxdrXs95zMvfucst30yzuA== X-Google-Smtp-Source: AGHT+IHo2zcQmwos9xEuBjs6DbnwKULUhMoS8tEXeQr7+XrJHy9b1OFzH/eivyXw3ooz3lriMKGA X-Received: by 2002:a5d:6da5:0:b0:343:ef1b:9f68 with SMTP id u5-20020a5d6da5000000b00343ef1b9f68mr6211908wrs.50.1713016685258; Sat, 13 Apr 2024 06:58:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713016685; cv=pass; d=google.com; s=arc-20160816; b=SwJGcdMBkaH3hWdlSayzaneqeW3FfQZP/kWbqKwZ/9KZsGreJ8VTJN4PiubJdnQpxD JiARAXy9gyMSRSdQW+3lOlJtn5C4tpJaW2iyCZ8wMWQ456ppt+twDRlsRkrkKtK1Q0ju KIaOjajXgW8J6/8NyAZoHOKte6dXVQX/HaJZEXCad6s9BUZ0+eYTmZk4mfdqXrmdBRou 9kdZpz8CZBch1uRu7pTvaZKoZH/p+SnXpA5mo+m+vH1VcOqDy5lbBdYl8npyFtMqbvDK R7++M1Eaf5HoZhmHv3yT/0WrfGu/Z+gwi8wih3/PPhvlfWICc2GLW2XZZ7WTzuLcfSLE 3tvA== 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=04YHOvgyKxIV8EOiQdBH6Pt5NZfGj8+5tbMEaegT57A=; fh=V9aN7wYpw0lKkgLPDTa2XZOVWFaUq0ElPKt9DGPKlpU=; b=aTYIinFHwG+4PptOYwGc4bcvQLW/ggI+ShUA1QM0F58HpnsuxwJicXCaPoaTDUc3Uf FF2FiUCR6Wu9FPTOffUQYVDX2zidWTOM+CmU5hLB9KRkt0YoaHLFx9VrCrULx6HFBNbp sMYwsQiWB4/0bmAZtNZKdHgC5lS1JXcmECGKCswdom51Y7xdDDCJmFgm2pCsjhYZWfEc eeFsI2H1EkHfOql4Ww8dlAKmxsxWVXCxNcktsf3RatWcm8GpBjyK0274vispB4PMN/Jy pjt1/3hXGmjSj1dMOxu82RluFXPmSmtPFwiMik9/KGxbfMH2S05kSrzXktXcyHGf62HO 9wVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IfT4UYcK; 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-143743-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jg2-20020a170907970200b00a474ecff8adsi2735406ejc.412.2024.04.13.06.58.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 06:58:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143743-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IfT4UYcK; 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-143743-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143743-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 am.mirrors.kernel.org (Postfix) with ESMTPS id DB5171F21BE8 for ; Sat, 13 Apr 2024 13:58:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6797244393; Sat, 13 Apr 2024 13:57:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IfT4UYcK" 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 010E222EE4 for ; Sat, 13 Apr 2024 13:57:54 +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=1713016676; cv=none; b=qsQvnnHI1fbFbBnqBtyMQjtL2nlZwXQylZIC7LvL3si0SuPtASeQAZi9w7ALaQc6ia3T/oHVZuu0shVC9O/4C6qtADVa+S/cwhumaNGPuN6hYGrCRq7VZMic56QGnKMYfdhRJKQOgVPbZBKR28kBaMiwQVl/rd3xTvyS8jqCkfQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713016676; c=relaxed/simple; bh=WfOLbSVW8JuAN6pofRznUzf4//UOoZnjeXSDc4Mw7P4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uT6E3mTFa4dew0j9W6YZG19IXrDNOtNfNt+0ZMkdR3aEGL5EJ2zboITifL5JfyQRa/bzfK9qcQm6f8PtPt6yUkIdPpWmMKBb9UJm3v/waM0PfdWAIclpS+J2q3GpWPKUC5Bh/Q9kYSkNiys4PCfcZYntfiZuRIumV5eLzit+H/A= 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=IfT4UYcK; 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=1713016673; 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=04YHOvgyKxIV8EOiQdBH6Pt5NZfGj8+5tbMEaegT57A=; b=IfT4UYcKoLX8l1cR9wxfhp7Mtceln/M4qtdZQ903rRgWu6ycceRemroT5KPZWGpitVHemZ 2Y8OJceYTzWpyrMIDjS7t8zBYEqHDjEX7dAKsN2HI8XpraMjuF6Xq6lK+rspOtTKOOeSrn bNT55e+wMZeX63wIeZk0JuMQ5wd9Vh0= 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-367-Fal3lT3hP5Gg4KFIdjp1WQ-1; Sat, 13 Apr 2024 09:57:49 -0400 X-MC-Unique: Fal3lT3hP5Gg4KFIdjp1WQ-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 5E7B6881E60; Sat, 13 Apr 2024 13:57:49 +0000 (UTC) Received: from localhost (unknown [10.72.116.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A5E6E1C06701; Sat, 13 Apr 2024 13:57:47 +0000 (UTC) Date: Sat, 13 Apr 2024 21:57:40 +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.7 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 OK, thanks for testing and spotting this. When I tested this patch, I only did test kexec reboot functionality. So the line of printing in kernel/crash_core.c is missed. While there seems to be no kexec_dprintk() in kernel/crash_reserve.c. Anyway, adding pr_fmt() is a good idea for debug printing in that file. I will post a standalone patch to add these. > > Otherwise: > Reviewed-by: Dave Young Thanks again. > > > > > 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 > > > > >