From patchwork Mon Dec 5 08:30:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Chen X-Patchwork-Id: 29596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2130914wrr; Mon, 5 Dec 2022 00:34:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf6d4zoPpGlWQjFF68p400rxWh/e560x/DaS0Yp4wJMYC+r4VtMkOcflLUeycniYLbwjqjMe X-Received: by 2002:a17:90a:4307:b0:213:9df5:43b2 with SMTP id q7-20020a17090a430700b002139df543b2mr92726465pjg.86.1670229278351; Mon, 05 Dec 2022 00:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670229278; cv=none; d=google.com; s=arc-20160816; b=Rh5SRd6z9HiUWJLRvJ5ZMfR+fOsG2X4tUcswSnv0scKb4Mdep0UwE5AJFQ/9wF89XV n2AifJsXLt5/A6iusSLiE0Y+ckg5lCZacVvaZ9ijy2neHh0O3RNkQ5nWg3f6OesfCYrY r4Ol44lO40XbCsgQLcl/G37pQBizcoLAZGN2YzfkoTREpPAXkXdiZQRwDj5yMWDnt0OW nWZ7pfr1ME71gnz2JBi/Pycfnr/XUbVAzgocJdSW0RnUfQd0KLP1YRraE2wzlHX6N6Pi F0o1i0zDssoxOrPb79egOr/nQO6grOcZDGU/N1BQb+NYCs23138rs3qKjn3HalnKGvtK mGpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:sender :hmm_source_type:hmm_attache_num:hmm_source_ip; bh=O6Qp/a6d8Jk6n4Ypylia+vRDfqUkkjbud6/sqzz+LgA=; b=1LXo+k1/kKVk7/MwB5ESbTkMwzdtZjPa+0N24dYzG0MKIuY7xWmHNnHEk+RwsCF5iS XpsXlzWkN4UeH/SMmUB0JFdIh1BjeSY06nffxKtNmXsv3psHaDRn1f/I+X7so/5GKYoJ 0ZIL8yB4p0VufzVsYdbO8Y4b3eVSybNQ/es5505BlxyJdSY9CYJik11E+2V1q6sBGgMA wQaAuFH8VyB7UTpiUmFHc22I2Eq/tOl+V92qVtw+hd9bMbyFeD50EeJgEdv31DUMh4ow +ZK/RtKb/tzF6j1qtzgRu+vUq3zj7hn6rknDVSIZloMiyp+Dpz+yi9XuLBnm+nna3ajT +qww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s2-20020a632c02000000b00477bfab5a83si14250089pgs.2.2022.12.05.00.34.25; Mon, 05 Dec 2022 00:34:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231829AbiLEIXl (ORCPT + 99 others); Mon, 5 Dec 2022 03:23:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232068AbiLEIXd (ORCPT ); Mon, 5 Dec 2022 03:23:33 -0500 Received: from 189.cn (ptr.189.cn [183.61.185.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 793A1165AD; Mon, 5 Dec 2022 00:23:30 -0800 (PST) HMM_SOURCE_IP: 10.64.8.41:59286.703431701 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-123.150.8.42 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id 6D6301002F0; Mon, 5 Dec 2022 16:23:28 +0800 (CST) Received: from ([123.150.8.42]) by gateway-153622-dep-6cffbd87dd-5n69v with ESMTP id 6754938087e943759d0a36285b07a169 for rostedt@goodmis.org; Mon, 05 Dec 2022 16:23:29 CST X-Transaction-ID: 6754938087e943759d0a36285b07a169 X-Real-From: chensong_2000@189.cn X-Receive-IP: 123.150.8.42 X-MEDUSA-Status: 0 Sender: chensong_2000@189.cn From: Song Chen To: rostedt@goodmis.org, mhiramat@kernel.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Song Chen Subject: [PATCH v3 4/4] kernel/trace: remove calling regs_* when compiling HEXAGON Date: Mon, 5 Dec 2022 16:30:17 +0800 Message-Id: <1670229017-4106-1-git-send-email-chensong_2000@189.cn> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751362335774491456?= X-GMAIL-MSGID: =?utf-8?q?1751362335774491456?= kernel test robot reports below errors: In file included from kernel/trace/trace_events_synth.c:22: >> kernel/trace/trace_probe_kernel.h:203:9: error: call to undeclared function 'regs_get_register'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] val = regs_get_register(regs, code->param); HEXAGON doesn't define and implement those reg_* functions underneath arch/hexagon as well as other archs. To remove those errors, i have to include those function calls in "CONFIG_HEXAGON" It looks ugly, but i don't know any other way to fix it, this patch can be reverted after reg_* have been in place in arch/hexagon. Signed-off-by: Song Chen Reported-by: kernel test robot --- kernel/trace/trace_probe_kernel.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_probe_kernel.h b/kernel/trace/trace_probe_kernel.h index 8c42abe0dacf..7e958b7f07e5 100644 --- a/kernel/trace/trace_probe_kernel.h +++ b/kernel/trace/trace_probe_kernel.h @@ -130,8 +130,7 @@ probe_mem_read(void *dest, void *src, size_t size) return copy_from_kernel_nofault(dest, src, size); } -static nokprobe_inline unsigned long -get_event_field(struct fetch_insn *code, void *rec) +static unsigned long get_event_field(struct fetch_insn *code, void *rec) { struct ftrace_event_field *field = code->data; unsigned long val; @@ -194,23 +193,41 @@ static int process_fetch_insn(struct fetch_insn *code, void *rec, void *dest, void *base) { +#ifndef CONFIG_HEXAGON struct pt_regs *regs = rec; +#endif unsigned long val; retry: /* 1st stage: get value from context */ switch (code->op) { case FETCH_OP_REG: +#ifdef CONFIG_HEXAGON + val = 0; +#else val = regs_get_register(regs, code->param); +#endif break; case FETCH_OP_STACK: +#ifdef CONFIG_HEXAGON + val = 0; +#else val = regs_get_kernel_stack_nth(regs, code->param); +#endif break; case FETCH_OP_STACKP: +#ifdef CONFIG_HEXAGON + val = 0; +#else val = kernel_stack_pointer(regs); +#endif break; case FETCH_OP_RETVAL: +#ifdef CONFIG_HEXAGON + val = 0; +#else val = regs_return_value(regs); +#endif break; case FETCH_OP_IMM: val = code->immediate;