From: yanjiang.jin@windriver.com (yjin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] socfpga_a10: reset CPU1 in socfpga_cpu_kill()
Date: Mon, 15 May 2017 17:05:49 +0800 [thread overview]
Message-ID: <59196F6D.40400@windriver.com> (raw)
In-Reply-To: <20170512143600.GB18818@leverpostej>
On 2017?05?12? 22:36, Mark Rutland wrote:
> On Wed, May 10, 2017 at 01:13:04AM -0400, yanjiang.jin at windriver.com wrote:
>> From: Yanjiang Jin <yanjiang.jin@windriver.com>
>>
>> Kexec's second kernel would hang if CPU1 isn't reset.
>>
>> Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
>> ---
>> arch/arm/mach-socfpga/platsmp.c | 12 +++++++++++-
>> 1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
>> index 0ee7677..db3940e 100644
>> --- a/arch/arm/mach-socfpga/platsmp.c
>> +++ b/arch/arm/mach-socfpga/platsmp.c
>> @@ -117,6 +117,16 @@ static int socfpga_cpu_kill(unsigned int cpu)
>> {
>> return 1;
>> }
>> +
>> +static int socfpga_a10_cpu_kill(unsigned int cpu)
>> +{
>> + /* This will put CPU #1 into reset. */
>> + if (socfpga_cpu1start_addr)
>> + writel(RSTMGR_MPUMODRST_CPU1, rst_manager_base_addr +
>> + SOCFPGA_A10_RSTMGR_MODMPURST);
>> +
>> + return 1;
>> +}
>> #endif
> I agree that currently, socfpga_cpu_die is completely bogus, as the CPU is just
> sat in WFI with the MMU, caches, etc enabled, and not actually off:
>
> static void socfpga_cpu_die(unsigned int cpu)
> {
> /* Do WFI. If we wake up early, go back into WFI */
> while (1)
> cpu_do_idle();
> }
>
> ... so that goes wrong as soon as the kerenl text gets ovewritten.
>
> However, AFAICT, this patch forcibly resets is without any teardown
> having happened. That will surely result in data being lost from the
> caches, for example.
>
> So I think this is incomplete.
Hi Mark,
I think I got what you mean. So far, flush_cache is the only thing that
I can think of.
Can we just add flush_cache_all in cpu_die() now, and add other missing
parts(if have) in the future.
Thanks!
Yanjiang
> Thanks,
> Mark.
>
>>
>> static const struct smp_operations socfpga_smp_ops __initconst = {
>> @@ -133,7 +143,7 @@ static int socfpga_cpu_kill(unsigned int cpu)
>> .smp_boot_secondary = socfpga_a10_boot_secondary,
>> #ifdef CONFIG_HOTPLUG_CPU
>> .cpu_die = socfpga_cpu_die,
>> - .cpu_kill = socfpga_cpu_kill,
>> + .cpu_kill = socfpga_a10_cpu_kill,
>> #endif
>> };
>>
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: yjin <yanjiang.jin@windriver.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: <dinguyen@kernel.org>, <dinguyen@opensource.altera.com>,
<linux@arm.linux.org.uk>, <jinyanjiang@gmail.com>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] socfpga_a10: reset CPU1 in socfpga_cpu_kill()
Date: Mon, 15 May 2017 17:05:49 +0800 [thread overview]
Message-ID: <59196F6D.40400@windriver.com> (raw)
In-Reply-To: <20170512143600.GB18818@leverpostej>
On 2017年05月12日 22:36, Mark Rutland wrote:
> On Wed, May 10, 2017 at 01:13:04AM -0400, yanjiang.jin@windriver.com wrote:
>> From: Yanjiang Jin <yanjiang.jin@windriver.com>
>>
>> Kexec's second kernel would hang if CPU1 isn't reset.
>>
>> Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
>> ---
>> arch/arm/mach-socfpga/platsmp.c | 12 +++++++++++-
>> 1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
>> index 0ee7677..db3940e 100644
>> --- a/arch/arm/mach-socfpga/platsmp.c
>> +++ b/arch/arm/mach-socfpga/platsmp.c
>> @@ -117,6 +117,16 @@ static int socfpga_cpu_kill(unsigned int cpu)
>> {
>> return 1;
>> }
>> +
>> +static int socfpga_a10_cpu_kill(unsigned int cpu)
>> +{
>> + /* This will put CPU #1 into reset. */
>> + if (socfpga_cpu1start_addr)
>> + writel(RSTMGR_MPUMODRST_CPU1, rst_manager_base_addr +
>> + SOCFPGA_A10_RSTMGR_MODMPURST);
>> +
>> + return 1;
>> +}
>> #endif
> I agree that currently, socfpga_cpu_die is completely bogus, as the CPU is just
> sat in WFI with the MMU, caches, etc enabled, and not actually off:
>
> static void socfpga_cpu_die(unsigned int cpu)
> {
> /* Do WFI. If we wake up early, go back into WFI */
> while (1)
> cpu_do_idle();
> }
>
> ... so that goes wrong as soon as the kerenl text gets ovewritten.
>
> However, AFAICT, this patch forcibly resets is without any teardown
> having happened. That will surely result in data being lost from the
> caches, for example.
>
> So I think this is incomplete.
Hi Mark,
I think I got what you mean. So far, flush_cache is the only thing that
I can think of.
Can we just add flush_cache_all in cpu_die() now, and add other missing
parts(if have) in the future.
Thanks!
Yanjiang
> Thanks,
> Mark.
>
>>
>> static const struct smp_operations socfpga_smp_ops __initconst = {
>> @@ -133,7 +143,7 @@ static int socfpga_cpu_kill(unsigned int cpu)
>> .smp_boot_secondary = socfpga_a10_boot_secondary,
>> #ifdef CONFIG_HOTPLUG_CPU
>> .cpu_die = socfpga_cpu_die,
>> - .cpu_kill = socfpga_cpu_kill,
>> + .cpu_kill = socfpga_a10_cpu_kill,
>> #endif
>> };
>>
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2017-05-15 9:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 5:13 [PATCH] socfpga_a10: fix a kexec boot issue yanjiang.jin at windriver.com
2017-05-10 5:13 ` yanjiang.jin
2017-05-10 5:13 ` [PATCH] socfpga_a10: reset CPU1 in socfpga_cpu_kill() yanjiang.jin at windriver.com
2017-05-10 5:13 ` yanjiang.jin
2017-05-12 14:25 ` Dinh Nguyen
2017-05-12 14:25 ` Dinh Nguyen
2017-05-12 14:36 ` Mark Rutland
2017-05-12 14:36 ` Mark Rutland
2017-05-15 9:05 ` yjin [this message]
2017-05-15 9:05 ` yjin
2017-05-15 10:00 ` Russell King - ARM Linux
2017-05-15 10:00 ` Russell King - ARM Linux
-- strict thread matches above, loose matches on Subject: below --
2017-05-15 9:13 [V2 PATCH] socfpga_a10: fix a kexec boot issue yanjiang.jin at windriver.com
2017-05-15 9:13 ` [PATCH] socfpga_a10: reset CPU1 in socfpga_cpu_kill() yanjiang.jin at windriver.com
2017-05-15 9:13 ` yanjiang.jin
2017-05-15 9:55 ` Russell King - ARM Linux
2017-05-15 9:55 ` Russell King - ARM Linux
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=59196F6D.40400@windriver.com \
--to=yanjiang.jin@windriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.