From: daniel.thompson@linaro.org (Daniel Thompson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] kgdb: Fix kgdb_roundup_cpus() for arches who used smp_call_function()
Date: Sat, 3 Nov 2018 10:45:03 +0000 [thread overview]
Message-ID: <20181103104503.eftn5btx7otgufro@holly.lan> (raw)
In-Reply-To: <CAD=FV=V1eHo7Wz31DTMMNi394qwEaESTxJCYVE60Q7hpDEqRmQ@mail.gmail.com>
On Wed, Oct 31, 2018 at 02:41:14PM -0700, Doug Anderson wrote:
> > As mentioned in another part of the thread we can also add robustness
> > by skipping a cpu where csd->flags != 0 (and adding an appropriately
> > large comment regarding why). Doing the check directly is abusing
> > internal knowledge that smp.c normally keeps to itself so an accessor
> > of some kind would be needed.
>
> Sure. I could add smp_async_func_finished() that just looked like:
>
> int smp_async_func_finished(call_single_data_t *csd)
> {
> return !(csd->flags & CSD_FLAG_LOCK);
> }
>
> My understanding of all the mutual exclusion / memory barrier concepts
> employed by smp.c is pretty weak, though. I'm hoping that it's safe
> to just access the structure and check the bit directly.
>
> ...but do you think adding a generic accessor like this is better than
> just keeping track of this in kgdb directly? I could avoid the
> accessor by adding a "rounding_up" member to "struct
> debuggerinfo_struct" and doing something like this in roundup:
>
> /* If it didn't round up last time, don't try again */
> if (kgdb_info[cpu].rounding_up)
> continue
>
> kgdb_info[cpu].rounding_up = true
> smp_call_function_single_async(cpu, csd);
>
> ...and then in kgdb_nmicallback() I could just add:
>
> kgdb_info[cpu].rounding_up = false
>
> In that case we're not adding a generic accessor to smp.c that most
> people should never use.
Whilst it is very tempting to make a sarcastic reply here ("Of course! What
kgdb really needs is yet another set of condition variables") I can't
because I actually agree with the proposal. I don't really want kgdb to
be too "special" especially when it doesn't need to be.
Only thing to note is that rounding_up will not be manipulated within a
common spin lock so you might have to invest a bit of thought to make
sure any races between the master and slave as the slave CPU clears the
flag are benign.
Daniel.
next prev parent reply other threads:[~2018-11-03 10:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-30 22:18 [PATCH v2 0/2] kgdb: Fix kgdb_roundup_cpus() Douglas Anderson
2018-10-30 22:18 ` [PATCH v2 1/2] kgdb: Remove irq flags from roundup Douglas Anderson
2018-10-30 22:18 ` [PATCH v2 2/2] kgdb: Fix kgdb_roundup_cpus() for arches who used smp_call_function() Douglas Anderson
2018-10-31 1:51 ` kbuild test robot
2018-10-31 13:49 ` Peter Zijlstra
2018-10-31 17:01 ` Daniel Thompson
2018-10-31 18:40 ` Daniel Thompson
2018-10-31 21:41 ` Doug Anderson
2018-11-03 10:45 ` Daniel Thompson [this message]
2018-11-07 1:04 ` Doug Anderson
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=20181103104503.eftn5btx7otgufro@holly.lan \
--to=daniel.thompson@linaro.org \
--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).