lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b783c9e-c129-6907-0637-5c7638158a65@linux.alibaba.com>
Date:   Sun, 3 Oct 2021 21:42:10 +0800
From:   Yinan Liu <yinan@...ux.alibaba.com>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     mark-pk.tsai@...iatek.com, peterz@...radead.org, mingo@...hat.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] scripts: ftrace - move the sort-processing in
 ftrace_init to compile time


在 2021/9/11 下午9:59, Steven Rostedt 写道:
> On Sat, 11 Sep 2021 21:50:42 +0800
> Yinan Liu <yinan@...ux.alibaba.com> wrote:
>
>> When ftrace is enabled, ftrace_init will consume a period of
>> time, usually around 15~20 ms. Approximately 40% of the time is
>> consumed by sort-processing. Moving the sort-processing to the
>> compile time can speed up the kernel boot process.
>>
> Nice. I like the idea of sorting at compile time.
Thanks !
>> performance test:
>>          env:    Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz
>>          method: before and after patching, compare the
>>                  total time of ftrace_init(), and verify
>>                  the functionality of ftrace.
>>
>>          avg_time of ftrace_init:
>>                  with patch: 8.352 ms
>>                  without patch: 15.763 ms
>>
>> Signed-off-by: Yinan Liu <yinan@...ux.alibaba.com>
>> ---
>>   kernel/trace/ftrace.c   |   5 ++-
>>   scripts/link-vmlinux.sh |   6 +--
>>   scripts/sorttable.c     |   2 +
>>   scripts/sorttable.h     | 109 +++++++++++++++++++++++++++++++++++++++++++++++-
>>   4 files changed, 115 insertions(+), 7 deletions(-)
>>
>> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>> index 7efbc8aaf7f6..c236da868990 100644
>> --- a/kernel/trace/ftrace.c
>> +++ b/kernel/trace/ftrace.c
>> @@ -6189,8 +6189,9 @@ static int ftrace_process_locs(struct module *mod,
>>   	if (!count)
>>   		return 0;
>>   
>> -	sort(start, count, sizeof(*start),
>> -	     ftrace_cmp_ips, NULL);
>> +	if (mod)
> Why can't we enforce modules to be sorted too?

hi,

Sorry for my slow progress . I have encountered some problems with the 
sorting
of the module's mcount in compile time. The .ko file will be relocated 
after insmod
or modprobe, most of the mcount relocation is based on .text section, 
but there are
also a small part of mcount relocation based on .init.text section such 
as module_init().
The loading position of .init.text and .text does not seem to be in a 
definite order.

For example, when I insmod ip_tables.ko twice, the front and back 
positions of init.text
and .text are different, so we cannot sort the mcounts in the two 
sections, which makes
the mcount sorting in the module meaningless.

What is your opinion on this?

>> +		sort(start, count, sizeof(*start),
>> +		     ftrace_cmp_ips, NULL);

> Best regards! 
> ---Yinan liu 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ