Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp300457lqk; Thu, 14 Mar 2024 03:40:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgG4aerfLgGslTlhI4cs7K5oK8U1i776dTpC9N/7vmA6xKyUc52sCO9etdm0JoqLl3NQ+IH9ExdE4Li+oblz1/o5yn0nJgSKYVSS8iFA== X-Google-Smtp-Source: AGHT+IH8wmbqackSrhbdSegOn5k1P00jH3IGjb2aToKZZxO7kWiIRUkz3a2LcXP54EDI7CaFd9bg X-Received: by 2002:a17:907:8b93:b0:a46:66c6:2c29 with SMTP id tb19-20020a1709078b9300b00a4666c62c29mr1878293ejc.1.1710412806798; Thu, 14 Mar 2024 03:40:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710412806; cv=pass; d=google.com; s=arc-20160816; b=XkrZj4hJSz9ODF5hvNLxxtckHauqOk52VHBboha334zbbnoRtw0KVVhs7FKBVKOy7a im5V6AQUDDxOtBYy96ADTP8lGBxvfJxOW8GU6XE7D6u3sWSfszZ/D/q6QUCmj0JTJrpx 2mC2HM3+8YYdQZf+Q+c7ivO0tFcRskjUuweUf3AQwhsJFSK62vb1GR6jEpkGt7b4zRww mB1CrcUnqUdxTlzsyj75+UV+vxvpXp5eXx+ezH9LD6jkU0DmEMqruB+UHkqUNaabUda+ av26QvgzkdPLlWVPXsXzk1SIl1GJQN5QsMxp0CtW8aTPVh50qAYiheuLEY7OKC2EGtFB FvUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=h1t6v9xZW/pkiF5v9nyuhZFPcP+Pb9Nu3++MFe0FI4s=; fh=sM0JvBWdFXlbRRlf+hu39TOjWw1ENbfCLnQFo82K75A=; b=yqe1qRir5bG/Qi4o8rxOWHkEwE32b5e4rclQGheIrEeg//IfrKG5EHsGyqgwuKaBdh 5G7CCUT80H5nGtyJnN0VT2hRPTcX6sBVQgEbg+VCknqh0e5E+UTTj6A74rZXmJBAN6OH iZ2ztMwf/NxlKW+OpIhWXuDJCnun8V5U2RCBakirbWzkqw7K0C+xUXJKSPOoA2sSu4jY HR1CNzEf5rgd8OvBIST56G03dDOy5T5sTwRYNc6I68tyDP7Gdzawn9wiTGRVYmjMSVPn Dpe7A5NoJkX9mfjXHvLzFw9QV/9ethDXO2p9bcyrlXr0vuyDOYGtAIqYf19BMOrK+ypO Ofow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MSw8VGoo; 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-103134-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103134-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u14-20020a1709060b0e00b00a45ead7b3e2si604506ejg.647.2024.03.14.03.40.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 03:40:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103134-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MSw8VGoo; 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-103134-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103134-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 72ABF1F213DC for ; Thu, 14 Mar 2024 10:40:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 852555DF26; Thu, 14 Mar 2024 10:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MSw8VGoo" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24A411A38FC for ; Thu, 14 Mar 2024 10:39:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710412799; cv=none; b=gcFeJvbssuGPej55EY3kGwiekwU22+T3KJQoycoc/JJjdewU4p9dl+NKmOOgg0JRnaQVzaWbVXGmYNsOcHQpgwiUf5QDlwlhRLCDnBVKboEFUkjQNFepSBKNvRsAm1m195MYnjlMYdEP+EKTiafRkhe8CO+9H5Z7XC8n+zOl1b8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710412799; c=relaxed/simple; bh=WA/d7U+qMBdpAtL/JkS2HGf9X4mCPAEE0NoMZUmak6M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-type; b=irN99MOg/h4jAaq5Ecw4tUMrSJ/SjuLjyol3aTmTA7xk25kTlc7S8vod9wd5QK4dCt9cYG/7HpuT7fCQyYookwvQKx/7kXqRK3wpvdzhjjTynHloThMgQcsdQ1UPH8U3bSRYchZu3MnnKBDd7HgrWhk++ODnJ+KSKLIY/AeTsDA= 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=MSw8VGoo; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710412797; 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; bh=h1t6v9xZW/pkiF5v9nyuhZFPcP+Pb9Nu3++MFe0FI4s=; b=MSw8VGoowUqdf2PIWFzqWYaqXnoUqmxZTGa6u1UMsw7vuIx7eKi6II3JYTFhfTTEDv9Crr 3AKXlO21odCDnrkCih0stR0XQG8LOnSJSxvrSIQqztwb5UVLG9gIH0j7VdqL+uUlGZsrMh 5ZWNqyN/J0MKvVxwOuE6aNI3evpx6+o= 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-204-Nvm8_iUWOYO1Tcub9tdI1Q-1; Thu, 14 Mar 2024 06:39:55 -0400 X-MC-Unique: Nvm8_iUWOYO1Tcub9tdI1Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 03F2784B061; Thu, 14 Mar 2024 10:39:55 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 459FF16A9C; Thu, 14 Mar 2024 10:39:50 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, jirislaby@kernel.org, akpm@linux-foundation.org, joe@perches.com, dyoung@redhat.com, Baoquan He Subject: [PATCH] kexec: fix the unexpected kexec_dprintk() macro Date: Thu, 14 Mar 2024 18:39:47 +0800 Message-ID: <20240314103947.717991-1-bhe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 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() and pr_debug() instead which are expected to work. Signed-off-by: Baoquan He Reported-by: Jiri Slaby Closes: https://lore.kernel.org/all/4c775fca-5def-4a2d-8437-7130b02722a2@kernel.org --- include/linux/kexec.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 400cb6c02176..09688e681bf7 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -502,10 +502,13 @@ static inline unsigned int crash_get_elfcorehdr_size(void) { return 0; } 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, args...) \ + do { \ + if (kexec_file_dbg_print) \ + pr_info(fmt, ##args); \ + else \ + pr_debug(fmt, ##args); \ + } while (0) #else /* !CONFIG_KEXEC_CORE */ struct pt_regs; -- 2.41.0