Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp381015ybg; Mon, 1 Jun 2020 04:01:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8/F4w7XIe1X4h7eD5eiNQrZVPmFRDqUqaq/8gyPXwAtX3WXzpbwpzxNmXEymx3zWMrqBO X-Received: by 2002:a17:907:33ce:: with SMTP id zk14mr18696099ejb.2.1591009261374; Mon, 01 Jun 2020 04:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591009261; cv=none; d=google.com; s=arc-20160816; b=Wm8syNmUGq4avEAE66iK1athQOnkbNI4TrB+LPyvA1CnLhWw036j/15NR85jHWvi1g 4KcSzvtv8HXxYJpE7O8b6WqkI88RWPGzuCOuozDc369Z+OxTw9uCVRUoXk643GNq4khr yyMHjGFnEJFohbNGF9xIMYMp18MJdQwObGNvctq7exiUkSDQBjwkeiTbdpavL1K4v+Ps 9r9FLPYmfxXtY7gDtnRh4lzTWdbM12xiz/a1LN/Xg+3HmLuGaRbjK8pAhOBZDjBtQRNj ZT3yYrtlhvQ3VJKeqIf/sqXkM25TEb4MrK/g2Bc8oPnzRCtakx9Q27dLm/Dlawcu+e2h skVg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=WvtTQ9EHafgZQreyIYmWntetDMEcUBIjpiRzw8PhfhI=; b=PfKbS0zKbs0qfevxsjqZWmElixpMSIBgVauQ0y6shNJDfwXvhwFGwHr/RRiLfZSvQy 5iK+Ocsm1RJTo/fk7lEb/NaoeG9Hg5LJiVsYoLsQJwhIkvysH+nanW2CS4IYXzkjrOcG pTyYR7GNVatbC8a78KFdmdNJ6c8oIqnjpksu7uLz3cDfaF7JoJM9keCHd3RZztzMPJZJ KhdL6ae70GnZUhpjx3WmyP30MDt4HR0Kprc7vRMZnrkWPzwAWyX3Ay1y1nknWGeCkd8R aEKtWvGOTvbBxtpMr059UirUEJrFo6Gl08trR3scHmW9GoKnJWj/WOGWueBd65s3/sUH RPUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hn+RZvKp; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h91si2542257edc.340.2020.06.01.04.00.36; Mon, 01 Jun 2020 04:01:01 -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=@gmail.com header.s=20161025 header.b=hn+RZvKp; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726038AbgFAK4m (ORCPT + 99 others); Mon, 1 Jun 2020 06:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbgFAK4l (ORCPT ); Mon, 1 Jun 2020 06:56:41 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DD70C061A0E; Mon, 1 Jun 2020 03:56:40 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id n9so1006567plk.1; Mon, 01 Jun 2020 03:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=WvtTQ9EHafgZQreyIYmWntetDMEcUBIjpiRzw8PhfhI=; b=hn+RZvKpABbnnC6PcU+q6x+LcvCPjZjjscpctJdGLpafU5Rkb9xre5LUsdHM9v2qxA ejNWGO1R3zcQqpFAW6/GgYK+51z98T3GcSoxUxx6/P3PVsrgfZy9MpTC+Amp1zYFyxg6 /Z2Z5RhWpy+1xX+0snzkayKRMsGvfn6m4MNMsgwIz1TECqICBMq1s6iwTSDrsGbmP3Ni vqj+cuslRIHKfP6syX6KT3c0to97e90s2IWIaqKa14RLkW4STKe4DXNzL5E9dxpf+zBu y3r6Tqpzhjf53jOvgTeCgJM0Hl1w4Cf4WYXFYGqpYIN0xgDrlwo7cKCQI/Z/jlN58ZJ5 NmZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=WvtTQ9EHafgZQreyIYmWntetDMEcUBIjpiRzw8PhfhI=; b=Pf+xZMRTHaa4d6xH7KrwONvJgbw+0Z3fKLYu8GF1R5mlAtsIRbZFdk7c/r2Mzbgyhh gap6XJlmuWgMp0Phu+M8zIWkr5HncyN3AipUdgjErNBbE5L9aSqRn9qFEu+3TeWq4msc HoqSGAusSQ1IAvRPuj3AI7nO+HjXxxioVqTBGh1w8jtyiaB1d+XWtcokfSVGZcZJGiMf 5af/RWDgkK+nQaOA0dEzpbGIE/5t6ULwYcSnFCWoUcUucuz4ZSk2sQqdAS4BVHZ0jfiU 7foyncRrA9JO6OCuA0r6p5HS0oOqkawUEExC/m/QCY0ul/DcL80K6RpSc9XKVjLOhCFP fegA== X-Gm-Message-State: AOAM533OU7qf346GiPCgH5LJ7T2gYeIfF/p2vsginSZFocW2c/Ddptjs OF8/RoijXAr7EaE52HhlFUDNYrEqAw4GSY2HdmE= X-Received: by 2002:a17:902:6b09:: with SMTP id o9mr20325820plk.100.1591009000110; Mon, 01 Jun 2020 03:56:40 -0700 (PDT) MIME-Version: 1.0 References: <20200525100054.17700-1-gengcixi@gmail.com> <917da283-5f1e-3fdb-13bb-4251312dc77a@linux.ibm.com> In-Reply-To: <917da283-5f1e-3fdb-13bb-4251312dc77a@linux.ibm.com> From: Cixi Geng Date: Mon, 1 Jun 2020 18:56:04 +0800 Message-ID: Subject: Re: [RFC PATCH v4] GCOV: profile by modules To: Peter Oberparleiter Cc: Greg KH , jslaby@suse.com, linux-serial@vger.kernel.org, "linux-kernel@vger.kernel.org" , Orson Zhai , zhang.lyra@gmail.com, Cixi Geng Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Oberparleiter =E4=BA=8E2020=E5=B9=B45=E6=9C= =8828=E6=97=A5=E5=91=A8=E5=9B=9B =E4=B8=8B=E5=8D=8810:47=E5=86=99=E9=81=93= =EF=BC=9A > > On 25.05.2020 12:00, 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_PREREQS > > to control part of the kernel modules to open gcov. > > Maybe rephrase the commit message to make the intention more obvious: > > Introduce new configuration option GCOV_PROFILE_PREREQS that can be used > to check whether the prerequisites for enabling gcov profiling for > specific files and directories are met. > > > > > Only add SERIAL_GCOV for an example. > > > > Signed-off-by: Cixi Geng > > --- > > drivers/tty/serial/Kconfig | 7 +++++++ > > drivers/tty/serial/Makefile | 1 + > > kernel/gcov/Kconfig | 14 ++++++++++++++ > > 3 files changed, 22 insertions(+) > > > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > > index adf9e80e7dc9..6df002370f18 100644 > > --- a/drivers/tty/serial/Kconfig > > +++ b/drivers/tty/serial/Kconfig > > @@ -1566,3 +1566,10 @@ endmenu > > > > config SERIAL_MCTRL_GPIO > > tristate > > + > > +config SERIAL_GCOV > > + bool "Enable profile gcov for serial directory" > > + depends on GCOV_PROFILE_PREREQS > > + help > > + The SERIAL_GCOV will add Gcov profiling flags when kernel compi= les. > > + Say 'Y' here if you want the gcov data for the serial directory= , > > diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile > > index d056ee6cca33..17272733db95 100644 > > --- a/drivers/tty/serial/Makefile > > +++ b/drivers/tty/serial/Makefile > > @@ -3,6 +3,7 @@ > > # Makefile for the kernel serial device drivers. > > # > > > > +GCOV_PROFILE :=3D $(CONFIG_SERIAL_GCOV) > > obj-$(CONFIG_SERIAL_CORE) +=3D serial_core.o > > > > obj-$(CONFIG_SERIAL_EARLYCON) +=3D earlycon.o > > diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig > > index 3941a9c48f83..ea8b514f5676 100644 > > --- a/kernel/gcov/Kconfig > > +++ b/kernel/gcov/Kconfig > > @@ -51,6 +51,20 @@ config GCOV_PROFILE_ALL > > larger and run slower. Also be sure to exclude files from profili= ng > > which are not linked to the kernel image to prevent linker errors= . > > > > +config GCOV_PROFILE_PREREQS > > + bool "Profile Kernel subsytem" > > + depends on !COMPILE_TEST > > + depends on GCOV_KERNEL > > + depends on !GCOV_PROFILE_ALL > > + help > > + This options activates profiling for the specified kernel modul= es. > > + > > + When some modules need Gcov data, enable this config, then conf= igure > > + with gcov on the corresponding modules,The directories or files= of > > + these modules will be added profiling flags after kernel compil= e. > > + > > + If unsure, say N. > > This is not quite what I had in mind. A user still needs to manually > select GCOV_PROFILE, then GCOV_PROFILE_PREREQS, then SERIAL_GCOV. > > My though was that you could provide an automatic config option that is > invisible in the configuration dialog, and that is automatically > selected when all prereqs for enabling GCOV in a module directory are met= . > > Something like the following: > > config GCOV_PROFILE_PREREQS > bool > default y if GCOV_KERNEL && !COMPILE_TEST > default n > > There's no need to add GCOV_KERNEL_ALL here since that is about a user > choice ("I want all code compiled with profiling") vs. this new symbol > which is about an ability ("all prereqs for enabling profiling in > specific directories are met). > As far as I'm concerned, The GCOV_KERNEL_ALL will conflict with GCOV_PROFILE_PREREQS=EF=BC=8Csince the GCOV_KERNEL_ALL will profing all code which contain the new config. > > > + > > choice > > prompt "Specify GCOV format" > > depends on GCOV_KERNEL > > > > > -- > Peter Oberparleiter > Linux on Z Development - IBM Germany