From patchwork Mon Jun 5 20:15:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 9767403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ABCD560353 for ; Mon, 5 Jun 2017 20:16:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D446281E1 for ; Mon, 5 Jun 2017 20:16:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91A752841E; Mon, 5 Jun 2017 20:16:01 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 2183F281E1 for ; Mon, 5 Jun 2017 20:16:01 +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=MKNZuWruYxxsJhnlDuqUJtsW0ym8m8NM9KneAP0urQM=; b=EckXLVVJYBYg0QAz5So3iyJzxR UYp5AYzdj1kZniUPfe6K+83c1Dg8wpAM/YQzZJ2jqQoy3LLQK5Yc0n9ZciKZoUDTRzIX1pnVyUrmX L9pqTG/sbJA+yxkMnL+2mit1iI1Q0fqDD7FA/tMFN51BOatPOtR7JO+R2R/1Y/k2BD61EQygfFbhz rxCx+ihsoJ0kSZZwAVwQqz8ZFL3/oTcnlqcKC+DdooMWntPjz9P+vHRyFvFd6ylyht3KhaQwhZnDN un7lMpS3vXtd6DWGUNMkPthXNbhL6I8GwdGpI4Ibcv9AChoMjJQ8ouvabdDxcmF8CLqOCfijz8NFj khLCh2gg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dHyPv-0008NK-UZ; Mon, 05 Jun 2017 20:15:59 +0000 Received: from mail-it0-x235.google.com ([2607:f8b0:4001:c0b::235]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dHyPg-00083s-G1 for linux-arm-kernel@lists.infradead.org; Mon, 05 Jun 2017 20:15:46 +0000 Received: by mail-it0-x235.google.com with SMTP id m47so88195474iti.0 for ; Mon, 05 Jun 2017 13:15:23 -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=8pLwJ/8H/sGgu6w+6dt+BYkqQqTXbZyP9kzdh34l+1c=; b=erIF7r+SrFK1FRZTOutUJw0rMQHo56YK+0zEvbfF0Yp+QpvN0FtNwd0w28QHFzok9e 0JAeyscCBYHqWbngO+pleXQOV3JUp+2pGp9CzcUi6aMMqqVDc+F5Q5ddg0p/RTrF3kuC 3pkymYKIggfZhSNvDer5ksCQImMdTCc8KwJiU= 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=8pLwJ/8H/sGgu6w+6dt+BYkqQqTXbZyP9kzdh34l+1c=; b=W1+U74er8L5frktB4tiW7O8m2rs2xpbCvNk2DrhdLT93Q0SsX9pln3d25NzHrRg04W FMpLiQ7PylCsd0eYD2Y/fW1DKNgcZ9BXqqUb+ydfYyUOlz6Sp/hZ5QFgDqBQjq8qyHBI w5rUSm7a5quf7/f+SvcDDIXKPReIF9YFg03dSTm6kg/f/7sYf2/d9yJvN26UzMv1eflF Kn4wSOrDr98QOyEBMyJuu0qWbqYpVLNT2roVo9iHmIQj/M5KRpBLpwjkc/er3T6Iifvu d5YJLBzyV05tB1JE6tAaGIlLswHS2xgn8gFUfXYCgLsoUtxhNJd9mmzRP/eS4gItjVna UIjg== X-Gm-Message-State: AODbwcBahn5boGX8MQW63IbBoohCMLWR5MLZ20DWdSKfnKACcxWqbZ5C O7R4u21EBkrVNhWZbHL6Ww== X-Received: by 10.107.198.19 with SMTP id w19mr16911302iof.121.1496693723209; Mon, 05 Jun 2017 13:15:23 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 200sm5372369itl.7.2017.06.05.13.15.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Jun 2017 13:15:22 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 01/17] coresight: Disable the path only when the source is disabled Date: Mon, 5 Jun 2017 14:15:02 -0600 Message-Id: <1496693718-9191-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496693718-9191-1-git-send-email-mathieu.poirier@linaro.org> References: <1496693718-9191-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170605_131544_580393_BE5BFF46 X-CRM114-Status: GOOD ( 14.30 ) 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: linux-arm-kernel@lists.infradead.org, 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 From: Suzuki K Poulose With a coresight tracing session, the components along the path from the source to sink are disabled after the source is disabled. However, if the source was not actually disabled due to active users, we should not disable the components in the path. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 0c37356e417c..532a2acfa8cc 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -253,14 +253,22 @@ static int coresight_enable_source(struct coresight_device *csdev, u32 mode) return 0; } -static void coresight_disable_source(struct coresight_device *csdev) +/** + * coresight_disable_source - Drop the reference count by 1 and disable + * the device if there are no users left. + * + * @csdev - The coresight device to disable + * + * Returns true if the device has been disabled. + */ +static bool coresight_disable_source(struct coresight_device *csdev) { if (atomic_dec_return(csdev->refcnt) == 0) { - if (source_ops(csdev)->disable) { + if (source_ops(csdev)->disable) source_ops(csdev)->disable(csdev, NULL); - csdev->enable = false; - } + csdev->enable = false; } + return !csdev->enable; } void coresight_disable_path(struct list_head *path) @@ -629,7 +637,7 @@ void coresight_disable(struct coresight_device *csdev) if (ret) goto out; - if (!csdev->enable) + if (!csdev->enable || !coresight_disable_source(csdev)) goto out; switch (csdev->subtype.source_subtype) { @@ -647,7 +655,6 @@ void coresight_disable(struct coresight_device *csdev) break; } - coresight_disable_source(csdev); coresight_disable_path(path); coresight_release_path(path);