linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Xiaoming Ni <nixiaoming@huawei.com>
To: <oss@buserror.net>, <mpe@ellerman.id.au>,
	<benh@kernel.crashing.org>, <paulus@samba.org>,
	<paul.gortmaker@windriver.com>, <chenhui.zhao@freescale.com>,
	<Yuantian.Tang@feescale.com>, <linuxppc-dev@lists.ozlabs.org>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
	<gregkh@linuxfoundation.org>
Cc: liuwenliang@huawei.com, wangle6@huawei.com,
	nixiaoming@huawei.com, chenjianguo3@huawei.com
Subject: [PATCH v2 0/2] powerpc:85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n
Date: Wed, 29 Sep 2021 11:36:44 +0800	[thread overview]
Message-ID: <20210929033646.39630-1-nixiaoming@huawei.com> (raw)
In-Reply-To: <021a5ee3-25ef-1de4-0111-d4c3281e0f45@huawei.com>

When CONFIG_SMP=y, timebase synchronization is required for mpc8572 when
 the second kernel is started
	arch/powerpc/kernel/smp.c:
	int __cpu_up(unsigned int cpu, struct task_struct *tidle)
	{
		...
		if (smp_ops->give_timebase)
			smp_ops->give_timebase();
		...
	}

	void start_secondary(void *unused)
	{
		...
		if (smp_ops->take_timebase)
			smp_ops->take_timebase();
		...
	}

When CONFIG_HOTPLUG_CPU=n and CONFIG_KEXEC_CORE=n,
 smp_85xx_ops.give_timebase is NULL,
 smp_85xx_ops.take_timebase is NULL,
As a result, the timebase is not synchronized.

test code:
	for i in $(seq 1 3); do taskset 1 date; taskset 2 date; sleep 1; echo;done
log:
	Sat Sep 25 18:50:00 CST 2021
	Sat Sep 25 19:07:47 CST 2021

	Sat Sep 25 18:50:01 CST 2021
	Sat Sep 25 19:07:48 CST 2021

	Sat Sep 25 18:50:02 CST 2021
	Sat Sep 25 19:07:49 CST 2021

Code snippet about give_timebase and take_timebase assignments:
	arch/powerpc/platforms/85xx/smp.c:
	#ifdef CONFIG_HOTPLUG_CPU
	#ifdef CONFIG_FSL_CORENET_RCPM
		fsl_rcpm_init();
	#endif
	#ifdef CONFIG_FSL_PMC
		mpc85xx_setup_pmc();
	#endif
		if (qoriq_pm_ops) {
			smp_85xx_ops.give_timebase = mpc85xx_give_timebase;
			smp_85xx_ops.take_timebase = mpc85xx_take_timebase;

config dependency:
	FSL_CORENET_RCPM depends on the PPC_E500MC.
	FSL_PMC depends on SUSPEND.
	SUSPEND depends on ARCH_SUSPEND_POSSIBLE.
	ARCH_SUSPEND_POSSIBLE depends on !PPC_E500MC.

CONFIG_HOTPLUG_CPU and CONFIG_FSL_PMC require the timebase function, but
the timebase should not depend on CONFIG_HOTPLUG_CPU and CONFIG_FSL_PMC.
Therefore, adjust the macro control range. Ensure that the corresponding
 timebase hook function is not empty when the dtsi node is configured.

-----
changes in v2:
 1. add new patch: "powerpc:85xx:Fix oops when mpc85xx_smp_guts_ids node
  cannot be found"
 2. Using !CONFIG_FSL_CORENET_RCPM to manage the timebase code of !PPC_E500MC

v1:
 https://lore.kernel.org/lkml/20210926025144.55674-1-nixiaoming@huawei.com
------

Xiaoming Ni (2):
  powerpc:85xx:Fix oops when mpc85xx_smp_guts_ids node cannot be found
  powerpc:85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n

 arch/powerpc/platforms/85xx/Makefile         |  4 +++-
 arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c |  7 +++++--
 arch/powerpc/platforms/85xx/smp.c            | 12 ++++++------
 3 files changed, 14 insertions(+), 9 deletions(-)

-- 
2.27.0


  reply	other threads:[~2021-09-29  3:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26  2:51 [PATCH] powerpc:85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n Xiaoming Ni
2021-09-26 12:34 ` Xiaoming Ni
2021-09-29  3:36   ` Xiaoming Ni [this message]
2021-09-29  3:36     ` [PATCH v2 1/2] powerpc:85xx:Fix oops when mpc85xx_smp_guts_ids node cannot be found Xiaoming Ni
2021-09-29  3:36     ` [PATCH v2 2/2] powerpc:85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n Xiaoming Ni
2021-10-11 12:06     ` [PATCH v2 0/2] " Michael Ellerman

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=20210929033646.39630-1-nixiaoming@huawei.com \
    --to=nixiaoming@huawei.com \
    --cc=Yuantian.Tang@feescale.com \
    --cc=benh@kernel.crashing.org \
    --cc=chenhui.zhao@freescale.com \
    --cc=chenjianguo3@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=liuwenliang@huawei.com \
    --cc=mpe@ellerman.id.au \
    --cc=oss@buserror.net \
    --cc=paul.gortmaker@windriver.com \
    --cc=paulus@samba.org \
    --cc=stable@vger.kernel.org \
    --cc=wangle6@huawei.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).