Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4271708pxj; Mon, 21 Jun 2021 18:20:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn1rvhsE4a4+FG+j8W5bFwF+nLlFQN+RfGWxGQAVDyM1046PVlNDz8GI998JV+qyhLtOze X-Received: by 2002:a17:906:bb0e:: with SMTP id jz14mr1001596ejb.285.1624324851413; Mon, 21 Jun 2021 18:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624324851; cv=none; d=google.com; s=arc-20160816; b=ioMk39GAMaQ3exxulFV9uEjSQATFkfX/gDp/+10f0mOo8D/M9X80muukvsJl7jTFnw tKCn0uRuV2hChJPysJdDzaCthhcCVYa5rtQOoOAJyOsjj/hNLUIVsxlcEhanBlAgi2Zi oJNKqjOhmqVO6Q6AXghw3mO73uMsvajFgnEQ/xEqPlwBkhD7JOem99GfHPBL4o5wS2f9 MgUtDjhE0SP6c3Z4GuZ2/4rr4l3nKy8qDmv+TJ3ljzbJhxhnghViLiQzdM276ajiZlV1 G8tbKBnryUsEexUoJOXzZJjMw45uZpn7hq3qleRlebvX5906OJfN6QC9JAduJqNRaRXq X/TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=xTfppjXr7g6DEQSAlT5IFcb+9BzP1tXmwPDwfopsBGQ=; b=KWrf1jJidmR7Yo4FViMXSa8DPj88OheHmdAEs8mpmLE9hd1nX77zNNjbyKEOt8eQox 2gr6jH4YEwpMdEz0SZU6hiOI6wevVjXEf8ZOym07+TzEG5/+r4utgeS5/gaMeO+mb7Bt Wq/rosGhwJcewhrgQPkeW+TRpvWhYPVT0ceBSsEJjgWkUmTlexV/tiaKrEe64uqE8sHN w7X4z+uQ4T2LXpBvkPVZpesi8q85P6DZMyMsAqD9J+amXviiEVx4l+q8uGORStW009id QuxdhPcLtulSQcy1B1o0ad3RmYCiT+KD6nsQTqYkj9iIx7J2vNlRx11/GCeAJSjS6iLI KQ/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si11741529eju.85.2021.06.21.18.20.27; Mon, 21 Jun 2021 18:20:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230175AbhFVBVq (ORCPT + 99 others); Mon, 21 Jun 2021 21:21:46 -0400 Received: from mail.loongson.cn ([114.242.206.163]:33754 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229663AbhFVBVp (ORCPT ); Mon, 21 Jun 2021 21:21:45 -0400 Received: from [10.130.0.135] (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxP0OZOtFgIJoVAA--.3536S3; Tue, 22 Jun 2021 09:19:22 +0800 (CST) Subject: Re: [RFC PATCH 1/2] ftrace: Introduce cmdline argument ftrace_disabled To: Steven Rostedt References: <1624084160-3342-1-git-send-email-yangtiezhu@loongson.cn> <1624084160-3342-2-git-send-email-yangtiezhu@loongson.cn> <20210619112202.0a2c7196@gandalf.local.home> <6847bf76-698d-a314-0825-803b48cb8740@loongson.cn> <20210621100004.7c1505be@oasis.local.home> Cc: Ingo Molnar , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li From: Tiezhu Yang Message-ID: Date: Tue, 22 Jun 2021 09:19:21 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20210621100004.7c1505be@oasis.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf9DxP0OZOtFgIJoVAA--.3536S3 X-Coremail-Antispam: 1UD129KBjvJXoW7AFW8Kw1xtw4DAF4DXrW5Wrg_yoW8Zr1Upa 9rtw1ayFZ7Xan0va13Zr48J34aya1kXrZ3AF1jkrW0vws8Gr4fXrWktw42gasrJ34Igrya v3W0y34UZFs8Zw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvG14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r 4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2Wl Yx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbV WUJVW8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7I2V7IY0VAS07Al zVAYIcxG8wCY02Avz4vE14v_KwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJV W8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF 1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6x IIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAI cVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa 73UjIFyTuYvjfUFVyIUUUUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/21/2021 10:00 PM, Steven Rostedt wrote: > On Mon, 21 Jun 2021 09:21:31 +0800 > Tiezhu Yang wrote: > >>> You have no rationale for this change. What's the purpose of this? >> The "System Benchmarks Index Score" of UnixBench under FUNCTION_TRACER >> is lower than !FUNCTION_TRACER, I want to use this new cmdline argument >> ftrace_disabled to test it, this is the original intention. >> >> I see the following help info of "config FUNCTION_TRACER": >> >> [If it's runtime disabled (the bootup default), then the overhead of the >> instructions is very small and not measurable even in micro-benchmarks.] > Those benchmarks were done a long time ago, and they may be measurable today :-/ > >> I am not quite understand the above description, could you tell me how to >> avoid the runtime performance overhead under FUNCTION_TRACER? > Anyway, your patch wont do anything to change the benchmarks. > > When CONFIG_FUNCTION_TRACER is enabled, on x86_64, most functions will > start with a call to fentry. At boot up, these functions will be > converted over to become a nop. And thinking about it, "ftrace_disable" > stops all conversions, so if you add that to the kernel command line, > those calls to fentry, wont be converted to nops, and you'll make > things much worse! > > Now, some versions of gcc (and perhaps clang) can do the conversion to > nops at compile time (in which case, your patch would keep the nops and > not the calls to fentry). > > The overhead that FUNCTION_TRACER adds is the 5 byte nop at the start > of most functions. This causes a slight hit to instruction cache, and a > minuscule amount of time in the instruction pipeline of the CPU. This > is the "overhead" that is talked about. Your patch doesn't do anything > to address it. The only way to remove that overhead is to compile the > kernel without CONFIG_FUNCTION_TRACER. > > -- Steve OK, I see, thank you very much. Thanks, Tiezhu