LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org,
	"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Subject: Re: [PATCH] powerpc/64: ftrace don't trace real mode
Date: Mon, 23 Mar 2020 14:10:39 +1000	[thread overview]
Message-ID: <1584936504.dbruogn3re.astroid@bobo.none> (raw)
In-Reply-To: <1584893587.qg26sf1ty0.naveen@linux.ibm.com>

Naveen N. Rao's on March 23, 2020 2:17 am:
> Nicholas Piggin wrote:
>> Naveen N. Rao's on March 21, 2020 4:39 am:
>>> Hi Nick,
>>> 
>>> Nicholas Piggin wrote:
>>>> This warns and prevents tracing attempted in a real-mode context.
>>> 
>>> Is this something you're seeing often? Last time we looked at this, KVM 
>>> was the biggest offender and we introduced paca->ftrace_enabled as a way 
>>> to disable ftrace while in KVM code.
>> 
>> Not often but it has a tendancy to blow up the least tested code at the
>> worst times :)
>> 
>> Machine check is bad, I'm sure HMI too but I haven't tested that yet.
>> 
>> I've fixed up most of it with annotations, this is obviously an extra
>> safety not something to rely on like ftrace_enabled. Probably even the
>> WARN_ON here is dangerous here, but I don't want to leave these bugs
>> in there.
> 
> Ok, makes sense.
> 
>> 
>> Although the machine check and hmi code touch a fair bit of stuff and
>> annotating is a bit fragile. It might actually be better if the
>> paca->ftrace_enabled could be a nesting counter, then we could use it
>> in machine checks too and avoid a lot of annotations.
> 
> I'm not too familiar with MC/HMI, but I suppose those aren't re-entrant?  
> If those have access to an emergency stack, can we save/restore 
> ftrace_enabled state across the handlers?

Yeah that's true. They're not highly reentrant though, we could just 
make it an 8 bit counter, it's nicer than saving / restoring from stack
(but I guess I could do that too).

> 
> We're primarily disabling ftrace across idle/offline/KVM right now. I'm 
> not sure if nesting is useful there.
> 
>> 
>>> While this is cheap when handling ftrace_regs_caller() as done in this 
>>> patch, for simple function tracing (see below), we will have to grab the 
>>> MSR which will slow things down slightly.
>> 
>> mfmsr is not too bad these days. 
> 
> That's great!

Thanks,
Nick

      reply	other threads:[~2020-03-23  4:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 15:25 [PATCH] powerpc/64: ftrace don't trace real mode Nicholas Piggin
2020-03-20 18:39 ` Naveen N. Rao
2020-03-21  6:32   ` Nicholas Piggin
2020-03-22 16:17     ` Naveen N. Rao
2020-03-23  4:10       ` Nicholas Piggin [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=1584936504.dbruogn3re.astroid@bobo.none \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    /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