[PATCH 1/2] powerpc/64s: Fix crashes when toggling stf barrier

Nathan Lynch nathanl at linux.ibm.com
Wed May 5 08:44:59 AEST 2021


Michael Ellerman <mpe at ellerman.id.au> writes:
> -void do_stf_barrier_fixups(enum stf_barrier_type types)
> +static int __do_stf_barrier_fixups(void *data)
>  {
> +	enum stf_barrier_type types = (enum stf_barrier_type)data;
> +
>  	do_stf_entry_barrier_fixups(types);
>  	do_stf_exit_barrier_fixups(types);
> +
> +	return 0;
> +}
> +
> +void do_stf_barrier_fixups(enum stf_barrier_type types)
> +{
> +	/*
> +	 * The call to the fallback entry flush, and the fallback/sync-ori exit
> +	 * flush can not be safely patched in/out while other CPUs are executing
> +	 * them. So call __do_stf_barrier_fixups() on one CPU while all other CPUs
> +	 * spin in the stop machine core with interrupts hard disabled.
> +	 */
> +	stop_machine_cpuslocked(__do_stf_barrier_fixups, (void *)types, NULL);

Would it be preferable to avoid the explicit casts:

	stop_machine_cpuslocked(__do_stf_barrier_fixups, &types, NULL);

...

static int __do_stf_barrier_fixups(void *data)
{
	enum stf_barrier_type *types = data;

 	do_stf_entry_barrier_fixups(*types);
 	do_stf_exit_barrier_fixups(*types);

?

post_mobility_fixup() does cpus_read_unlock() before calling
pseries_setup_security_mitigations(), I think that will need to be
changed?


More information about the Linuxppc-dev mailing list