[PATCH v1 2/4] coresight: etm4x: Don't use virtual contextID for non-root PID namespace

Leo Yan leo.yan at linaro.org
Thu Nov 4 08:24:26 PDT 2021


On Thu, Nov 04, 2021 at 03:07:45PM +0000, Suzuki Kuruppassery Poulose wrote:

[...]

> > @@ -2111,6 +2111,13 @@ static ssize_t vmid_val_show(struct device *dev,
> >   	struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
> >   	struct etmv4_config *config = &drvdata->config;
> > +	/*
> > +	 * Don't use virtual contextID tracing if coming from a PID namespace.
> > +	 * See comment in ctxid_pid_store().
> > +	 */
> > +	if (task_active_pid_ns(current) != &init_pid_ns)
> > +		return -EINVAL;
> > +
> >   	spin_lock(&drvdata->spinlock);
> >   	val = (unsigned long)config->vmid_val[config->vmid_idx];
> >   	spin_unlock(&drvdata->spinlock);
> > @@ -2125,6 +2132,13 @@ static ssize_t vmid_val_store(struct device *dev,
> >   	struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
> >   	struct etmv4_config *config = &drvdata->config;
> > +	/*
> > +	 * Don't use virtual contextID tracing if coming from a PID namespace.
> > +	 * See comment in ctxid_pid_store().
> > +	 */
> > +	if (task_active_pid_ns(current) != &init_pid_ns)
> 
> Please could we add a helper function to make this obvious ?
> 
> e.g: task_is_in_root_ns(task) ?

Yeah, I will use a separate patch set to add this helper function and
polish relevant codes in the kernel.  Thanks for suggestion.

Leo



More information about the linux-arm-kernel mailing list