Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1017055pxj; Sat, 15 May 2021 01:00:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlxjpriQHydYk0BUNKg0YpSNzEmutVotKNldsFvtSaZUjprjm1QOi2zGpACzCNgoaG1e6H X-Received: by 2002:a5d:8a10:: with SMTP id w16mr34773410iod.26.1621065611038; Sat, 15 May 2021 01:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621065611; cv=none; d=google.com; s=arc-20160816; b=bJXwDyHDXDmOH5qQFWG9fKF4hGPGtaw/l2ayphM/NExhr4QCK3P5YTb9/9ZvTMd+4R y52I38aAzvDdW2HiFOd+88PuVqFRpIG8uTXnmjbEA8t8RRblrkiT8CMkAy1ZvNFWxfm1 EeN9SQJM8GgaJFmFJU3ivuM0uECchl1VBuBAvOOn7oM9z+juhe59eZ6PGBS9lUAwWlhf TLy8i/rb2qJ0ggwDbzLiKnMcRvZsVE7wUOrBxnODVCf3KTB+dx9GckyBDGaewnzVIunb mh4Cp8x5NfAWfVnMPHckdNG4uViGoNrvPKDJT2mYYFdw/X+Wcx6DF4MkE9OEvU+2taiD V80Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=XG33eIJsrxMuT05lfy2r+Ra69gUMWaEBJ5U51RLR3KY=; b=X5CtfYl+8xkPycJzRFA1FxubQNt1PlGKdYaAF0sDl/e5SKlgyr07oa2nmMD/ISlKn6 XzbM3NM7gItmV5wlzyzhi/Iu2Swec0tITy2gVQoHqbOW28kPRNf+3SAasYPgDt+pkws2 IS8HESYFYsS2TiwdkLWHQMtLI/UYZDJ4tdxHy+GTSyNl6EHXryKLWZ67TfKX9wwS9WUp sa9YGHj+imkiPOrYQlrXePL2edBU+yMHmDA8FqF7/hlDNGyP36UPG9Do1tw8mZnHCeJl yYb+BbDs60BicPRuHZmKB525/XhfqlAANLYiVrf7PN0g5fgL/moL94ESWTerozYr0JY4 utFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@akamai.com header.s=jan2016.eng header.b=FcCtdqZe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si9281284iom.23.2021.05.15.00.59.58; Sat, 15 May 2021 01:00:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@akamai.com header.s=jan2016.eng header.b=FcCtdqZe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233086AbhENT5r (ORCPT + 99 others); Fri, 14 May 2021 15:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbhENT5j (ORCPT ); Fri, 14 May 2021 15:57:39 -0400 Received: from mx0b-00190b01.pphosted.com (mx0b-00190b01.pphosted.com [IPv6:2620:100:9005:57f::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8BC0C061574 for ; Fri, 14 May 2021 12:56:27 -0700 (PDT) Received: from pps.filterd (m0050102.ppops.net [127.0.0.1]) by m0050102.ppops.net-00190b01. (8.16.0.43/8.16.0.43) with SMTP id 14EJsk7N020051; Fri, 14 May 2021 20:56:05 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=jan2016.eng; bh=XG33eIJsrxMuT05lfy2r+Ra69gUMWaEBJ5U51RLR3KY=; b=FcCtdqZeVXCqT1YvD3OwgyBy00Q4CNMEJaeDqsA6rKwfy0GJPoVnxmJjF8Okfr83gpc/ eo7o2gl2xMYnXSIWGPdqcao11UzfOq0xMEfDxEOSbVv6ihgwhex2nh4HIsEI2RhlQIrA 7OYDYcmJAjDEEwMlb/hQvnItgHM7+vtXFgSFtW9aQpcdbkuiNKigVQSByGj3bdGC6Vt3 K1z8Bf9RmnDuQqVWXqkyZp0M0HPTJO1BYwuV05LcxvaoqeF5zZIMDa/U9QUsRpZR2r2R xyRvXMp0+E9D1pWSqxcQnOXkL2ve7SmAWnoMyQT/XOQen+YGBKQsqarGWZC9tDeLAHkF 8w== Received: from prod-mail-ppoint2 (prod-mail-ppoint2.akamai.com [184.51.33.19] (may be forged)) by m0050102.ppops.net-00190b01. with ESMTP id 38hhtwv6jc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 May 2021 20:56:04 +0100 Received: from pps.filterd (prod-mail-ppoint2.akamai.com [127.0.0.1]) by prod-mail-ppoint2.akamai.com (8.16.1.2/8.16.1.2) with SMTP id 14EJsl7K021768; Fri, 14 May 2021 15:56:02 -0400 Received: from prod-mail-relay11.akamai.com ([172.27.118.250]) by prod-mail-ppoint2.akamai.com with ESMTP id 38gpmrn6qv-1; Fri, 14 May 2021 15:56:02 -0400 Received: from [0.0.0.0] (prod-ssh-gw01.bos01.corp.akamai.com [172.27.119.138]) by prod-mail-relay11.akamai.com (Postfix) with ESMTP id EDEE92666A; Fri, 14 May 2021 19:56:01 +0000 (GMT) Subject: Re: [PATCH 2/2] x86/e820: Use pr_debug to avoid spamming dmesg log with debug messages To: Joe Perches , Heiner Kallweit , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Cc: Linux Kernel Mailing List References: <6d55670d-2f06-d768-699f-5a79cece6ce0@gmail.com> <59985635-665b-773f-de8f-b15fe3f60196@gmail.com> <1789b1da-7a0f-9fc9-6ed2-ff68e2306342@akamai.com> <204a99e1-de7a-4434-0932-45f1b507e9ec@gmail.com> <5a416031-ddcd-7ef4-ec33-47134bf064bb@akamai.com> <7cc30a8a6644bb60e5f3358e89253d9fc783fe54.camel@perches.com> From: Jason Baron Message-ID: Date: Fri, 14 May 2021 15:56:01 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <7cc30a8a6644bb60e5f3358e89253d9fc783fe54.camel@perches.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-14_10:2021-05-12,2021-05-14 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=765 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105140154 X-Proofpoint-ORIG-GUID: OAb3dx6iElzXp6GMMTNJNL8hEVJr6V41 X-Proofpoint-GUID: OAb3dx6iElzXp6GMMTNJNL8hEVJr6V41 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-14_08:2021-05-12,2021-05-14 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 clxscore=1015 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=736 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105140155 X-Agari-Authentication-Results: mx.akamai.com; spf=${SPFResult} (sender IP is 184.51.33.19) smtp.mailfrom=jbaron@akamai.com smtp.helo=prod-mail-ppoint2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/14/21 1:38 PM, Joe Perches wrote: > On Tue, 2021-05-11 at 17:31 -0400, Jason Baron wrote: > >> That said, I do see the value in not having to open code the branch stuff, and >> making pr_debug() consistent with printk which does return a value. So that >> makes sense to me. > > IMO: printk should not return a value. > Ok, the issue we are trying to resolve is to control whether a 'pr_debug()' statement is enabled and thus use that to control subsequent output. The proposed patch does: + printed = pr_debug("e820: update [mem %#010Lx-%#010Lx] ", start, end - 1); + if (printed > 0) { + e820_print_type(old_type); + pr_cont(" ==> "); + e820_print_type(new_type); + pr_cont("\n"); + } I do think pr_debug() here is different from printk() b/c it can be explicitly toggled. I also suggested an alternative, which is possible with the current code which is to use DYNAMIC_DEBUG_BRANCH(). if (DYNAMIC_DEBUG_BRANCH(e820_debg)) { printk(KERN_DEBUG "e820: update [mem %#010Lx-%#010Lx] ", start, end - 1); e820_print_type(old_type); pr_cont(" ==> "); e820_print_type(new_type); pr_cont("\n"); } That however does require one to do something like this first: DEFINE_DYNAMIC_DEBUG_METADATA(e820_dbg, "e820 verbose mode"); So I don't feel too strongly either way, but maybe others do? Thanks, -Jason