Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp948759ybh; Wed, 18 Mar 2020 12:05:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv7/eIFPgX4TxQOJBnwPjwVGwEtWUjZ08+iKPx+b6FNhZ7dh9cAHd89oqzIPRewZmpr8UDB X-Received: by 2002:a05:6808:10b:: with SMTP id b11mr4175073oie.99.1584558303189; Wed, 18 Mar 2020 12:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584558303; cv=none; d=google.com; s=arc-20160816; b=udSK3bAZ8paRqurEIrjApKBKRpigqAmQjfw0jfie8bfuc8cbFRPkdWp132LR3pX07P V0FTXH3EpJkGsaKoOsZW3U3jP9ivQkQPve4FP0Za04XuyMIOADnTm4nSpnskq77z2ODH m2x9nj/xx+XtngvEFrOJP3aVdl9yWZIV1BD5CbFiz3TBQflULTEJIjsZ30a0/Laul3/+ aFJ4ymBLFmdNCTwn+xMzT6JNnhZBA/h/JuVqlgL85zjeIQTMsXUkCkSD8QBaT9GKhAld x5m9ExsfZkqS+MtKixQQ6z4LevHAid07JjbrCgY+DT/0dwJD22UnytAsNibziyB2aCRS DS3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=9sJyPIS9MqiGD0DkB/0XejsZsmuSIXG8S6Q+9dvyB0E=; b=g1Jx4Dd16FxK9sixVKS4p5LFQgsS/pDkhX2DmMp5Gt1U4ABOiqhsQj4Eg1y2jeK/PH lqVV5YUX12XUNNCDkGukrpdyOMup6/cBZBzEbbOBocf4aK9O3ucxzpbiz0EOeUz1qNPw Yo2iQYISHI6q04Xbmy14DpH8jVW9msj/ukxDIbOQOAQ/mJ+dxxw2QbLrYECyPbohcLVu XzhhShlj/SMDTUuLFA78LpygYoIhHxC5suClCIuZvk/UVy0NeDXvtBi0pDWS0oeYtS2p QBzDpYJBEZDnI1dmH4ltEjSgMOT2MhP3pp6MANK0yeLkSxLObsCuHXsB/dMNjEpIV5R2 bcxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=i146djn3; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m125si3572918oia.240.2020.03.18.12.04.43; Wed, 18 Mar 2020 12:05:03 -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=@gmail.com header.s=20161025 header.b=i146djn3; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbgCRTEQ (ORCPT + 99 others); Wed, 18 Mar 2020 15:04:16 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46741 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbgCRTEP (ORCPT ); Wed, 18 Mar 2020 15:04:15 -0400 Received: by mail-pl1-f195.google.com with SMTP id r3so3541712pls.13 for ; Wed, 18 Mar 2020 12:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9sJyPIS9MqiGD0DkB/0XejsZsmuSIXG8S6Q+9dvyB0E=; b=i146djn3/XFsXRqyCdh52CCACkJdrCMQ4DY2IU9cmSWFAg7wmi3yuFfQXSGy11xx63 Ex7oICQ2hMFta1eTmsejUjSNbUEBlnpI8Fv2dvySf5tmBbCd/EzgdhcPVJFxPIlriQJd chXKEOzl1rzrZpwhPVz4zw9Va2rFqzlczu9/rVi2s0f8lFCDjIWtcfrey+SKHfrpHpDJ +fQroK0d4W6tEpmI2sccXQ0rXse1JQuzBHiwyOuDXcqOsUKkkDDguZj03PGYADTJJBrB rM55iVC55h9iLUNM+dgwgnpl1e5iaNnGlLIqU/4ScQeFPJnpZN3ajXrotLu659R/7Dkn VnCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9sJyPIS9MqiGD0DkB/0XejsZsmuSIXG8S6Q+9dvyB0E=; b=LlqZFfW3UdNXwEcea8MeOFNNZTLF457ViTes1cY5C7i8kQXfwuPRMB39jBNE1/+0kZ 5UhFphKzgnRm77yU2WrqRmZWpu+uTRxkJhVd3jjxSuyKsZw6DywCE5rVXFOtAg0f61Zy qaMDdRbGic9r2jHAAhlTSmnpl9jvFdh+MnQb7EDr3vz299U/i5ACNbzpXyHECRtsoRDT 22z2l3RJq80oLszKLCHvFpP0L5d4bqSBr8BHvVKGydnCx1RHvCbFiv0UGv9Uk6gBdX3l /8sn9QAMzQCu2h6AXhPaKuBEe026ZilWMrqW2j1vVpsZKcfOYb2KznrpYG0q6ecgNhLQ dS2A== X-Gm-Message-State: ANhLgQ3fKpe5pjdcrNpljLbhcO9BaMt6zu6dBj6j18gxYXh/qxB9ePSB FMLDqpjOMEyTyMugVuMOrkY= X-Received: by 2002:a17:90b:f16:: with SMTP id br22mr5821444pjb.170.1584558254608; Wed, 18 Mar 2020 12:04:14 -0700 (PDT) Received: from lenovo.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id e126sm7267968pfa.122.2020.03.18.12.04.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Mar 2020 12:04:13 -0700 (PDT) From: Orson Zhai To: Jason Baron , 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, Orson Zhai Subject: [RFC PATCH] dynamic_debug: Add config option of DYNAMIC_DEBUG_CORE Date: Thu, 19 Mar 2020 03:03:06 +0800 Message-Id: <1584558186-23373-1-git-send-email-orson.unisoc@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- 2.7.4