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: 10884855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA4A113B5 for ; Thu, 4 Apr 2019 03:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF56828A38 for ; Thu, 4 Apr 2019 03:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3505286D5; Thu, 4 Apr 2019 03:52:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D13E28A46 for ; Thu, 4 Apr 2019 03:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=/5sG7Q7ySucuqyy32JoLCGPSCxOEfHdHfeTSigmkMwQ=; b=esimRZOpcW6/qd9S9Y7pb5FnZS 64w0TgKWMe7jjfw6SmzI+UElErs9eYqUef+4KO/ImDAtdDK2B8eTpgzDE5hkt9lXNCi+GWVdP8/k+ uW+4uLTfDp9Ln8/vLEmcSSjMcQH7HPeAxiSeaocPsMw6A7iCPO1zeArBYZhJBNG3KQe8x88U3tnqv UtBC+XnQMcWHd6Lw80mS1/xA1co7GU/wBsxuCqke1rEP/QZ4+iFlIlVk5fQQ0Y2DGYkNc/t5aR3iC DhOx1hRyd8Ed6LD+bmFqZ2hO691ZPtnZaW4GaltMCfvLGl5Tv3hXtdmuQE0q/chVXiRlnupAMvNqM 76ktiFrA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBtQg-0003d2-FO; Thu, 04 Apr 2019 03:52:42 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBtQ2-0002DC-Lf for linux-arm-kernel@bombadil.infradead.org; Thu, 04 Apr 2019 03:52:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Dv9y6a52f07gLfeGg5bt9mu9Q1KVd8oRTBa2/L6JdcE=; b=B09H4JgEG8ZOeBiEEl4lQ6a38 EC8vr+GrfRKSbAV2lPuDpFu22sYe4iYD7gkdYmDppS0rgyHokf8ryWu1iVb2Dn65y5SueOLwVUv8w sepEHAu6wozoKShdcgfKsaIK08IlMbsB4sVvbK+oaC3E2D2Kah70+h2exDGVjIjZN9tZJ4yTCUpHJ WH6iwV0+AEKYQn8J5vvPVwlf04+S/4ScGezu7VWVtSfli8m2vz7d+ZW306Rgxaf0KIDhrDuK9oMbx 5UW2Dd0/n+MnHcjLZIb3VGqsEp4WSxPFdg6NpAD5nW4HprmE9wpWoH8Aja7vLg/gF7l4wdlQsjVdK Y3UtotTVQ==; Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBtAx-0008GA-Ck for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2019 03:36:29 +0000 Received: by mail-pg1-x544.google.com with SMTP id k3so502950pga.6 for ; Wed, 03 Apr 2019 20:36:27 -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=U/8onU56cC/NpvE5WH/mZj+g2nP28ifcjE8Ucir8wTio9uxWtes1Wluzt6wly/NZNY bAQXM7EnuIY5Anf25C5k91pQ21mCn+j6Kt0vKaulwKfFFMWuiUUCmr1YnFRirHvZXpXp AFPSpXTXZQLekOzcbEfeSqZyIgaQwtMFOOe+ytnxYH+t+Qz6GPTWkGzyN3AuBVoCyAWb Ayg/MM5nLHxDCtu3RQGPzV63+/xcSqTbFvvMrjkGzxn3sB8a0hlCJkzFDK4/lFmZLmFq zxzDpUJn/tSyLVRIh7VeKg6gYsDlATADUVTbXFZIMRH9MajSvMFX/kpai6wwK0SUPpBW 5b/A== X-Gm-Message-State: APjAAAV7IAVgY8IKT5NFH1a/mQvreCdTxVXrXIF0DcG7pH2c4wlw9CV3 39UL/NMX8Way2sPajkDmsHRwsi7z+qg= X-Google-Smtp-Source: APXvYqzpliniiY03EdRi60SI8VpjM7a1uF2J+7xGVpAyWtDwpNjy1DYHC27iE6NYShR6MMn73heX1Q== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_043627_505267_4CE336DE X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, peterz@infradead.org, mike.leach@arm.com, leo.yan@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;