Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3629710ybl; Mon, 12 Aug 2019 03:50:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3jIMwelvcasPRyVW2P+UcoeVj0aPqhnFZuoG6tikLIqcXXNjMAGU9tQypo9DHPDT0FcAR X-Received: by 2002:a17:90a:4806:: with SMTP id a6mr22902801pjh.38.1565607039924; Mon, 12 Aug 2019 03:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565607039; cv=none; d=google.com; s=arc-20160816; b=gWVZdxsNkOSbY5q3QRjguHHvU3z8QxwMv/Z9tOSgKfw/J+BTrp08wh0YyE+AmH+kvu lqPW8r1mwzZWuTjJ8mXCv6psk3C8/0pVPHHpQpaeFgFOXGL4zeUh6O90JE8GSQJTUKpe b8xfldF9b3J/5DHA80vCRJgqG+KwXf9Ar8vdMEE8tCBKJ0HqkhuCTXeebg3JuJztJR2n qT8fsUuvJDTYg8qkqkN0NT7uNCRnZnYaZTseawe2ItUOM6P7EGS/9k+F+YEtd4uCvYyE jREqz0JCUM61+EupY28DlU/8lFQ51KOOpgx71+QLD+0FGpkSfOtvdtsyvTgpXyg2dl2L 2fPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=ybOa4yeKumg59XO85xMT7hP21RE1D+ftQntb2JbyAQI=; b=AWnTHeolt7IRQp878+6RQKZdxhoxOz4Ywh74KBFbldH2rMoJbU6wZaxBDx6ULF2Y5g pm7oyVgVqONww8HKLYM17jeMAYAu1+ipMODl3oP4Br64aXouwV1SVje3t5HncImIEKBx HhMwQ/NCexHjBOJUFG9AbmtZq+NTj5qFVmoyvz4TAXKF2woasknczQOxd2LIpz7hoMlo HkmNFRqeqS3b8hs268KS2jcPa4Bmm8cW5y8cGWJD4RKXdIY1WA/Tt+y5ZhuDit7Emtw3 GCJSkxK/9jI3X2wg5ZWaPs4xYpqwb6kizDglak/jwu+hAjoN880LELYVxiusPzwwBTx1 CXAQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si50107026pfa.141.2019.08.12.03.50.24; Mon, 12 Aug 2019 03:50:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728052AbfHLKsW (ORCPT + 99 others); Mon, 12 Aug 2019 06:48:22 -0400 Received: from foss.arm.com ([217.140.110.172]:48192 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727235AbfHLKsW (ORCPT ); Mon, 12 Aug 2019 06:48:22 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C5A5A15AB; Mon, 12 Aug 2019 03:48:21 -0700 (PDT) Received: from dawn-kernel.cambridge.arm.com (unknown [10.1.197.116]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 111603F706; Mon, 12 Aug 2019 03:48:20 -0700 (PDT) Subject: Re: [PATCH v2] coresight: Serialize enabling/disabling a link device. From: Suzuki K Poulose To: yabinc@google.com, mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20190809214538.29677-1-yabinc@google.com> <056f411f-eef2-752e-0c02-2e5ed803cc62@arm.com> Message-ID: <606aaae4-3f26-7a58-3276-f4c5e3f8d17d@arm.com> Date: Mon, 12 Aug 2019 11:48:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <056f411f-eef2-752e-0c02-2e5ed803cc62@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yabin, On 12/08/2019 11:38, Suzuki K Poulose wrote: > > Hi Yabin, > > On 09/08/2019 22:45, Yabin Cui wrote: >> When tracing etm data of multiple threads on multiple cpus through perf >> interface, some link devices are shared between paths of different cpus. >> It creates race conditions when different cpus wants to enable/disable >> the same link device at the same time. >> >> Example 1: >> Two cpus want to enable different ports of a coresight funnel, thus >> calling the funnel enable operation at the same time. But the funnel >> enable operation isn't reentrantable. >> >> Example 2: >> For an enabled coresight dynamic replicator with refcnt=1, one cpu wants >> to disable it, while another cpu wants to enable it. Ideally we still have >> an enabled replicator with refcnt=1 at the end. But in reality the result >> is uncertain. >> >> Since coresight devices claim themselves when enabled for self-hosted >> usage, the race conditions above usually make the link devices not usable >> after many cycles. >> >> To fix the race conditions, this patch adds a spinlock to serialize >> enabling/disabling a link device. Please could you also add : Fixes : a06ae8609b3dd ("coresight: add CoreSight core layer framework") Suzuki