From patchwork Thu Apr 4 03:35:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 161729 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1087331jan; Wed, 3 Apr 2019 20:36:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9WcbPIO+UKTmuh1cUuto6bqf9xcO+ucNXsNOIGjpxL7nHtJGN3Tq8/Lk7RPR9Oy5kcKiB X-Received: by 2002:a65:6489:: with SMTP id e9mr3426142pgv.364.1554348989333; Wed, 03 Apr 2019 20:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554348989; cv=none; d=google.com; s=arc-20160816; b=lYgiDCq9cMiEgPOIW7GBxc4w4dtPOvaW2Q4zSfE+/F6egepEwjOPXJz9pk+HrhB/5T BccgtRhCWk6m8dDzfZJlq12sTg/0tFZYDOcDXVgSGcVI6IhB7ks4AT6XY0S26x4oHlOQ po+iGdFDt42S43LTaVtEwVMbGJktdVWg/fPdu5Dsms/ivPo46elH08QsA4iu928/Mb9m 8b0id8JBHpqD956V1wKebr9HETyrGaJNg5UtsOKGkEKBcU48RV7OgAXgGlKP0EiEDeV7 PXI/mzAsSU9dny3R5kivX0juN1ZmUt1gD7LiNdaCNPuFMXFnIlVeUct7URhdtONbSFvp ypPQ== 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=Dv9y6a52f07gLfeGg5bt9mu9Q1KVd8oRTBa2/L6JdcE=; b=K9YBdyWfKuVlM3j+14UiHo0gYm3/kTcV4Cv5ksBkjVY6+sxtksNaOMPL77TXkSWDJj xm9gUIk6w+drfciV5guzLQl00KJgwVzN3gtZptpvMWFOnho3QDjPR6E2lqU00ehpm0NH 8P12EG90G0B/sMwWamRaIjxTBuHIMgL88YUCIcouuBjbY5LL1sKa/grlvur3Orf1MlPo smlL3rR3HcxymNAoIbydd802+JFqWxiBxZpZgWjSJVhqHjRkbm4WzyOjzcghQTrCVaaB 1ypI65Ibx3b1OCACsO4lWnWNFVvOx8C1OPg6y/hEVsMXREsbRPW86bQSbwMVVYqqxwIP rkCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nd7rhGJL; 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 f66si16431083plb.261.2019.04.03.20.36.29; Wed, 03 Apr 2019 20:36:29 -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=nd7rhGJL; 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 S1728552AbfDDDg1 (ORCPT + 31 others); Wed, 3 Apr 2019 23:36:27 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34288 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728412AbfDDDg0 (ORCPT ); Wed, 3 Apr 2019 23:36:26 -0400 Received: by mail-pg1-f194.google.com with SMTP id v12so515448pgq.1 for ; Wed, 03 Apr 2019 20:36:26 -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=Dv9y6a52f07gLfeGg5bt9mu9Q1KVd8oRTBa2/L6JdcE=; b=nd7rhGJLp6uakVyfCcVqzS4ysrJlCjbe5qVHJ8WFBTutz45kQj0T1EKbTNqXsJ4Xo1 MXdii2+cyi0GnFyuX1/98yRAyZ81XFHh9Cn5e9yNLFJ+FZnJUsIFz1r5MvKX4LDeJLpl NQGj7G0eT5J/HCL/rF3/hj/YNYFac8nBgUNFebnX5wdf86aZjZ6yqabOO1Xeh8CHikcl 1TH+dgxG4SOYPB5wxYiwoJC26THS5CCeXcyqpeM+Vxk1gwZVsmTJlNOENdWtUyHT7w1O 4JL1IUaXgTJgBCvBxLnEAQRBDyVxzYBvlCx0el9OyYb8y7U4Ft5agX32zwYeEgjMSkiY chjQ== 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=Dv9y6a52f07gLfeGg5bt9mu9Q1KVd8oRTBa2/L6JdcE=; b=OXsosUB9LB3skzHVTgjQ0Z+8nZsNX/IpSgUstuY0tBA+my6fyXwLEtJUhH9S4Y5A3N P2jAhwlSE3jbmpz44X+TmXCsE0H0fehaW2I95HZB4kHBX9DjfGyxBdd2mZo+KGk1K8kE Yp/OQ/FDSlzVpMztbhi/2cYsH1niVS/QKDorCeMeKl5mm8TynSDRIFn0zv3gL8dJcwuE 9Zp2Zwxqjj8cPbcyeeIVn1P2DYCDa/LSxBJ1bsqU3AIEsiubVsYILH9QJAYBPGxzVeXx SkM6yKzp8SowIk/7O9o5J0vAdQG6dH3/KIKaM3EzKdDjSVP2MENXWsZ05RaEPE++fpWg okCw== X-Gm-Message-State: APjAAAWrvbIdy2NrCebSukoqoutz5HO0sSbKzXhW+HlOA3AJs7+9uGNv PWMtAlB2cTDbPUWByFUad4Mggg== X-Received: by 2002:a62:e50a:: with SMTP id n10mr3324246pff.55.1554348985691; Wed, 03 Apr 2019 20:36:25 -0700 (PDT) Received: from xps15.imgcgcw.net ([147.50.13.10]) by smtp.gmail.com with ESMTPSA id u5sm12212780pfm.121.2019.04.03.20.36.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 20:36:24 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Cc: alexander.shishkin@linux.intel.com, peterz@infradead.org, suzuki.poulose@arm.com, mike.leach@arm.com, leo.yan@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 10/20] coresight: perf: Refactor function free_event_data() Date: Wed, 3 Apr 2019 21:35:31 -0600 Message-Id: <20190404033541.14072-11-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190404033541.14072-1-mathieu.poirier@linaro.org> References: <20190404033541.14072-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 --- .../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;