linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Michael Neuling <mikey@neuling.org>,
	linuxppc-dev@lists.ozlabs.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Nicholas Piggin <npiggin@gmail.com>
Subject: Re: [PATCH] powerpc/ftrace: Handle large kernel configs
Date: Fri, 07 Jan 2022 13:18:30 +0530	[thread overview]
Message-ID: <1641541262.djkf8dxvi1.naveen@linux.ibm.com> (raw)
In-Reply-To: <e1397c7f-abbd-c5dc-1bf6-74f409b07b4c@csgroup.eu>

Hi Christophe,
Sorry for the delay, catching up with some of the earlier emails now..


Christophe Leroy wrote:
> Hi Naveen,
> 
> Le 16/10/2018 à 22:25, Naveen N. Rao a écrit :
> ...
> 
>> +/*
>> + * If this is a compiler generated long_branch trampoline (essentially, a
>> + * trampoline that has a branch to _mcount()), we re-write the branch to
>> + * instead go to ftrace_[regs_]caller() and note down the location of this
>> + * trampoline.
>> + */
>> +static int setup_mcount_compiler_tramp(unsigned long tramp)
>> +{
>> +	int i, op;
>> +	unsigned long ptr;
>> +	static unsigned long ftrace_plt_tramps[NUM_FTRACE_TRAMPS];
>> +
>> +	/* Is this a known long jump tramp? */
>> +	for (i = 0; i < NUM_FTRACE_TRAMPS; i++)
>> +		if (!ftrace_tramps[i])
>> +			break;
>> +		else if (ftrace_tramps[i] == tramp)
>> +			return 0;
>> +
>> +	/* Is this a known plt tramp? */
>> +	for (i = 0; i < NUM_FTRACE_TRAMPS; i++)
>> +		if (!ftrace_plt_tramps[i])
>> +			break;
>> +		else if (ftrace_plt_tramps[i] == tramp)
>> +			return -1;
> 
> I don't understand how this is supposed to work.
> ftrace_plt_tramps[] being a static table, it is set to 0s at startup.
> So the above loop breaks at first round.
> 
> Then ftrace_plt_tramps[i] is never/nowhere set.
> 
> So I just see it as useless.
> 
> Am I missing something ?

No, that's correct. I had posted a cleanup of this a year back as part 
of the ftrace_direct enablement. I have updated that series and will be 
posting it out soon (though I should rebase it atop your livepatch 
series):
http://lkml.kernel.org/r/bdc3710137c4bda8393532a789558bed22507cfe.1606412433.git.naveen.n.rao@linux.vnet.ibm.com


- Naveen

      reply	other threads:[~2022-01-07  7:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 20:25 [PATCH] powerpc/ftrace: Handle large kernel configs Naveen N. Rao
2018-10-22  9:38 ` Michael Ellerman
2021-11-29 13:09 ` [PATCH] " Christophe Leroy
2022-01-07  7:48   ` Naveen N. Rao [this message]

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=1641541262.djkf8dxvi1.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=npiggin@gmail.com \
    --cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).