[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174e6461-4d46-cb65-c094-c06ee3b21568@arm.com>
Date: Fri, 23 Oct 2020 09:49:53 +0100
From: Suzuki Poulose <suzuki.poulose@....com>
To: Peter Zijlstra <peterz@...radead.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>
Cc: Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>,
Mike Leach <mike.leach@...aro.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>, coresight@...ts.linaro.org,
Stephen Boyd <swboyd@...omium.org>,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCHv2 2/4] coresight: tmc-etf: Fix NULL ptr dereference in
tmc_enable_etf_sink_perf()
Hi Peter
On 10/23/20 8:39 AM, Peter Zijlstra wrote:
> On Thu, Oct 22, 2020 at 03:20:33PM -0600, Mathieu Poirier wrote:
>> Suzuki's depiction of the usecase is accurate. Using the pid of the process
>> that created the events comes out of a discussion you and I had in the common
>> area by the Intel booth at ELC in Edinburgh in the fall of 2018. At the time I
>> exposed the problem of having multiple events sharing the same HW resources and
>> you advised to proceed this way.
>
> Bah, I was afraid of that. I desperately tried to find correspondence on
> it, but alas, verbal crap doesn't end up in the Sent folder :-/
>
>> That being said it is plausible that I did not expressed myself clearly enough
>> for you to understand the full extend of the problem. If that is the case we
>> are more than willing to revisit that solution. Do you see a better option than
>> what has currently been implemented?
>
> Moo... that really could've done with a comment I suppose.
>
> So then I don't understand the !->owner issue, that only happens when
> the task dies, which cannot be concurrent with event creation. Are you
Part of the patch from Sai, fixes this by avoiding the dereferencing
after event creation (by caching it). But the kernel events needs
fixing.
One follow up question on the !->owner issue. Given the ->owner is
dying, does it prevent events from being scheduled ? Or is there a delay
between that and eventually stopping the events. In this case, we hit
the issue when :
A A or B ?
event_start()
... event->owner = NULL
READ_ONCE(event->owner);
Is this expected ?
> somehow accessing ->owner later?
>
> As for the kernel events.. why do you care about the actual task_struct
> * in there? I see you're using it to grab the task-pid, but how is that
> useful?
Correct, kernel events are something that the driver didn't account for.
May be we could handle this case with a "special pid" and simply
disallow sharing (which is fine I believe, given there are not grouping
for the kernel created events).
Suzuki
Powered by blists - more mailing lists