[PATCH v4] coresight: Serialize enabling/disabling a link device.

2019-10-18 Thread Yabin Cui
uses spinlocks to serialize enabling/disabling link devices. Fixes: a06ae8609b3d ("coresight: add CoreSight core layer framework") Signed-off-by: Yabin Cui --- v3 -> v4: moved lock from coresight_enable/disable_link() to enable/disable functions of each link device. I also removed

Re: [PATCH 0/2] coresight: Add barrier packet when moving offset forward

2019-08-26 Thread Yabin Cui
> Can I add your Tested-by ? Yes. I just sent a tested-by reply, but not sure if it works. I am not very familar with linux kernel review system.

Re: [PATCH 2/2] coresight: Add barrier packet when moving offset forward

2019-08-26 Thread Yabin Cui
Tested-by: Yabin Cui

Re: [PATCH 0/2] coresight: Add barrier packet when moving offset forward

2019-08-23 Thread Yabin Cui
Thanks for fixing this problem. I didn't realize it because I usually use a buffer size >= the default ETR buffer size, which is harder to reproduce the problem. The patches LGTM, maybe you also want to fix the problem commented by Leo Yan. I tested the patches by recording etm data with a buffer s

[PATCH v3] coresight: tmc-etr: Fix perf_data check.

2019-08-15 Thread Yabin Cui
instead of etr_perf_buffer. Also move the code setting and clearing perf_buf to more suitable places. Fixes: 3147da92a8a8 ("coresight: tmc-etr: Allocate and free ETR memory buffers for CPU-wide scenarios") Signed-off-by: Yabin Cui --- v2 -> v3: moved place of setting drvdata->p

Re: [PATCH v2] coresight: tmc-etr: Fix perf_data check.

2019-08-14 Thread Yabin Cui
> Did you actually see the check fail or is this a theoretical thing? > I'm really perplex here has I have tested this scenario many times > without issues. > I have seen this warning in dmesg output, that's how I find the problem. > In CPU wide scenarios each perf event (one per CPU) is associate

Re: [PATCH v3] coresight: Serialize enabling/disabling a link device.

2019-08-13 Thread Yabin Cui
> The patch isn't difficult to do but does go deeper in each link > drivers (ETF, funnel, replicator). Let me know if you are not > comfortable with the idea and I will see what I can do on my side. I am comfortable with the idea. I chose to add lock in coresight_enable_link() just because it is

[PATCH v2] coresight: tmc-etr: Fix updating buffer in not-snapshot mode.

2019-08-12 Thread Yabin Cui
ess data than the reality. So change to only copy the latest data fitting the available space in perf aux buffer. Signed-off-by: Yabin Cui --- v1 -> v2: copy the latest data instead of the earliest data. --- .../hwtracing/coresight/coresight-tmc-etr.c| 18 +++--- 1 file

[PATCH v3] coresight: Serialize enabling/disabling a link device.

2019-08-12 Thread Yabin Cui
adds a spinlock to serialize enabling/disabling a link device. Fixes: a06ae8609b3d ("coresight: add CoreSight core layer framework") Signed-off-by: Yabin Cui --- v2 -> v3: extend lock range to protect csdev->enable for link devices. Add fixes tag. --- driver

[PATCH v2] coresight: tmc-etr: Fix perf_data check.

2019-08-12 Thread Yabin Cui
instead of etr_perf_buffer. Fixes: 3147da92a8a8 ("coresight: tmc-etr: Allocate and free ETR memory buffers for CPU-wide scenarios") Signed-off-by: Yabin Cui --- v1 -> v2: rename perf_data to perf_buf. Add fixes tag. --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 6 +++--- driv

Re: [PATCH] coresight: Serialize enabling/disabling a link device.

2019-08-09 Thread Yabin Cui
>You may also want to protect the refcount checks below with the same lock, just >to be consistent. Good suggestion! I didn't protect it because I found other places using refcnt. But it turns out they are not link devices. I have uploaded patch v2.

[no subject]

2019-08-09 Thread Yabin Cui
From: Yabin Cui Subject: Re: [PATCH] coresight: Serialize enabling/disabling a link device. >You may also want to protect the refcount checks below with the same lock, just >to be consistent. Good suggestion! I didn't protect it because I found other places using refcnt. But it tur

[PATCH v2] coresight: Serialize enabling/disabling a link device.

2019-08-09 Thread Yabin Cui
adds a spinlock to serialize enabling/disabling a link device. Signed-off-by: Yabin Cui --- v1 -> v2: extend lock range to protect read of refcnt in coresight_disable_link(). --- drivers/hwtracing/coresight/coresight.c | 12 +++- include/linux/coresight.h | 3 +++

[PATCH] coresight: tmc-etr: Fix perf_data check.

2019-08-09 Thread Yabin Cui
instead of etr_perf_buffer. Signed-off-by: Yabin Cui --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 17006705287a

Re: [PATCH] coresight: tmc-etr: Remove perf_data check.

2019-08-09 Thread Yabin Cui
I totally agree that checking etr_buf is a better way. It solves my problem. I will upload a new patch soon.

[PATCH] coresight: tmc-etr: Remove perf_data check.

2019-08-08 Thread Yabin Cui
When tracing etm data of multiple threads on multiple cpus through perf interface, each cpu has a unique etr_perf_buffer while sharing the same etr device. There is no guarantee that the last cpu starts etm tracing also stops last. So the perf_data check is no longer valid. Signed-off-by: Yabin

[PATCH] coresight: Serialize enabling/disabling a link device.

2019-08-08 Thread Yabin Cui
adds a spinlock to serialize enabling/disabling a link device. Signed-off-by: Yabin Cui --- drivers/hwtracing/coresight/coresight.c | 8 include/linux/coresight.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight.c b/dr

[PATCH] coresight: tmc-etr: Fix updating buffer in not-snapshot mode.

2019-08-05 Thread Yabin Cui
ess data than the reality. Signed-off-by: Yabin Cui --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 1700

[tip:perf/urgent] perf/ring_buffer: Fix exposing a temporarily decreased data_head

2019-05-24 Thread tip-bot for Yabin Cui
Commit-ID: 1b038c6e05ff70a1e66e3e571c2e6106bdb75f53 Gitweb: https://git.kernel.org/tip/1b038c6e05ff70a1e66e3e571c2e6106bdb75f53 Author: Yabin Cui AuthorDate: Fri, 17 May 2019 13:52:31 +0200 Committer: Ingo Molnar CommitDate: Fri, 24 May 2019 09:00:10 +0200 perf/ring_buffer: Fix

Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head.

2019-05-17 Thread Yabin Cui
> > - local_inc(&rb->nest); > > + rb->nest++; > > + barrier(); > Urgh; almost but not quite. You just lost the 'volatile' qualifier and > now the compiler can mess things up for you. I thought the barriers added could force the compiler to forget what it knows about rb->nest, and do the wri

[PATCH v2] perf/ring_buffer: Fix exposing a temporarily decreased data_head.

2019-05-16 Thread Yabin Cui
ected behaviors. This can be fixed by moving dec(&rb->nest) to after updating data_head, which prevents the IRQ/NMI above from updating data_head. Signed-off-by: Yabin Cui --- v1 -> v2: change rb->nest from local_t to unsigned int, and add barriers. --- kernel/events/internal.h|

Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head.

2019-05-16 Thread Yabin Cui
>Indeed, good catch! Have you observed this, or is this patch due to code inspection? I observed this. I was using perf_event_open instead of linux tools perf to monitor a process continuously forking new processes, generating a lot of mmap records. And a sample record happens while generating a m

[PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head.

2019-05-14 Thread Yabin Cui
ected behaviors. This can be fixed by moving dec(&rb->nest) to after updating data_head, which prevents the IRQ/NMI above from updating data_head. Signed-off-by: Yabin Cui --- kernel/events/ring_buffer.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/

[tip:perf/urgent] perf/core: Force USER_DS when recording user stack data

2018-09-10 Thread tip-bot for Yabin Cui
Commit-ID: 02e184476eff848273826c1d6617bb37e5bcc7ad Gitweb: https://git.kernel.org/tip/02e184476eff848273826c1d6617bb37e5bcc7ad Author: Yabin Cui AuthorDate: Thu, 23 Aug 2018 15:59:35 -0700 Committer: Ingo Molnar CommitDate: Mon, 10 Sep 2018 14:01:46 +0200 perf/core: Force USER_DS

[PATCH] perf: Force USER_DS when recording user stack data.

2018-08-23 Thread Yabin Cui
(KERNEL_DS). And it is explicitly forbidden by hardware on ARM64 when both CONFIG_ARM64_UAO and CONFIG_ARM64_PAN are used. So fix this by forcing USER_DS when recording user stack data. Signed-off-by: Yabin Cui --- kernel/events/core.c | 4 1 file changed, 4 insertions(+) diff --git a/kernel