Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp494682pxx; Wed, 28 Oct 2020 09:35:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz72DaHu9dwus5ItNMzBA/Rws/e540QfWimsJnMy1LeUINgIKpThdAhk2L4SFlaRmc7tKLR X-Received: by 2002:a17:906:1a19:: with SMTP id i25mr8144949ejf.323.1603902953029; Wed, 28 Oct 2020 09:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603902953; cv=none; d=google.com; s=arc-20160816; b=jiR8MZWyNPdSu2IWY8xGdQGMGKZMh8LBuYfzL1dCBZVvItzS4DQYz0jChzWyIFe2tL BbKBfdx7E9DkIj9zooO3TtVyzQNWMlcQG/aneZzC/pqpXDSgB9l9AlOHmRPJOx4SvmxQ u6E2zwq5kHt1JQGTnaMKPRpekIvV9cAk7Y8RRVGiSDcV520x6RtiuVDWRFFjVw3OkjrR fI2+I3+dYcL9jvO47bkw/pFnm3hvU3d8M8Zz57xckBCLzEj54hUzE1orfy3s958ws+I2 Ub2xYzTg56M9HLX+1RB/aZlisGYcFUzWBHJd0UUBfxmk6FWMlbI9eLHI/UE39VETH7xj p1yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5XFsnUlsQ11TGe5btzY10fYEs1151ORyGvXLkfjKftQ=; b=gRS4JFC1VdDCMdOR2sHsn1lPjZMjTdDELyS1xeOKczIzNa0or+5PxuWINjn+3xftmQ ZTBayeS6vIfXNSPe2SO0LF4I4Ky+rjTTpzUfNC1eLVyBCgkz9EYsoq9sOxXSfJ3aT8ai NRiM2NsTNSZuXWFgIcAH4DmeFPfwEOS+VDbFwytdQfbHcZKFMUAfl9fIryk9k3V2m0LM G6HoDCcOZuYT9oJygOuZwpYgbL3hYYLHxzcDZSd13NeIJd2LMbSUCm8hWqXoqMiQ9cwh iIwhOxd3gwuJqwmzGrtuDs4P7h+iIRjw5vx8vBIOZFt/pgsmK2D+O6pFvnCoS82ckGkU YV/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U/VxG6Se"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu23si3620690ejb.83.2020.10.28.09.35.30; Wed, 28 Oct 2020 09:35:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U/VxG6Se"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1818027AbgJ0RQ6 (ORCPT + 99 others); Tue, 27 Oct 2020 13:16:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:59510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1783396AbgJ0O6O (ORCPT ); Tue, 27 Oct 2020 10:58:14 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7996F20715; Tue, 27 Oct 2020 14:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810694; bh=OhaDBBnxbYMzQQopBBEYIM19xtqxR6PHTP9eV9r0BKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/VxG6SeRlgR6JiugjzngVAy0lykAR2DtUnwST4si6VyFT7aISQFHwtdVrVVPzgvS C3AaIrrQNsG4P1Npt7/qX7xIM1ii9wcNK1mI9YEFtKif/SJIttVzCGx3cITRD60vIa JuU3ByEHpsqjWc3Jk5qN64+2vfrM+SffP2DuE5pA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Leach , Tingwei Zhang , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.8 230/633] coresight: cti: disclaim device only when its claimed Date: Tue, 27 Oct 2020 14:49:33 +0100 Message-Id: <20201027135533.470552439@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tingwei Zhang [ Upstream commit 0dee28268ddbe53a981d4d87faf5dc0f1700e698 ] 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") Reviewed-by: Mike Leach Signed-off-by: Tingwei Zhang Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20200916191737.4001561-6-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 3ccc703dc9409..d6fea6efec71f 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; } -- 2.25.1