From patchwork Wed Sep 16 19:17:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780631 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B8EF59D for ; Wed, 16 Sep 2020 19:19:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 596142075E for ; Wed, 16 Sep 2020 19:19:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="t9YbpRT7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bArPy8Nl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 596142075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=BrH1AaZEnDeWbBIFxwxUsRWQ/CCPX796WMcwGJClJWs=; b=t9YbpRT7vutbvYeMJHe3HEoQv 54k24JVOmrkDyCldV2oToXXfDdNgE4vvhIrHXjNQNq3AwuMJb97s+nLKxNuT90NSMny2zUFrvM3Ye Cax2/qtxdiAaPkkJIEbWvmELMQaO6YQxtkJ+vmy2oehtgJUJgG1yIFzgE6BUZLXff7TLaCGvAU4+q r6hy0ZczLmG3YvGkN5pHJ1zMTh+oPlCTpsQyXaWBOCMjxQom1F3vnt8okY5pPvJ6qR25YzZOajYAH GdgD70+ShXYZ8h9Frnk4GhatkLJmN9k3VA+0KiqQ95/eiaZXihz306bxOKIlcKYVS0v/WJ6vQ/GGO WfJVolVhw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwW-0005FE-UL; Wed, 16 Sep 2020 19:18:13 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcw7-00056m-6y for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:49 +0000 Received: by mail-pj1-x1042.google.com with SMTP id b17so2019112pji.1 for ; Wed, 16 Sep 2020 12:17:46 -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 :mime-version:content-transfer-encoding; bh=JtOdjzk2AjLKKx8fR1wiVnJLztwSFAhfdF2zzVQT4WQ=; b=bArPy8Nlme0HHLA+psQxCWzsczi82wThoDcWgLRGfYdXivtIGIe6HXIlWyeGHfsGgn R/YYPSm1m1UV+z7W7EThJm96k/+RYf6MGr0x3EYMcLA/yXFvUn5kucWYY1cSwdbq82QW nmom4rug9qS6T0mEtEZdv4YTASbpMSHt0KAnVekuvGFr0z4YqtxcpFXMLss8k9CKBf+l aHGdvyaddYcQBfdhpe9Gi/Al+UjRyUFD7RCCSzZonzy7Ow1R1JeM2PzJBbTkMuZeebrC SLNpCKeC4j14ffjhcQF3oC+PGoS6Iejecvwdhaqzip11uReuPVdFENNFY6aDOLD7ywmE rurw== 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:mime-version:content-transfer-encoding; bh=JtOdjzk2AjLKKx8fR1wiVnJLztwSFAhfdF2zzVQT4WQ=; b=clOAsyVUWbghpRV3Gai6DdFefZV5aiKYqTwqNhaS9rVMS7BGtb0qOJK2gAuPRuDPBB xr6wdNvBRkxGkM4EbVA5YexDbQfDT4MdZjmSmvhcEYpRBtab+AReEOL3reJStKzhiF4s tfcCAQlW0vSC/Qy0QXgM2t/QbLNmqrkBrZABxM9iaPicb6IBRgISFs9KQ9tbih9ZLq7s h2sxkT545mwZr52QjHNtrBd63M1Osln3IJ7HNQZkaNmH37ThhWMK4s8opV/Sns5o+LM3 0qLV22txvWccQk7NTUxUMGoyCsDiLicL9WA7fRpxumwpKf/QFHLwzb4Olt7oa5ysAKeS F8mw== X-Gm-Message-State: AOAM530iCYpBcPFxQB8xu5ZQAug7eey0PA8nMrTZF/iqb3q736guXo8H JsbbBe44GV8R3IdyV01ZrNU+9kpJIErUBg== X-Google-Smtp-Source: ABdhPJxtYWXM55bbRMdbJcs1S4l9lg8eh9p4tiUeKPoE0W9ygP3Q8NplZVDmsrgrvwbSXxe8nRr7qQ== X-Received: by 2002:a17:90a:fc6:: with SMTP id 64mr5487062pjz.194.1600283865126; Wed, 16 Sep 2020 12:17:45 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:44 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 05/16] coresight: cti: disclaim device only when it's claimed Date: Wed, 16 Sep 2020 13:17:26 -0600 Message-Id: <20200916191737.4001561-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151747_318886_7CC7AB2A X-CRM114-Status: GOOD ( 14.27 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1042 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang Coresight_claim_device() is called in cti_starting_cpu() only when CTI is enabled while coresight_disclaim_device() is called uncontionally in cti_dying_cpu(). This triggered below WARNING. Only call disclaim device when CTI device is enabled to fix it. [ 75.989643] WARNING: CPU: 1 PID: 14 at kernel/drivers/hwtracing/coresight/coresight.c:209 coresight_disclaim_device_unlocked+0x10/0x24 [ 75.989697] CPU: 1 PID: 14 Comm: migration/1 Not tainted 5.9.0-rc1-gff1304be0a05-dirty #21 [ 75.989709] Hardware name: Thundercomm Dragonboard 845c (DT) [ 75.989737] pstate: 80c00085 (Nzcv daIf +PAN +UAO BTYPE=--) [ 75.989758] pc : coresight_disclaim_device_unlocked+0x10/0x24 [ 75.989775] lr : coresight_disclaim_device+0x24/0x38 [ 75.989783] sp : ffff800011cd3c90 . [ 75.990018] Call trace: [ 75.990041] coresight_disclaim_device_unlocked+0x10/0x24 [ 75.990066] cti_dying_cpu+0x34/0x4c [ 75.990101] cpuhp_invoke_callback+0x84/0x1e0 [ 75.990121] take_cpu_down+0x90/0xe0 [ 75.990154] multi_cpu_stop+0x134/0x160 [ 75.990171] cpu_stopper_thread+0xb0/0x13c [ 75.990196] smpboot_thread_fn+0x1c4/0x270 [ 75.990222] kthread+0x128/0x154 [ 75.990251] ret_from_fork+0x10/0x18 Fixes: e9b880581d55 ("coresight: cti: Add CPU Hotplug handling to CTI driver") Signed-off-by: Tingwei Zhang Reviewed-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 3ccc703dc940..d6fea6efec71 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -742,7 +742,8 @@ static int cti_dying_cpu(unsigned int cpu) spin_lock(&drvdata->spinlock); drvdata->config.hw_powered = false; - coresight_disclaim_device(drvdata->base); + if (drvdata->config.hw_enabled) + coresight_disclaim_device(drvdata->base); spin_unlock(&drvdata->spinlock); return 0; }