From patchwork Mon May 14 03:52:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 10396701 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 06E01601E7 for ; Mon, 14 May 2018 03:53:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0F6C228C9 for ; Mon, 14 May 2018 03:53:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5E8327F3E; Mon, 14 May 2018 03:53:00 +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 452F229094 for ; Mon, 14 May 2018 03:53:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751099AbeENDxA (ORCPT ); Sun, 13 May 2018 23:53:00 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35663 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbeENDw7 (ORCPT ); Sun, 13 May 2018 23:52:59 -0400 Received: by mail-pf0-f195.google.com with SMTP id x9-v6so5342393pfm.2 for ; Sun, 13 May 2018 20:52: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; bh=+3KyjVmzORs6IYW6GC5iU2/T/SrONIYa2OoHwNLNnvE=; b=ZRUK3xQk0RBFA+iRU4QYB9sxQrmTRlOYSgdATMfnhn9lshITHdBN9yw22JzZ+K90O1 DQU2crTCpkqtA6OB4Hpm4h6DlC+h6Gj/8SRYnJOTBcke2A96MNW/AFfe5xBT1tl/ZaRX 8Lo1Ne5Ya0qZ0LOfLfjDNTufxwxOI8mZlfplgsXgfu2PB0bI96KglXPB/w8WIOyXzjKq O4vSnsAFThBtVuvLfkUZev8hd8EPf/fy/fqMv7yvdYy47ZIeT/Z67ARApNgjGufEsR5n GO6bWdD9m01PFbRIKfXec6CHa50VE5QegZMgSZrmHO5SV3cUOqJRKc52eqmsF+wKxZnP dw1w== 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=+3KyjVmzORs6IYW6GC5iU2/T/SrONIYa2OoHwNLNnvE=; b=l8XEagN21zYnHFnKSEbO7o0/4EpALY9LE7728F5rAm0aM9jCG6LWR3KcHKDZFcwoiJ BJtEnXaazyhVNBs9AZRS2dstwM8xVld8aZmhWodl3EnoYdVRkthvfB65wSczytqSlBYC nYh+T66ZDXvh6xXoO4YpHSN7ZcmViwkgFiUNgLoeOKhggDqnGDZWkeKy5AjY05iiXwOp pk69yp+g6qVbaEOpLmcFCSXaOdqmvhxk2jrEHyYQutO3VT5gll6gzbZP79Sf5pBrxfxD KPe3twRUDraA+THw2qJ67bSz8G3uV/uuWT4zD/noK5CrWT9AsoSPp2/DKmNch7IHRlmQ +pbw== X-Gm-Message-State: ALKqPwcVmMO14AC+5gVkwIjXyjZsY+ayiHWZBDmYq1ohDDVRBE/A3YjR QsyMgyJRyKgJeY9N3Z3qPd9FRA== X-Google-Smtp-Source: AB8JxZrnRqzoDYJi0FPQQH8TioojaBNyu1fTw2+O0/4eUatZUfIzkrzU5LXdmOmOxJzFfrjORe+OYg== X-Received: by 2002:a63:5e44:: with SMTP id s65-v6mr4010520pgb.104.1526269978577; Sun, 13 May 2018 20:52:58 -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 d71-v6sm15668943pfd.48.2018.05.13.20.52.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 May 2018 20:52:57 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Cc: Nicholas Piggin , linuxppc-dev@lists.ozlabs.org, Masahiro Yamada , Segher Boessenkool , Steven Rostedt Subject: [PATCH v3 4/4] powerpc/kbuild: move -mprofile-kernel check to Kconfig Date: Mon, 14 May 2018 13:52:28 +1000 Message-Id: <20180514035228.21316-5-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514035228.21316-1-npiggin@gmail.com> References: <20180514035228.21316-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 6faf1d6ad9dd..8f7a64fe7370 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -161,18 +161,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