From patchwork Mon Mar 25 21:56:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 10870099 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 167B91708 for ; Mon, 25 Mar 2019 21:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1309290E9 for ; Mon, 25 Mar 2019 21:58:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E512D29140; Mon, 25 Mar 2019 21:58:19 +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 934B3290E9 for ; Mon, 25 Mar 2019 21:58:19 +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=/ELPvT3lEdkSrPT3clNvCkuLFT4898hvQ4NwjA50Dm8=; b=o4wNY/PF8WH8I4IE8QsqlQOtQL nd+nnvzbZNfldDSlbwA3uW1ukhvjKIbbyoogMBXcaPOoQZz60SV+awmEKnR72vrcMwM5V+0EGm8kz CmI5/b2hRmbI2ri3bHy5P4U5fTz+ghKA8wGiQBkwWKajKSxWMAVxlCnLKIDG3QjMBNSAnfZwXBgIt LjcqjaKp6Ok9hI9qZqgkpj3mBhvSHHRk84NJ38cmc3jEvkb8j056FES74AWfKA5Dk3y60xvLkMXdL Rpb0CBRIZL4nuWYCMUzDP80j1aBhqAx9GLqi3paH3nf32gffFSpdv7aKcpqm3A1WlT8LA3sjxL7fC 9mZUvTGg==; 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 1h8Xbl-0005j6-2s; Mon, 25 Mar 2019 21:58:17 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8XaL-0003qR-OO for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2019 21:56:57 +0000 Received: by mail-pf1-x442.google.com with SMTP id b3so5695383pfd.1 for ; Mon, 25 Mar 2019 14:56:49 -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=esdugp3JHWAOdac4n1jt9/v2vNqDI45vct1EVxf3pdY=; b=UUKJYKvz/GzNdKiIlzefw9v+j4w59NKSHAlKfMTC6S6ziPewLVC0mnsZ+x7VpiJw2Z GE2vJyKAL/SDgiaH/iR97ZiZSJ3WNehX/1dl0p2mlOA37MOoGOZSnGdrlfakPxGq+4Ll cKHWN0N/8VT/dk3hXCeAuhvOFlzjxT5DJT8RERTVyvouaJjckIH8q+sUOcYVO7/pYZYw 37iPdkPOoD6Bvm7gRt2hsxOuLGYfBagF3ser2ESFfqAtxjV1y7eL3gzchut80ol8uqbg nzCncU9aSozQq7wSErAmgbJCgJDiiw1NlvG1BMRNA4zaQ/QGTCei/V7IvIDo08e3PZU8 30gw== 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=esdugp3JHWAOdac4n1jt9/v2vNqDI45vct1EVxf3pdY=; b=txFrKJVlO8SERtt220NGFnG8PiFnkWvyfLPVxxBM0SIEWdDNiFk3pwSkHrWfCPRO6U VhgyzfS6WGnk2WLYL80pIH6DAg6TNoOMoY4hO3fvuRPh5FVeSKbCv3n/jDgxtMbVQbWd drPXNGtgJ6aT0TqVO1+J8CYPinxnW/7ov+GlwAePDLVD0zhwij3ww1lQlnHFhx39KEsI Ls3z434gbtMEJO5hsI/Z5UB5PFbOM+/adeAIRI/ypbJRbIMs0RZyXsEWXKFQdNtIvLyj AM9/Vwk4TnFZ/KFHkNENmX0sUD6R3VVAsc/fqXmptIv9MApHKRMxeI5dKKkaN+RFY/DJ 5d4w== X-Gm-Message-State: APjAAAUfzS3TK+Dh+n51YtLm1Sfqh54zoj4ohed1tHRBjK+tcTM5Fo0C mgMMrZeeYqGJdch1/C8PXeFyTzaMlIU= X-Google-Smtp-Source: APXvYqx0DFVXc3G5qKHMURP6/Eu1Wzd0nyE6uzoTzcSATnyOOeLrRhRCmkd8eSJq8mMziZaqEeUI9Q== X-Received: by 2002:aa7:8d01:: with SMTP id j1mr26959847pfe.122.1553551006002; Mon, 25 Mar 2019 14:56:46 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j20sm30645631pfi.27.2019.03.25.14.56.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 14:56:45 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 09/16] coresight: perf: Refactor function free_event_data() Date: Mon, 25 Mar 2019 15:56:25 -0600 Message-Id: <20190325215632.17013-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190325215632.17013-1-mathieu.poirier@linaro.org> References: <20190325215632.17013-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190325_145650_352781_D34250A3 X-CRM114-Status: GOOD ( 13.11 ) 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, 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;