From patchwork Sun Aug 25 13:23:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113359 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99AC4912 for ; Sun, 25 Aug 2019 13:24:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6632420850 for ; Sun, 25 Aug 2019 13:24:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="p6HHz9vK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g0nxmzW0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6632420850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6Kr3eocvJlovV9eQ1LCxxhivz08yC/ET/LsP8n8m++8=; b=p6HHz9vK6se/Ey nmQizjcMc524aC6oolvGN6n28GhQEgqUQRMgxkBfgqeE5pb9hHcx7mhn4kSJJBqRFJXh1/7FrJetx lJwOx4ziHQE6pXhljjCn6OmhD2T/tFKylsCBKoGFSyMGP8qC3jTpNdVkS6dvchbfY+OJyWu5bpsBo IprPKuT/rUrMR1xJ/e0W+o65E4rz+QL98WWd3mrzdFoYJ+YyMo+fBwsto+HhkDpz68iNdEQojkhFS 0fhHeTl3r6s4HGlG/oL74GytvJrYh6E2lOJX0gKiWMXJVQVN+D4R4Eujdyb5LVMhbeDtVtftxCtLp oSA4qXyWgqbKwupBPDqA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sVT-0003KZ-OS; Sun, 25 Aug 2019 13:24:31 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sUt-0002qh-Ly; Sun, 25 Aug 2019 13:23:57 +0000 Received: by mail-pf1-x441.google.com with SMTP id c81so9812059pfc.11; Sun, 25 Aug 2019 06:23:55 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ATcCbM6biHkdS6pzkwBCxjjCLgoJOMzk+hMVWKlY49s=; b=g0nxmzW0zZ8NOi10EuoUp6vH1QqnVKl2IMIkaHt7cnF9O3K6n0oILEW7cwjrYanydu gtoL3DlYM2M5MgCbMEnM06N2evopvAboFj4vypZN5kjGpI15b8rhq5rh/KAkudzPdJpR sLDbzKbUi7x6t+5MFWoJogmWGPO2NmboeiEiGdRisvYQ9toPvwp5sS0u6lAQ6B1HzHtA NeqnHB9yIGItC6Df2iIXR2yzDjYytV106x33kfO6K4887MnkmD7Xx47qsOPdysl9o3r6 VHxKFYS5Dpwv/D05aGqO18ep0Y7hxYUSiawMaYs0cINAZIcwP14La+QLXLaoHQpwqAit rYBw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ATcCbM6biHkdS6pzkwBCxjjCLgoJOMzk+hMVWKlY49s=; b=nsEebrmbdEe/YIPvy2vp16NX2w73GOZ7g/Ct3pYM4yzcanhTzpzpUIARgiPbeZKds/ pYRP0UM1roE8NFX/Jke1+mdP4o0dRtXZaLO8hjmvW8+FMedtw55yQVwD6qrplpq8mVU9 Qg/ziw+18AuP6fCf/+hofoa9nJiNDnVG+XxSu5SpZs6RsJ2PPb02So8EcFmaJEVHSRdm PgUoFxBaVIh557MHpiv+CB5Vt5irAnu8/aKJgRXJEdE73WmBAHMY9Nqzo8S5s6HXIJMZ rwDK9NaL6FqWhI4+KdVQPFiyW35JYlZUeZYv0O1D/HQ+BhHOjRJZSROrWQxoyeEXMm7y qsMw== X-Gm-Message-State: APjAAAUz1cVAm2fTeJBo8w+UM14l1Qqnp1b9irFKuyI4qnuDpvpe23Vl Wdv967W72MQtpuwbKrpHgfg= X-Google-Smtp-Source: APXvYqzaJqepN4zSy7ymgD+GkZvtuT8tWiHagREHmYhkwZsvhh4laEBbm32dRe/EdCR5Hh5hXENyXQ== X-Received: by 2002:a17:90a:fb8e:: with SMTP id cp14mr14686883pjb.54.1566739434878; Sun, 25 Aug 2019 06:23:54 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:23:54 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 01/11] ftrace: move recordmcount tools to scripts/ftrace Date: Sun, 25 Aug 2019 21:23:20 +0800 Message-Id: <20190825132330.5015-2-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062355_815954_0EB841EE X-CRM114-Status: GOOD ( 11.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, "John F . Reiser" , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org Move ftrace tools to its own directory. We will add another tool later. Cc: John F. Reiser Signed-off-by: Changbin Du --- scripts/.gitignore | 1 - scripts/Makefile | 2 +- scripts/Makefile.build | 10 +++++----- scripts/ftrace/.gitignore | 4 ++++ scripts/ftrace/Makefile | 4 ++++ scripts/{ => ftrace}/recordmcount.c | 0 scripts/{ => ftrace}/recordmcount.h | 0 scripts/{ => ftrace}/recordmcount.pl | 0 8 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 scripts/ftrace/.gitignore create mode 100644 scripts/ftrace/Makefile rename scripts/{ => ftrace}/recordmcount.c (100%) rename scripts/{ => ftrace}/recordmcount.h (100%) rename scripts/{ => ftrace}/recordmcount.pl (100%) mode change 100755 => 100644 diff --git a/scripts/.gitignore b/scripts/.gitignore index 17f8cef88fa8..1b5b5d595d80 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -6,7 +6,6 @@ conmakehash kallsyms pnmtologo unifdef -recordmcount sortextable asn1_compiler extract-cert diff --git a/scripts/Makefile b/scripts/Makefile index 16bcb8087899..d5992def49a8 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -14,7 +14,6 @@ hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c hostprogs-$(CONFIG_KALLSYMS) += kallsyms hostprogs-$(CONFIG_LOGO) += pnmtologo hostprogs-$(CONFIG_VT) += conmakehash -hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount hostprogs-$(CONFIG_BUILDTIME_EXTABLE_SORT) += sortextable hostprogs-$(CONFIG_ASN1) += asn1_compiler hostprogs-$(CONFIG_MODULE_SIG) += sign-file @@ -34,6 +33,7 @@ hostprogs-y += unifdef subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_SECURITY_SELINUX) += selinux +subdir-$(CONFIG_FTRACE) += ftrace # Let clean descend into subdirs subdir- += basic dtc gdb kconfig mod package diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 2f66ed388d1c..67558983c518 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -188,18 +188,18 @@ endif # files, including recordmcount. sub_cmd_record_mcount = \ if [ $(@) != "scripts/mod/empty.o" ]; then \ - $(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)"; \ + $(objtree)/scripts/ftrace/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)"; \ fi; -recordmcount_source := $(srctree)/scripts/recordmcount.c \ - $(srctree)/scripts/recordmcount.h +recordmcount_source := $(srctree)/scripts/ftrace/recordmcount.c \ + $(srctree)/scripts/ftrace/recordmcount.h else -sub_cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ +sub_cmd_record_mcount = perl $(srctree)/scripts/ftrace/recordmcount.pl "$(ARCH)" \ "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ "$(if $(CONFIG_64BIT),64,32)" \ "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)" \ "$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \ "$(if $(part-of-module),1,0)" "$(@)"; -recordmcount_source := $(srctree)/scripts/recordmcount.pl +recordmcount_source := $(srctree)/scripts/ftrace/recordmcount.pl endif # BUILD_C_RECORDMCOUNT cmd_record_mcount = $(if $(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags)), \ $(sub_cmd_record_mcount)) diff --git a/scripts/ftrace/.gitignore b/scripts/ftrace/.gitignore new file mode 100644 index 000000000000..54d582c8faad --- /dev/null +++ b/scripts/ftrace/.gitignore @@ -0,0 +1,4 @@ +# +# Generated files +# +recordmcount diff --git a/scripts/ftrace/Makefile b/scripts/ftrace/Makefile new file mode 100644 index 000000000000..6797e51473e5 --- /dev/null +++ b/scripts/ftrace/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 + +hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount +always := $(hostprogs-y) diff --git a/scripts/recordmcount.c b/scripts/ftrace/recordmcount.c similarity index 100% rename from scripts/recordmcount.c rename to scripts/ftrace/recordmcount.c diff --git a/scripts/recordmcount.h b/scripts/ftrace/recordmcount.h similarity index 100% rename from scripts/recordmcount.h rename to scripts/ftrace/recordmcount.h diff --git a/scripts/recordmcount.pl b/scripts/ftrace/recordmcount.pl old mode 100755 new mode 100644 similarity index 100% rename from scripts/recordmcount.pl rename to scripts/ftrace/recordmcount.pl From patchwork Sun Aug 25 13:23:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113411 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E519B912 for ; Sun, 25 Aug 2019 13:25:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0F5B20850 for ; Sun, 25 Aug 2019 13:25:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NJ8t1QlR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P2wojTKq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0F5B20850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tuz58TJCH25oBeyF86AbuXg4is7RO/g+r9FgODAhoh0=; b=NJ8t1QlRhxpsQM YXyBC+aWIiZJHPxGTr/T4CIQffr72TjxjuoB2h8wYOQH6iCYvMwqKztEXstobi0XT/7owP7Q9Wo04 vkSjQSh5qw9tBWY5apUcCATd0L7a3WMHS6FRYFUeVTg8d2T09wWBpj2shFTgBqkx6njVtD8MLWcBz da1FoiXWUrc4ffjcxnXKoNspaJmWYxIO8p7Zajj34S416/MhuNcltozWG7M+PrCM+bCrsaorlpj7W rEKZ2W304Ku7THA8CSMFZK4cUBIlKjq+gaL+9tFrT24LrvHLgT6VMqrF1TNPs81txoasjn5exmXhC 6zvlxyklXOyRHgmuIIzw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sWR-0005HB-Fx; Sun, 25 Aug 2019 13:25:31 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sV2-0002yt-Ti; Sun, 25 Aug 2019 13:24:07 +0000 Received: by mail-pg1-x544.google.com with SMTP id o13so8737189pgp.12; Sun, 25 Aug 2019 06:24:04 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=yFcwaE5XZgy8/JWul+9dMsDxHhsAe+rq+bNw4aia6aI=; b=P2wojTKqpcCoKKB15v009tP4jbbqDqoRSEYiqz7FPwBhWB5iibTOdDi5mVtT68je99 wVzdcQqFhRNv8QKi21WWDTGIKS/SEmW1RHEoflINUYDkG88SrGWYEHwUIKDhADJaue6U ZHRjs76+u9Cx45pVEMopRjTpxExNjGX1xsCAjJ9HPpxpKKwOZNBFe2c3q6ghFxTJpOCY nGdKlWjpcE8DbZuCfA0MI3Hs2QrrqBNEsqMzzJ5cTYCqDE4mShA8PwXNb7y/siDYAlWc BZEW1BkB6Zl4YlxFzgPsNGhOKcBUfFUFcIoWTdhiIYzjV6xh4CyXnyrbHJrIS3P0rRyG UZ+Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=yFcwaE5XZgy8/JWul+9dMsDxHhsAe+rq+bNw4aia6aI=; b=FAm86imwBK7wZ33pSx9YEn0t3RaezH9BDhDRiZ6Fk2vYza2IF8T7Cf7ChnTkIgy8Mo R7IAsGDoPjTvGeTKIqA7GSSPO/3gxg20JdhlIqU0tOI+Csu/vJUiWqsOLM7ULjhmgSVM QqQODVM0C6heEv28OKciQQ+NsgyiWK/22UUDuePptzFDI8V4iPotDSaVs6AC2o1mp9ps KR1i/hA46LgQiHPI2y/Baq125RBJuEyBM3N3xiYP/+Z3MRfI7xTy2OfmFHOps1T9q+sQ K0GG0v/eOTEZS55OWf1AC5aOo5E9wWzM4M2Nu45Y/bfbo9pGoD3iwzuvaDQu0Iued5Lp 7s9w== X-Gm-Message-State: APjAAAUafFX9BI+KN1KRFJVe2NqoMpvm+Vqq6gOj4YNziNa87Lf339EY Fb9MeWf5nMUxwpwtUy9k9kg= X-Google-Smtp-Source: APXvYqxRTC1ZCIou+O1ieQ8X4jZyYLi3Uuk65dRZrbyaBzYBL/qQqrtlREWLEIUs6943U+8msaNzDg== X-Received: by 2002:a17:90a:bc06:: with SMTP id w6mr15457363pjr.130.1566739444052; Sun, 25 Aug 2019 06:24:04 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:24:02 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 02/11] ftrace: introduce new building tool funcprototype Date: Sun, 25 Aug 2019 21:23:21 +0800 Message-Id: <20190825132330.5015-3-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062405_175890_A19553F9 X-CRM114-Status: GOOD ( 20.36 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:544 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org This is a new ftrace tool to implement CONFIG_FTRACE_FUNC_PROTOTYPE feature which allow ftrace record function parameters and return value (see later patches). Essentially funcprototype extracts only necessary information from the DWARF debug sections in the ELF object file, including function return type, parameter names and parameter data types. Then they will be built into the original ELF object. Here is an example for function memremap() in kernel/iomem.o. The declaration is: void *memremap(resource_size_t offset, size_t size, unsigned long flags) The output of funcprototype tool is: .section __funcprotostr, "a" .P_memremap_0: .string "offset" .P_memremap_1: .string "size" .P_memremap_2: .string "flags" .section __funcproto, "a" .quad memremap .byte 0x8 .byte 0x3 .quad .P_memremap_0 .byte 0x8 .byte 0x55 .byte 0x0 .quad .P_memremap_1 .byte 0x8 .byte 0x54 .byte 0x0 .quad .P_memremap_2 .byte 0x8 .byte 0x51 .byte 0x0 The strings are placed in '__funcprotostr' section, and prototype information is placed in '__funcproto' section. It equals to below C struct: struct func_param { char *name; uint8_t type; uint8_t loc[2]; } __packed; struct func_prototype { unsigned long ip; uint8_t ret_type; uint8_t nr_param; struct func_param params[0]; } __packed; Signed-off-by: Changbin Du --- kernel/trace/Kconfig | 19 ++ scripts/Makefile.build | 18 +- scripts/ftrace/.gitignore | 2 + scripts/ftrace/Makefile | 7 +- scripts/ftrace/funcprototype.c | 576 +++++++++++++++++++++++++++++++++ 5 files changed, 620 insertions(+), 2 deletions(-) create mode 100644 scripts/ftrace/funcprototype.c diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 98da8998c25c..20d1b0ae114d 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -38,6 +38,9 @@ config HAVE_FTRACE_MCOUNT_RECORD help See Documentation/trace/ftrace-design.rst +config HAVE_FTRACE_FUNC_PROTOTYPE + bool + config HAVE_SYSCALL_TRACEPOINTS bool help @@ -170,6 +173,22 @@ config FUNCTION_GRAPH_TRACER the return value. This is done by setting the current return address on the current task structure into a stack of calls. +config FTRACE_FUNC_PROTOTYPE + bool "Support recording function parameters and return value" + default n + depends on DYNAMIC_FTRACE + depends on HAVE_FTRACE_FUNC_PROTOTYPE + depends on FUNCTION_GRAPH_TRACER + help + Enable the Function Graph Tracer to record function parameters and + return value. It can be dynamically enabled/disabled by the + 'record-funcproto' trace option. + + By enabling this, function prototype information is built into + kernel. And the kernel size will increase by approximately 2%. + + Say N if unsure. + config TRACE_PREEMPT_TOGGLE bool help diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 67558983c518..d56850808d96 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -206,6 +206,21 @@ cmd_record_mcount = $(if $(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags)), endif # CC_USING_RECORD_MCOUNT endif # CONFIG_FTRACE_MCOUNT_RECORD +ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +sub_cmd_funcprototype = \ + $(srctree)/scripts/ftrace/funcprototype "$(@)" | \ + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -c \ + -o $(@D)/.tmp_$(@F:.o=.funcprototype) -x assembler -; \ + $(LD) $(ld_flags) -r -o $(@D)/.tmp_$(@F) $@ $(@D)/.tmp_$(@F:.o=.funcprototype); \ + mv -f $(@D)/.tmp_$(@F) $@; \ + rm -f $(@D)/.tmp_$(@F:.o=.funcprototype); +cmd_funcprototype = \ + if $(OBJDUMP) -h $@ | grep -q __mcount_loc; then \ + $(sub_cmd_funcprototype) \ + fi +funcprototype_source := $(srctree)/scripts/ftrace/funcprototype.c +endif # CONFIG_FTRACE_FUNC_PROTOTYPE + ifdef CONFIG_STACK_VALIDATION ifneq ($(SKIP_STACK_VALIDATION),1) @@ -259,6 +274,7 @@ define rule_cc_o_c $(call cmd,objtool) $(call cmd,modversions_c) $(call cmd,record_mcount) + $(call cmd,funcprototype) endef define rule_as_o_S @@ -276,7 +292,7 @@ cmd_undef_syms = echo endif # Built-in and composite module parts -$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE +$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(funcprototype_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) diff --git a/scripts/ftrace/.gitignore b/scripts/ftrace/.gitignore index 54d582c8faad..92aa4f335656 100644 --- a/scripts/ftrace/.gitignore +++ b/scripts/ftrace/.gitignore @@ -2,3 +2,5 @@ # Generated files # recordmcount +funcprototype + diff --git a/scripts/ftrace/Makefile b/scripts/ftrace/Makefile index 6797e51473e5..c44d131b075c 100644 --- a/scripts/ftrace/Makefile +++ b/scripts/ftrace/Makefile @@ -1,4 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 -hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount +hostprogs-$(BUILD_C_RECORDMCOUNT) := recordmcount + +hostprogs-$(CONFIG_FTRACE_FUNC_PROTOTYPE) += funcprototype +HOSTLDLIBS_funcprototype += -lelf +HOSTLDLIBS_funcprototype += -ldw + always := $(hostprogs-y) diff --git a/scripts/ftrace/funcprototype.c b/scripts/ftrace/funcprototype.c new file mode 100644 index 000000000000..064724047b19 --- /dev/null +++ b/scripts/ftrace/funcprototype.c @@ -0,0 +1,576 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * funcprototype.c: generate function prototypes of the locations of calls to + * 'mcount' so that ftrace can record function parameters and return value. + * + * Copyright 2019 Changbin Du . All rights reserved. + * + * Usage: funcprototype [OPTION...] elf-file + * + * Here is an example for function memremap() in kernel/iomem.o. The + * declaration is: + * void *memremap(resource_size_t offset, size_t size, unsigned long flags) + * + * The output of funcprototype tool is: + * .section __funcprotostr, "a" + * .P_memremap_0: + * .string "offset" + * .P_memremap_1: + * .string "size" + * .P_memremap_2: + * .string "flags" + * + * .section __funcproto, "a" + * .quad memremap + * .byte 0x8 + * .byte 0x3 + * .quad .P_memremap_0 + * .byte 0x8 + * .byte 0x55 + * .byte 0x0 + * .quad .P_memremap_1 + * .byte 0x8 + * .byte 0x54 + * .byte 0x0 + * .quad .P_memremap_2 + * .byte 0x8 + * .byte 0x51 + * .byte 0x0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct func_param { + char *name; + uint8_t type; + u_int8_t loc[2]; /* Location expression, loc[0] is opcode */ +}; + +struct func_prototype { + struct func_prototype *next; + bool skip; + + char *name; + uint8_t ret_type; + uint8_t nr_param; + struct func_param *params; +}; + +#define MK_TYPE(sign, size) (((!!sign) << 7) | size) + +static bool is_64bit_obj; +static struct func_prototype *func_prototype_list; + + +static struct func_prototype *func_prototype_list_add_new(const char *name) +{ + struct func_prototype *proto; + + proto = malloc(sizeof(*proto)); + if (!proto) + errx(1, "no memory"); + memset(proto, 0, sizeof(*proto)); + + proto->name = strdup(name); + if (!proto->name) + errx(1, "no memory"); + + if (!func_prototype_list) { + proto->next = NULL; + func_prototype_list = proto; + } else { + proto->next = func_prototype_list->next; + func_prototype_list->next = proto; + } + + return proto; +} + +static struct func_prototype *func_prototype_list_search(const char *name) +{ + struct func_prototype *proto; + + for (proto = func_prototype_list; proto != NULL; proto = proto->next) { + if (!strcmp(proto->name, name)) + return proto; + }; + return NULL; +} + +static void func_prototype_list_dumpnames(void) +{ + struct func_prototype *proto; + + for (proto = func_prototype_list; proto != NULL; proto = proto->next) + printf("%s\n", proto->name); +} + +static void func_prototype_list_destroy(void) +{ + struct func_prototype *proto; + int i; + + while (func_prototype_list) { + proto = func_prototype_list; + func_prototype_list = func_prototype_list->next; + + free(proto->name); + if (proto->params) { + for (i = 0; i < proto->nr_param; i++) + free(proto->params[i].name); + free(proto->params); + } + free(proto); + } +} + +static bool is_mcount(char *name) +{ + return !strcmp(name, "__fentry__") || + !strcmp(name, "_mcount") || + !strcmp(name, "mcount"); +} + +static void check_elf(Elf *elf) +{ + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr; + + ehdr = gelf_getehdr(elf, &ehdr_mem); + if (!ehdr) + errx(1, "cannot read ELF header"); + + is_64bit_obj = gelf_getclass(elf) == ELFCLASS64; + + switch (ehdr->e_machine) { + case EM_386: + case EM_X86_64: + break; + default: + errx(1, "unsupported arch %d", ehdr->e_machine); + } +} + +/** + * Search the symbole table to get the entry which matches @scn and @offset + * from relocation talbe. + */ +static char *search_mcount_caller(Elf *elf, GElf_Shdr *symshdr, + Elf_Data *symdata, int scn, int offset) +{ + int ndx; + char *caller; + + for (ndx = 0; ndx < symshdr->sh_size / symshdr->sh_entsize; ++ndx) { + GElf_Sym sym; + + gelf_getsym(symdata, ndx, &sym); + + /* TODO: add local symobl support. */ + if (GELF_ST_BIND(sym.st_info) == STB_GLOBAL && + scn == sym.st_shndx && (offset >= sym.st_value) && + (offset < sym.st_value + sym.st_size)) { + caller = elf_strptr(elf, symshdr->sh_link, sym.st_name); + return caller; + } + } + + return NULL; +} + +/* Get all functions that call to mcount. */ +static void get_mcount_callers(const char *elf_file) +{ + Elf *elf; + Elf_Scn *scn = NULL; + GElf_Shdr shdr; + int fd; + int ndx; + + fd = open(elf_file, O_RDONLY); + if (fd < 0) + errx(1, "can not open %s", elf_file); + + elf_version(EV_CURRENT); + elf = elf_begin(fd, ELF_C_READ, NULL); + + check_elf(elf); + + while ((scn = elf_nextscn(elf, scn)) != NULL) { + gelf_getshdr(scn, &shdr); + + if (shdr.sh_type == SHT_REL || shdr.sh_type == SHT_RELA) { + Elf_Data *data = elf_getdata(scn, NULL); + Elf_Scn *symscn = elf_getscn(elf, shdr.sh_link); + Elf_Data *symdata = elf_getdata(symscn, NULL); + GElf_Shdr symshdr_mem; + GElf_Shdr *symshdr = gelf_getshdr(symscn, &symshdr_mem); + + for (ndx = 0; ndx < shdr.sh_size / shdr.sh_entsize; + ++ndx) { + unsigned long sym_index; + unsigned long offset; + GElf_Sym sym; + char *symname; + + if (shdr.sh_type == SHT_REL) { + GElf_Rel rel_mem; + GElf_Rel *rel = gelf_getrel(data, ndx, + &rel_mem); + sym_index = GELF_R_SYM(rel->r_info); + offset = rel->r_offset; + } else { + GElf_Rela rela_mem; + GElf_Rela *rela = gelf_getrela( + data, ndx, &rela_mem); + sym_index = GELF_R_SYM(rela->r_info); + offset = rela->r_offset; + } + + gelf_getsym(symdata, sym_index, &sym); + symname = elf_strptr(elf, symshdr->sh_link, + sym.st_name); + + if (is_mcount(symname)) { + const char *caller; + + caller = search_mcount_caller( + elf, symshdr, symdata, + shdr.sh_info, offset); + if (caller) + func_prototype_list_add_new(caller); + } + } + } + } + + elf_end(elf); + close(fd); +} + +/* + * Get a variable size and sign info. + * TODO: Determine the expected display format. (e.g. size_t for "%lu"). + */ +static void die_type_sign_bytes(Dwarf_Die *die, bool *is_signed, int *bytes) +{ + Dwarf_Attribute attr; + Dwarf_Die type; + int ret; + + *bytes = 0; + *is_signed = false; + + ret = dwarf_peel_type(dwarf_formref_die( + dwarf_attr_integrate(die, DW_AT_type, &attr), &type), + &type); + if (ret == 0) { + Dwarf_Word val; + + ret = dwarf_formudata(dwarf_attr(&type, DW_AT_encoding, + &attr), &val); + if (ret == 0) + *is_signed = (val == DW_ATE_signed) || + (val == DW_ATE_signed_char); + + if (dwarf_aggregate_size(&type, &val) == 0) + *bytes = val; + } +} + +static int get_func_nr_params(Dwarf_Die *funcdie) +{ + Dwarf_Die child; + int count = 0; + + if (dwarf_child(funcdie, &child) == 0) { + do { + if (dwarf_tag(&child) == DW_TAG_formal_parameter) + count++; + } while (dwarf_siblingof(&child, &child) == 0); + } + + return count; +} + +static int get_loc_expr(const char *fname, Dwarf_Op *loc, uint8_t expr[2]) +{ + int ret = 0; + int off; + + switch (loc->atom) { + case DW_OP_reg0 ... DW_OP_reg31: + expr[0] = loc->atom; + expr[1] = 0; + break; + case DW_OP_fbreg: + off = (int32_t)loc->number; + + /* + * Very few functions have number that exceeds + * (SCHAR_MIN, SCHAR_MAX). We skip these + * functions to keep protrotype data as small + * as possilbe. + */ + if (off > SCHAR_MAX || off < SCHAR_MIN) { + warnx("%s: loc fbreg offset %d too large", fname, off); + ret = -1; + } else { + expr[0] = loc->atom; + expr[1] = off; /* The operand is signed */ + } + break; + case DW_OP_breg0 ... DW_OP_breg31: + off = (int32_t)loc->number; + + if (off > SCHAR_MAX || off < SCHAR_MIN) { + warnx("%s: loc bregx offset %d too large", fname, off); + ret = -1; + } else { + expr[0] = loc->atom; + expr[1] = off; + } + break; + default: + warnx("%s: unsupported loc operation 0x%x", + fname, loc->atom); + ret = -1; + }; + + return ret; +} + +static int handle_function(Dwarf_Die *funcdie, void *arg) +{ + const char *name = dwarf_diename(funcdie); + Dwarf_Addr func_addr; + Dwarf_Die child; + struct func_prototype *proto; + int nr_params; + int sz, n = 0; + + if (!dwarf_hasattr(funcdie, DW_AT_low_pc)) + return 0; + + /* Such symbol is a local function generated by GCC ipa-fnsplit. */ + if (!dwarf_hasattr(funcdie, DW_AT_name)) + return 0; + + /* check whether it is a mcount caller. */ + proto = func_prototype_list_search(name); + if (!proto) + return 0; + + nr_params = get_func_nr_params(funcdie); + sz = sizeof(proto->params[0]) * nr_params; + proto->params = malloc(sz); + if (!proto->params) + errx(1, "no memory"); + + memset(proto->params, 0, sz); + + dwarf_lowpc(funcdie, &func_addr); + + /* get function return type */ + if (dwarf_hasattr(funcdie, DW_AT_type)) { + bool is_signed; + int bytes; + + die_type_sign_bytes(funcdie, &is_signed, &bytes); + proto->ret_type = MK_TYPE(is_signed, bytes); + } else + proto->ret_type = 0; + + /* process function parameters. */ + if (dwarf_child(funcdie, &child) == 0) { + do { + if (dwarf_tag(&child) == DW_TAG_formal_parameter) { + Dwarf_Attribute locattr; + Dwarf_Op *loc; + size_t nloc = 0; + bool is_signed; + int bytes; + + die_type_sign_bytes(&child, &is_signed, &bytes); + proto->params[n].name = strdup(dwarf_diename(&child)); + proto->params[n].type = MK_TYPE(is_signed, bytes); + + if (!dwarf_hasattr(&child, DW_AT_location)) + errx(1, "%s: no location attr", name); + + dwarf_attr(&child, DW_AT_location, &locattr); + if (dwarf_getlocation(&locattr, &loc, &nloc) < 0) { + Dwarf_Addr base, begin, end; + + if (dwarf_getlocations( + &locattr, 0, &base, + &begin, &end, &loc, + &nloc) <= 0) + errx(1, "%s: no param loc info", + name); + } + if (get_loc_expr(name, loc, proto->params[n].loc)) { + /* skip this function. */ + proto->skip = true; + return 0; + } + + n++; + }; + } while (dwarf_siblingof(&child, &child) == 0); + } + + proto->nr_param = n; + return 0; +} + +static const Dwfl_Callbacks offline_callbacks = { + .find_debuginfo = dwfl_standard_find_debuginfo, + .section_address = dwfl_offline_section_address, +}; + +/* Iterate each DW_TAG_subprogram DIE to get their prototype info. */ +static void dwarf_get_prototypes(const char *elf_file) +{ + Dwfl *dwfl = NULL; + Dwarf_Die *cu = NULL; + Dwarf_Addr dwbias; + int ret; + + dwfl = dwfl_begin(&offline_callbacks); + if (dwfl == NULL) + errx(1, "dwfl fail"); + + if (dwfl_report_offline(dwfl, "", elf_file, -1) == NULL) + errx(1, "dwfl report fail"); + + ret = dwfl_report_end(dwfl, NULL, NULL); + assert(ret == 0); + + while ((cu = dwfl_nextcu(dwfl, cu, &dwbias)) != NULL) + dwarf_getfuncs(cu, &handle_function, NULL, 0); +} + +static void print_prototypes_assembly(void) +{ + struct func_prototype *proto; + int i; + + if (!func_prototype_list) + return; + + printf(" .section __funcprotostr, \"a\"\n"); + for (proto = func_prototype_list; proto != NULL; proto = proto->next) { + if (proto->skip) + continue; + for (i = 0; i < proto->nr_param; i++) { + printf(".P_%s_%d:\n", proto->name, i); + printf(" .string \"%s\"\n", proto->params[i].name); + } + }; + + printf("\n .section __funcproto, \"a\"\n"); + for (proto = func_prototype_list; proto != NULL; proto = proto->next) { + if (proto->skip) + continue; + if (is_64bit_obj) + printf(" .quad %s\n", proto->name); + else + printf(" .long %s\n", proto->name); + printf(" .byte 0x%x\n", proto->ret_type); + printf(" .byte 0x%x\n", proto->nr_param); + for (i = 0; i < proto->nr_param; i++) { + if (is_64bit_obj) + printf(" .quad .P_%s_%d\n", proto->name, i); + else + printf(" .long .P_%s_%d\n", proto->name, i); + printf(" .byte 0x%x\n", proto->params[i].type); + printf(" .byte 0x%x\n", proto->params[i].loc[0]); + printf(" .byte 0x%x\n", proto->params[i].loc[1]); + } + printf("\n"); + }; +} + +/* Program documentation. */ +static char doc[] = + "funcprototype -- a program to generate mcount caller prototypes"; + +/* A description of the arguments we accept. */ +static const char args_doc[] = "elf-file"; + +/* The options we understand. */ +static struct argp_option options[] = { { "mcount-callers", 'm', 0, 0, + "show mcount callers only" }, + { 0 } }; + +struct arguments { + char *elf_file; + int show_callers_only; +}; + +/* Parse options. */ +static error_t parse_opt(int key, char *arg, struct argp_state *state) +{ + struct arguments *arguments = state->input; + + switch (key) { + case 'm': + arguments->show_callers_only = 1; + break; + case ARGP_KEY_ARG: + if (state->arg_num > 2) { + /* Too many arguments. */ + argp_usage(state); + } + arguments->elf_file = arg; + break; + case ARGP_KEY_END: + if (state->arg_num < 1) + /* Not enough arguments. */ + argp_usage(state); + break; + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +/* Our argp parser. */ +static struct argp argp = { options, parse_opt, args_doc, doc }; + +int main(int argc, char *argv[]) +{ + struct arguments arguments; + + arguments.show_callers_only = 0; + argp_parse(&argp, argc, argv, 0, 0, &arguments); + + get_mcount_callers(arguments.elf_file); + + if (arguments.show_callers_only) { + func_prototype_list_dumpnames(); + goto free; + } + + dwarf_get_prototypes(arguments.elf_file); + print_prototypes_assembly(); + +free: + func_prototype_list_destroy(); + return 0; +} From patchwork Sun Aug 25 13:23:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29CB8912 for ; Sun, 25 Aug 2019 13:25:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07E7E20850 for ; Sun, 25 Aug 2019 13:25:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hBwX+vtf"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aUENNOnT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07E7E20850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jAHER17cb7gZPy6bG4J38aQQxqU+UNrt59mXa7C0Qsc=; b=hBwX+vtfftE0tT roozp9bABp2HfpXPC+OTKNqC/z+lo/yIXvToVjjTKSCj8poiTXtWuIvxPdkuvNxDxkRmin/fd+GQr qqInFfbxpaeTkar1aSHg9QgnMaCqFdJvHSmVwgNfn1xY/+RIBrSYrCmtsq2WqtxjYkOVFhfaMQN10 JRP0hRFJgFNWqkq1vsvFQiNigqHcdI0dDsIY/3pmJokDXTRZ+pOJ4jOSyECo5OIBnUcTYh/c35mHP xzbJr6IXobnD9ph/ScDul7K1b0FJWw8n27NmndOkPk9EgMI5KJCktoVB72jeO+A62i7NR8N2GXPVq OW4FjWux9uKVlszdkGjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sWn-0005Wy-R8; Sun, 25 Aug 2019 13:25:53 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sVA-000330-1g; Sun, 25 Aug 2019 13:24:14 +0000 Received: by mail-pf1-x441.google.com with SMTP id q139so9807977pfc.13; Sun, 25 Aug 2019 06:24:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=sJqaaN3fFlNFQlgDnqMXC9K3Wn4iCAubnxsjfvsinrg=; b=aUENNOnTkc6UvqkiK35jB6tUYGyM3TlDKalbikNLu59Q1ula/2Ga+nHGf1vvpR+24f T70el8qOEE8Js9Hv0fCRSaf5/h+Ee+TtWHSTiEw/On20HMF+MGhSLdILu6xb3OeqJGD0 v4SmlD696FiPnCEHt7nKgdfXV1KReF2EKfgmKkWRVQfggOFucpUyrpP+wMwIsThgKuG7 9NM1+C4jBZf8JCU7fWzbrufyWAcqSoTjSFCzRqJJlnpLBGW64qDjwQWVPtThqjdBHjhF ROVV4uLMS8CM3JTQuM9NCBt4uahyzBDMBlGy7sMu2kDvOmHPNzLGh8R/8dGZi/QL0bga 3SXA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=sJqaaN3fFlNFQlgDnqMXC9K3Wn4iCAubnxsjfvsinrg=; b=FFpmwxK9Ef8oIabPhk8wEXRmXv3iTt70Q2pBH/yfwmpF+13qNJUa5JtZO6LpedWdGn ZGyMMuMObnvt/uhIOBuu/8wSmh874Hq/IqlTguOJ3toMOF/kSjJfwlpkhwRz2cCob5Lh gwT2LGxOUEf21CWUMnpP12i/eHkIe0vZocvKDjhswGSymq+0ZZ0Zk+lg8YO3M5hfLysK pYsC7UeQun0ZbHpMDTcYgMhF8YPFGGzn7Ll//xTrj0PUIcPttAYO9GhTnpD4bLOY6Lsy Hnv6CjiMdRasbNc+Q319hem2iUC96TU+LCZWmHiwtPAbpIF6praCFisnJHs8yeJFeOEI t3kA== X-Gm-Message-State: APjAAAW4nZ1S74xLwRjk+dpvPog5XAauVW20vAnembZRZeKaqDISvbVr ZB8w/Z6rV6KFLaw9zyIBh3Q= X-Google-Smtp-Source: APXvYqxBB4sMg5D7Mm+ptiLy9D8i4zanUHATTOCxqDzRbVRsUB905N5kg4h4DAYSv8z2SCDUUgkMWA== X-Received: by 2002:a17:90a:ec12:: with SMTP id l18mr14467542pjy.6.1566739451635; Sun, 25 Aug 2019 06:24:11 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.24.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:24:11 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 03/11] asm-generic: add generic dwarf definition Date: Sun, 25 Aug 2019 21:23:22 +0800 Message-Id: <20190825132330.5015-4-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062412_848313_82E8EBE1 X-CRM114-Status: UNSURE ( 9.12 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org Add generic DWARF constant definitions. We will use it later. Signed-off-by: Changbin Du --- include/asm-generic/dwarf.h | 199 ++++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 include/asm-generic/dwarf.h diff --git a/include/asm-generic/dwarf.h b/include/asm-generic/dwarf.h new file mode 100644 index 000000000000..c705633c2a8f --- /dev/null +++ b/include/asm-generic/dwarf.h @@ -0,0 +1,199 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * Architecture independent definitions of DWARF. + * + * Copyright (C) 2019 Changbin Du + */ +#ifndef __ASM_GENERIC_DWARF_H +#define __ASM_GENERIC_DWARF_H + +/* + * DWARF expression operations + */ +#define DW_OP_addr 0x03 +#define DW_OP_deref 0x06 +#define DW_OP_const1u 0x08 +#define DW_OP_const1s 0x09 +#define DW_OP_const2u 0x0a +#define DW_OP_const2s 0x0b +#define DW_OP_const4u 0x0c +#define DW_OP_const4s 0x0d +#define DW_OP_const8u 0x0e +#define DW_OP_const8s 0x0f +#define DW_OP_constu 0x10 +#define DW_OP_consts 0x11 +#define DW_OP_dup 0x12 +#define DW_OP_drop 0x13 +#define DW_OP_over 0x14 +#define DW_OP_pick 0x15 +#define DW_OP_swap 0x16 +#define DW_OP_rot 0x17 +#define DW_OP_xderef 0x18 +#define DW_OP_abs 0x19 +#define DW_OP_and 0x1a +#define DW_OP_div 0x1b +#define DW_OP_minus 0x1c +#define DW_OP_mod 0x1d +#define DW_OP_mul 0x1e +#define DW_OP_neg 0x1f +#define DW_OP_not 0x20 +#define DW_OP_or 0x21 +#define DW_OP_plus 0x22 +#define DW_OP_plus_uconst 0x23 +#define DW_OP_shl 0x24 +#define DW_OP_shr 0x25 +#define DW_OP_shra 0x26 +#define DW_OP_xor 0x27 +#define DW_OP_skip 0x2f +#define DW_OP_bra 0x28 +#define DW_OP_eq 0x29 +#define DW_OP_ge 0x2a +#define DW_OP_gt 0x2b +#define DW_OP_le 0x2c +#define DW_OP_lt 0x2d +#define DW_OP_ne 0x2e +#define DW_OP_lit0 0x30 +#define DW_OP_lit1 0x31 +#define DW_OP_lit2 0x32 +#define DW_OP_lit3 0x33 +#define DW_OP_lit4 0x34 +#define DW_OP_lit5 0x35 +#define DW_OP_lit6 0x36 +#define DW_OP_lit7 0x37 +#define DW_OP_lit8 0x38 +#define DW_OP_lit9 0x39 +#define DW_OP_lit10 0x3a +#define DW_OP_lit11 0x3b +#define DW_OP_lit12 0x3c +#define DW_OP_lit13 0x3d +#define DW_OP_lit14 0x3e +#define DW_OP_lit15 0x3f +#define DW_OP_lit16 0x40 +#define DW_OP_lit17 0x41 +#define DW_OP_lit18 0x42 +#define DW_OP_lit19 0x43 +#define DW_OP_lit20 0x44 +#define DW_OP_lit21 0x45 +#define DW_OP_lit22 0x46 +#define DW_OP_lit23 0x47 +#define DW_OP_lit24 0x48 +#define DW_OP_lit25 0x49 +#define DW_OP_lit26 0x4a +#define DW_OP_lit27 0x4b +#define DW_OP_lit28 0x4c +#define DW_OP_lit29 0x4d +#define DW_OP_lit30 0x4e +#define DW_OP_lit31 0x4f +#define DW_OP_reg0 0x50 +#define DW_OP_reg1 0x51 +#define DW_OP_reg2 0x52 +#define DW_OP_reg3 0x53 +#define DW_OP_reg4 0x54 +#define DW_OP_reg5 0x55 +#define DW_OP_reg6 0x56 +#define DW_OP_reg7 0x57 +#define DW_OP_reg8 0x58 +#define DW_OP_reg9 0x59 +#define DW_OP_reg10 0x5a +#define DW_OP_reg11 0x5b +#define DW_OP_reg12 0x5c +#define DW_OP_reg13 0x5d +#define DW_OP_reg14 0x5e +#define DW_OP_reg15 0x5f +#define DW_OP_reg16 0x60 +#define DW_OP_reg17 0x61 +#define DW_OP_reg18 0x62 +#define DW_OP_reg19 0x63 +#define DW_OP_reg20 0x64 +#define DW_OP_reg21 0x65 +#define DW_OP_reg22 0x66 +#define DW_OP_reg23 0x67 +#define DW_OP_reg24 0x68 +#define DW_OP_reg25 0x69 +#define DW_OP_reg26 0x6a +#define DW_OP_reg27 0x6b +#define DW_OP_reg28 0x6c +#define DW_OP_reg29 0x6d +#define DW_OP_reg30 0x6e +#define DW_OP_reg31 0x6f +#define DW_OP_breg0 0x70 +#define DW_OP_breg1 0x71 +#define DW_OP_breg2 0x72 +#define DW_OP_breg3 0x73 +#define DW_OP_breg4 0x74 +#define DW_OP_breg5 0x75 +#define DW_OP_breg6 0x76 +#define DW_OP_breg7 0x77 +#define DW_OP_breg8 0x78 +#define DW_OP_breg9 0x79 +#define DW_OP_breg10 0x7a +#define DW_OP_breg11 0x7b +#define DW_OP_breg12 0x7c +#define DW_OP_breg13 0x7d +#define DW_OP_breg14 0x7e +#define DW_OP_breg15 0x7f +#define DW_OP_breg16 0x80 +#define DW_OP_breg17 0x81 +#define DW_OP_breg18 0x82 +#define DW_OP_breg19 0x83 +#define DW_OP_breg20 0x84 +#define DW_OP_breg21 0x85 +#define DW_OP_breg22 0x86 +#define DW_OP_breg23 0x87 +#define DW_OP_breg24 0x88 +#define DW_OP_breg25 0x89 +#define DW_OP_breg26 0x8a +#define DW_OP_breg27 0x8b +#define DW_OP_breg28 0x8c +#define DW_OP_breg29 0x8d +#define DW_OP_breg30 0x8e +#define DW_OP_breg31 0x8f +#define DW_OP_regx 0x90 +#define DW_OP_fbreg 0x91 +#define DW_OP_bregx 0x92 +#define DW_OP_piece 0x93 +#define DW_OP_deref_size 0x94 +#define DW_OP_xderef_size 0x95 +#define DW_OP_nop 0x96 +#define DW_OP_push_object_address 0x97 +#define DW_OP_call2 0x98 +#define DW_OP_call4 0x99 +#define DW_OP_call_ref 0x9a +#define DW_OP_form_tls_address 0x9b +#define DW_OP_call_frame_cfa 0x9c +#define DW_OP_bit_piece 0x9d +#define DW_OP_implicit_value 0x9e +#define DW_OP_stack_value 0x9f +#define DW_OP_implicit_pointer 0xa0 +#define DW_OP_addrx 0xa1 +#define DW_OP_constx 0xa2 +#define DW_OP_entry_value 0xa3 +#define DW_OP_const_type 0xa4 +#define DW_OP_regval_type 0xa5 +#define DW_OP_deref_type 0xa6 +#define DW_OP_xderef_type 0xa7 +#define DW_OP_convert 0xa8 +#define DW_OP_reinterpret 0xa9 + +/* GNU extensions. */ +#define DW_OP_GNU_push_tls_address 0xe0 +#define DW_OP_GNU_uninit 0xf0 +#define DW_OP_GNU_encoded_addr 0xf1 +#define DW_OP_GNU_implicit_pointer 0xf2 +#define DW_OP_GNU_entry_value 0xf3 +#define DW_OP_GNU_const_type 0xf4 +#define DW_OP_GNU_regval_type 0xf5 +#define DW_OP_GNU_deref_type 0xf6 +#define DW_OP_GNU_convert 0xf7 +#define DW_OP_GNU_reinterpret 0xf9 +#define DW_OP_GNU_parameter_ref 0xfa + +/* GNU Debug Fission extensions. */ +#define DW_OP_GNU_addr_index 0xfb, +#define DW_OP_GNU_const_index 0xfc +#define DW_OP_GNU_variable_value 0xfd + +#define DW_OP_lo_user 0xe0 +#define DW_OP_hi_user 0xff + +#endif /* __ASM_GENERIC_DWARF_H */ From patchwork Sun Aug 25 13:23:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D962114DB for ; Sun, 25 Aug 2019 13:26:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B7BA920850 for ; Sun, 25 Aug 2019 13:26:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NfgfeQQx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sHDg4LdF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7BA920850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WA4zZp/5LSmjC5KsNTudMGs7+yJgNkYM8EnB9R+TqRk=; b=NfgfeQQxC6K6U0 tkL3QDeiqUxtlCloY1UMqcdNF/saFAS404qe6dXHGOWDGISrns4yAwtEZ7QsFJ3faLVN0eWZjyQ8r JS5/GIyCmUguIIm9FdoUAEVl/IP/zrRCGUGKZHxp8uqmwdgXPTMjuEelFUUPuJ0glYX+9yTy5z4pY 94Be5BmlPeIA/ni3NFgj/fU8mGLLrxhiHnkas+YpMgjIBJq7MGtN/uggBpbNB9Vx9dVInywYJ1krd BX71zQYypDpmbD8DQUJPHUiFYQV58YJSWnc7LzmrG5WksHPPRiplpZcbU/Lr4Tn/gRDozU7cG/zLx RW3VUpoBIPTNEKWKd2Yg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sXF-00063M-LO; Sun, 25 Aug 2019 13:26:21 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sVH-0003A7-RE; Sun, 25 Aug 2019 13:24:21 +0000 Received: by mail-pg1-x543.google.com with SMTP id m3so8721304pgv.13; Sun, 25 Aug 2019 06:24:19 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZBMOYzu8UIu95lP7jXMjUUnVweWqbQKsr6KxrGRBejY=; b=sHDg4LdFrZLoGW/ZYspHbC6si5YKDLezCKJyEjDpI/sdIE9awBNr91t8Vhfot9Jkv/ eY42rNW+4SWG7yComJVhrM6XBby3bfRflTU3gZKNvI3LyaamRH5OjwxcYHOm09dbfmNI t1ix14MoqSf120rnu5QbAzkF79vwWQKxhqXPBnXMc0lOXCWJtyvXsI0kTP/MMPNK1JUo cLZ9SKjeQoOaWjCl1i2knVrN+R/+widRkHLHIBuvg3Dms/8DumzuWQnRndvA3vlc2ra+ VjSjvDvL9QH/d9g3AYDaj60J1P/SBbs+EHTE1BskRsNLdUgHaE7p93H+uAyK0UdkBANy EYxg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZBMOYzu8UIu95lP7jXMjUUnVweWqbQKsr6KxrGRBejY=; b=CqANQ+EREhlWoISfT1IP3YyP8YqptMq8TRhTO14Tyq66rE9DXqziWEDY01To826+Il 2FObpQoW61yGebs+6nqLb2T8LbgKddF84ouqfIjJXfnFw5y/alC9ctsSk3DvFs62YRWV 9a2K5Pzk+DZN5VfNt7rBxXouaLqAu8z9QJ6F/PWKCk0jKFGF4xCveLGEQ1b9igGvFVTX C9gOIh0QvI13nLrgSSJFaf1Hm5MD3zFEr3bhHsn/hUzqtNWUvGomhyGhK0GxArCZSRkE iNGz31KFrogK7QSDIPv9y++wHR0uOMBUUtmXjU0D+7rIUQ5+pK/wAxHNSh0cB+3rQmle LO8g== X-Gm-Message-State: APjAAAU2KLctnuOlMkvC90pK6YWnHIpYqd9xxMJDMEMezH1bw9B5rDLI Eggo9+ZrWGB+cM5Z2AHlLww= X-Google-Smtp-Source: APXvYqxpYPr/pKADhj70YxFWPqP5/wYXfBY0LpRYX2aLllbJNw9nnJFrJ+KG+/AqWzkmIcaviruEwA== X-Received: by 2002:aa7:93aa:: with SMTP id x10mr15472120pff.83.1566739459240; Sun, 25 Aug 2019 06:24:19 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:24:18 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 04/11] ftrace/hash: add private data field Date: Sun, 25 Aug 2019 21:23:23 +0800 Message-Id: <20190825132330.5015-5-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062419_927744_8AF28E34 X-CRM114-Status: GOOD ( 11.25 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org We will reuse ftrace_hash to lookup function prototype information. So we need an additional field to bind ftrace_func_entry to prototype information. Signed-off-by: Changbin Du --- kernel/trace/ftrace.c | 17 +++++++---------- kernel/trace/trace.h | 6 ++++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index eca34503f178..a314f0768b2c 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1017,11 +1017,6 @@ static bool update_all_ops; # error Dynamic ftrace depends on MCOUNT_RECORD #endif -struct ftrace_func_entry { - struct hlist_node hlist; - unsigned long ip; -}; - struct ftrace_func_probe { struct ftrace_probe_ops *probe_ops; struct ftrace_ops ops; @@ -1169,7 +1164,8 @@ static void __add_hash_entry(struct ftrace_hash *hash, hash->count++; } -static int add_hash_entry(struct ftrace_hash *hash, unsigned long ip) +static int add_hash_entry(struct ftrace_hash *hash, unsigned long ip, + void *priv) { struct ftrace_func_entry *entry; @@ -1178,6 +1174,7 @@ static int add_hash_entry(struct ftrace_hash *hash, unsigned long ip) return -ENOMEM; entry->ip = ip; + entry->priv = priv; __add_hash_entry(hash, entry); return 0; @@ -1346,7 +1343,7 @@ alloc_and_copy_ftrace_hash(int size_bits, struct ftrace_hash *hash) size = 1 << hash->size_bits; for (i = 0; i < size; i++) { hlist_for_each_entry(entry, &hash->buckets[i], hlist) { - ret = add_hash_entry(new_hash, entry->ip); + ret = add_hash_entry(new_hash, entry->ip, NULL); if (ret < 0) goto free_hash; } @@ -3694,7 +3691,7 @@ enter_record(struct ftrace_hash *hash, struct dyn_ftrace *rec, int clear_filter) if (entry) return 0; - ret = add_hash_entry(hash, rec->ip); + ret = add_hash_entry(hash, rec->ip, NULL); } return ret; } @@ -4700,7 +4697,7 @@ ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove) return 0; } - return add_hash_entry(hash, ip); + return add_hash_entry(hash, ip, NULL); } static int @@ -5380,7 +5377,7 @@ ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer) if (entry) continue; - if (add_hash_entry(hash, rec->ip) < 0) + if (add_hash_entry(hash, rec->ip, NULL) < 0) goto out; } else { if (entry) { diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 005f08629b8b..ad619c73a505 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -882,6 +882,12 @@ struct ftrace_hash { struct rcu_head rcu; }; +struct ftrace_func_entry { + struct hlist_node hlist; + unsigned long ip; + void *priv; +}; + struct ftrace_func_entry * ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip); From patchwork Sun Aug 25 13:23:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113423 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC2D6912 for ; Sun, 25 Aug 2019 13:26:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 98B8220850 for ; Sun, 25 Aug 2019 13:26:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="okx/gBuz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BBTUSTiF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98B8220850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DziBjlzQDt2iI5QBh9n3b9wv2AEItg7IvPfrAdU6DsA=; b=okx/gBuzahxjOZ okuQ0hJjm1Bo1DP9PNYU/kC+QM/bRQJLVCJOzLQVSvckROkx+DpGU+u2SUszg6BooP6EGL7zLAS9E kpK/k015G9B/dZ2o87WkCN0W/w5mTHM3z5bnrgzrkFJXLudNdrVvs3EITs+2PHCk3WzSsuLfIQG1o YR/eGNV8LLnGgA3jhNmY6n2T6tnbbz70lJ/Rcq2oX7boKYLwtu0rEyZJXr8/oymPjxnjhTSgo6O67 EhNDxAHzPl9FcSSZ4E3yuOUSPbYfY0/Ftj4StGjTrE9DXkqA06T2WOzbSWwm494oW0ArXtH5pDFSU HqJqXNjYmuZqm+l9g/wg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sXX-0006Kb-RT; Sun, 25 Aug 2019 13:26:39 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sVP-0003HL-Cp; Sun, 25 Aug 2019 13:24:28 +0000 Received: by mail-pf1-x441.google.com with SMTP id y200so2148698pfb.6; Sun, 25 Aug 2019 06:24:27 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=AnjEbtcd5cNHwbypnsrs4cfSdZGE8Y8KXODnC5r+/Sw=; b=BBTUSTiFPulSXGVxfV98A1F0dTvb1nWs3kkM5cP9rBvuoglTt4LTj8MiMfMFJBcrsS MTkeTo7kfOO+E0w+tKCTnNl3c/QHQ2SSNUY9y0LVFtXPL9z4rM2CVMgGoJ5gO8pDVZ3K vpOFcvPN2hFCmHJbZGQeZy5BK6pHjBE8Plt63H0GmNLx4Vm2E5hg9Nh/n+QOK3km2hVD H13h6219G0X/DDyWj/h1KQ89LK+SNeEolCXmqpXmn50tXDlsOST1VLkuz+6fbZZ/VRDy KA2SYRSEYEHy+/fzoZr+9A/pwqozm+eDevLCy6f29pL0zilHLKXlEXyE9eRy40DxvdGs yOaQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=AnjEbtcd5cNHwbypnsrs4cfSdZGE8Y8KXODnC5r+/Sw=; b=tEEagTXQoQeg6qi9YtdZZEKYmougpSlRA2+haFZjOCUBHCuplhycx3o1kGRVXl7Ahx c/ey0QaAa9A9FxRSG7aHIKoBnE3jF0bV8yiOiBr3PZDmKzXRpr2Uxrx0oYCDgJ6ZFkU/ qKuiePIQHjEXz9fkE+Mbkfm/vQS5S6s6uRH7LdbrYV5Yh7Wo3OVT20HO7Kxwp+uS2IsL 6RjFsE+2x9Iybe/v6XAhLNd7YyVA+ss1s0DIWEWm87qvOe7SoAB9tTWClHbM19k+kgnJ mHQQfGqOEv0/MKpcd5djF3z1BhHh7hoyfHw0yJSCmuhCZuPOlG2bKujgNvBTlnoYxfbF sVZw== X-Gm-Message-State: APjAAAU2KHd7R1/UFI8XZlFfHt5m6PxUp6UwKoY9+FJ/sHcVniskffZ8 enMIttFigP7Y2LwF3JmRpJo= X-Google-Smtp-Source: APXvYqw6YJNQG1mv4TcaAIQFGH9uTD6ol5DJ8JkmCimZzRNBFxq3HdokK6aYuJxRfnvwrECLT3Lxsw== X-Received: by 2002:a63:5b52:: with SMTP id l18mr12098178pgm.21.1566739466886; Sun, 25 Aug 2019 06:24:26 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:24:26 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 05/11] ftrace: create memcache for hash entries Date: Sun, 25 Aug 2019 21:23:24 +0800 Message-Id: <20190825132330.5015-6-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062427_546544_AE39478E X-CRM114-Status: GOOD ( 10.67 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org When CONFIG_FTRACE_FUNC_PROTOTYPE is enabled, thousands of ftrace_func_entry instances are created. So create a dedicated memcache to enhance performance. Signed-off-by: Changbin Du --- kernel/trace/ftrace.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index a314f0768b2c..cfcb8dad93ea 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -94,6 +94,8 @@ struct ftrace_ops *function_trace_op __read_mostly = &ftrace_list_end; /* What to set function_trace_op to */ static struct ftrace_ops *set_function_trace_op; +struct kmem_cache *hash_entry_cache; + static bool ftrace_pids_enabled(struct ftrace_ops *ops) { struct trace_array *tr; @@ -1169,7 +1171,7 @@ static int add_hash_entry(struct ftrace_hash *hash, unsigned long ip, { struct ftrace_func_entry *entry; - entry = kmalloc(sizeof(*entry), GFP_KERNEL); + entry = kmem_cache_alloc(hash_entry_cache, GFP_KERNEL); if (!entry) return -ENOMEM; @@ -6153,6 +6155,15 @@ void __init ftrace_init(void) if (ret) goto failed; + hash_entry_cache = kmem_cache_create("ftrace-hash", + sizeof(struct ftrace_func_entry), + sizeof(struct ftrace_func_entry), + 0, NULL); + if (!hash_entry_cache) { + pr_err("failed to create ftrace hash entry cache\n"); + goto failed; + } + count = __stop_mcount_loc - __start_mcount_loc; if (!count) { pr_info("ftrace: No functions to be traced?\n"); @@ -6172,6 +6183,10 @@ void __init ftrace_init(void) return; failed: + if (hash_entry_cache) { + kmem_cache_destroy(hash_entry_cache); + hash_entry_cache = NULL; + } ftrace_disabled = 1; } From patchwork Sun Aug 25 13:23:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113429 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16508912 for ; Sun, 25 Aug 2019 13:27:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E693220850 for ; Sun, 25 Aug 2019 13:27:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IEkfLMMg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I/UiMy2R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E693220850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6rFRRX9zOc8NB3x4EK4Lxvsaq9zeTPiOtGY63eEKKRo=; b=IEkfLMMg+8kwUd UOt4hKV7iTnEBJz0NTidIOJ3bXHur81s5pN8ynacOQcOA9KHYZX1HuLCPfbjBcPP2prbuRjK4/Ef1 ypIfcVH7JpqvmkcLnCKMUDx9ddtA+LqQ9zM94ll3FIb4JouCU1E7ZSKP63KB9OvQ60isJKMxoYa4t X8Cdcm2bHkRJ/EXjWLQ6qZv287E9+yxAjNAF/SxHlTCgU+xbQt0GRvmHDZlBTi40hDpOnHkTxLCo9 lyaDdDS9nbNtaHS+SGGn7rUagmpYKjfMdmYpimRl7A4wzmDOFnGD96ecNW6sXYC1OyPyREd7Bc6zR vyNUbJjjv5Uy58EqK00g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sXq-0006c3-VO; Sun, 25 Aug 2019 13:26:58 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sVX-0003OI-LI; Sun, 25 Aug 2019 13:24:37 +0000 Received: by mail-pl1-x641.google.com with SMTP id y1so8443598plp.9; Sun, 25 Aug 2019 06:24:35 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=2pTVuNmqzcV3Op0lr/NM5GfDOg6CKox2DhhefWfSKJA=; b=I/UiMy2RRPAPvoKy0t7HkHjN2MpeaAd6rZsrJIBNtVbPYCLfqfqP9wnn0PZ2SmIe6p Bk8ibbvIlhXpzVLG/hou/A2kBOhmQSlhGhN7rZk+9DEqMpludfcVVfdbTIdga06mwYCJ GVfRE8TvzxhuP1uKOUgGU3wr4QMbG7PfwGgNhSX1hpgonK0EaRH174VYFDovga9YevWC nT214rTNH1dZBi647hDH7iko9v1XQU4Osegpd4WDi8uSwE33Sm5ejsO6/uaKsra4Mc0Y OsAuU2FA0NyR4DEil46tNmKFj7vzQxuusnSu5Yr2XjrZZYzNXIpN7r2t//WW8drnxQV0 v14g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=2pTVuNmqzcV3Op0lr/NM5GfDOg6CKox2DhhefWfSKJA=; b=jB/AM9UJzl7FyR1/va0fJcThqSPfxoWnKIf37iBMtJGqgimQPlFtDgNrrbVzxUJhUZ Hw558IrDyv4DQqhsiGQopjlFSCfAIoldge7ofkiCqstMTAVvHKTxtX3Knjrm5rE8+8fi FjZiozflG5071qqb61ZIIT9dfTn6wpbzllq9x5nQQqIbyyYBraKS70erF2s2e3mUNtAu d72EI5Q2x6zHQuewkjyrBk2SpnUa6RmD9HkJiyyar5/5Dx5kLGOarz+DcVETHOHGJnkb RYd9r8tJWGPj/wECtK21z03UOF4cy7tBPAyyqUQZ8HDpI6EvO0YrdwqAroFWSGjM9fPI +kPQ== X-Gm-Message-State: APjAAAUKAiiJPjLgPFnd0jIULfhfV/xAH3pxT9Af3g91sYBeS5MaQObZ zFtFQz92uW6xRjHP3GuHCPg= X-Google-Smtp-Source: APXvYqwW5vgalEvzXbNDzG8Sy2C+nrBmYuDxURknm4QUVr63S8vbHRcx35z28SMC7WZypbpFAxEGaA== X-Received: by 2002:a17:902:b593:: with SMTP id a19mr14240906pls.110.1566739474770; Sun, 25 Aug 2019 06:24:34 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:24:34 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 06/11] ftrace: process function prototype data in vmlinux and modules Date: Sun, 25 Aug 2019 21:23:25 +0800 Message-Id: <20190825132330.5015-7-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062435_790157_462204EB X-CRM114-Status: GOOD ( 17.30 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org Walk through the '__funcproto' section in vmlinux and kernel modules. For each item we add it to a new ftrace hash table ftrace_prototype_hash. When unloading a module, its items are removed from hash table. Signed-off-by: Changbin Du --- include/asm-generic/vmlinux.lds.h | 18 ++++++++ include/linux/ftrace.h | 18 ++++++++ include/linux/module.h | 4 ++ kernel/module.c | 25 ++++++++-- kernel/trace/ftrace.c | 76 ++++++++++++++++++++++++++++++- kernel/trace/trace.h | 4 ++ 6 files changed, 140 insertions(+), 5 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index cd28f63bfbc7..3b0a10cbf0ca 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -125,6 +125,23 @@ #define MCOUNT_REC() #endif +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +#define FUNC_PROTOTYPE \ + . = ALIGN(8); \ + __funcprotostr : AT(ADDR(__funcprotostr) - LOAD_OFFSET) { \ + KEEP(*(__funcprotostr)) \ + } \ + \ + . = ALIGN(8); \ + __funcproto : AT(ADDR(__funcproto) - LOAD_OFFSET) { \ + __start_funcproto = .; \ + KEEP(*(__funcproto)) \ + __stop_funcproto = .; \ + } +#else +#define FUNC_PROTOTYPE +#endif + #ifdef CONFIG_TRACE_BRANCH_PROFILING #define LIKELY_PROFILE() __start_annotated_branch_profile = .; \ KEEP(*(_ftrace_annotated_branch)) \ @@ -396,6 +413,7 @@ } \ \ TRACEDATA \ + FUNC_PROTOTYPE \ \ /* Kernel symbol table: Normal symbols */ \ __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 8a8cb3c401b2..f5aab37a8c34 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -361,6 +361,24 @@ struct dyn_ftrace { struct dyn_arch_ftrace arch; }; +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +struct func_param { + char *name; + uint8_t type; + uint8_t loc[2]; +} __packed; + +struct func_prototype { + unsigned long ip; + uint8_t ret_type; + uint8_t nr_param; + struct func_param params[0]; +} __packed; + +#define FTRACE_PROTOTYPE_SIGNED(t) (t & BIT(7)) +#define FTRACE_PROTOTYPE_SIZE(t) (t & GENMASK(6, 0)) +#endif + int ftrace_force_update(void); int ftrace_set_filter_ip(struct ftrace_ops *ops, unsigned long ip, int remove, int reset); diff --git a/include/linux/module.h b/include/linux/module.h index 1455812dd325..516062dfe567 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -477,6 +477,10 @@ struct module { unsigned int num_ftrace_callsites; unsigned long *ftrace_callsites; #endif +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + struct func_prototype *funcproto_start; + size_t funcproto_sec_size; +#endif #ifdef CONFIG_LIVEPATCH bool klp; /* Is this a livepatch module? */ diff --git a/kernel/module.c b/kernel/module.c index 9ee93421269c..1c5eea7b6a28 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -360,17 +360,30 @@ static void *section_addr(const struct load_info *info, const char *name) return (void *)info->sechdrs[find_sec(info, name)].sh_addr; } +/* Get info of a module section. */ +static void *section_info(const struct load_info *info, + const char *name, + size_t *size) +{ + unsigned int sec = find_sec(info, name); + + /* Section 0 has sh_addr 0 and sh_size 0. */ + *size = info->sechdrs[sec].sh_size; + return (void *)info->sechdrs[sec].sh_addr; +} + /* Find a module section, or NULL. Fill in number of "objects" in section. */ static void *section_objs(const struct load_info *info, const char *name, size_t object_size, unsigned int *num) { - unsigned int sec = find_sec(info, name); + void *addr; + size_t sz; - /* Section 0 has sh_addr 0 and sh_size 0. */ - *num = info->sechdrs[sec].sh_size / object_size; - return (void *)info->sechdrs[sec].sh_addr; + addr = section_info(info, name, &sz); + *num = sz / object_size; + return addr; } /* Provided by the linker */ @@ -3140,6 +3153,10 @@ static int find_module_sections(struct module *mod, struct load_info *info) sizeof(*mod->ftrace_callsites), &mod->num_ftrace_callsites); #endif +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + mod->funcproto_start = section_info(info, "__funcproto", + &mod->funcproto_sec_size); +#endif #ifdef CONFIG_FUNCTION_ERROR_INJECTION mod->ei_funcs = section_objs(info, "_error_injection_whitelist", sizeof(*mod->ei_funcs), diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index cfcb8dad93ea..438b8b47198f 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5060,6 +5060,9 @@ static DEFINE_MUTEX(graph_lock); struct ftrace_hash *ftrace_graph_hash = EMPTY_HASH; struct ftrace_hash *ftrace_graph_notrace_hash = EMPTY_HASH; +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +struct ftrace_hash *ftrace_prototype_hash = EMPTY_HASH; +#endif enum graph_filter_type { GRAPH_FILTER_NOTRACE = 0, @@ -5615,6 +5618,46 @@ static int ftrace_process_locs(struct module *mod, return ret; } +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +static int ftrace_process_funcproto(struct module *mod, + struct func_prototype *start, + struct func_prototype *end, + bool remove) +{ + struct ftrace_func_entry *ent; + struct func_prototype *proto; + int ret = 0; + + mutex_lock(&ftrace_lock); + +restart: + proto = start; + while (proto < end) { + if (remove) { + ent = ftrace_lookup_ip(ftrace_prototype_hash, + proto->ip); + if (ent) + free_hash_entry(ftrace_prototype_hash, ent); + } else { + ret = add_hash_entry(ftrace_prototype_hash, + proto->ip, proto); + if (ret < 0) { + end = proto; + remove = 1; + goto restart; + } + } + proto = (struct func_prototype *)((char *)proto + + sizeof(*proto) + + sizeof(proto->params[0]) * proto->nr_param); + } + + mutex_unlock(&ftrace_lock); + + return ret; +} +#endif + struct ftrace_mod_func { struct list_head list; char *name; @@ -5707,7 +5750,7 @@ static void ftrace_free_mod_map(struct rcu_head *rcu) kfree(mod_map); } -void ftrace_release_mod(struct module *mod) +void ftrace_release_dyn(struct module *mod) { struct ftrace_mod_map *mod_map; struct ftrace_mod_map *n; @@ -5773,6 +5816,17 @@ void ftrace_release_mod(struct module *mod) } } +void ftrace_release_mod(struct module *mod) +{ + ftrace_release_dyn(mod); + +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + ftrace_process_funcproto(mod, mod->funcproto_start, + (void *)mod->funcproto_start + mod->funcproto_sec_size, + true); +#endif +} + void ftrace_module_enable(struct module *mod) { struct dyn_ftrace *rec; @@ -5852,6 +5906,11 @@ void ftrace_module_init(struct module *mod) ftrace_process_locs(mod, mod->ftrace_callsites, mod->ftrace_callsites + mod->num_ftrace_callsites); +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + ftrace_process_funcproto(mod, mod->funcproto_start, + (void *)mod->funcproto_start + mod->funcproto_sec_size, + false); +#endif } static void save_ftrace_mod_rec(struct ftrace_mod_map *mod_map, @@ -6146,6 +6205,10 @@ void __init ftrace_init(void) { extern unsigned long __start_mcount_loc[]; extern unsigned long __stop_mcount_loc[]; +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + extern struct func_prototype __start_funcproto[]; + extern struct func_prototype __stop_funcproto[]; +#endif unsigned long count, flags; int ret; @@ -6179,6 +6242,17 @@ void __init ftrace_init(void) __start_mcount_loc, __stop_mcount_loc); +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + ftrace_prototype_hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); + if (WARN_ON(!ftrace_prototype_hash)) + goto failed; + + ftrace_process_funcproto(NULL, + __start_funcproto, + __stop_funcproto, + false); +#endif + set_ftrace_early_filters(); return; diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index ad619c73a505..22433a15e340 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -940,6 +940,10 @@ extern void __trace_graph_return(struct trace_array *tr, extern struct ftrace_hash *ftrace_graph_hash; extern struct ftrace_hash *ftrace_graph_notrace_hash; +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +extern struct ftrace_hash *ftrace_prototype_hash; +#endif + static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace) { unsigned long addr = trace->func; From patchwork Sun Aug 25 13:23:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113433 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BBBE14DB for ; Sun, 25 Aug 2019 13:27:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6698820850 for ; Sun, 25 Aug 2019 13:27:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="P1Xgz6FN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XlOYWrX8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6698820850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1rpQeVFC/ljFhc7+g8L5HdDnvNi7tFVRd8mfQd4nS7g=; b=P1Xgz6FNfuWOyL 5w43V8WrSbCkxM3nTEZBjtLjyk+3qcrUsvlw72Nz0d/QnXQLfTsDsO1p9q9n3Ln4cMIVGTTbtehFp Bu2+H9c2tA13JUiKXjv8JXgxTb26Tn8+x28C1Di6Mts5hBx4hgZdEofkX/MYqsJnnNTwO1LtLCVWJ hwDQLA+NC9O6FHXL7jbftp/hzBcF98LtThPOpEHgoRNuwR812ZFsS0RS7oCcrz/cRPi9fnhuzaMzb /XyWnkbvIYyiECUkWmEVPABffN6+14tpLUz5HkxQx2rrza5Z1dwP2eJfXLur6s2/4s9K5T3zVbkg3 4vfBRGN3G+0dHWhhh8hQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sY7-0006wk-BQ; Sun, 25 Aug 2019 13:27:15 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sVf-0003Vs-4i; Sun, 25 Aug 2019 13:24:45 +0000 Received: by mail-pf1-x444.google.com with SMTP id y200so2148911pfb.6; Sun, 25 Aug 2019 06:24:43 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ABqbUOb9yTlWBycLA+vVgy10aa3RFNPi90+kbWnXnj4=; b=XlOYWrX84QfUGfxVujtYSDLQjkO2n+X/V1vEeWQMWM0vBDv5dZmYayL7ewK9/lbe5f puws9gxnBBL3ZtW3KScqzRc6gHb1KEsyl2y4yQhDyRG12zSj06u/4BhqS6ynaWZhcInC Jp4HYYwgNMLWg2Ghh9y1+QkLbuG/aRj1cGJLC2LO3yJRuIkfwU5za3pe3qi4aGcuhY2k 7OebOSPIuR/+smUIR4lMDKkb/t7HmfEDAj3+b1z7UddF8v1iR7b851xb4Zpfzt15eWOb SR2YAFMULehg2fpkKPwipTt84L1s26e4zUxtTuEXMUwo8IfVPP0ODxn+3EWkpC+gdOC1 eAuQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ABqbUOb9yTlWBycLA+vVgy10aa3RFNPi90+kbWnXnj4=; b=dAuutJxRKuSUekq/zd2qLBDT3zls6NecQKPF3jG9kstZJUIOKeruLmbAcP3iuU0pcK 162leloBjLfekjTZr8Azfyq5PxnXtlV4WKG5ufa6smxKlhaR41k4rUpvWnSZIGUUIMSo Ty+iq3zDyaHwztSiNC9jKEAOar0q81US2bkcZMZYslPThzfuAw7VU2gMyuYDb8YFaPHr 1oHP2bFhLEp48le8i4/iwkZjhoFtzIGoD08wWMbzB1dpzSI9MMyqcm5KRbK9u0CLAWHE TRzPyy8lKDTY6QPr6RevKRmRmBcr6u2T2//cSuwh4u0fuYdAX4dcFLT5bu0z8zibE2la rdIA== X-Gm-Message-State: APjAAAV3XNCr2WnvpzURv9RNZhajFJg3F6P3GtXGA5k80oPvgE5BoPDJ XCPkd+QPzvrUZYI2E/Y9X0K1IrVJkMPSZQ== X-Google-Smtp-Source: APXvYqyBC/JTyOCCBr2L81Di8jkyCQ7yEHU7nHNyqfLhe02b3ofAjzg1rsOUutsL2IFiJsmTOyG3Yg== X-Received: by 2002:a63:69c1:: with SMTP id e184mr11615522pgc.198.1566739482405; Sun, 25 Aug 2019 06:24:42 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:24:42 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 07/11] ftrace: prepare arch specific interfaces for function prototype feature Date: Sun, 25 Aug 2019 21:23:26 +0800 Message-Id: <20190825132330.5015-8-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062443_315684_22A13A9D X-CRM114-Status: GOOD ( 16.45 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org To record function parameter and return value, we need the arch specific code to pass the saved register context. It is only valid if the CONFIG_FTRACE_FUNC_PROTOTYPE feature is enabled. This patch only changes the interfaces, real implementation will be added later. Signed-off-by: Changbin Du --- arch/arm/kernel/ftrace.c | 2 +- arch/arm64/kernel/ftrace.c | 2 +- arch/csky/kernel/ftrace.c | 2 +- arch/microblaze/kernel/ftrace.c | 2 +- arch/mips/kernel/ftrace.c | 2 +- arch/nds32/kernel/ftrace.c | 5 +++-- arch/parisc/kernel/ftrace.c | 2 +- arch/powerpc/kernel/trace/ftrace.c | 2 +- arch/riscv/kernel/ftrace.c | 2 +- arch/s390/kernel/ftrace.c | 2 +- arch/sh/kernel/ftrace.c | 2 +- arch/sparc/kernel/ftrace.c | 2 +- arch/x86/kernel/ftrace.c | 2 +- include/linux/ftrace.h | 10 +++++++--- kernel/trace/fgraph.c | 21 +++++++++++++++------ kernel/trace/ftrace.c | 4 +++- kernel/trace/trace.h | 2 +- kernel/trace/trace_functions_graph.c | 2 +- kernel/trace/trace_irqsoff.c | 3 ++- kernel/trace/trace_sched_wakeup.c | 3 ++- 20 files changed, 46 insertions(+), 28 deletions(-) diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index bda949fd84e8..fd01c08b2dcb 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c @@ -191,7 +191,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, old = *parent; *parent = return_hooker; - if (function_graph_enter(old, self_addr, frame_pointer, NULL)) + if (function_graph_enter(old, self_addr, frame_pointer, NULL, NULL)) *parent = old; } diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index 171773257974..dc8cc516c00a 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -233,7 +233,7 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent, */ old = *parent; - if (!function_graph_enter(old, self_addr, frame_pointer, NULL)) + if (!function_graph_enter(old, self_addr, frame_pointer, NULL, NULL)) *parent = return_hooker; } diff --git a/arch/csky/kernel/ftrace.c b/arch/csky/kernel/ftrace.c index 44f4880179b7..5bc67f447e78 100644 --- a/arch/csky/kernel/ftrace.c +++ b/arch/csky/kernel/ftrace.c @@ -148,7 +148,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, old = *parent; if (!function_graph_enter(old, self_addr, - *(unsigned long *)frame_pointer, parent)) { + *(unsigned long *)frame_pointer, parent, NULL)) { /* * For csky-gcc function has sub-call: * subi sp, sp, 8 diff --git a/arch/microblaze/kernel/ftrace.c b/arch/microblaze/kernel/ftrace.c index 224eea40e1ee..9722e98cd01d 100644 --- a/arch/microblaze/kernel/ftrace.c +++ b/arch/microblaze/kernel/ftrace.c @@ -62,7 +62,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) return; } - if (function_graph_enter(old, self_addr, 0, NULL)) + if (function_graph_enter(old, self_addr, 0, NULL, NULL)) *parent = old; } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c index 2625232bfe52..24668bf079d2 100644 --- a/arch/mips/kernel/ftrace.c +++ b/arch/mips/kernel/ftrace.c @@ -378,7 +378,7 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra, insns = core_kernel_text(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1; self_ra -= (MCOUNT_INSN_SIZE * insns); - if (function_graph_enter(old_parent_ra, self_ra, fp, NULL)) + if (function_graph_enter(old_parent_ra, self_ra, fp, NULL, NULL)) *parent_ra_addr = old_parent_ra; return; out: diff --git a/arch/nds32/kernel/ftrace.c b/arch/nds32/kernel/ftrace.c index fd2a54b8cd57..3dbf0017dfdf 100644 --- a/arch/nds32/kernel/ftrace.c +++ b/arch/nds32/kernel/ftrace.c @@ -217,7 +217,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, old = *parent; - if (!function_graph_enter(old, self_addr, frame_pointer, NULL)) + if (!function_graph_enter(old, self_addr, frame_pointer, NULL, NULL)) *parent = return_hooker; } @@ -235,7 +235,8 @@ noinline void ftrace_graph_caller(void) prepare_ftrace_return(parent_ip, selfpc, frame_pointer); } -extern unsigned long ftrace_return_to_handler(unsigned long frame_pointer); +extern unsigned long ftrace_return_to_handler(unsigned long frame_pointer, + unsigned long retval); void __naked return_to_handler(void) { __asm__ __volatile__ ( diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c index b6fb30f2e4bf..ea02f36e4f84 100644 --- a/arch/parisc/kernel/ftrace.c +++ b/arch/parisc/kernel/ftrace.c @@ -40,7 +40,7 @@ static void __hot prepare_ftrace_return(unsigned long *parent, old = *parent; - if (!function_graph_enter(old, self_addr, 0, NULL)) + if (!function_graph_enter(old, self_addr, 0, NULL, NULL)) /* activate parisc_return_to_handler() as return point */ *parent = (unsigned long) &parisc_return_to_handler; } diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c index be1ca98fce5c..78174bbb257e 100644 --- a/arch/powerpc/kernel/trace/ftrace.c +++ b/arch/powerpc/kernel/trace/ftrace.c @@ -956,7 +956,7 @@ unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip) return_hooker = ppc_function_entry(return_to_handler); - if (!function_graph_enter(parent, ip, 0, NULL)) + if (!function_graph_enter(parent, ip, 0, NULL, NULL)) parent = return_hooker; out: return parent; diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c index b94d8db5ddcc..18f836727950 100644 --- a/arch/riscv/kernel/ftrace.c +++ b/arch/riscv/kernel/ftrace.c @@ -142,7 +142,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, */ old = *parent; - if (function_graph_enter(old, self_addr, frame_pointer, parent)) + if (function_graph_enter(old, self_addr, frame_pointer, parent, NULL)) *parent = return_hooker; } diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 1bb85f60c0dd..5021a23c5089 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c @@ -209,7 +209,7 @@ unsigned long prepare_ftrace_return(unsigned long ra, unsigned long sp, if (unlikely(atomic_read(¤t->tracing_graph_pause))) goto out; ip -= MCOUNT_INSN_SIZE; - if (!function_graph_enter(ra, ip, 0, (void *) sp)) + if (!function_graph_enter(ra, ip, 0, (void *) sp), NULL) ra = (unsigned long) return_to_handler; out: return ra; diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c index 1b04270e5460..3a8271993e9c 100644 --- a/arch/sh/kernel/ftrace.c +++ b/arch/sh/kernel/ftrace.c @@ -364,7 +364,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) return; } - if (function_graph_enter(old, self_addr, 0, NULL)) + if (function_graph_enter(old, self_addr, 0, NULL, NULL)) __raw_writel(old, parent); } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ diff --git a/arch/sparc/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c index 684b84ce397f..2783185719ba 100644 --- a/arch/sparc/kernel/ftrace.c +++ b/arch/sparc/kernel/ftrace.c @@ -130,7 +130,7 @@ unsigned long prepare_ftrace_return(unsigned long parent, if (unlikely(atomic_read(¤t->tracing_graph_pause))) return parent + 8UL; - if (function_graph_enter(parent, self_addr, frame_pointer, NULL)) + if (function_graph_enter(parent, self_addr, frame_pointer, NULL, NULL)) return parent + 8UL; return return_hooker; diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 024c3053dbba..a044734167af 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -1072,7 +1072,7 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent, return; } - if (function_graph_enter(old, self_addr, frame_pointer, parent)) + if (function_graph_enter(old, self_addr, frame_pointer, parent, NULL)) *parent = old; } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index f5aab37a8c34..e615b5e639aa 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -757,9 +757,12 @@ struct ftrace_graph_ret { /* Type of the callback handlers for tracing function graph*/ typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ -typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ +/* @pt_regs is only available for CONFIG_FTRACE_FUNC_PROTOTYPE. */ +typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *, + struct pt_regs *); /* entry */ -extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace); +int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace, + struct pt_regs *pt_regs); #ifdef CONFIG_FUNCTION_GRAPH_TRACER @@ -797,7 +800,8 @@ extern void return_to_handler(void); extern int function_graph_enter(unsigned long ret, unsigned long func, - unsigned long frame_pointer, unsigned long *retp); + unsigned long frame_pointer, unsigned long *retp, + struct pt_regs *pt_regs); struct ftrace_ret_stack * ftrace_graph_get_ret_stack(struct task_struct *task, int idx); diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index 8dfd5021b933..7451dba84fee 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c @@ -96,8 +96,13 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, return 0; } +/* + * Called from arch specific code. @pt_regs is only available for + * CONFIG_FTRACE_FUNC_PROTOTYPE. + */ int function_graph_enter(unsigned long ret, unsigned long func, - unsigned long frame_pointer, unsigned long *retp) + unsigned long frame_pointer, unsigned long *retp, + struct pt_regs *pt_regs) { struct ftrace_graph_ent trace; @@ -108,7 +113,7 @@ int function_graph_enter(unsigned long ret, unsigned long func, goto out; /* Only trace if the calling function expects to */ - if (!ftrace_graph_entry(&trace)) + if (!ftrace_graph_entry(&trace, pt_regs)) goto out_ret; return 0; @@ -204,9 +209,11 @@ static struct notifier_block ftrace_suspend_notifier = { /* * Send the trace to the ring-buffer. + * @retval is only available for CONFIG_FTRACE_FUNC_PROTOTYPE. * @return the original return address. */ -unsigned long ftrace_return_to_handler(unsigned long frame_pointer) +unsigned long ftrace_return_to_handler(unsigned long frame_pointer, + unsigned long retval) { struct ftrace_graph_ret trace; unsigned long ret; @@ -327,7 +334,8 @@ void ftrace_graph_sleep_time_control(bool enable) fgraph_sleep_time = enable; } -int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace) +int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace, + struct pt_regs *pt_regs) { return 0; } @@ -417,11 +425,12 @@ ftrace_graph_probe_sched_switch(void *ignore, bool preempt, next->ret_stack[index].calltime += timestamp; } -static int ftrace_graph_entry_test(struct ftrace_graph_ent *trace) +static int ftrace_graph_entry_test(struct ftrace_graph_ent *trace, + struct pt_regs *pt_regs) { if (!ftrace_ops_test(&global_ops, trace->func, NULL)) return 0; - return __ftrace_graph_entry(trace); + return __ftrace_graph_entry(trace, pt_regs); } /* diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 438b8b47198f..a1683cc55838 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -794,7 +794,9 @@ void ftrace_graph_graph_time_control(bool enable) fgraph_graph_time = enable; } -static int profile_graph_entry(struct ftrace_graph_ent *trace) +/* @pt_regs is only available for CONFIG_FTRACE_FUNC_PROTOTYPE. */ +static int profile_graph_entry(struct ftrace_graph_ent *trace, + struct pt_regs *pt_regs) { struct ftrace_ret_stack *ret_stack; diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 22433a15e340..4b31176d443e 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -737,7 +737,7 @@ void print_trace_header(struct seq_file *m, struct trace_iterator *iter); int trace_empty(struct trace_iterator *iter); void trace_graph_return(struct ftrace_graph_ret *trace); -int trace_graph_entry(struct ftrace_graph_ent *trace); +int trace_graph_entry(struct ftrace_graph_ent *trace, struct pt_regs *pt_regs); void set_graph_array(struct trace_array *tr); void tracing_start_cmdline_record(void); diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 78af97163147..f331a9ba946d 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -124,7 +124,7 @@ static inline int ftrace_graph_ignore_irqs(void) return in_irq(); } -int trace_graph_entry(struct ftrace_graph_ent *trace) +int trace_graph_entry(struct ftrace_graph_ent *trace, struct pt_regs *pt_regs) { struct trace_array *tr = graph_array; struct trace_array_cpu *data; diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index a745b0cee5d3..513e3544a45a 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c @@ -172,7 +172,8 @@ static int irqsoff_display_graph(struct trace_array *tr, int set) return start_irqsoff_tracer(irqsoff_trace, set); } -static int irqsoff_graph_entry(struct ftrace_graph_ent *trace) +static int irqsoff_graph_entry(struct ftrace_graph_ent *trace, + struct pt_regs *pt_regs) { struct trace_array *tr = irqsoff_trace; struct trace_array_cpu *data; diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 743b2b520d34..ce18f679930c 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c @@ -112,7 +112,8 @@ static int wakeup_display_graph(struct trace_array *tr, int set) return start_func_tracer(tr, set); } -static int wakeup_graph_entry(struct ftrace_graph_ent *trace) +static int wakeup_graph_entry(struct ftrace_graph_ent *trace, + struct pt_regs *pt_regs) { struct trace_array *tr = wakeup_trace; struct trace_array_cpu *data; From patchwork Sun Aug 25 13:23:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113437 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBBD2912 for ; Sun, 25 Aug 2019 13:27:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9108720850 for ; Sun, 25 Aug 2019 13:27:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="P6vkMeV5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GksUN9j0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9108720850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NZ4L1mynWQ/r5F5jx95i9hddMS7VH8mCzzJ2oiSb2rs=; b=P6vkMeV5F2af0B DDhPbLN+OY1z1UpyHj+hF+YthpUU+dCDl6rHUfxd2XiWaRY7+/u0yjwWV864q9bLxGJoRZaoVrgBi nKvMK5/PsDfX/LGaXY8PQuPvTdFgv2DCgtBh2XjZ6E88uxsMtpB1yUY8KV3/fRxr8JBetLLkdED/W /EkyxW6CS3063klKVixT8arHdhktF8T5ve8DVRcVDcaqyz6QuB3Zm+ZDsWSoDrUGuc+nAw3cuh6qu nbAYqo7a/pEQ2NvLZ9NfekCqX/Miv+phuWq/pPrRBjlyWZVUnSnGMrD59A0f1cPaIXgCCsjhmwD9i LH72/M+BcojbUynyWBew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sYS-0007Hg-R4; Sun, 25 Aug 2019 13:27:37 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sVn-0003eV-UR; Sun, 25 Aug 2019 13:24:54 +0000 Received: by mail-pf1-x441.google.com with SMTP id v12so9829093pfn.10; Sun, 25 Aug 2019 06:24:51 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=kAp9rBiagwe8XKAVdRDELHL9r8vQmtXA/ae5KwLFduo=; b=GksUN9j0Ha1KClE/9eLYSTylVI4jvyyGL7zrLmT2P9d4MzEEz8lwoNS5tg8XJc1pLG SMUxdI+WtLFvKmV679ZWdlTFnNildzsUJ2yszk/mcwlkQxq9MdW6QwtvO3ZJYprYTswz nrDRyO+nHTnyVgNCNLOXdVtX1oO5RDFs8kuey1uTOBMXImeWg2kkHRPRWBajbcukJ0eq AW487a1wzz2TwnuLl1GBj0LJgsxnDHWOnvvRQwZyX7OUfTLVlItIfT+Tmzfkfjh3X1Ba YnthDVNSdlOpIpG86RaM7LOcqB5U6gxkkwxaSSnWivL2z0XkydCd5eItNKqQl6pV/oPg /jhA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=kAp9rBiagwe8XKAVdRDELHL9r8vQmtXA/ae5KwLFduo=; b=aSLyJJYB/aFtbiIVmBGGPPsUwjLvuvfjhA9RV7Nd1kfi1w05tE6tfWp/+M0k77NY/2 lwXCsF0g2wZNa9E+tcjFkUODsPfFiLlwUf2wQao07Jy0YtsExFtOyuProdQE2JtvBNfx XifSYuvSsAO8zvztCOSm7NnuvtbR9FnSDURB15Lhwbgquio8dFwx2VhSFuORD3Wj4ixi pIGvvJx9UFDPlWF5LcfZkqOJd2r3WD2O2Toa8OvoUCEWOaTSUNCvYiF8o9kETMrDz3Or gqcXKK5Qdm0IEo64XNsblMmEOytkpBTKAZ6Vxl5Sm7v9LgQznzf2iG/AwXwaWyGWwoBF 95UQ== X-Gm-Message-State: APjAAAUn2s0fPwwRvZtvkEr4Gi4pGipIkeX9InL8CrIqCO9ZB7FIbwEv RTfciZV4Sc1SGeCoVnS0gTg= X-Google-Smtp-Source: APXvYqw/JQNHIo4k980ZK4NFstZpfGbMg4A01vDLGmYKWi7iBVw5yootcvwOkApQ8aSTHVu3ur9wVA== X-Received: by 2002:a63:494d:: with SMTP id y13mr12296270pgk.109.1566739490877; Sun, 25 Aug 2019 06:24:50 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:24:50 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 08/11] ftrace: introduce core part of function prototype recording Date: Sun, 25 Aug 2019 21:23:27 +0800 Message-Id: <20190825132330.5015-9-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062451_996668_8606B883 X-CRM114-Status: GOOD ( 20.51 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org This patch introduces the core part of our new CONFIG_FTRACE_FUNC_PROTOTYPE feature. For arch which supports this feature must implement a new arch-specific interface arch_fgraph_record_params(). In this patch, we add a new trace option "record-funcproto", and by now only function graph tracer is supported. The major work is to handle the printing stuff. Here is an example of the graph trace of function pick_next_task_fair(). Note that we only record the parameter and return value of global functions. 2) | pick_next_task_fair() { 2) | update_blocked_averages() { 2) 0.765 us | _raw_spin_lock_irqsave(lock=0xffff88807da2b100); /* ret=0x0000000000000082 */ 2) 0.944 us | update_rq_clock(rq=0xffff88807da2b100); 2) 0.612 us | __update_load_avg_cfs_rq(now=0x000000251b8516ee, cfs_rq=0xffff8880754f7488); /* ret=0 */ 2) 0.654 us | __update_load_avg_se(now=0x000000251b8516ee, cfs_rq=0xffff88807da2b180, se=0xffff88807be2e0d8); /* ret=0 */ 2) 0.206 us | __update_load_avg_cfs_rq(now=0x000000251b8516ee, cfs_rq=0xffff88807da2b180); /* ret=0 */ 2) | __update_load_avg_cfs_rq(now=0x000000251b8516ee, cfs_rq=0xffff888079b5fb18) { 2) 2.410 us | __accumulate_pelt_segments(); 2) 3.103 us | } /* ret=1 */ 2) 0.193 us | __update_load_avg_cfs_rq(now=0x000000251b8516ee, cfs_rq=0xffff88807da2b180); /* ret=0 */ 2) | update_rt_rq_load_avg(now=0x000000251b8516ee, rq=0xffff88807da2b100, running=0) { 2) 0.258 us | __accumulate_pelt_segments(); 2) 1.617 us | } /* ret=1 */ 2) | update_dl_rq_load_avg(now=0x000000251b8516ee, rq=0xffff88807da2b100, running=0) { 2) 0.230 us | __accumulate_pelt_segments(); 2) 1.511 us | } /* ret=1 */ 2) 1.040 us | _raw_spin_unlock_irqrestore(lock=0xffff88807da2b100, flags=0x0000000000000082); 2) + 14.739 us | } 2) | load_balance() { 2) | find_busiest_group() { 2) 0.874 us | update_group_capacity(sd=0xffff88807c1d37d0, cpu=2); 2) 1.761 us | idle_cpu(); 2) 0.262 us | idle_cpu(); 2) 0.217 us | idle_cpu(); 2) 6.338 us | } 2) 8.442 us | } 2) 1.823 us | __msecs_to_jiffies(m=0x00000006); /* ret=0x0000000000000002 */ 2) | load_balance() { 2) | find_busiest_group() { 2) 0.434 us | idle_cpu(); 2) 0.233 us | idle_cpu(); 2) 0.210 us | idle_cpu(); 2) 2.308 us | } 2) 2.821 us | } 2) 0.263 us | __msecs_to_jiffies(m=0x00000008); /* ret=0x0000000000000002 */ 2) 0.977 us | _raw_spin_lock(lock=0xffff88807da2b100); 2) + 32.262 us | } The printing rules of each value is: o For signed value, it is always printed as decimal number. o For unsigned value, - For value has size great than 8, it is printed as '{..}'. - For value has size of 1,2,4,8, it is printed as hexadecimal number. - If failed to record a parameter, it is printed as '?'. Signed-off-by: Changbin Du --- include/linux/ftrace.h | 27 +++++++ kernel/trace/fgraph.c | 5 ++ kernel/trace/ftrace.c | 50 +++++++++++++ kernel/trace/trace.h | 8 ++ kernel/trace/trace_entries.h | 10 +++ kernel/trace/trace_functions_graph.c | 106 +++++++++++++++++++++++++-- 6 files changed, 201 insertions(+), 5 deletions(-) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index e615b5e639aa..82b92d355431 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -377,6 +378,9 @@ struct func_prototype { #define FTRACE_PROTOTYPE_SIGNED(t) (t & BIT(7)) #define FTRACE_PROTOTYPE_SIZE(t) (t & GENMASK(6, 0)) + +void ftrace_print_typed_val(struct trace_seq *s, uint8_t type, + unsigned long val); #endif int ftrace_force_update(void); @@ -731,6 +735,13 @@ extern void ftrace_init(void); static inline void ftrace_init(void) { } #endif +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +# define FTRACE_MAX_FUNC_PARAMS 10 + +# define FTRACE_PROTOTYPE_SIGNED(t) (t & BIT(7)) +# define FTRACE_PROTOTYPE_SIZE(t) (t & GENMASK(6, 0)) +#endif + /* * Structure that defines an entry function trace. * It's already packed but the attribute "packed" is needed @@ -739,6 +750,12 @@ static inline void ftrace_init(void) { } struct ftrace_graph_ent { unsigned long func; /* Current function */ int depth; +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + uint8_t nr_param; + char *param_names[FTRACE_MAX_FUNC_PARAMS]; + uint8_t param_types[FTRACE_MAX_FUNC_PARAMS]; + unsigned long param_values[FTRACE_MAX_FUNC_PARAMS]; +#endif } __packed; /* @@ -753,8 +770,13 @@ struct ftrace_graph_ret { unsigned long long calltime; unsigned long long rettime; int depth; +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + uint8_t ret_type; + unsigned long retval; +#endif } __packed; + /* Type of the callback handlers for tracing function graph*/ typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ /* @pt_regs is only available for CONFIG_FTRACE_FUNC_PROTOTYPE. */ @@ -842,6 +864,11 @@ static inline void unpause_graph_tracing(void) { atomic_dec(¤t->tracing_graph_pause); } + +void arch_fgraph_record_params(struct ftrace_graph_ent *trace, + struct func_prototype *proto, + struct pt_regs *pt_regs); + #else /* !CONFIG_FUNCTION_GRAPH_TRACER */ #define __notrace_funcgraph diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index 7451dba84fee..26e452418249 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c @@ -220,6 +220,11 @@ unsigned long ftrace_return_to_handler(unsigned long frame_pointer, ftrace_pop_return_trace(&trace, &ret, frame_pointer); trace.rettime = trace_clock_local(); + +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + trace.retval = retval; +#endif + ftrace_graph_return(&trace); /* * The ftrace_graph_return() may still access the current diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index a1683cc55838..1e6a96f1986b 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5658,6 +5658,56 @@ static int ftrace_process_funcproto(struct module *mod, return ret; } + +void ftrace_print_typed_val(struct trace_seq *s, uint8_t type, + unsigned long val) +{ + unsigned int sz = FTRACE_PROTOTYPE_SIZE(type); + bool is_signed = FTRACE_PROTOTYPE_SIGNED(type); + + /* Don't show complex types */ + if (sz > sizeof(long)) { + trace_seq_printf(s, "{..}"); + return; + } + + switch (sz) { + case 0: + /* The value is not valid. */ + trace_seq_printf(s, "?"); + break; + case 1: + val &= GENMASK_ULL(7, 0); + if (is_signed) + trace_seq_printf(s, "%d", (char)val); + else + trace_seq_printf(s, "0x%02lx", val); + break; + case 2: + val &= GENMASK_ULL(15, 0); + if (is_signed) + trace_seq_printf(s, "%d", (short)val); + else + trace_seq_printf(s, "0x%04lx", val); + break; + case 4: + val &= GENMASK_ULL(31, 0); + if (is_signed) + trace_seq_printf(s, "%d", (int)val); + else + trace_seq_printf(s, "0x%08lx", val); + break; + case 8: + val &= GENMASK_ULL(63, 0); + if (is_signed) + trace_seq_printf(s, "%lld", (long long)val); + else + trace_seq_printf(s, "0x%016lx", val); + break; + default: + trace_seq_printf(s, "{badsize%d}", sz); + } +} #endif struct ftrace_mod_func { diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 4b31176d443e..f10acad0140f 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1231,6 +1231,13 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf, # define STACK_FLAGS #endif +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +# define FUNCPROTO_FLAGS \ + C(RECORD_FUNCPROTO, "record-funcproto"), +#else +# define FUNCPROTO_FLAGS +#endif + /* * trace_iterator_flags is an enumeration that defines bit * positions into trace_flags that controls the output. @@ -1256,6 +1263,7 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf, C(LATENCY_FMT, "latency-format"), \ C(RECORD_CMD, "record-cmd"), \ C(RECORD_TGID, "record-tgid"), \ + FUNCPROTO_FLAGS \ C(OVERWRITE, "overwrite"), \ C(STOP_ON_FREE, "disable_on_free"), \ C(IRQ_INFO, "irq-info"), \ diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h index fc8e97328e54..68b044ea8440 100644 --- a/kernel/trace/trace_entries.h +++ b/kernel/trace/trace_entries.h @@ -82,6 +82,12 @@ FTRACE_ENTRY_PACKED(funcgraph_entry, ftrace_graph_ent_entry, __field_struct( struct ftrace_graph_ent, graph_ent ) __field_desc( unsigned long, graph_ent, func ) __field_desc( int, graph_ent, depth ) +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + __field_desc( unsigned char, graph_ent, nr_param ) + __array_desc( char *, graph_ent, param_names, FTRACE_MAX_FUNC_PARAMS) + __array_desc( uint8_t, graph_ent, param_types, FTRACE_MAX_FUNC_PARAMS) + __array_desc( unsigned long, graph_ent, param_values, FTRACE_MAX_FUNC_PARAMS) +#endif ), F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth), @@ -101,6 +107,10 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry, __field_desc( unsigned long long, ret, rettime ) __field_desc( unsigned long, ret, overrun ) __field_desc( int, ret, depth ) +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + __field_desc( unsigned char, ret, ret_type) + __field_desc( unsigned long, ret, retval ) +#endif ), F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d", diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index f331a9ba946d..ba4eb71646e9 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -169,6 +169,17 @@ int trace_graph_entry(struct ftrace_graph_ent *trace, struct pt_regs *pt_regs) if (tracing_thresh) return 1; +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + trace->nr_param = 0; + if (tr->trace_flags & TRACE_ITER_RECORD_FUNCPROTO) { + struct ftrace_func_entry *ent; + + ent = ftrace_lookup_ip(ftrace_prototype_hash, trace->func); + if (ent) + arch_fgraph_record_params(trace, ent->priv, pt_regs); + } +#endif + local_irq_save(flags); cpu = raw_smp_processor_id(); data = per_cpu_ptr(tr->trace_buffer.data, cpu); @@ -250,6 +261,21 @@ void trace_graph_return(struct ftrace_graph_ret *trace) return; } +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE + if (tr->trace_flags & TRACE_ITER_RECORD_FUNCPROTO) { + struct ftrace_func_entry *ent; + + ent = ftrace_lookup_ip(ftrace_prototype_hash, trace->func); + if (ent) { + /* The retval has been saved by trace_graph_return(). */ + trace->ret_type = + ((struct func_prototype *)ent->priv)->ret_type; + } else + trace->ret_type = 0; + } else + trace->ret_type = 0; +#endif + local_irq_save(flags); cpu = raw_smp_processor_id(); data = per_cpu_ptr(tr->trace_buffer.data, cpu); @@ -380,6 +406,71 @@ static void print_graph_lat_fmt(struct trace_seq *s, struct trace_entry *entry) trace_seq_puts(s, " | "); } +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +static void print_graph_params(struct trace_seq *s, + struct ftrace_graph_ent *call, + struct ftrace_graph_ret *graph_ret) +{ + int i; + + BUG_ON(call->nr_param > FTRACE_MAX_FUNC_PARAMS); + + trace_seq_printf(s, "%ps(", (void *)call->func); + for (i = 0; i < call->nr_param; i++) { + if (i > 0) + trace_seq_printf(s, ", "); + trace_seq_printf(s, "%s=", call->param_names[i]); + ftrace_print_typed_val(s, call->param_types[i], + call->param_values[i]); + } + + if (graph_ret) { + /* leaf */ + if (graph_ret->ret_type) { + trace_seq_printf(s, "); /* ret="); + ftrace_print_typed_val(s, graph_ret->ret_type, + graph_ret->retval); + trace_seq_puts(s, " */\n"); + } else + trace_seq_puts(s, ");\n"); + } else + trace_seq_printf(s, ") {\n"); +} + +static void print_graph_retval(struct trace_seq *s, + struct ftrace_graph_ret *trace, + bool tail) +{ + if (trace->ret_type) { + if (tail) + trace_seq_puts(s, ", "); + else + trace_seq_puts(s, " /* "); + + trace_seq_printf(s, "ret="); + ftrace_print_typed_val(s, trace->ret_type, trace->retval); + + trace_seq_printf(s, " */"); + } +} +#else +static void print_graph_params(struct trace_seq *s, + struct ftrace_graph_ent *call, + struct ftrace_graph_ret *graph_ret) +{ + if (graph_ret) + trace_seq_printf(s, "%ps();\n", (void *)call->func); + else + trace_seq_printf(s, "%ps() {\n", (void *)call->func); +} + +static void print_graph_retval(struct trace_seq *s, + struct ftrace_graph_ret *trace, + bool tail) +{ +} +#endif + /* If the pid changed since the last trace, output this event */ static void verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) @@ -665,7 +756,7 @@ print_graph_entry_leaf(struct trace_iterator *iter, for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) trace_seq_putc(s, ' '); - trace_seq_printf(s, "%ps();\n", (void *)call->func); + print_graph_params(s, call, graph_ret); print_graph_irq(iter, graph_ret->func, TRACE_GRAPH_RET, cpu, iter->ent->pid, flags); @@ -703,7 +794,7 @@ print_graph_entry_nested(struct trace_iterator *iter, for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) trace_seq_putc(s, ' '); - trace_seq_printf(s, "%ps() {\n", (void *)call->func); + print_graph_params(s, call, NULL); if (trace_seq_has_overflowed(s)) return TRACE_TYPE_PARTIAL_LINE; @@ -950,10 +1041,15 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, * belongs to, write out the function name. Always do * that if the funcgraph-tail option is enabled. */ - if (func_match && !(flags & TRACE_GRAPH_PRINT_TAIL)) - trace_seq_puts(s, "}\n"); - else + if (func_match && !(flags & TRACE_GRAPH_PRINT_TAIL)) { + trace_seq_puts(s, "}"); + print_graph_retval(s, trace, false); + trace_seq_puts(s, "\n"); + } else { trace_seq_printf(s, "} /* %ps */\n", (void *)trace->func); + print_graph_retval(s, trace, true); + trace_seq_puts(s, "\n"); + } /* Overrun */ if (flags & TRACE_GRAPH_PRINT_OVERRUN) From patchwork Sun Aug 25 13:23:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DCB27912 for ; Sun, 25 Aug 2019 13:28:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB21C20850 for ; Sun, 25 Aug 2019 13:28:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QCbNDLvm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cOVJF79W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB21C20850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rQqS3p7WOMPXe60mAlof5fms1rsVHSPbu20Hha2CosM=; b=QCbNDLvmhsnYoZ 63svmsfi3nWKLsZZ9kicO88jHxLB4DK2fzQYLpm3X0TjCCgelpeV7JBsaSPWXaFoqRVhWc4AvyHlp ji3+08m2rUtsjAX5uGsLsVVxW8aAAS2DcEdfre+geWtyqI9UppQybvQL3xDlHNh5VXTiS9fT1hLWi uoRwjfXifoCjvicrK8TH37eHzu532Lb5M9aTInmV/K5eSjJIvFVVnEnuj+K+S059BnmZr8j0fMkYZ n7AIR9hvHpKhbEpNf0McdEfaCcFMSoHZXZm2UlDB6WGlO6NfuT+GFvbJRWRZbnJvJh0gLbWcA4xyB lpwyVY/NaPIYp9FFyl6w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sYp-0007dk-Ay; Sun, 25 Aug 2019 13:27:59 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sVv-0003mw-2b; Sun, 25 Aug 2019 13:25:00 +0000 Received: by mail-pf1-x444.google.com with SMTP id w26so9809998pfq.12; Sun, 25 Aug 2019 06:24:59 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=JqpgoR8V6SjsIuqoJ+8NqdaMmEPfAbLAaPv+Hcgdg84=; b=cOVJF79WqvqKRT3ZXzzxuLNI4rbZt4lfbP6az49c1byhyK2QahOrqbSI2dB2fZhWCC xJCbft2VLYrbwdzXF9jIiXUwPyokyE/gLjMn6UbplIiyUIshSRGBh09bXozM15K1nsuc hVqsLwo8519kPAFe9mVCqIiwt6iUC7u7wKwV7QZ33C4FGl/cd3m96WtMvKbt7c4jcDwj QB3okZeBtzimdK2gKfpcMlyKmkszszsFr79e3wOM8/ErGZfWwWpwQlwOhcLgo9WKQzwE CO6qHnCy0oV9Gt51zgP/CeciV8d7/eTmq3bR5PhIONNKkekvCWxA77q6JHkEqqoviw1X t/Aw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=JqpgoR8V6SjsIuqoJ+8NqdaMmEPfAbLAaPv+Hcgdg84=; b=iVl9SITYxt+Oj38/DL9slAY3zN/HbP6w0hHA0pwbeBdkgMJ7tsBC4HyNAxbuIMs18d lbSKtdqjcI4mqUEBkK2l0laRmhcYKhAjJ1n9KhsCIbLij4shS896feWCdmRdAwbPNYiX zASLeU5jDP+5K6bBURTHM/MNjqkYciwW0uy9XxbRCmZRzx0J5hVCWxrALpJk4yGcLlCW +fApc2WrlKzYTSEPqWoOzaiP3c+IsERumtGJrGltG4pu6O7wwO8q54hLNOf3mqISF2Hf IgDBaGsaAt2c3mhJRjPQFzAyawgSBC9QH5RnCTb5lRmnrjt6MLT6//6cn0+Wq8jzO6nX 8aZw== X-Gm-Message-State: APjAAAV+FWQFW/fn+//GJ+Fuk0KMMqfFG/YOFOg5zNiljJwrt3kwGc21 lCy+PXyJpYkATvgh0S9Scr0uvX8Ad+2fxw== X-Google-Smtp-Source: APXvYqwQzM/nOUwplTcnKi74XFc9NcY/wLN6wqU0HucyOEq0vc6nrliugvK9Jha3kK8nxmI1irB8+w== X-Received: by 2002:a63:fb14:: with SMTP id o20mr11958817pgh.136.1566739498486; Sun, 25 Aug 2019 06:24:58 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:24:58 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 09/11] x86_64: add function prototype recording support Date: Sun, 25 Aug 2019 21:23:28 +0800 Message-Id: <20190825132330.5015-10-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062459_158845_661C7BB9 X-CRM114-Status: GOOD ( 17.66 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org This patch implements the arch_fgraph_record_params() function for x86_64 platform and deliver the return value of function to ftrace core part. Signed-off-by: Changbin Du --- arch/x86/Kconfig | 1 + arch/x86/kernel/ftrace.c | 84 +++++++++++++++++++++++++++++++++++-- arch/x86/kernel/ftrace_64.S | 4 +- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 222855cc0158..34e583bfdab8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -31,6 +31,7 @@ config X86_64 select NEED_DMA_MAP_STATE select SWIOTLB select ARCH_HAS_SYSCALL_WRAPPER + select HAVE_FTRACE_FUNC_PROTOTYPE config FORCE_DYNAMIC_FTRACE def_bool y diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index a044734167af..fc0a062ce762 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef CONFIG_DYNAMIC_FTRACE @@ -918,7 +919,8 @@ static void *addr_from_call(void *ptr) } void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent, - unsigned long frame_pointer); + unsigned long frame_pointer, + struct pt_regs *pt_regs); /* * If the ops->trampoline was not allocated, then it probably @@ -973,6 +975,82 @@ void arch_ftrace_trampoline_free(struct ftrace_ops *ops) ops->trampoline = 0; } +#ifdef CONFIG_FTRACE_FUNC_PROTOTYPE +void arch_fgraph_record_params(struct ftrace_graph_ent *trace, + struct func_prototype *proto, + struct pt_regs *pt_regs) +{ + int i; + + trace->nr_param = min(proto->nr_param, (uint8_t)FTRACE_MAX_FUNC_PARAMS); + + for (i = 0; i < trace->nr_param; i++) { + struct func_param *param = &proto->params[i]; + unsigned int sz = FTRACE_PROTOTYPE_SIZE(param->type); + long off = (char)param->loc[1]; + unsigned long value = 0; + bool good = true; + + if (sz > sizeof(value)) { + /* Don't record value of complex type. */ + trace->param_types[i] = param->type; + trace->param_values[i] = 0; + continue; + } + + switch (param->loc[0]) { + case DW_OP_reg1: + value = pt_regs->dx; + break; + case DW_OP_reg2: + value = pt_regs->cx; + break; + case DW_OP_reg3: + value = pt_regs->bx; + break; + case DW_OP_reg4: + value = pt_regs->si; + break; + case DW_OP_reg5: + value = pt_regs->di; + break; + case DW_OP_reg6: + value = pt_regs->bp; + break; + case DW_OP_reg8: + value = pt_regs->r8; + break; + case DW_OP_reg9: + value = pt_regs->r9; + break; + case DW_OP_fbreg: + if (probe_kernel_read(&value, + (void *)pt_regs->bp + off, + sz)) + good = false; + break; + case DW_OP_breg7: + if (probe_kernel_read(&value, + (void *)pt_regs->sp + off, + sz)) + good = false; + break; + default: + /* unexpected loc expression */ + good = false; + } + + trace->param_names[i] = param->name; + if (good) { + trace->param_types[i] = param->type; + trace->param_values[i] = value; + } else { + /* set the type to 0 so we skip it when printing. */ + trace->param_types[i] = 0; + } + } +} +#endif /* CONFIG_FTRACE_FUNC_PROTOTYPE */ #endif /* CONFIG_X86_64 */ #endif /* CONFIG_DYNAMIC_FTRACE */ @@ -1017,7 +1095,7 @@ int ftrace_disable_ftrace_graph_caller(void) * in current thread info. */ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent, - unsigned long frame_pointer) + unsigned long frame_pointer, struct pt_regs *pt_regs) { unsigned long old; int faulted; @@ -1072,7 +1150,7 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent, return; } - if (function_graph_enter(old, self_addr, frame_pointer, parent, NULL)) + if (function_graph_enter(old, self_addr, frame_pointer, parent, pt_regs)) *parent = old; } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S index 809d54397dba..e01d6358e859 100644 --- a/arch/x86/kernel/ftrace_64.S +++ b/arch/x86/kernel/ftrace_64.S @@ -289,7 +289,8 @@ ENTRY(ftrace_graph_caller) leaq MCOUNT_REG_SIZE+8(%rsp), %rsi movq $0, %rdx /* No framepointers needed */ - call prepare_ftrace_return + movq %rsp, %rcx /* the fourth parameter */ + call prepare_ftrace_return restore_mcount_regs @@ -304,6 +305,7 @@ ENTRY(return_to_handler) movq %rax, (%rsp) movq %rdx, 8(%rsp) movq %rbp, %rdi + movq %rax, %rsi call ftrace_return_to_handler From patchwork Sun Aug 25 13:23:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113445 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8224912 for ; Sun, 25 Aug 2019 13:28:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A671620850 for ; Sun, 25 Aug 2019 13:28:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MPQim8Ry"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g03zkfsq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A671620850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SsvtOWdgpafcA48cZd69zXiIEkn3iMexBnIOcy6nZcE=; b=MPQim8RyTKuFWD FaZfIY239zi7ppkCBHgQBCt1DiGflaIUCYlLsUV6LBLkgwFF+ujnfanBMDWy1JCARpcaPamnRBdAT NJ3JPCBqgYXVUXTXAg3sjcGpuDheNzAsUk4H9CsAJygH9AYsK3xbdnomWw+FMkA6J2DzyYPwQjbKX YAtRFB+fU4SjVd1KTsKXN00pklP2PiRiBemid6u97QSpqKys+417qnGBO9+JKnvuAfDsgT23nRU2L Gxsg7N6+ZDaou363kCyM1T1ZHwqIcL7M24mN8H8wsIpURqQ9NVyMndz3RADkr5/4eqBocXtZ4HCcR fQRpMXuWAMiZHoW6X9+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sZ9-0007vZ-9f; Sun, 25 Aug 2019 13:28:19 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sW3-0004DS-0t; Sun, 25 Aug 2019 13:25:08 +0000 Received: by mail-pf1-x443.google.com with SMTP id g2so9845157pfq.0; Sun, 25 Aug 2019 06:25:06 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=NnHjdka8q9MM1nbcRBaxfkCGVCCjsDG70zM+YYdNV3E=; b=g03zkfsq+c6M14xC3btV7g6IPmWaG8X+9s5nY7dD43zw7K8+Dl6zmdV/meLJmfcsMD /XzawISKOMxF9+tzCwu74cViPpHxmr/GarsoBsTn/ENQVJNySASP3aLxbeDN7HAHeP7x 5AqjpbMw/SWUexnfZkPSUIB379U8mtrc4sNHcxkuWU4mRUZg6at+EX63IeNV5JvMSKsP dwxVFHi7nznxJzkCv1jujm1jXMieR9Eb+5viooHTscZhT58A5U5DAPY7JJfRziAsgBjm JRivX+QMRW56PFrMRP81NpX/zHCaOTF8BBRZ+789DiMV5Tbs37PC1YPOlEkouAyarn5N J2Fw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=NnHjdka8q9MM1nbcRBaxfkCGVCCjsDG70zM+YYdNV3E=; b=hv6IW8p7dvubaM0HQwf9+wn7DQeclS/zUg9sw/CH7X+4HZjFP7WJvZJxxT0eqgivJL hLtKSX/zXxFX8zTFNvQ8H9Rm7HtEHmbtoGEJ8Ev4PfjLs2q+QysfoaL2E3M9uU+ndYzV hH+CbAxueUe//olKOnSj5MzKPRMXByvKVCkW9wyQTBo1+1uJ9w99mOaujNiuy1AAVngX KLO7KDf1tIGStCMiiw3tpKiqm0tyItivUMAtFWfWUUxnd0UFKoSy9ezOIDTqX0C7PT2L gIn3l2Z2BUfDI/fnC6a8ToFwvMyQPBZR9sBoRDAeV977vFm1lpkeuMcpNmkfGSUQahrv G3eQ== X-Gm-Message-State: APjAAAVrZAlv3F/QVR/BdDHy/9hGqlvyO3nXmjjOvwt16fwxQDFbp6dT boLtZwjyJfk+swJQ6vVjvhA= X-Google-Smtp-Source: APXvYqyz1vAktHcdxrCebWGWWISA04KQUpd77awztbV1MU/g3rutrKQ4McqGMrzQW2zfpUUXANHC4Q== X-Received: by 2002:aa7:97aa:: with SMTP id d10mr15293204pfq.176.1566739506119; Sun, 25 Aug 2019 06:25:06 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:25:05 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 10/11] ftrace: add doc for new option record-funcproto Date: Sun, 25 Aug 2019 21:23:29 +0800 Message-Id: <20190825132330.5015-11-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062507_567462_02C6D2B5 X-CRM114-Status: UNSURE ( 9.20 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org Just add the doc for our new feature. Signed-off-by: Changbin Du --- Documentation/trace/ftrace.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst index f60079259669..c68fbbedb8bd 100644 --- a/Documentation/trace/ftrace.rst +++ b/Documentation/trace/ftrace.rst @@ -988,6 +988,7 @@ To see what is available, simply cat the file:: nolatency-format record-cmd norecord-tgid + norecord-funcproto overwrite nodisable_on_free irq-info @@ -1131,6 +1132,11 @@ Here are the available options: mapped Thread Group IDs (TGID) mapping to pids. See "saved_tgids". + record-funcproto + Record function parameters and return value. This option + is only supported by function_graph tracer on x86_64 + platform by now. + overwrite This controls what happens when the trace buffer is full. If "1" (default), the oldest events are From patchwork Sun Aug 25 13:23:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 11113449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96AD814DB for ; Sun, 25 Aug 2019 13:28:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 747A520850 for ; Sun, 25 Aug 2019 13:28:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mkNRkEbB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GO/PVWf3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 747A520850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VzIbXpkDy73PqaIGL23DAfFMo5T8CXUTrc74qfbST0U=; b=mkNRkEbBZr/wl6 +weuJyr75E4EjOStjZMHNNHQHH/m71u+/wOft248hGKIHoh04iv5Ptm8ggOuWM9FsuxzYB7YOSXrm JJPbCLIZlgdU+0pSDxPHxtPP6IVRKOHkeZLeiEXz0GH8SE873J4oKL1x/QEL6ET/jxdCQg84c3bW+ SucG2MUj3wMbCuEut0remXoCK9tz2tmgkAz27vJVUHjLgbaLmNgyWyoxQkIb5nXzltouc0Y6CzJ0R VEefxZz6Q5YFnTt+CLuNWntaR1PxOhnR8fapF5+uu7vs1DDI7w0NOs0JUDCCn7opWJE5M2DWgn+IU PF+Mafs/5KfJpycpBG2g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1sZT-0008DA-Te; Sun, 25 Aug 2019 13:28:39 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1sWA-0004zU-5X; Sun, 25 Aug 2019 13:25:15 +0000 Received: by mail-pg1-x541.google.com with SMTP id n9so8762732pgc.1; Sun, 25 Aug 2019 06:25:13 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=0QzXKgHJNJjac27m2EIm1Lz0/kAofQ72J+526iejRFQ=; b=GO/PVWf3Aip/lj76SnUDb0sMdXD+1tVF4Pr4MtQbEEKh9xmXb2UDDeimXy+D9tSRoG ONfI3x+1GnVxlk4972mu5UBRbB3v9cDn0s0GXIfDvUkoxvFpZB7qpM3Wm7svq08IqXES 3/9H/nvW/APPaP6DXd/ZlsqTaXXFgfY5nbRum3oET7EhpHDQM6O7aQgrLYUCx31vh/tp Pj3jnXMeh/9xoFgvF62TEqWkl9dtlG9kZEQ23LqbLsRsqn9qkIxzDaA35xnLfCdk7Yvg kdWiDXZHWBnkOUGF5K8KzJ635D2qzEbl/F8Ge9MZplop+b+vPJfi/jVV3tdF7l5wEKUI HPiA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0QzXKgHJNJjac27m2EIm1Lz0/kAofQ72J+526iejRFQ=; b=oeDGeaoPq5NeZhAxhVca4OEjGim/3E6HnbxaGVPAnBPk0zAmO2JD6pdVBTZ8tFvC1p LBl5GOPzQf7iRr4FMO4gpG/qBkXtNXzF+pQLSHDHg6E0jjirOeAFICKCZTyJ5VzHpg6Z BeU8NhGYFFpsqWZtNbmyyxC8Y68AlbjyQPeYihJc7HDmIGXT7Xs4CCG3SQnLzDE2igKW FhyN3rPlPbxJX5o5qBAonll0FfNitIuB0rsJqMFpTWKWnIApN57wYCzkjQgORBVb4Qqb lz2fxiUhuad+Tec7HjCZzjiopG2DrTVntxvoHVIdirbte4D9s770CFSCj6rECpqKC0UH /S1A== X-Gm-Message-State: APjAAAVRcOQoNqmJuzRPUHmxYA/eTz1FOJb+7xao0Y5tIxAm79yerJsn U5z99xxo3TlKQ+mFG1AKsoEsvUU0SMEOWQ== X-Google-Smtp-Source: APXvYqxZ3PAtXLqHmn+Zgv1+tnSLgb0uWh1NyJ7+nIhirLt8hpEvkUAsM2RAxT5IIyrqsmvFKAmyHw== X-Received: by 2002:a17:90a:3465:: with SMTP id o92mr14610155pjb.20.1566739513587; Sun, 25 Aug 2019 06:25:13 -0700 (PDT) Received: from localhost.localdomain ([149.28.153.17]) by smtp.gmail.com with ESMTPSA id y23sm11076562pfr.86.2019.08.25.06.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 06:25:13 -0700 (PDT) From: Changbin Du To: Steven Rostedt , Ingo Molnar Subject: [PATCH 11/11] MAINTAINERS: make scripts/ftrace/ maintained Date: Sun, 25 Aug 2019 21:23:30 +0800 Message-Id: <20190825132330.5015-12-changbin.du@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190825132330.5015-1-changbin.du@gmail.com> References: <20190825132330.5015-1-changbin.du@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_062514_368561_A5082223 X-CRM114-Status: UNSURE ( 7.54 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (changbin.du[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jonathan Corbet , linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Changbin Du Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org Make scripts/ftrace/ maintained and I would like to help with reviewing related patches. Signed-off-by: Changbin Du --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9cbcf167bdd0..ca012ea260d7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16293,6 +16293,7 @@ F: drivers/char/tpm/ TRACING M: Steven Rostedt M: Ingo Molnar +R: Changbin Du T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core S: Maintained F: Documentation/trace/ftrace.rst @@ -16303,6 +16304,7 @@ F: include/linux/trace*.h F: include/trace/ F: kernel/trace/ F: tools/testing/selftests/ftrace/ +F: scripts/ftrace/ TRACING MMIO ACCESSES (MMIOTRACE) M: Steven Rostedt