linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: cmetcalf@mellanox.com (Chris Metcalf)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 1/4] nmi_backtrace: add more trigger_*_cpu_backtrace() methods
Date: Mon, 8 Aug 2016 11:49:57 -0400	[thread overview]
Message-ID: <d023a7b0-d3e0-4318-3a62-d0b2da99d2e4@mellanox.com> (raw)
In-Reply-To: <20160808135711.GA13300@pathway.suse.cz>

On 8/8/2016 9:57 AM, Petr Mladek wrote:
> On Thu 2016-07-14 16:50:29, Chris Metcalf wrote:
>> Currently you can only request a backtrace of either all cpus, or
>> all cpus but yourself.  It can also be helpful to request a remote
>> backtrace of a single cpu, and since we want that, the logical
>> extension is to support a cpumask as the underlying primitive.
>>
>> This change modifies the existing lib/nmi_backtrace.c code to take
>> a cpumask as its basic primitive, and modifies the linux/nmi.h code
>> to use either the old "all/all_but_self" arch methods, or the new
>> "cpumask" method, depending on which is available.
> I triggered this function using
>    echo l >/proc/sysrq-trigger
>
>
> and got
>
> [  270.791328] -----------  All but itself: ---------------------
>
> [  270.791331] ===============================
> [  270.791331] [ INFO: suspicious RCU usage. ]
> [  270.791333] 4.8.0-rc1-4-default+ #3086 Not tainted
> [  270.791333] -------------------------------
> [  270.791335] ./include/linux/rcupdate.h:556 Illegal context switch in RCU read-side critical section!

Ah hah, you tested this with CPUMASK_OFFSTACK, which I didn't.
That explains why you got RCU kmalloc warnings.

>> +	cpumask_copy(mask, cpu_online_mask);
>> +	cpumask_clear_cpu(cpu, mask);
>> +	arch_trigger_cpumask_backtrace(mask);
>> +	put_cpu();
>> +	free_cpumask_var(mask);
>> +	return true;
> Also this looks too much code for an inlined function.
> It is rather slow and there is not a big gain. I would move
> the definition to lib/nmi_backtrace.c.

After some thought, I ended up just removing both cpumask allocation
sites.  For the allbutself() case, I just re-introduced the "include_self"
boolean that the code used to have.  If it is false when we get into the inner
nmi_trigger_cpumask_backtrace(), I just clear the cpu bit of the current
cpu.  It requires passing a funny boolean around with the mask, but the
alternative (if we don't want to allocate a mask on this path) is to
break apart the nmi_trigger_cpumask_backtrace() function so we can
piggy-back on its locking and its cpumask and set up the cpumask the
way we want, which I think is too much added ugliness.

For the trigger_single_cpu_backtrace() case, I remembered that there was
a cpumask_of() function that we can use that is fast and doesn't allocate,
even with CPUMASK_OFFSTACK, so I just used that instead.

> PS: I am sorry for sending this so late in the game. I was
> curious why the patch had not been upstream yet and. I made
> a closer look to give a Reviewed-by tag...

No worries - even a late review is much better than none!  I'll
send v7 shortly and please do let me know if it works for you.

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

  reply	other threads:[~2016-08-08 15:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201604031905.WLWlnyKg%fengguang.wu@intel.com>
2016-04-05 17:26 ` [PATCH v5 0/4] improvements to the nmi_backtrace code Chris Metcalf
2016-04-05 17:26   ` [PATCH v5 1/4] nmi_backtrace: add more trigger_*_cpu_backtrace() methods Chris Metcalf
2016-04-14 15:17     ` Aaron Tomlin
2016-04-05 17:26   ` [PATCH v5 2/4] nmi_backtrace: do a local dump_stack() instead of a self-NMI Chris Metcalf
2016-04-14 15:19     ` Aaron Tomlin
2016-04-05 17:26   ` [PATCH v5 4/4] nmi_backtrace: generate one-line reports for idle cpus Chris Metcalf
2016-07-13 18:44   ` [PATCH v5 0/4] improvements to the nmi_backtrace code Chris Metcalf
2016-07-14 20:50     ` [PATCH v6 " Chris Metcalf
2016-07-14 20:50       ` [PATCH v6 1/4] nmi_backtrace: add more trigger_*_cpu_backtrace() methods Chris Metcalf
2016-08-08 13:57         ` Petr Mladek
2016-08-08 15:49           ` Chris Metcalf [this message]
2016-07-14 20:50       ` [PATCH v6 2/4] nmi_backtrace: do a local dump_stack() instead of a self-NMI Chris Metcalf
2016-07-14 20:50       ` [PATCH v6 4/4] nmi_backtrace: generate one-line reports for idle cpus Chris Metcalf

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=d023a7b0-d3e0-4318-3a62-d0b2da99d2e4@mellanox.com \
    --to=cmetcalf@mellanox.com \
    --cc=linux-arm-kernel@lists.infradead.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).