From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [peterz-queue:x86/static_call 7/24] arch/x86/kernel/ftrace.c:440:26: error: storage size of 'calc' isn't known
Date: Wed, 09 Oct 2019 19:37:27 +0800 [thread overview]
Message-ID: <201910091922.Gy0i2ehm%lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 11251 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/static_call
head: ea10f7a86ed1b536df6c0d061d2c7f78af294e3d
commit: 0c54fd21334a9f256976fa366b29e803d3e263da [7/24] x86/ftrace: Use text_gen_insn()
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
git checkout 0c54fd21334a9f256976fa366b29e803d3e263da
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
arch/x86/kernel/ftrace.c: In function 'ftrace_call_replace':
>> arch/x86/kernel/ftrace.c:63:41: warning: passing argument 2 of 'text_gen_insn' makes pointer from integer without a cast [-Wint-conversion]
return text_gen_insn(CALL_INSN_OPCODE, ip, addr);
^~
In file included from arch/x86/kernel/ftrace.c:33:0:
arch/x86/include/asm/text-patching.h:52:14: note: expected 'const void *' but argument is of type 'long unsigned int'
extern void *text_gen_insn(u8 opcode, const void *addr, const void *dest);
^~~~~~~~~~~~~
arch/x86/kernel/ftrace.c:63:45: warning: passing argument 3 of 'text_gen_insn' makes pointer from integer without a cast [-Wint-conversion]
return text_gen_insn(CALL_INSN_OPCODE, ip, addr);
^~~~
In file included from arch/x86/kernel/ftrace.c:33:0:
arch/x86/include/asm/text-patching.h:52:14: note: expected 'const void *' but argument is of type 'long unsigned int'
extern void *text_gen_insn(u8 opcode, const void *addr, const void *dest);
^~~~~~~~~~~~~
arch/x86/kernel/ftrace.c: In function 'addr_from_call':
>> arch/x86/kernel/ftrace.c:440:26: error: storage size of 'calc' isn't known
union ftrace_code_union calc;
^~~~
arch/x86/kernel/ftrace.c:440:26: warning: unused variable 'calc' [-Wunused-variable]
arch/x86/kernel/ftrace.c: In function 'ftrace_jmp_replace':
arch/x86/kernel/ftrace.c:522:42: warning: passing argument 2 of 'text_gen_insn' makes pointer from integer without a cast [-Wint-conversion]
return text_gen_insn(JMP32_INSN_OPCODE, ip, addr);
^~
In file included from arch/x86/kernel/ftrace.c:33:0:
arch/x86/include/asm/text-patching.h:52:14: note: expected 'const void *' but argument is of type 'long unsigned int'
extern void *text_gen_insn(u8 opcode, const void *addr, const void *dest);
^~~~~~~~~~~~~
arch/x86/kernel/ftrace.c:522:46: warning: passing argument 3 of 'text_gen_insn' makes pointer from integer without a cast [-Wint-conversion]
return text_gen_insn(JMP32_INSN_OPCODE, ip, addr);
^~~~
In file included from arch/x86/kernel/ftrace.c:33:0:
arch/x86/include/asm/text-patching.h:52:14: note: expected 'const void *' but argument is of type 'long unsigned int'
extern void *text_gen_insn(u8 opcode, const void *addr, const void *dest);
^~~~~~~~~~~~~
arch/x86/kernel/ftrace.c: In function 'addr_from_call':
>> arch/x86/kernel/ftrace.c:454:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vim +440 arch/x86/kernel/ftrace.c
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 436)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 437) /* Return the address of the function the trampoline calls */
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 438) static void *addr_from_call(void *ptr)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 439) {
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 @440) union ftrace_code_union calc;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 441) int ret;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 442)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 443) ret = probe_kernel_read(&calc, ptr, MCOUNT_INSN_SIZE);
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 444) if (WARN_ON_ONCE(ret < 0))
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 445) return NULL;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 446)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 447) /* Make sure this is a call */
745cfeaac09ce3 Steven Rostedt (VMware 2019-03-04 448) if (WARN_ON_ONCE(calc.op != 0xe8)) {
745cfeaac09ce3 Steven Rostedt (VMware 2019-03-04 449) pr_warn("Expected e8, got %x\n", calc.op);
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 450) return NULL;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 451) }
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 452)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 453) return ptr + MCOUNT_INSN_SIZE + calc.offset;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 @454) }
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 455)
6a06bdbf7f9c66 Steven Rostedt (Red Hat 2014-11-24 456) void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 457) unsigned long frame_pointer);
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 458)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 459) /*
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 460) * If the ops->trampoline was not allocated, then it probably
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 461) * has a static trampoline func, or is the ftrace caller itself.
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 462) */
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 463) static void *static_tramp_func(struct ftrace_ops *ops, struct dyn_ftrace *rec)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 464) {
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 465) unsigned long offset;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 466) bool save_regs = rec->flags & FTRACE_FL_REGS_EN;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 467) void *ptr;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 468)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 469) if (ops && ops->trampoline) {
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 470) #ifdef CONFIG_FUNCTION_GRAPH_TRACER
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 471) /*
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 472) * We only know about function graph tracer setting as static
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 473) * trampoline.
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 474) */
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 475) if (ops->trampoline == FTRACE_GRAPH_ADDR)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 476) return (void *)prepare_ftrace_return;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 477) #endif
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 478) return NULL;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 479) }
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 480)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 481) offset = calc_trampoline_call_offset(save_regs);
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 482)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 483) if (save_regs)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 484) ptr = (void *)FTRACE_REGS_ADDR + offset;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 485) else
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 486) ptr = (void *)FTRACE_ADDR + offset;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 487)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 488) return addr_from_call(ptr);
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 489) }
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 490)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 491) void *arch_ftrace_trampoline_func(struct ftrace_ops *ops, struct dyn_ftrace *rec)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 492) {
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 493) unsigned long offset;
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 494)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 495) /* If we didn't allocate this trampoline, consider it static */
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 496) if (!ops || !(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 497) return static_tramp_func(ops, rec);
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 498)
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 499) offset = calc_trampoline_call_offset(ops->flags & FTRACE_OPS_FL_SAVE_REGS);
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 500) return addr_from_call((void *)ops->trampoline + offset);
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 501) }
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 502)
12cce594fa8f12 Steven Rostedt (Red Hat 2014-07-03 503) void arch_ftrace_trampoline_free(struct ftrace_ops *ops)
12cce594fa8f12 Steven Rostedt (Red Hat 2014-07-03 504) {
12cce594fa8f12 Steven Rostedt (Red Hat 2014-07-03 505) if (!ops || !(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
12cce594fa8f12 Steven Rostedt (Red Hat 2014-07-03 506) return;
12cce594fa8f12 Steven Rostedt (Red Hat 2014-07-03 507)
7fdfe1e40b225b Rick Edgecombe 2019-04-25 508 tramp_free((void *)ops->trampoline);
12cce594fa8f12 Steven Rostedt (Red Hat 2014-07-03 509) ops->trampoline = 0;
12cce594fa8f12 Steven Rostedt (Red Hat 2014-07-03 510) }
15d5b02cc575e5 Steven Rostedt (Red Hat 2014-07-03 511)
f3bea49115b21e Steven Rostedt (Red Hat 2014-07-02 512) #endif /* CONFIG_X86_64 */
f3bea49115b21e Steven Rostedt (Red Hat 2014-07-02 513) #endif /* CONFIG_DYNAMIC_FTRACE */
f3bea49115b21e Steven Rostedt (Red Hat 2014-07-02 514)
f3bea49115b21e Steven Rostedt (Red Hat 2014-07-02 515) #ifdef CONFIG_FUNCTION_GRAPH_TRACER
f3bea49115b21e Steven Rostedt (Red Hat 2014-07-02 516)
f3bea49115b21e Steven Rostedt (Red Hat 2014-07-02 517) #ifdef CONFIG_DYNAMIC_FTRACE
f3bea49115b21e Steven Rostedt (Red Hat 2014-07-02 518) extern void ftrace_graph_call(void);
5a45cfe1c64862 Steven Rostedt 2008-11-26 519
95852d4d3ae983 Peter Zijlstra 2019-08-26 520 static const char *ftrace_jmp_replace(unsigned long ip, unsigned long addr)
745cfeaac09ce3 Steven Rostedt (VMware 2019-03-04 521) {
0c54fd21334a9f Peter Zijlstra 2019-10-09 @522 return text_gen_insn(JMP32_INSN_OPCODE, ip, addr);
745cfeaac09ce3 Steven Rostedt (VMware 2019-03-04 523) }
745cfeaac09ce3 Steven Rostedt (VMware 2019-03-04 524)
:::::: The code at line 440 was first introduced by commit
:::::: 15d5b02cc575e5b20ddfa1645fc1242f0b0ba1c8 ftrace/x86: Show trampoline call function in enabled_functions
:::::: TO: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
:::::: CC: Steven Rostedt <rostedt@goodmis.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 70868 bytes --]
reply other threads:[~2019-10-09 11:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201910091922.Gy0i2ehm%lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.