From patchwork Thu Jul 16 17:57:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11668253 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21F12722 for ; Thu, 16 Jul 2020 18:05:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAF0F2070E for ; Thu, 16 Jul 2020 18:05:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WMhPPzkl"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OmeYpK0w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAF0F2070E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cvQfG6DhXQODUIYcw4z/WdaXtNr9QnbozM6i2CzFMCQ=; b=WMhPPzklZhc0RmPY8F9WQXjc+ F0ipdhwarBIuSWptIkYtSvMrsGjbJSRC6GCoa4C4TzOMpQ0GdMdAwnhrQc7sS7K4X1FkNElvMxw62 5wm6ayraa9c0dLmyJMLi20SUWOovceTv4tnMwW24aHE4Jqeaw7GPePYWlGjCwccB52z0ZtPK02ZKL MOOUHrlw8xK/EftJXxqGiC9IFMdykoisJo8KvSGII5VhppNHoyLWieMnupo2xU+E6QUsubkcNshmS zDqntTcfKGvLtrFWGaXyrWCIZdUuPy4S52GIMiJCEMgsXbpWkzd6LRSRfSbFuLTUE2S479Mrf2rlO UABgknFcw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw8Az-0004Fz-5R; Thu, 16 Jul 2020 18:00:09 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw893-0003IP-2V for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 17:58:12 +0000 Received: by mail-pj1-x1043.google.com with SMTP id t15so5039566pjq.5 for ; Thu, 16 Jul 2020 10:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8T+MoLWAP8/J+zNBYiFvQYBlIRTzpOrL1hDOxZpt034=; b=OmeYpK0wSp0IFqrdJgKfLsdkXvybR+tUuAW3Ire4TxeWBpW9CT4FjZnTK9Puhq6Xvu Q8EuNjPDQuQr98GHBA8a78I8h9vAZFn0bpLI4C5Bk2ACA8nepwkYSgjf+jfm4MIVI7cr w3YG7bi00yHdhSFJCNznHnoaa/NhDRAR0JBUrMQvhsw+9z34LTWGRd+58O7ZRyE91etE jbBnd/mLC2+oWOJz83U0+7F5bVjVovttRTZKJwSsjxCxbeIO/0lhVhOvbx835Gmv5acn Taa5TVvhK3xqpyCba/f/fl/7csRrfIL4l9IkQR6IXeW2syAx63IfkSCoBYkoJHy9u1JV Up9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8T+MoLWAP8/J+zNBYiFvQYBlIRTzpOrL1hDOxZpt034=; b=VxCqssCLp+iupxTVl/T9NPu+j6XWAl/4EaPBztP+cxIzIGEf5LycXF/0UhFOqiylr7 auwIxhyvzDpxOjXLMSbONm3m6DdE0OjYjbyR3nlHS9yHVqUiQ3ZN6E9klAinqVOJj1SX i4KrQ0UFIM2zc+tutfea0z+0DEvycBt/VXgYODWvW6vnmwGpue6pzSh2kVM0iWcCOwsJ kZ9qetRLzHNQw6O4TQMeoHjpWNqmE1i89dg97z3yu2OWosB49K/3nYbsPKBqHxM/Oc6T isansBYCDfsNEFC7EOXdd+JPyAsFhex9p5T2rM/1EjZSS+heeUmQz6ZFG57+m3wC+zY+ 5fxA== X-Gm-Message-State: AOAM531Bhweyw+2XnSRGrhxDaadO2MYv+Z6EuJ63pA64jqaByWjLu+j/ NjyLVBY31Tb1LSTBBV7Wmym8hndW7UM= X-Google-Smtp-Source: ABdhPJwALAlq+NgQmA/wEgmqCSfxdGZeSnPppHL2l/Ly5LKyG9SeX/n8LcyhLuDBQBtqqtfH2Gu8jQ== X-Received: by 2002:a17:90a:1b2c:: with SMTP id q41mr6107469pjq.195.1594922287194; Thu, 16 Jul 2020 10:58:07 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 83sm5473253pfu.60.2020.07.16.10.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 10:58:06 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 16/17] coresight: etm: perf: Add default sink selection to etm perf Date: Thu, 16 Jul 2020 11:57:45 -0600 Message-Id: <20200716175746.3338735-17-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200716175746.3338735-1-mathieu.poirier@linaro.org> References: <20200716175746.3338735-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_135809_267602_6D7FD869 X-CRM114-Status: GOOD ( 15.23 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1043 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saiprakash.ranjan@codeaurora.org, suzuki.poulose@arm.com, vulab@iscas.ac.cn, tingwei@codeaurora.org, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach Add default sink selection to the perf trace handling in the etm driver. Uses the select default sink infrastructure to select a sink for the perf session, if no other sink is specified. Signed-off-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-etm-perf.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 84f1dcb69827..1a3169e69bb1 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -226,9 +226,6 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, sink = coresight_get_enabled_sink(true); } - if (!sink) - goto err; - mask = &event_data->mask; /* @@ -253,6 +250,16 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, continue; } + /* + * No sink provided - look for a default sink for one of the + * devices. At present we only support topology where all CPUs + * use the same sink [N:1], so only need to find one sink. The + * coresight_build_path later will remove any CPU that does not + * attach to the sink, or if we have not found a sink. + */ + if (!sink) + sink = coresight_find_default_sink(csdev); + /* * Building a path doesn't enable it, it simply builds a * list of devices from source to sink that can be @@ -267,6 +274,10 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, *etm_event_cpu_path_ptr(event_data, cpu) = path; } + /* no sink found for any CPU - cannot trace */ + if (!sink) + goto err; + /* If we don't have any CPUs ready for tracing, abort */ cpu = cpumask_first(mask); if (cpu >= nr_cpu_ids)