Message ID | 20230526153508.6208-1-quic_jinlmao@quicinc.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp579739vqr; Fri, 26 May 2023 08:59:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mNK1WxIsQOPMAa2fd2B6/S+8p99ili7Y6M9DfToXDKU1maMDyM1uJJorMqzCdrM8PBnbI X-Received: by 2002:a17:90a:4b05:b0:255:3ca1:d620 with SMTP id g5-20020a17090a4b0500b002553ca1d620mr2590897pjh.29.1685116757297; Fri, 26 May 2023 08:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685116757; cv=none; d=google.com; s=arc-20160816; b=jkigmDFupUyL7pwMBe5GoOrYKwlq7RhlREi91EPiRFSwX5qGFZic7grdcAHOQPYbnJ QvpQNs0h419GJOAMSb6j11EL2YHtZiVn59KRy0e6vXH55l7g/ymcB7AdkABEhnSJcvGY FGKqK4w0AfVeXrCGakMVa0bt8Uj4Gw14TSsa9bQ3Ru9yHqc/AcGc60VXXwrWN0MJxOop 1lfuOucliXAL2n8BUJcj00RE1wvEySwJGWLEfJfNZd2WJ4my1zEBoRYl43a3geEf8bZ7 /P4mzrhJCgwqiY2GIb0bWi4lggSLpiqKwnC7RHIGKbNm6eRshoop7o0r+wDEeoqZ6a1I tYAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=I/yJNJ8Tx5koKovC6ZBuTwfjqydZGhxxnpU/ilMbykE=; b=OH8U0r3HMuONNmfuL/DVauMqDsoaxQntemW9Fj6L+M+sunbiJAU2MZuYEXpnF4ZKFq 1sKJYIAmU7YxfBP7RD2aWBtkyOKlOBCn28+iOlceTaNSOcTfSLStNBWvv3XMcYLoD3/N /jShzpghpv98FqAkcI1+FyrIdgJGwxTAfe3r6xzmBYCIeGM7t926nsXpMfqnk77jAGEj cXtbjKqSRFviH2HBMHtANecvpbXFTUAWL0m4nLh6Uhx68RWdmHZLEU5qHz+EZdie0K0T o2FpFO0O8e97iF8PU/fOpIWzORP9jvOoAmPP5wR3ExsqDzjSOljAFGD0VUmsdPZ0yPgD XwiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FZCYGuTS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a17090a470f00b0024c1ddfa1bfsi569423pjg.92.2023.05.26.08.59.04; Fri, 26 May 2023 08:59:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FZCYGuTS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236220AbjEZPfv (ORCPT <rfc822;zhanglyra.2023@gmail.com> + 99 others); Fri, 26 May 2023 11:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbjEZPft (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 26 May 2023 11:35:49 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A5ECF3; Fri, 26 May 2023 08:35:44 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34QDVgN0001308; Fri, 26 May 2023 15:35:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=I/yJNJ8Tx5koKovC6ZBuTwfjqydZGhxxnpU/ilMbykE=; b=FZCYGuTSD6I9TZcj4MINaBwt+KONWXifSNnd0YeeLgZnp7rW8wGIBjxlFlovTnI7wpmX NB0QpiAMsttSbiiAbPA9M4iTyd5gpyBgiskmtDXxiWp2H9Ftc76fhcNg0LRVjek1sLV6 2mkPZ6EV5q6XYKJ98hh6Qa2iqtIM5W3P+0L6KI7XfCXPiJsXlStMp8ShnFH4dJmZdFoa O1a/ygr2LZyaitib1YgvqqUgVSsr9ZV4rpgOOgUy2OJqBCR0Iqg8JQECkxFXp8VlPa31 Tnvrjbp2Az98w7VWlTdZJBEQ0umShHiKjCI2Ut7OEM1E0PsaWjnkAxZFP9T2tBo9cIhz CQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qtu0u0nx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 May 2023 15:35:30 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34QFZTnQ011790 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 May 2023 15:35:29 GMT Received: from jinlmao-gv.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Fri, 26 May 2023 08:35:25 -0700 From: Mao Jinlong <quic_jinlmao@quicinc.com> To: Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Suzuki K Poulose <suzuki.poulose@arm.com>, Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> CC: Mao Jinlong <quic_jinlmao@quicinc.com>, <coresight@lists.linaro.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>, Tingwei Zhang <quic_tingweiz@quicinc.com>, Yuanfang Zhang <quic_yuanfang@quicinc.com>, "Tao Zhang" <quic_taozha@quicinc.com>, Hao Zhang <quic_hazha@quicinc.com> Subject: [PATCH v1 0/3] Add support for a streaming interface for TMC ETR Date: Fri, 26 May 2023 23:35:05 +0800 Message-ID: <20230526153508.6208-1-quic_jinlmao@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Ym7BB_2UHm6UfdoDfRa9EaziNYBAU0Pa X-Proofpoint-GUID: Ym7BB_2UHm6UfdoDfRa9EaziNYBAU0Pa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-26_06,2023-05-25_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 lowpriorityscore=0 malwarescore=0 suspectscore=0 mlxlogscore=642 impostorscore=0 phishscore=0 mlxscore=0 spamscore=0 bulkscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305260131 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766972988826188788?= X-GMAIL-MSGID: =?utf-8?q?1766972988826188788?= |
Series |
Add support for a streaming interface for TMC ETR
|
|
Message
Mao Jinlong
May 26, 2023, 3:35 p.m. UTC
This patch series is to add support for a streaming interface for TMC ETR to allow for continuous log collection to secondary storage. An interrupt based mechanism is used to stream out the data from the device. QDSS_CS_QDSSCSR_ETRIRQCTRL register is used to set the IRQ byte counter value. The value of this registers defines the number of bytes that when moved by the ETR AXI interface. It will casues an interrupt which can be used by an userspace program to know how much data is present in memory requiring copy to some other location. A zero setting disables the interrupt.A one setting means 8 bytes, two 16 bytes, etc. In other words, the value in this register is the interrupt threshold times 8 bytes. ETR must be enabled when use this interrupt function. Sample: echo 4096 > /sys/bus/coresight/devices/tmc_etr0/block_size echo 1 > /sys/bus/coresight/devices/tmc_etr0/enable_sink echo 1 > /sys/bus/coresight/devices/stm0/enabl_source cat /dev/byte-cntr > /data/qdss_etr.bin & The log collection will stop after disabling the ETR. Commit link: https://git.codelinaro.org/clo/linux-kernel/coresight/-/commits/coresight-byte-cntr-v1 Mao Jinlong (3): Coresight: Add driver to support for CSR coresight-tmc: byte-cntr: Add support for streaming interface for ETR dt-bindings: arm: Adds CoreSight CSR hardware definitions .../testing/sysfs-bus-coresight-devices-tmc | 7 + .../bindings/arm/qcom,coresight-csr.yaml | 62 ++++ drivers/hwtracing/coresight/Kconfig | 12 + drivers/hwtracing/coresight/Makefile | 3 +- .../hwtracing/coresight/coresight-byte-cntr.c | 304 ++++++++++++++++++ .../hwtracing/coresight/coresight-byte-cntr.h | 49 +++ drivers/hwtracing/coresight/coresight-csr.c | 168 ++++++++++ drivers/hwtracing/coresight/coresight-csr.h | 59 ++++ .../hwtracing/coresight/coresight-tmc-core.c | 66 ++++ .../hwtracing/coresight/coresight-tmc-etr.c | 8 +- drivers/hwtracing/coresight/coresight-tmc.h | 12 +- 11 files changed, 745 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-csr.yaml create mode 100644 drivers/hwtracing/coresight/coresight-byte-cntr.c create mode 100644 drivers/hwtracing/coresight/coresight-byte-cntr.h create mode 100644 drivers/hwtracing/coresight/coresight-csr.c create mode 100644 drivers/hwtracing/coresight/coresight-csr.h
Comments
Hi, I have a few general comments about this patch set. Firstly, I am assuming that this is a standard TMC, with the new byte monitor functionality implemented in the CSR block. Now that being the case, all the byte counter operations, the sysfs block_size, file ops to read the data and interrupt handling should be in the CSR driver, not the TMC driver. This counter is not part of a generic TMC device - but a specific hardware addition into your system. As such I would expect it to be in a separate driver. The specific enabling of the CSR counters from within the enable code of the TMC should be removed. If your device is set up correctly as a helper device with appropriate connections between TMC and CSR, then the enable operations can be handled automatically using the helper function mechnisms added in this patchset:- https://lists.linaro.org/archives/list/coresight@lists.linaro.org/thread/2BBWZCBJWP3AOLBJSB64I5727JZFA6QZ/ I also see that you are assuming that you will be able to read the TMC memory faster than it fills - as there is no guard against overflow or detection when the TMC buffer wraps. Given the amount of trace that can be generated in a very short space of time, I cannot see how this can be guaranteed. Any undetected buffer wrap will result in significant decode failures. The normal sysfs read operations synchronise the DMA using a system call and read the RRP and RWP to ensure determine the start and end positions of the buffer. This cannot be done safely without stopping the TMC. Moreover, you are assuming that the buffer allocated is a contiguous flat mapped buffer, and not scatter gather. The change to the TMC core code - even if this operation could be guaranteed to be reliable, should be limited to extracting the data only - ensuring that the above constraints are observed. I'll comment inline in a couple of the other patches Thanks and Regards Mike On Fri, 26 May 2023 at 16:35, Mao Jinlong <quic_jinlmao@quicinc.com> wrote: > > This patch series is to add support for a streaming interface for > TMC ETR to allow for continuous log collection to secondary storage. > An interrupt based mechanism is used to stream out the data from the device. > > QDSS_CS_QDSSCSR_ETRIRQCTRL register is used to set the IRQ byte counter > value. The value of this registers defines the number of bytes that when moved by > the ETR AXI interface. It will casues an interrupt which can be used by an > userspace program to know how much data is present in memory requiring copy to some > other location. A zero setting disables the interrupt.A one setting > means 8 bytes, two 16 bytes, etc. In other words, the value in this > register is the interrupt threshold times 8 bytes. ETR must be enabled > when use this interrupt function. > > Sample: > echo 4096 > /sys/bus/coresight/devices/tmc_etr0/block_size > echo 1 > /sys/bus/coresight/devices/tmc_etr0/enable_sink > echo 1 > /sys/bus/coresight/devices/stm0/enabl_source > > cat /dev/byte-cntr > /data/qdss_etr.bin & > > The log collection will stop after disabling the ETR. > > Commit link: > https://git.codelinaro.org/clo/linux-kernel/coresight/-/commits/coresight-byte-cntr-v1 > > Mao Jinlong (3): > Coresight: Add driver to support for CSR > coresight-tmc: byte-cntr: Add support for streaming interface for ETR > dt-bindings: arm: Adds CoreSight CSR hardware definitions > > .../testing/sysfs-bus-coresight-devices-tmc | 7 + > .../bindings/arm/qcom,coresight-csr.yaml | 62 ++++ > drivers/hwtracing/coresight/Kconfig | 12 + > drivers/hwtracing/coresight/Makefile | 3 +- > .../hwtracing/coresight/coresight-byte-cntr.c | 304 ++++++++++++++++++ > .../hwtracing/coresight/coresight-byte-cntr.h | 49 +++ > drivers/hwtracing/coresight/coresight-csr.c | 168 ++++++++++ > drivers/hwtracing/coresight/coresight-csr.h | 59 ++++ > .../hwtracing/coresight/coresight-tmc-core.c | 66 ++++ > .../hwtracing/coresight/coresight-tmc-etr.c | 8 +- > drivers/hwtracing/coresight/coresight-tmc.h | 12 +- > 11 files changed, 745 insertions(+), 5 deletions(-) > create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-csr.yaml > create mode 100644 drivers/hwtracing/coresight/coresight-byte-cntr.c > create mode 100644 drivers/hwtracing/coresight/coresight-byte-cntr.h > create mode 100644 drivers/hwtracing/coresight/coresight-csr.c > create mode 100644 drivers/hwtracing/coresight/coresight-csr.h > > -- > 2.17.1 > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK
Hi Mike, Sorry for the late response. Thanks for the comments. On 5/30/2023 11:11 PM, Mike Leach wrote: > Hi, > > I have a few general comments about this patch set. > > Firstly, I am assuming that this is a standard TMC, with the new byte > monitor functionality implemented in the CSR block. > > Now that being the case, all the byte counter operations, the sysfs > block_size, file ops to read the data and interrupt handling should be > in the CSR driver, not the TMC driver. > This counter is not part of a generic TMC device - but a specific > hardware addition into your system. As such I would expect it to be in > a separate driver. > > The specific enabling of the CSR counters from within the enable code > of the TMC should be removed. If your device is set up correctly as a > helper device with appropriate connections between TMC and CSR, then > the enable operations can be handled automatically using the helper > function mechnisms added in this patchset:- > https://lists.linaro.org/archives/list/coresight@lists.linaro.org/thread/2BBWZCBJWP3AOLBJSB64I5727JZFA6QZ/ I will consider to use helper function mechanism for CSR device. > > I also see that you are assuming that you will be able to read the TMC > memory faster than it fills - as there is no guard against overflow or > detection when the TMC buffer wraps. Given the amount of trace that > can be generated in a very short space of time, I cannot see how this > can be guaranteed. Any undetected buffer wrap will result in > significant decode failures. It can't be guarantee that read the TMC memory faster than it fills. There could be override issue happens. When issue happens, we usually suggest user to increase the buffer size of the ETR to make the gap large enough for reading the data and filling the data to ETR. > > The normal sysfs read operations synchronise the DMA using a system > call and read the RRP and RWP to ensure determine the start and end > positions of the buffer. This cannot be done safely without stopping > the TMC. Moreover, you are assuming that the buffer allocated is a > contiguous flat mapped buffer, and not scatter gather. When it is scatter gather mode, 4K data will be read each time. When it is flat mode, the required length will be read. > > The change to the TMC core code - even if this operation could be > guaranteed to be reliable, should be limited to extracting the data > only - ensuring that the above constraints are observed. > > I'll comment inline in a couple of the other patches > > Thanks and Regards > > Mike > > > On Fri, 26 May 2023 at 16:35, Mao Jinlong <quic_jinlmao@quicinc.com> wrote: >> This patch series is to add support for a streaming interface for >> TMC ETR to allow for continuous log collection to secondary storage. >> An interrupt based mechanism is used to stream out the data from the device. >> >> QDSS_CS_QDSSCSR_ETRIRQCTRL register is used to set the IRQ byte counter >> value. The value of this registers defines the number of bytes that when moved by >> the ETR AXI interface. It will casues an interrupt which can be used by an >> userspace program to know how much data is present in memory requiring copy to some >> other location. A zero setting disables the interrupt.A one setting >> means 8 bytes, two 16 bytes, etc. In other words, the value in this >> register is the interrupt threshold times 8 bytes. ETR must be enabled >> when use this interrupt function. >> >> Sample: >> echo 4096 > /sys/bus/coresight/devices/tmc_etr0/block_size >> echo 1 > /sys/bus/coresight/devices/tmc_etr0/enable_sink >> echo 1 > /sys/bus/coresight/devices/stm0/enabl_source >> >> cat /dev/byte-cntr > /data/qdss_etr.bin & >> >> The log collection will stop after disabling the ETR. >> >> Commit link: >> https://git.codelinaro.org/clo/linux-kernel/coresight/-/commits/coresight-byte-cntr-v1 >> >> Mao Jinlong (3): >> Coresight: Add driver to support for CSR >> coresight-tmc: byte-cntr: Add support for streaming interface for ETR >> dt-bindings: arm: Adds CoreSight CSR hardware definitions >> >> .../testing/sysfs-bus-coresight-devices-tmc | 7 + >> .../bindings/arm/qcom,coresight-csr.yaml | 62 ++++ >> drivers/hwtracing/coresight/Kconfig | 12 + >> drivers/hwtracing/coresight/Makefile | 3 +- >> .../hwtracing/coresight/coresight-byte-cntr.c | 304 ++++++++++++++++++ >> .../hwtracing/coresight/coresight-byte-cntr.h | 49 +++ >> drivers/hwtracing/coresight/coresight-csr.c | 168 ++++++++++ >> drivers/hwtracing/coresight/coresight-csr.h | 59 ++++ >> .../hwtracing/coresight/coresight-tmc-core.c | 66 ++++ >> .../hwtracing/coresight/coresight-tmc-etr.c | 8 +- >> drivers/hwtracing/coresight/coresight-tmc.h | 12 +- >> 11 files changed, 745 insertions(+), 5 deletions(-) >> create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-csr.yaml >> create mode 100644 drivers/hwtracing/coresight/coresight-byte-cntr.c >> create mode 100644 drivers/hwtracing/coresight/coresight-byte-cntr.h >> create mode 100644 drivers/hwtracing/coresight/coresight-csr.c >> create mode 100644 drivers/hwtracing/coresight/coresight-csr.h >> >> -- >> 2.17.1 >> > > -- > Mike Leach > Principal Engineer, ARM Ltd. > Manchester Design Centre. UK > _______________________________________________ > CoreSight mailing list -- coresight@lists.linaro.org > To unsubscribe send an email to coresight-leave@lists.linaro.org