lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210929033646.39630-1-nixiaoming@huawei.com>
Date:   Wed, 29 Sep 2021 11:36:44 +0800
From:   Xiaoming Ni <nixiaoming@...wei.com>
To:     <oss@...error.net>, <mpe@...erman.id.au>,
        <benh@...nel.crashing.org>, <paulus@...ba.org>,
        <paul.gortmaker@...driver.com>, <chenhui.zhao@...escale.com>,
        <Yuantian.Tang@...scale.com>, <linuxppc-dev@...ts.ozlabs.org>,
        <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>,
        <gregkh@...uxfoundation.org>
CC:     <wangle6@...wei.com>, <liuwenliang@...wei.com>,
        <chenjianguo3@...wei.com>, <nixiaoming@...wei.com>
Subject: [PATCH v2 0/2] powerpc:85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ