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]
Date:   Fri, 6 Jul 2018 17:21:00 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Guo Ren <ren_guo@...ky.com>
Cc:     linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
        tglx@...utronix.de, daniel.lezcano@...aro.org,
        jason@...edaemon.net, arnd@...db.de, c-sky_gcc_upstream@...ky.com,
        gnu-csky@...tor.com, thomas.petazzoni@...tlin.com,
        wbx@...ibc-ng.org, green.hu@...il.com
Subject: Re: [PATCH V2 16/19] csky: SMP support

On Fri, Jul 06, 2018 at 08:26:31PM +0800, Guo Ren wrote:
> On Fri, Jul 06, 2018 at 12:43:52PM +0100, Mark Rutland wrote:
> > Please see the devicetree spec [1], section 2.3.4. Valid values are:
> > 
> > * "okay" // equivalent to no status property present
> > * "disabled"
> > * "fail"
> > * "fail-sss"
> Nice tip, thx.
> 
> > I'm a bit confused. You write (1 << cpu) into cv<29, 0>, to enable a
> > particular CPU, so I assume that bit uniquely identifies a CPU,
> Yes, you're right and cr<29, 0>'s bit uniquely identifies a cpu.
> 
> > and
> > therefore the reg is some unique ID for the CPU.
> static int csky_of_cpu(struct device_node *node)
> {
> 	const char *status;
> 
> 	if (of_property_read_string(node, "status", &status))
> 		status = "okay";
> 
> 	if (strcmp(status, "disabled") == 0)
> 		goto error;
> 
> 	return 1;
> error:
> 	return 0;
> }

Please don't open-code this. Use of_device_is_available(), which checks
the status property itself. e.g.

void __init setup_smp(void)
{
	struct device_node *node = NULL;

	while ((node = of_find_node_by_type(node, "cpu"))) {
		if (!of_device_is_available(node))
			continue;

		...
	}
}

> void __init setup_smp(void)
> {
> 	struct device_node *node = NULL;
> 	int i = 0;
> 
> 	while ((node = of_find_node_by_type(node, "cpu"))) {
> 		if (!csky_of_cpu(node))
> 			continue;
> 
> 		set_cpu_possible(i, true);
> 		set_cpu_present(i, true);
> 
> 		i++;
> 	}
> }
> Hmm?
> 
> No <reg> in next version patch, it's no use.

Please use the reg property, you need it to describe which particular
CPUs are available.

You probably also want a mapping from Linux logical CPU id to your
physical CPU id, and a sanity check on this. See arm64 for an example.

> > I see.
> > 
> > Is this SMP bringup mechanism architectual, or are you likely to need
> > another mechanism to turn on CPUs on future chips?
> It's the only SMP bringup mechanism architectual for C-SKY SMP. There is
> no another way in future and SOC vendor couldn't change it.
> 
> > You probably want to use an enable-method property to describe this.
> No, thx.

Fair enough.

Thanks,
Mark.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ