Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10012115ybi; Wed, 24 Jul 2019 14:09:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUxoF2TbLJGwTbI10YXLJKAVjWMuAKU7y7T/p9KJ8LNhJIfLUzqlKihqtDD8ModBubPROi X-Received: by 2002:a17:90a:bb94:: with SMTP id v20mr90673110pjr.88.1564002549108; Wed, 24 Jul 2019 14:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564002549; cv=none; d=google.com; s=arc-20160816; b=E5kYvq0Wo8QqUaAE1c+ksLutB6D7R0MROeAlUtUOKRE3cCb7k5dPmjCAvQeagtYNZD BLaCnzOC6C2HP4HBe8z7755HT1ZNRAoZTF/KCaN1fALBnTlIlMpqDyorbhV/KjsHzto6 nyrsDK1U1dM5WVQrNfefeEbWe+znh+/u0sEh/1PjROaNSVypGl55C/1r4dB9Y8EslhRd 8opiB3VVmjHx8FMHjTFYB0enBVMvN0q+zZY9JKS2f748YC8F+UUPXsZqd7B4S9GgfMuH yginlr3k2cUqai+KySuKKwwZ+egsnHGY2H2bzBmr+aJ9h3WXIvjo98Mu7sT46LBatnmQ E7iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=cnid/J1C24ZE3zwXcyyjRYPTeUI+PS1dFWVc+lanlts=; b=fJR94HdlSFKlx/wZPyJ2xJH9jRfLWNnC2Qosw8m+2PSC+o0KHho1mFzL+f3CsoX1Lt 9Fyv14ToUITlqw8eZieQ7ex1CTsb2kF7DBZxUJei3gc6NFYNBIa+B5dMsWhwlu7HMjM0 LrGUQ3GqGTvwOXEWHnb0425BQbLpL1JJ3dhMkB6XwnwEEBp/Wwcx9a8cQaNFEoLm4mSo P3LzFSVaAVRGeuedB6qNYJn98UpMM7vubSST9D70ZyN99+l+OtvmSgjwaLWMSCn3AyHJ GHXet580cwv4T9pFohDKlAT2rj8ryXUyV0N8BMAMBMkdVDeexojTMLfdZXt+/OnHHaig K/Cg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y92si13914576plb.209.2019.07.24.14.08.54; Wed, 24 Jul 2019 14:09:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387919AbfGXVFZ (ORCPT + 99 others); Wed, 24 Jul 2019 17:05:25 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:53146 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbfGXVFZ (ORCPT ); Wed, 24 Jul 2019 17:05:25 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 24 Jul 2019 14:05:03 -0700 Received: from rlwimi.localdomain (unknown [10.166.65.164]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id F1869407C8; Wed, 24 Jul 2019 14:05:22 -0700 (PDT) From: Matt Helsley To: LKML CC: Ingo Molnar , Josh Poimboeuf , Peter Zijlstra , Steven Rostedt , Matt Helsley Subject: [PATCH v3 00/13] Cleanup recordmcount and begin objtool conversion Date: Wed, 24 Jul 2019 14:04:54 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII Received-SPF: None (EX13-EDG-OU-001.vmware.com: mhelsley@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series cleans up recordmcount and then makes it into an objtool subcommand. The series starts with 8 cleanup patches which make recordmcount easier to review and integrate with objtool. The final 5 patches show the beginning steps of converting recordmcount to use objtool's ELF code rather than its own open-coded methods of accessing ELF files. --- v3: Rebased on mainline. s/elf_open/elf_read/ in recordmcount.c v2: Fix whitespace before line continuation Add ftrace/mcount/record.h to objtool_dep Rename the Makefile variable BUILD_C_RECORDMCOUNT to better reflect its purpose Similar: rename recordmcount_source => recordmcount_dep When using objtool we can just depend on the binary rather than the source the binary is built from. This should address Josh's feedback and make the Makefile code a bit clearer Add a comment to make reading the Makefile a little easier Rebased to latest mainline -rc Collected some build time measurements Build times measurements (measured for v2 posting) -- median of multiple runs in a VM measured with "time": mainline (5.2.0-rc4) build times (median of 3 runs): real 2m58.379s user 2m29.621s sys 1m35.116s Post recordmcount-cleanup build times (median of 5 runs): real 2m51.973s user 2m29.094s sys 1m33.688s objtool mcount build times (median of 7 runs): real 2m57.92s user 2m33.73s sys 1m37.06s Note: I saw some significant variation especially in the "real" time measurements probably because it was in a VM on a machine with various "idle" GUI tasks running. This is why I took the median rather than the mean. Though I haven't run the statistics, my sense is the numbers don't support concluding that things really got any faster or slower. Matt Helsley (13): recordmcount: Remove redundant strcmp recordmcount: Remove uread() recordmcount: Remove unused fd from uwrite() and ulseek() recordmcount: Rewrite error/success handling recordmcount: Kernel style function signature formatting recordmcount: Kernel style formatting recordmcount: Remove redundant cleanup() calls recordmcount: Clarify what cleanup() does objtool: Prepare to merge recordmcount objtool: Make recordmcount into an objtool subcmd objtool: recordmcount: Start using objtool's elf wrapper objtool: recordmcount: Search for __mcount_loc before walking the sections objtool: recordmcount: Convert do_func() relhdrs Makefile | 6 +- scripts/.gitignore | 1 - scripts/Makefile | 1 - scripts/Makefile.build | 25 +- tools/objtool/.gitignore | 1 + tools/objtool/Build | 1 + tools/objtool/Makefile | 1 + tools/objtool/builtin-mcount.c | 72 +++++ tools/objtool/builtin-mcount.h | 23 ++ tools/objtool/builtin.h | 1 + tools/objtool/objtool.c | 1 + {scripts => tools/objtool}/recordmcount.c | 350 ++++++++++----------- {scripts => tools/objtool}/recordmcount.h | 197 +++++++----- {scripts => tools/objtool}/recordmcount.pl | 0 14 files changed, 406 insertions(+), 274 deletions(-) create mode 100644 tools/objtool/builtin-mcount.c create mode 100644 tools/objtool/builtin-mcount.h rename {scripts => tools/objtool}/recordmcount.c (78%) rename {scripts => tools/objtool}/recordmcount.h (78%) rename {scripts => tools/objtool}/recordmcount.pl (100%) -- 2.20.1