[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d069626-1aed-6244-b932-7853e832eb70@linux.alibaba.com>
Date: Sat, 9 Oct 2021 10:56:40 +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
On 2021/10/9 上午7:48, Steven Rostedt wrote:
> On Sun, 3 Oct 2021 21:42:10 +0800
> Yinan Liu <yinan@...ux.alibaba.com> wrote:
>
>> 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.
>
> Right, there's no guarantee that the .text portion of a module is
> placed before or after the .init.text portion.
yes.
>
>>
>> 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?
>
> Probably just keep the sorting algorithm in the kernel and take place
> on module load.
>
> If you still want to sort at compile time, then do the sort for .init
> functions separate from the .text ones, and have a way to extract this
> information (shouldn't be too hard) in the kernel at module load, and
> then just swap the init and text functions if they were added in the
> reverse order that was expect.
>
> The functions in .init will either be before all the functions in .text
> or after. They wont be intermingled. Thus, if they are both sorted,
> then they are placed correctly or the two groups of functions need to
> be switched. No other sorting should be necessary.
Thanks so much! I see. And I will have a try.
>
> -- Steve
>
Best regards!
-- Yinan liu
Powered by blists - more mailing lists