From patchwork Thu May 10 05:16:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 10391155 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 973166028E for ; Thu, 10 May 2018 05:17:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8856E28866 for ; Thu, 10 May 2018 05:17:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D38928870; Thu, 10 May 2018 05:17:28 +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 0A34828866 for ; Thu, 10 May 2018 05:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756566AbeEJFR1 (ORCPT ); Thu, 10 May 2018 01:17:27 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:36326 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756501AbeEJFR1 (ORCPT ); Thu, 10 May 2018 01:17:27 -0400 Received: by mail-pl0-f66.google.com with SMTP id v24-v6so611024plo.3 for ; Wed, 09 May 2018 22:17:26 -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=eZ/16WYPfdTwI48OeBLmSaGu4yn3/8f+hRHr15VxDnA=; b=I0IOM+efV5wTMVFBwJfYNM59CdYhwwSfMjEJGOOuXZarSx+V3M5RycQ5rFEef8Nisg AmzlSopqnpfKag7p3t6shwqcSdPy4vn3yHavAZ8ThMToxx6+ZBAowEEEOpcXSAHU6t2y gKHNxKBwo4DoiRVRbV4td5y/OBD8AlBaSy9uEKoXQMduglAG177W6jyZghB6W6f+bQWH FnjHp3Gr+Ul36VG2K70WhNNxqy1HeukluYglitnGmbtH48n/qWeVBIyQQCeWo+6R9JUO xqW2sePpASjo6yiUqgvLpTNJ/aWdqCAgZ0ox7RcFia/3f+t1IRhsXj5od3Qsi2IP4ZNY ztxQ== 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=eZ/16WYPfdTwI48OeBLmSaGu4yn3/8f+hRHr15VxDnA=; b=tItamcBzO4mlGqpvKghg9txuWsqwjRpeYjmRVUgls1iHXY9PBf0S9VbbpxjQqHva+E EWJzE1QQNSaYlwzl8ItRNIlSupBDDf4vlWozK059r8ZWI7YMDgdDNWS/H9RNwuZf+ffz Uyrjrri5N5rGj++tsN21CPkjlegG+IRe8gFkSsGd6ZzkK2uDRr7SoKU2kjJ81wwIjNJ7 UGOKKSfYO4jHRbthO/20/EZ8oX8FLNfzuSgX9gdCz0I7zz0BCF7oznfa5AQxJ/C4RO8l mSnFYEDrVL4Az2+3xQXkGKlPEJXf0Otill1JtBcOWExcrrLll4B55IrNHeYUf1Iz0Kcl P8mg== X-Gm-Message-State: ALKqPwf85C6/0JMWhCaU70wBvYF7jJz60Gy0hrGk7WYX15/iL1d3lrA8 3MmAYNpiZ2hL3/WuWHKr5/e+/w== X-Google-Smtp-Source: AB8JxZr/BLdV6T42qvlOSlMaiRpJKgMRp2DjMHrhFplNImY1EW8L2KhJJItwkcxS9/YIrg8Eay4GZA== X-Received: by 2002:a17:902:8bc4:: with SMTP id r4-v6mr1519575plo.381.1525929446157; Wed, 09 May 2018 22:17:26 -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 a7-v6sm8922265pgc.68.2018.05.09.22.17.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 22:17:25 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Cc: Nicholas Piggin , Masahiro Yamada , linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 5/5] powerpc/kbuild: move -mprofile-kernel check to Kconfig Date: Thu, 10 May 2018 15:16:59 +1000 Message-Id: <20180510051659.15356-6-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510051659.15356-1-npiggin@gmail.com> References: <20180510051659.15356-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. [ Note: this depends on https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig-shell-v3 ] Signed-off-by: Nicholas Piggin --- 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 5f3ec8029e50..9f69b1599c61 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -156,18 +156,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