Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1064757ybh; Wed, 18 Mar 2020 14:20:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vukbzMaCPioi0wrVnaowjRz71f6m4N9gBA2ETibr6bWY9kXPuIFqRZEZ/mwICrOUAbvO1nk X-Received: by 2002:a9d:7750:: with SMTP id t16mr5510503otl.333.1584566447835; Wed, 18 Mar 2020 14:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584566447; cv=none; d=google.com; s=arc-20160816; b=ntN83/UEiuj5KkrxUTM4PfB1C0gcT85LznyQyPXy4Rzzzrf2F4pDJuP7hP12ImM2oe y10IivTL2p5Oxl4bI/AENgjLxqQj5UxLFgutOO+IUCoNyKIkqt7nE/sQXir5XW1ZrkrD TYzUyfcWQsAfCc2l/F4se01AiqKPTpyEmkVc9ttVehlVFWD+R27XLBCwvr/VYMOAmYTQ 3FUZwzSoMc6M9Jxlsiuo+pDhlaTdDyQrXfOchOeunBgNXN5gaEUpaYGOD96Po2ek42d9 EqrRd96OyrJOnfXyF8DbptrcgXCw+CH488B2AaTEYP5elkCCM5Lb0pmJjMFUqHSw1/fp bSlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=4f9r9PkNTcv0nmoy8ud0muS6lvAJRtaiv+QarXWwcsI=; b=zg8p+l6GzEfWkhjlFvcLGS0uDW0VhRBf3BiiPTiZbr/tE5F7sZcgJeLaMstir1yfmC 8oawXLpzkBzA+ImB1vd/r7UFuvkiFLfuxcb64+an3k3CbwRyN3MccU2cprkgewfZ2eDf f87m7NjeP4OgJ4LxFzuUUUb541ht+jVtIX+EKt6SXyiSdwQ7uMOI85WHevd9mOrbFIrE yJiaxCVezHvsMyNQA46VgpqXYJn2iquwPGNDabAwoqaFtXhKgp25cltZSQJJrsbp9R0H 3+G9xppU4VkmSdrK13BT49Ly88ueaoVlQgsrOZow3kNqfPapFxGWyjPFW8X3DiXMAQO4 9uVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@akamai.com header.s=jan2016.eng header.b=K0uRFHxo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id f128si4285704oig.208.2020.03.18.14.20.34; Wed, 18 Mar 2020 14:20:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@akamai.com header.s=jan2016.eng header.b=K0uRFHxo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726943AbgCRVT2 (ORCPT + 99 others); Wed, 18 Mar 2020 17:19:28 -0400 Received: from mx0b-00190b01.pphosted.com ([67.231.157.127]:56564 "EHLO mx0b-00190b01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbgCRVT2 (ORCPT ); Wed, 18 Mar 2020 17:19:28 -0400 Received: from pps.filterd (m0122331.ppops.net [127.0.0.1]) by mx0b-00190b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02IL3qoi008087; Wed, 18 Mar 2020 21:18:45 GMT 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=4f9r9PkNTcv0nmoy8ud0muS6lvAJRtaiv+QarXWwcsI=; b=K0uRFHxoQb88Djyvmm0jAb6WYlJUBooKczPpBmfs60Jn796QZDL3UsGADkBOeau3TfhP 0d/0ALSNP4NBOVMi48vR3DkFbkHqQy4QvwS0ik8xRZjc2YOx2OpwOiMuCKha6ktLz5iV Mpg/8n5sTK6jDu+aZGPCwKVyVuaxZ0R6zfivHt6GP5dmYX5GnkmPbn3+NXQUNlC8Ejqh ab8W/1YJgIs8CqmC5FcpYiFf8chYhbzIo1MfgAY7mnOJZKekvU3ygAFD6hd5P6h3azyn 4axm5BVGUFaDjRjD4IgJuwHpnxxQUNT6ZIEPO8OnqMVt7K9JW3PQr1p03bdxxDlhdZ6f pg== Received: from prod-mail-ppoint6 (prod-mail-ppoint6.akamai.com [184.51.33.61] (may be forged)) by mx0b-00190b01.pphosted.com with ESMTP id 2ys8nhgj9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Mar 2020 21:18:45 +0000 Received: from pps.filterd (prod-mail-ppoint6.akamai.com [127.0.0.1]) by prod-mail-ppoint6.akamai.com (8.16.0.27/8.16.0.27) with SMTP id 02ILHbub023256; Wed, 18 Mar 2020 17:18:44 -0400 Received: from prod-mail-relay11.akamai.com ([172.27.118.250]) by prod-mail-ppoint6.akamai.com with ESMTP id 2yrtkvbvp4-1; Wed, 18 Mar 2020 17:18:44 -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 D052D21B0F; Wed, 18 Mar 2020 21:18:43 +0000 (GMT) Subject: Re: [RFC PATCH] dynamic_debug: Add config option of DYNAMIC_DEBUG_CORE To: Orson Zhai , Andrew Morton , Changbin Du , Randy Dunlap , Masahiro Yamada , Shuah Khan , Krzysztof Kozlowski , Masami Hiramatsu , Brendan Higgins , Herbert Xu , Ard Biesheuvel , Gary Hook , Andy Shevchenko , David Gow , Mark Rutland Cc: orsonzhai@gmail.com, linux-kernel@vger.kernel.org, kernel-team@android.com References: <1584558186-23373-1-git-send-email-orson.unisoc@gmail.com> From: Jason Baron Message-ID: <51568376-da8b-3265-ddb3-6ddba74207dc@akamai.com> Date: Wed, 18 Mar 2020 17:18:43 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1584558186-23373-1-git-send-email-orson.unisoc@gmail.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.138,18.0.645 definitions=2020-03-18_07:2020-03-18,2020-03-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2002250000 definitions=main-2003180091 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-18_07:2020-03-18,2020-03-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 phishscore=0 clxscore=1011 adultscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003180090 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/18/20 3:03 PM, Orson Zhai wrote: > There is the requirement from new Android that kernel image (GKI) and > kernel modules are supposed to be built at differnet places. Some people > want to enable dynamic debug for kernel modules only but not for kernel > image itself with the consideration of binary size increased or more > memory being used. > > By this patch, dynamic debug is divided into core part (the defination of > functions) and macro replacement part. We can only have the core part to > be built-in and do not have to activate the debug output from kenrel image. > > Signed-off-by: Orson Zhai Hi Orson, I think this is a nice feature. Is the idea then that driver can do something like: #if defined(CONFIG_DRIVER_FOO_DEBUG) #define driver_foo_debug(fmt, ...) \ dynamic_pr_debug(fmt, ##__VA_ARGS__) #else no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #enif And then the Kconfig: config DYNAMIC_DRIVER_FOO_DEBUG bool "Enable dynamic driver foo printk() support" select DYNAMIC_DEBUG_CORE Or did you have something else in mind? Do you have an example code for the drivers that you mention? Thanks, -Jason > --- > include/linux/dynamic_debug.h | 2 +- > lib/Kconfig.debug | 18 ++++++++++++++++-- > lib/Makefile | 2 +- > 3 files changed, 18 insertions(+), 4 deletions(-) > > diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h > index 4cf02ec..abcd5fd 100644 > --- a/include/linux/dynamic_debug.h > +++ b/include/linux/dynamic_debug.h > @@ -48,7 +48,7 @@ struct _ddebug { > > > > -#if defined(CONFIG_DYNAMIC_DEBUG) > +#if defined(CONFIG_DYNAMIC_DEBUG_CORE) > int ddebug_add_module(struct _ddebug *tab, unsigned int n, > const char *modname); > extern int ddebug_remove_module(const char *mod_name); > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index 69def4a..78a7256 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -97,8 +97,7 @@ config BOOT_PRINTK_DELAY > config DYNAMIC_DEBUG > bool "Enable dynamic printk() support" > default n > - depends on PRINTK > - depends on DEBUG_FS > + select DYNAMIC_DEBUG_CORE > help > > Compiles debug level messages into the kernel, which would not > @@ -164,6 +163,21 @@ config DYNAMIC_DEBUG > See Documentation/admin-guide/dynamic-debug-howto.rst for additional > information. > > +config DYNAMIC_DEBUG_CORE > + bool "Enable core functions of dynamic debug support" > + depends on PRINTK > + depends on DEBUG_FS > + help > + Enable this option to build ddebug_* and __dynamic_* routines > + into kernel. If you want enable whole dynamic debug features, > + select CONFIG_DYNAMIC_DEBUG directly and this option will be > + automatically selected. > + > + This option is selected when you want to enable dynamic debug > + for kernel modules only but not for the kernel base. Especailly > + in the case that kernel modules are built out of the place where > + kernel base is built. > + > config SYMBOLIC_ERRNAME > bool "Support symbolic error names in printf" > default y if PRINTK > diff --git a/lib/Makefile b/lib/Makefile > index 611872c..2096d83 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -183,7 +183,7 @@ lib-$(CONFIG_GENERIC_BUG) += bug.o > > obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o > > -obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o > +obj-$(CONFIG_DYNAMIC_DEBUG_CORE) += dynamic_debug.o > obj-$(CONFIG_SYMBOLIC_ERRNAME) += errname.o > > obj-$(CONFIG_NLATTR) += nlattr.o >