[PATCH v3] arm64: mte: allow async MTE to be upgraded to sync on a per-CPU basis

Catalin Marinas catalin.marinas at arm.com
Mon Jun 14 11:04:58 PDT 2021


On Fri, Jun 11, 2021 at 02:51:01PM -0700, Peter Collingbourne wrote:
> +static ssize_t mte_upgrade_async_store(struct device *dev,
> +				       struct device_attribute *attr,
> +				       const char *buf, size_t count)
> +{
> +	ssize_t ret;
> +	u32 val;
> +	u64 tcf;
> +
> +	ret = kstrtou32(buf, 0, &val);
> +	if (ret < 0)
> +		return ret;
> +
> +	tcf = ((u64)val) << SCTLR_EL1_TCF0_SHIFT;
> +	if (tcf != SCTLR_EL1_TCF0_NONE && tcf != SCTLR_EL1_TCF0_SYNC &&
> +	    tcf != SCTLR_EL1_TCF0_ASYNC)
> +		return -EINVAL;
> +
> +	device_lock(dev);
> +	per_cpu(mte_upgrade_async, dev->id) = tcf;
> +
> +	if (cpu_online(dev->id))
> +		ret = smp_call_function_single(dev->id, sync_sctlr, NULL, 0);

Forgot about this. I get it now, you only need to kick the CPU that is
getting changed. This looks fine.

-- 
Catalin



More information about the linux-arm-kernel mailing list