Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2592371ybk; Mon, 18 May 2020 03:05:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyxgmCiOdK/CFe2XVtyotHHoJE37anXbrmJQKUWx34nIaEPbIidMehaehi5FozYfA8bIbT X-Received: by 2002:a50:b586:: with SMTP id a6mr12417732ede.292.1589796336966; Mon, 18 May 2020 03:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589796336; cv=none; d=google.com; s=arc-20160816; b=vAYkB560eis6YeYQOa0FH7MpR+t9RZCWe8TFUU7etV+y4Xh4RhBksqTFWxlEbt2ftE qFOYG2jEm5cSrGfvOjBcmBe53EFExvfMnaKcpasg0i5HWF6s2Jwapr/J1vIOFGvbBXju MZwJ3dFVMi/KjXxU+dfERh6UiCa5b3mDMzAqrPLhlHVA3pX53w3/X9JWylBnMyCCacUJ mkrAbcTgtAainem3za/yL5KDUKF/dLfMOJPmqxklLK/Kk2Af5KHVABtK3RuoVbHZJhRy Od3gRCk2AltL1j9KcsVT9SLpFMq3dO5DozxoD/BRdGLyCu8/PSIUlnhDBeZpSaNopT1J akYA== 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:date:message-id:from :references:cc:to:subject; bh=lfYrm8PkLF1hya9EFDzWge2MnqnC7wQRoFX49w3R+sc=; b=zRkh5IsKwlw7dxbtCM6w0U0N3SzVg9gcyQDwEDgfN/BthbwXNSw3tBWxKE9ohqLKp2 0NjWUXPv9C40tDhjqZ1O+ZyWLiTSlIx/POY+L1w2u1XXQ3LzMc47WbMz7HncqNQI4IW1 rRIwS2wolFyXqw1JHOPrZzc4AhwfPVgnq9SrSiX+jdJYxhkHdt5FHewu7vRdvAThN7Ke y95FwRgA6EiO/bn3QoKZ/cQOOrHBHHVxRIOODIfauXKZnFjEEjSEa2P44E5CWTV1cwI8 NRzJ3MMNUYqiCjc6VtKIzEnf+/HTLvsjvMIm0G9LM4ZkXQPf/eYm45OCBcqsCNv9s8xg n0eA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc2si6752476edb.598.2020.05.18.03.05.09; Mon, 18 May 2020 03:05:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726522AbgERKBB (ORCPT + 99 others); Mon, 18 May 2020 06:01:01 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:16908 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbgERKBA (ORCPT ); Mon, 18 May 2020 06:01:00 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04I9XRJD057725; Mon, 18 May 2020 06:00:52 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 312cqktmem-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 May 2020 06:00:52 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04I9XcMT058693; Mon, 18 May 2020 06:00:52 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 312cqktmd6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 May 2020 06:00:52 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 04I9tRH7001090; Mon, 18 May 2020 10:00:49 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 3127t5hj8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 May 2020 10:00:49 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04IA0kRR64028906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 May 2020 10:00:46 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7C0F4203F; Mon, 18 May 2020 10:00:45 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1BCAF42063; Mon, 18 May 2020 10:00:43 +0000 (GMT) Received: from [9.163.36.73] (unknown [9.163.36.73]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 18 May 2020 10:00:42 +0000 (GMT) Subject: Re: [RFC][PATCH] GCOV: profile by modules To: gengcixi@gmail.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, gregkh@linuxfoundation.org, jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Cixi Geng References: <20200518080703.22431-1-gengcixi@gmail.com> From: Peter Oberparleiter Message-ID: <017a2780-91ea-6d34-4007-959e3014eb6d@linux.ibm.com> Date: Mon, 18 May 2020 12:00:41 +0200 MIME-Version: 1.0 In-Reply-To: <20200518080703.22431-1-gengcixi@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.676 definitions=2020-05-18_03:2020-05-15,2020-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 adultscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 suspectscore=1 lowpriorityscore=0 clxscore=1011 cotscore=-2147483648 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005180086 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18.05.2020 10:07, gengcixi@gmail.com wrote: > From: Cixi Geng > > The CONFIG_GCOV_PROFILE_ALL will compile kernel by profiling entire > kernel which will lead to kernel run slower.Use GCOV_PROFILE_MODULES > to control part of the kernel modules to open gcov. > > Only add SERIAL_GCOV for an example. > > Signed-off-by: Cixi Geng I'm not convinced that the introduction of a GCOV_PROFILE_MODULES config symbol in this way is a good idea. The name of the symbol suggests that this would enabled GCOV profiling for all kernel modules, which is not the case. In the end it is only an abbreviation for adding the dependencies required for enabling GCOV profiling for specific modules. I'd instead suggest the introduction of an automatic symbol GCOV_PROFILE_PREREQS (or similar) that is enabled when both GCOV_KERNEL is set, and COMPILE_TEST is not set. There is no need to depend on ARCH_HAS_GCOV_PROFILE_ALL. The SERIAL_GCOV symbol and other related symbols of modules that want to introduce similar config options can then depend on this symbol. As a reminder, here are the involved symbols and their meaning in the context of GCOV. GCOV_KERNEL: You need this to get gcov data out of the kernel !COMPILE_TESTS: You don't want to enable any GCOV profile during compile tests due to unwanted side-effects ARCH_HAS_GCOV_PROFILE_ALL: An architecture has ensured that enabling full-kernel profiling does not cause any unwanted side-effects. As this relates to kernel base code only it is not required in the context of modules. > --- > drivers/tty/serial/Kconfig | 6 ++++++ > drivers/tty/serial/Makefile | 1 + > kernel/gcov/Kconfig | 15 +++++++++++++++ > 3 files changed, 22 insertions(+) > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index adf9e80e7dc9..0b4c070f6c74 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -1566,3 +1566,9 @@ endmenu > > config SERIAL_MCTRL_GPIO > tristate > + > +config SERIAL_GCOV > + bool "open gcov for serial" > + depends on GCOV_PROFILE_MODULES > + help > + Say Y here to enable gcov in serial. > diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile > index d056ee6cca33..7be1202286d2 100644 > --- a/drivers/tty/serial/Makefile > +++ b/drivers/tty/serial/Makefile > @@ -2,6 +2,7 @@ > # > # Makefile for the kernel serial device drivers. > # > +GCOV_PROFILE := $(CONFIG_SERIAL_GCOV) > > obj-$(CONFIG_SERIAL_CORE) += serial_core.o > > diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig > index 3941a9c48f83..7f9c1d2476c9 100644 > --- a/kernel/gcov/Kconfig > +++ b/kernel/gcov/Kconfig > @@ -51,6 +51,21 @@ config GCOV_PROFILE_ALL > larger and run slower. Also be sure to exclude files from profiling > which are not linked to the kernel image to prevent linker errors. > > +config GCOV_PROFILE_MODULES > + bool "Profile Kernel subsytem" > + depends on !COMPILE_TEST > + depends on GCOV_KERNEL > + depends on ARCH_HAS_GCOV_PROFILE_ALL > + default n > + help > + This options activates profiling for the specified kernel modules. > + > + If unsure, say N. > + > + When some modules need Gcov data, enable this config, then configure > + with gcov on the corresponding modules configs.The directories or files > + of these modules will be added profiling flags after kernel compile. > + > choice > prompt "Specify GCOV format" > depends on GCOV_KERNEL > -- Peter Oberparleiter Linux on Z Development - IBM Germany