From patchwork Thu Apr 25 19:53:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 162878 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2363283jan; Thu, 25 Apr 2019 12:54:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLPLk6CQOzYPbcvCZ2saM1CuJiQUr1/y8gMIVDDoYlW/yRqs6cff1TleQwxFIM2oLnZqod X-Received: by 2002:a62:47d0:: with SMTP id p77mr41492536pfi.95.1556222078780; Thu, 25 Apr 2019 12:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556222078; cv=none; d=google.com; s=arc-20160816; b=1I75dABKHzhWWsybB3qEKkVM8NRVRUy+JkVCYQPPYV3cW8L97gFt24fz1IFsQ4Cg5K XZGpzuO6vs2y+C3GfM+wF3uQaT0RCiTbCZHXHz/iNSwVDSjtjsTxDIBKZAqoqfjvXkFA ztRDb7Fds/OjGVBHTwHWzjexsNabPE4yutPxVXnR761VmRRyiAaJ1c/ZpAz/4zZHBcdl yjhSAEb7Q3l6ZWpAdDEqtI3AMluiH1dEicmYTD9ChPGBdyLPF6KSyH/hjoIKfJG/xC03 CbtLvGRzrHRDWMvDYwUjEJG9hqHzd+tSGK9WwI8eJF3IQl1Fp3KjCWzWOQUvA3emnytr fezQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=BWqaSOkHsxJfaZN3QLvNFkWqa4XvxW+N+NDPocOCvzI=; b=jH1SidpWBfXBFVQFGKv7Rw2tt6/z1MDTpMBWYE6uX0tBZT4LFNMVWHzpQxC6Wr7bSr 0KqcKZxXgMYTPgcDAyDys7aGoK7/Hv6cJYdNTVH/tTLBupH5v0xk6HoIS5NaMb9CKnzq kHM3Ydf92K2Vfs5IiikDL/Dw66iQOpV6U12A24B5K2sWf90j2ScQmleSn33ESRSC6/c9 Pib9qbwNyMnmx0TX79NihekOC7lGx+ztH/5kAi2cq+VBXHhozaZmFeWOExbmywHCuWIo OMrz4/qcOx4zxDAb7QeHQhAWuIQhMbJCCqspZMAPzLozcZd2HrijC93pdOF/SStNjIkp L/sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z60rd2YZ; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k19si7721515pgg.579.2019.04.25.12.54.38; Thu, 25 Apr 2019 12:54:38 -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=@linaro.org header.s=google header.b=z60rd2YZ; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387838AbfDYTyh (ORCPT + 30 others); Thu, 25 Apr 2019 15:54:37 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45663 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730616AbfDYTxl (ORCPT ); Thu, 25 Apr 2019 15:53:41 -0400 Received: by mail-pl1-f195.google.com with SMTP id o5so299310pls.12 for ; Thu, 25 Apr 2019 12:53:41 -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; bh=BWqaSOkHsxJfaZN3QLvNFkWqa4XvxW+N+NDPocOCvzI=; b=z60rd2YZEpEDu+UvQPLQUb3IqoHa6vicmzKNWQqHP+vS81haR5WL9FQ/qcvyUcTy4+ WRHpxR813bLFRAiR/eQSFJ/Tj6tWU/SRV2MGKo76PoVG0tGhQbn2WdYMXIkUXk8PSv3a mAmE4dUI0Rf9qu39EPmNfwh+sJ/lf8MLBjf2joEtmq8dyAzJBmMKj+6WcO7neOOxBra6 f7uRdufrpTZWdUulzHOQ5YZrbA8uXHoWQpUVpvbJsU9u7Wm9dPfGzMETflNwILn2kC6f LL3Za3kIkDG6KYeK47RNVfs8iAs/xyedSlr3+ca3+9/w1wuwB5f04Gb0uGqmJ19EoBdc IrIA== 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; bh=BWqaSOkHsxJfaZN3QLvNFkWqa4XvxW+N+NDPocOCvzI=; b=DZ0hpl3mgRThBOTghtVvbOM6SJh9WP9+EFhlVfHq4gy6bkDpT9QkGHna2YMO8ZabEi 9gKFULaIQPcPDbTxGpQuS6IO4le/zf+8kqq0Vts02UEA9T3FXe7ggLVi2Ly8SLEK3PKh XaSlnhB07D8As019nmsgpW5JoyGI2aOH3mBXt0LlTj6rukUEY7O4n/QpxEdNW7KCeu1C iMWVuQsJHXppCQmFayDgeuH9cbQTwcJUJrbT+NHc76L25pLnq5s/bEeGH588fWxwWeke /ChDNq8ql6weJ0mD3yZtaNhwcHJ6wrbv8QLvvWBKsMgW2XFN2RnfAoB45BVHh/Of6gqZ otug== X-Gm-Message-State: APjAAAWTvDUUdnvjVuqCCNBeq3xZmwd2e80ZVVNW3yi+/vecJQDDwqxw ZHQt0Cq+EH2JkxjRgWfJBJcUGg== X-Received: by 2002:a17:902:5c5:: with SMTP id f63mr39998769plf.327.1556222021137; Thu, 25 Apr 2019 12:53:41 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id t64sm47261961pfa.86.2019.04.25.12.53.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 12:53:40 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 22/32] coresight: perf: Refactor function free_event_data() Date: Thu, 25 Apr 2019 13:53:00 -0600 Message-Id: <20190425195310.31562-23-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190425195310.31562-1-mathieu.poirier@linaro.org> References: <20190425195310.31562-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function free_event_data() is already busy and is bound to become worse with the addition of CPU-wide trace scenarios. As such spin off a new function to strickly take care of the sink buffers. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose Tested-by: Leo Yan Tested-by: Robert Walker --- .../hwtracing/coresight/coresight-etm-perf.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index b8ca3800b56b..806b3dd5872d 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -120,22 +120,34 @@ static int etm_event_init(struct perf_event *event) return ret; } +static void free_sink_buffer(struct etm_event_data *event_data) +{ + int cpu; + cpumask_t *mask = &event_data->mask; + struct coresight_device *sink; + + if (WARN_ON(cpumask_empty(mask))) + return; + + if (!event_data->snk_config) + return; + + cpu = cpumask_first(mask); + sink = coresight_get_sink(etm_event_cpu_path(event_data, cpu)); + sink_ops(sink)->free_buffer(event_data->snk_config); +} + static void free_event_data(struct work_struct *work) { int cpu; cpumask_t *mask; struct etm_event_data *event_data; - struct coresight_device *sink; event_data = container_of(work, struct etm_event_data, work); mask = &event_data->mask; /* Free the sink buffers, if there are any */ - if (event_data->snk_config && !WARN_ON(cpumask_empty(mask))) { - cpu = cpumask_first(mask); - sink = coresight_get_sink(etm_event_cpu_path(event_data, cpu)); - sink_ops(sink)->free_buffer(event_data->snk_config); - } + free_sink_buffer(event_data); for_each_cpu(cpu, mask) { struct list_head **ppath;