From patchwork Mon Apr 30 01:23:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 10370699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65BCF60234 for ; Mon, 30 Apr 2018 01:24:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55562288DA for ; Mon, 30 Apr 2018 01:24:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49F4728A3F; Mon, 30 Apr 2018 01:24:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9CC0288DA for ; Mon, 30 Apr 2018 01:24:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753750AbeD3BYJ (ORCPT ); Sun, 29 Apr 2018 21:24:09 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36692 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753659AbeD3BYI (ORCPT ); Sun, 29 Apr 2018 21:24:08 -0400 Received: by mail-pg0-f66.google.com with SMTP id z129-v6so1077136pgz.3 for ; Sun, 29 Apr 2018 18:24:08 -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; bh=Y8GEqLXKpYUsLHJmtrtbtsVd+uv3xJxqoKtunWwtTpE=; b=hFra8IM3cjscoinlc0xsBHbCfK4oGBqlOgchxKSFFtbcmMdT+IpURnypiLqQCS3zd3 rh81OjeSOEGXxX01Xvq+bvs46A8yE0vJ20p7Hy/zu2rlqjnjT0gDJwoFp5e2VCvq5Sw5 BOEp0bSw4HJRV4mm7ebWIKiL8OCjuiADg1tVJOhlivUyK0IOJPczaeJfzsemoJLRnazZ 0Oy3scUw0dPaHi9ZtvLis8As4xlLju2BV8FwawbLXb7Puc9Rnz/33VXVBUvzyVLuqbVT OIGHb7l3Qu4p3qJBkjUF3EKyaTK9g44xMXd3eirIFit9w8x5gdecn12qx79XPbqzAcp5 hPqQ== 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; bh=Y8GEqLXKpYUsLHJmtrtbtsVd+uv3xJxqoKtunWwtTpE=; b=bd1+utVFlFiaK0WyJKEzgBuTQ9TDQZ1XalkkD7nd0T2EqHnjUvXdfFf821UgE9LfPI nb+tHYwCRmPrV1I/UYMtN6h1lGUo2sAzhn/3Q/U6fhJ4xKfdmmaoRI97fDkyn81pSZ04 ddQXfueQJ94F1e74R8nz6Ntg2N73eNWB/LArjfB7WmxL/0BMnEXpN7XwzykvufR5MOFI 7GI6EU8gkvi4lsa9Ptp1T7PCKtLxQhCgE01LYdbMdgQU/8yJ8dkFZAdRuZODAadh1uyk v807wixE8BF5xV0Jy216vvgMSCx8KO6rwklDRB4vs7qA7RAyhWhAOLhNDOh81U0hwatV pw5Q== X-Gm-Message-State: ALQs6tBNU4H/PV/V7gTe6bNrupBvlZsYPG9FHuwoZ2iiY/+IaSyhTkkj Ng9FHoP+v6WgHr2vVFu3rlY9bA== X-Google-Smtp-Source: AB8JxZrQEZ/Bf0xpx1+pUFWCypo9f4vFVOpnNoAaI4KsoX8TyeEl/qzw4D+TB+FfTaHbtS/q2E0JJA== X-Received: by 2002:a17:902:1665:: with SMTP id g92-v6mr10777254plg.195.1525051447884; Sun, 29 Apr 2018 18:24:07 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id h6-v6sm9959635pgn.65.2018.04.29.18.24.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Apr 2018 18:24:07 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Cc: Nicholas Piggin , Masahiro Yamada , linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH 2/2] powerpc/kbuild: move -mprofile-kernel check to Kconfig Date: Mon, 30 Apr 2018 11:23:51 +1000 Message-Id: <20180430012351.28814-3-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430012351.28814-1-npiggin@gmail.com> References: <20180430012351.28814-1-npiggin@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This eliminates the workaround that requires disabling -mprofile-kernel by default in Kconfig. --- arch/powerpc/Kconfig | 16 +--------------- arch/powerpc/Makefile | 14 ++------------ arch/powerpc/tools/gcc-check-mprofile-kernel.sh | 4 ++-- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 512fcc177c87..af527f894f9b 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -460,23 +460,9 @@ config LD_HEAD_STUB_CATCH If unsure, say "N". -config DISABLE_MPROFILE_KERNEL - bool "Disable use of mprofile-kernel for kernel tracing" - depends on PPC64 && CPU_LITTLE_ENDIAN - default y - help - Selecting this options disables use of the mprofile-kernel ABI for - kernel tracing. That will cause options such as live patching - (CONFIG_LIVEPATCH) which depend on CONFIG_DYNAMIC_FTRACE_WITH_REGS to - be disabled also. - - If you have a toolchain which supports mprofile-kernel, then you can - disable this. Otherwise leave it enabled. If you're not sure, say - "Y". - config MPROFILE_KERNEL depends on PPC64 && CPU_LITTLE_ENDIAN - def_bool !DISABLE_MPROFILE_KERNEL + def_bool $(success $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__) config IOMMU_HELPER def_bool PPC64 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 046b5dde9ff5..efab4d66043b 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -158,18 +158,8 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif ifdef CONFIG_MPROFILE_KERNEL - ifeq ($(shell $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK) - CC_FLAGS_FTRACE := -pg -mprofile-kernel - KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL - else - # If the user asked for mprofile-kernel but the toolchain doesn't - # support it, emit a warning and deliberately break the build later - # with mprofile-kernel-not-supported. We would prefer to make this an - # error right here, but then the user would never be able to run - # oldconfig to change their configuration. - $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL) - CC_FLAGS_FTRACE := -mprofile-kernel-not-supported - endif + CC_FLAGS_FTRACE := -pg -mprofile-kernel + KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL endif CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell) diff --git a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh index 061f8035bdbe..ec4486a9c4a3 100755 --- a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh +++ b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh @@ -10,13 +10,13 @@ set -o pipefail # Test whether the compile option -mprofile-kernel exists and generates # profiling code (ie. a call to _mcount()). echo "int func() { return 0; }" | \ - $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ + $* -m64 -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ grep -q "_mcount" # Test whether the notrace attribute correctly suppresses calls to _mcount(). echo -e "#include \nnotrace int func() { return 0; }" | \ - $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ + $* -m64 -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ grep -q "_mcount" && \ exit 1