Skip to content

Commit abba759

Browse files
npigginmasahir0y
authored andcommitted
powerpc/kbuild: move -mprofile-kernel check to Kconfig
This eliminates the workaround that requires disabling -mprofile-kernel by default in Kconfig. Signed-off-by: Nicholas Piggin <[email protected]> Acked-by: Michael Ellerman <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 8373b7d commit abba759

File tree

6 files changed

+8
-34
lines changed

6 files changed

+8
-34
lines changed

arch/powerpc/Kconfig

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -459,23 +459,9 @@ config LD_HEAD_STUB_CATCH
459459

460460
If unsure, say "N".
461461

462-
config DISABLE_MPROFILE_KERNEL
463-
bool "Disable use of mprofile-kernel for kernel tracing"
464-
depends on PPC64 && CPU_LITTLE_ENDIAN
465-
default y
466-
help
467-
Selecting this options disables use of the mprofile-kernel ABI for
468-
kernel tracing. That will cause options such as live patching
469-
(CONFIG_LIVEPATCH) which depend on CONFIG_DYNAMIC_FTRACE_WITH_REGS to
470-
be disabled also.
471-
472-
If you have a toolchain which supports mprofile-kernel, then you can
473-
disable this. Otherwise leave it enabled. If you're not sure, say
474-
"Y".
475-
476462
config MPROFILE_KERNEL
477463
depends on PPC64 && CPU_LITTLE_ENDIAN
478-
def_bool !DISABLE_MPROFILE_KERNEL
464+
def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)
479465

480466
config HOTPLUG_CPU
481467
bool "Support for enabling/disabling CPUs"

arch/powerpc/Makefile

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,7 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
161161
endif
162162

163163
ifdef CONFIG_MPROFILE_KERNEL
164-
ifeq ($(shell $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK)
165-
CC_FLAGS_FTRACE := -pg -mprofile-kernel
166-
KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL
167-
else
168-
# If the user asked for mprofile-kernel but the toolchain doesn't
169-
# support it, emit a warning and deliberately break the build later
170-
# with mprofile-kernel-not-supported. We would prefer to make this an
171-
# error right here, but then the user would never be able to run
172-
# oldconfig to change their configuration.
173-
$(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL)
174-
CC_FLAGS_FTRACE := -mprofile-kernel-not-supported
175-
endif
164+
CC_FLAGS_FTRACE := -pg -mprofile-kernel
176165
endif
177166

178167
CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)

arch/powerpc/include/asm/module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <asm-generic/module.h>
1515

1616

17-
#ifdef CC_USING_MPROFILE_KERNEL
17+
#ifdef CONFIG_MPROFILE_KERNEL
1818
#define MODULE_ARCH_VERMAGIC_FTRACE "mprofile-kernel "
1919
#else
2020
#define MODULE_ARCH_VERMAGIC_FTRACE ""

arch/powerpc/kernel/module_64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static unsigned long stub_for_addr(const Elf64_Shdr *sechdrs,
466466
return (unsigned long)&stubs[i];
467467
}
468468

469-
#ifdef CC_USING_MPROFILE_KERNEL
469+
#ifdef CONFIG_MPROFILE_KERNEL
470470
static bool is_mprofile_mcount_callsite(const char *name, u32 *instruction)
471471
{
472472
if (strcmp("_mcount", name))
@@ -753,7 +753,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
753753

754754
#ifdef CONFIG_DYNAMIC_FTRACE
755755

756-
#ifdef CC_USING_MPROFILE_KERNEL
756+
#ifdef CONFIG_MPROFILE_KERNEL
757757

758758
#define PACATOC offsetof(struct paca_struct, kernel_toc)
759759

arch/powerpc/kernel/trace/ftrace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ __ftrace_make_nop(struct module *mod,
144144
return -EINVAL;
145145
}
146146

147-
#ifdef CC_USING_MPROFILE_KERNEL
147+
#ifdef CONFIG_MPROFILE_KERNEL
148148
/* When using -mkernel_profile there is no load to jump over */
149149
pop = PPC_INST_NOP;
150150

@@ -188,7 +188,7 @@ __ftrace_make_nop(struct module *mod,
188188
pr_err("Expected %08x found %08x\n", PPC_INST_LD_TOC, op);
189189
return -EINVAL;
190190
}
191-
#endif /* CC_USING_MPROFILE_KERNEL */
191+
#endif /* CONFIG_MPROFILE_KERNEL */
192192

193193
if (patch_instruction((unsigned int *)ip, pop)) {
194194
pr_err("Patching NOP failed.\n");
@@ -324,7 +324,7 @@ int ftrace_make_nop(struct module *mod,
324324
* They should effectively be a NOP, and follow formal constraints,
325325
* depending on the ABI. Return false if they don't.
326326
*/
327-
#ifndef CC_USING_MPROFILE_KERNEL
327+
#ifndef CONFIG_MPROFILE_KERNEL
328328
static int
329329
expected_nop_sequence(void *ip, unsigned int op0, unsigned int op1)
330330
{

arch/powerpc/tools/gcc-check-mprofile-kernel.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \
2424
2> /dev/null | grep -q "_mcount" && \
2525
exit 1
2626

27-
echo "OK"
2827
exit 0

0 commit comments

Comments
 (0)