Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp81073ybl; Mon, 12 Aug 2019 12:05:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4e3tPfK3zko5UcTl7pLNsbDz/aGoghREOomAc4oqV3m2l+X25GMq0UDvoiboj1yKIrnx0 X-Received: by 2002:a17:90a:a404:: with SMTP id y4mr675706pjp.69.1565636720645; Mon, 12 Aug 2019 12:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565636720; cv=none; d=google.com; s=arc-20160816; b=ctIJZVbMfKPTV2jbBtpyFjvRWRfmpwsuW/abc6b24rlWHrDivYt+lFZhfUldr3EVSP Lqzl8p4wlovtVyLp8cN0X886TFp85DbddsUhxsTPVVwpLotyMuaBIzkNM6sdl9E29lYx q2EVmpvYTrHs4kccl4cS0Mf6jPFHpinoWMgzqIhx02hNUK5Rf/CK6Z+INBPBXtTGH7Ce C+MK8Z7eznwjU3GuLUhBIkAJ5XdcafIcHhDSmIjfGsifX7kH5b5XrH0hV5zZRg5Gzw41 3EpYcd7LUgkg7iMCUHzk9GD7Wewyd3dSn1n36aTOhBxlV6AFcjH9nPq+1inO8RmSeN/F ib5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=mVRG9jasrEKg9xmOyrLCCjteMMsk/r5mx76vPr6ubzk=; b=Aob2XK346P0smkGMvnJkuMRle8VHI3eCIQj3PaWuNwA7p09dC2b4Px4kM5hQSXW3rt nPnzmTywJDCe5awzcMJBp7c/7eZE4L1n5otzkTPxdS8HczyU9PCWtJ+Ku5df5EN36IkA EQiNSdTg9/YbyHRPJHdLGtVLLjSU+fqAhuNBzBsQdpV46/HmvxzM0UOF2zAimtD6R4Yd 5CIrXe1a9g4hwGl3admkEOHpehBKXNLK3JVPbp4VMEeKYQA15djfIYAerDbeKVgYuQ1U QN8oumz/qcGQKR9kxgIP+4+FHaeCUEgBnI9RzcdocWgWQ4HUSmh00WimMcbz3YEqMN93 me8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=q9RDmDO2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si65853932pgc.510.2019.08.12.12.05.04; Mon, 12 Aug 2019 12:05:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=q9RDmDO2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726807AbfHLTDv (ORCPT + 99 others); Mon, 12 Aug 2019 15:03:51 -0400 Received: from mail-pl1-f201.google.com ([209.85.214.201]:51268 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbfHLTDv (ORCPT ); Mon, 12 Aug 2019 15:03:51 -0400 Received: by mail-pl1-f201.google.com with SMTP id p9so2641905pls.18 for ; Mon, 12 Aug 2019 12:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=mVRG9jasrEKg9xmOyrLCCjteMMsk/r5mx76vPr6ubzk=; b=q9RDmDO2fkCI9Qt4DsOTQzVOLjfIiL+630cF1AohLv94Zttj87byDozSTNIzJdDFxS 65LIrJBSWoWIPgg8HLw/Ibe+hpcR8l860eYDAMrCTN2mb4YifgWxGfgc/kIDQv3PjPOz 1U1OI8q9EVNzl8XvJQmH4CaIptQ7UoukxN2XN+Q+KCZjNfIQ9ARbxFyTmRsVbN4FwiYu voOTvcr1jxQtiSrDxs8xdjQpdwIUxlAMT223sLKDhHO0pgWClDkk4F5cymxcnYlxVGr0 0DQFGhVkujomhJzVwjuMSmGKkJnfhefJkUR2W2ih5Ct9N7PXTcL+3/i4ELl5X3y1Mekm hJjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=mVRG9jasrEKg9xmOyrLCCjteMMsk/r5mx76vPr6ubzk=; b=K/iy8QuzmZJ2uSICFy1Hd9A3xhZbvxfFr3goCvZGCRHuT6KirEo/TSrMjqozEKErJ6 SWhCE2wFOd06RALd08YC/HNbu2WP43vS86v0/1J2LoKkYHSFxKtbQhTzbYRWTE1weylD EtjoYS/R5u53jMjde/ndVvOSfb+5bl8pzApY9oDZV3eeP2bSSUrpoTBL08WLDJhrjOOZ 5lXORgqLljirjLBlbSWlkdbbcinxrK+xzUJSOI/VE+KM1ReRa5Fd8/XZ0dcM8GdiEJGm rz3Et9aju/PBQsKOo4iI1Yk+qOSOr8Z9c5OUbVtcmjzRc3Xa/wWgmCgsRgs3nNFHrag/ Jkgw== X-Gm-Message-State: APjAAAUWsjRPBZvssqKqJh5HZDacQnXeciKIFzqH9Mt0KlimTNXug/7V Ao75lpj7FgxrjHuVqxTE3rVoIq7iYw== X-Received: by 2002:a63:89c2:: with SMTP id v185mr31231727pgd.241.1565636630566; Mon, 12 Aug 2019 12:03:50 -0700 (PDT) Date: Mon, 12 Aug 2019 12:03:20 -0700 Message-Id: <20190812190320.209988-1-yabinc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH v2] coresight: tmc-etr: Fix perf_data check. From: Yabin Cui To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yabin Cui Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. This makes perf_data check fail. Fix it by checking etr_buf 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 +++--- drivers/hwtracing/coresight/coresight-tmc.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 17006705287a..90d1548ad268 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1484,7 +1484,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev, goto out; } - if (WARN_ON(drvdata->perf_data != etr_perf)) { + if (WARN_ON(drvdata->perf_buf != etr_buf)) { lost = true; spin_unlock_irqrestore(&drvdata->spinlock, flags); goto out; @@ -1497,7 +1497,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev, CS_LOCK(drvdata->base); /* Reset perf specific data */ - drvdata->perf_data = NULL; + drvdata->perf_buf = NULL; spin_unlock_irqrestore(&drvdata->spinlock, flags); size = etr_buf->len; @@ -1556,7 +1556,7 @@ static int tmc_enable_etr_sink_perf(struct coresight_device *csdev, void *data) } etr_perf->head = PERF_IDX2OFF(handle->head, etr_perf); - drvdata->perf_data = etr_perf; + drvdata->perf_buf = etr_perf->etr_buf; /* * No HW configuration is needed if the sink is already in diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 1ed50411cc3c..f9a0c95e9ba2 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -178,8 +178,8 @@ struct etr_buf { * device configuration register (DEVID) * @idr: Holds etr_bufs allocated for this ETR. * @idr_mutex: Access serialisation for idr. - * @perf_data: PERF buffer for ETR. - * @sysfs_data: SYSFS buffer for ETR. + * @sysfs_buf: SYSFS buffer for ETR. + * @perf_buf: PERF buffer for ETR. */ struct tmc_drvdata { void __iomem *base; @@ -202,7 +202,7 @@ struct tmc_drvdata { struct idr idr; struct mutex idr_mutex; struct etr_buf *sysfs_buf; - void *perf_data; + struct etr_buf *perf_buf; }; struct etr_buf_operations { -- 2.23.0.rc1.153.gdeed80330f-goog