From: Scott Wood <scottwood@freescale.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: <linuxppc-dev@lists.ozlabs.org>,
Tiejun Chen <tiejun.chen@intel.com>, <kexec@lists.infradead.org>
Subject: Re: [RFC PATCH 14/17] powerpc/book3e-64/kexec: Enable SMP release
Date: Tue, 25 Aug 2015 18:40:42 -0500 [thread overview]
Message-ID: <1440546042.16577.74.camel@freescale.com> (raw)
In-Reply-To: <1440467874.16933.1.camel@ellerman.id.au>
On Tue, 2015-08-25 at 11:57 +1000, Michael Ellerman wrote:
> On Mon, 2015-08-24 at 15:25 -0500, Scott Wood wrote:
> > On Thu, 2015-08-20 at 14:54 +1000, Michael Ellerman wrote:
> > > Hi Scott,
> > >
> > > Sorry for the delay. So I'm back to square one on this patch.
> > >
> > > On Sat, 2015-07-18 at 15:08 -0500, Scott Wood wrote:
> > > > booted_from_exec is similar to __run_at_load, except that it is set
> > > > for
> > > > regular kexec as well as kdump.
> > > >
> > > > The flag is needed because the SMP release mechanism for FSL book3e is
> > > > different from when booting with normal hardware. In theory we could
> > > > simulate the normal spin table mechanism, but not at the addresses
> > > > U-Boot put in the device tree -- so there'd need to be even more
> > > > communication between the kernel and kexec to set that up. Since
> > > > there's already a similar flag being set (for kdump only), this seemed
> > > > like a reasonable approach.
> > >
> > > Although this is a reasonable approach, I don't think it's the best
> > > approach.
> > >
> > > AFAICS there's no reason why we can't use a device tree property for
> > > this,
> > > so I think we should do that.
> >
> > OK, I'll look into that.
>
> Thanks.
>
> > > > diff --git a/arch/powerpc/platforms/85xx/smp.c
> > > > b/arch/powerpc/platforms/85xx/smp.c
> > > > index 5152289..4abda43 100644
> > > > --- a/arch/powerpc/platforms/85xx/smp.c
> > > > +++ b/arch/powerpc/platforms/85xx/smp.c
> > > > @@ -305,10 +310,13 @@ static int smp_85xx_kick_cpu(int nr)
> > > > __secondary_hold_acknowledge = -1;
> > > > }
> > > > #endif
> > > > - flush_spin_table(spin_table);
> > > > - out_be32(&spin_table->pir, hw_cpu);
> > > > - out_be32(&spin_table->addr_l, __pa(__early_start));
> > > > - flush_spin_table(spin_table);
> > > > +
> > > > + if (have_spin_table) {
> > > > + flush_spin_table(spin_table);
> > > > + out_be32(&spin_table->pir, hw_cpu);
> > > > + out_be32(&spin_table->addr_l, __pa(__early_start));
> > > > + flush_spin_table(spin_table);
> > > > + }
> > > >
> > > > /* Wait a bit for the CPU to ack. */
> > > > if (!spin_event_timeout(__secondary_hold_acknowledge == hw_cpu,
> > >
> > > This looks like it's inside an #ifdef CONFIG_PPC32 block, which doesn't
> > > make
> > > sense, so I must be missing a lead-up patch or something? (I looked on
> > > the
> > > list
> > > but didn't find anything immediately)
> >
> > Thanks for catching this.
> >
> > This is apparently a mismerge due to the code having been previously
> > worked
> > on in the context of the SDK tree, which does not have that code inside
> > #ifdef CONFIG_PPC32. When I then applied the result to mainline,
> > everything
> > still appeared to work, because there's no real consequence to writing to
> > the
> > spin table in this case -- it's just a no-op.
>
> Aha, that's good, I stared at it for ages thinking I was going mad, but I
> wasn't!
>
> > setup_64.c is the part where checking booted_from_kexec (or devicetree
> > equivalent) really matters.
>
> OK. Can we avoid that too?
>
> All smp_release_cpus() does is whack __secondary_hold_spinloop and then spin
> for a while. For the non-kexec case writing to __secondary_hold_spinloop
> should
> be harmless I think, so the only problem is we'll get stuck for a while in
> the
> udelay() loop.
>
> But you could avoid that by preemptively setting spinning_secondaries to 0
> in
> platform code.
>
> That'd have to be in ppc_md.init_early(), but that's actually not very
> early,
> the device tree is already unflattened.
>
> I guess it's arguable whether that's more or less horrible than adding an
> #ifdef'ed booted_from_kexec check, but I think I'd prefer the
> spinning_secondaries solution.
We'd still need the device tree property regardless of whether we keep
use_spinloop() or set spinning_secondaries to zero.
use_spinloop() (with a device tree property rather than booted_from_kexec)
seems cleaner:
- Avoids depending on the fact that some piece of platform code executes
after spinning_secondaries is initialized but before smp_release_cpus().
- Doesn't put a different requirement on platform code based on 32 versus 64
bit (we have too many 32 versus 64 bit differences as is).
- Doesn't require the change in all relevant platform code files (we have
both corenet_generic and qemu_e500, both of which support both 32 and 64 bit,
and custom boards might not all use corenet_generic), whether the platform
supports kexec or not. I doesn't look like there's any non-Freescale book3e-
64 left in the kernel[1], but if it ever gets added, it would also be
affected by a solution that requires platform code to do something to
preserve the current behavior.
-Scott
[1] If this is true, and won't likely change, can the non-fsl book3e-64 TLB
miss handlers and such come out?
next prev parent reply other threads:[~2015-08-25 23:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-18 20:08 [RFC PATCH 00/17] powerpc/fsl-book3e-64: kexec/kdump support Scott Wood
2015-07-18 20:08 ` [RFC PATCH 01/17] powerpc/85xx: Load all early TLB entries at once Scott Wood
2015-07-18 20:08 ` [RFC PATCH 02/17] powerpc/85xx: Don't use generic timebase sync on 64-bit Scott Wood
2015-07-18 20:08 ` [RFC PATCH 03/17] crypto: caam: Blacklist CAAM when kexec is enabled Scott Wood
2015-07-18 20:08 ` [RFC PATCH 04/17] powerpc/fsl-corenet: Disable coreint if " Scott Wood
2015-07-18 20:08 ` [RFC PATCH 05/17] powerpc/fsl-booke-64: Don't limit ppc64_rma_size to one TLB entry Scott Wood
2015-07-18 20:08 ` [RFC PATCH 06/17] powerpc/85xx: Implement 64-bit kexec support Scott Wood
2015-07-18 20:08 ` [RFC PATCH 07/17] powerpc/e6500: kexec: Handle hardware threads Scott Wood
2015-07-18 20:08 ` [RFC PATCH 08/17] powerpc/book3e-64: rename interrupt_end_book3e with __end_interrupts Scott Wood
2015-07-18 20:08 ` [RFC PATCH 09/17] powerpc/booke64: Fix args to copy_and_flush Scott Wood
2015-07-18 20:08 ` [RFC PATCH 10/17] powerpc/book3e: support CONFIG_RELOCATABLE Scott Wood
2015-07-18 20:08 ` [RFC PATCH 11/17] powerpc/book3e/kdump: Enable crash_kexec_wait_realmode Scott Wood
2015-07-18 20:08 ` [RFC PATCH 12/17] powerpc/book3e-64: Don't limit paca to 256 MiB Scott Wood
2015-07-18 20:08 ` [RFC PATCH 13/17] powerpc/book3e-64/kexec: create an identity TLB mapping Scott Wood
2015-07-18 20:08 ` [RFC PATCH 14/17] powerpc/book3e-64/kexec: Enable SMP release Scott Wood
2015-08-18 4:51 ` [RFC,14/17] " Michael Ellerman
2015-08-18 5:09 ` Scott Wood
2015-08-20 4:54 ` [RFC PATCH 14/17] " Michael Ellerman
2015-08-24 20:25 ` Scott Wood
2015-08-25 1:57 ` Michael Ellerman
2015-08-25 23:40 ` Scott Wood [this message]
2015-08-26 1:13 ` Michael Ellerman
2015-07-18 20:08 ` [RFC PATCH 15/17] powerpc/booke: Only use VIRT_PHYS_OFFSET on booke32 Scott Wood
2015-07-18 20:08 ` [RFC PATCH 16/17] powerpc/book3e-64/kexec: Set "r4 = 0" when entering spinloop Scott Wood
2015-07-18 20:08 ` [RFC PATCH 17/17] powerpc/book3e-64: Enable kexec Scott Wood
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=1440546042.16577.74.camel@freescale.com \
--to=scottwood@freescale.com \
--cc=kexec@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=tiejun.chen@intel.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;
as well as URLs for NNTP newsgroup(s).