Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3005756pxa; Tue, 18 Aug 2020 04:12:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfdFzsVHjGrQ+XhtcYsFN0uhDG3GsJcnDNk+HqayTXi3qyJ947UK76BzbKv9sbtV0IAIqk X-Received: by 2002:a05:6402:30a5:: with SMTP id df5mr18838858edb.18.1597749176486; Tue, 18 Aug 2020 04:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597749176; cv=none; d=google.com; s=arc-20160816; b=PXAT3NT+jSWqt4lZvRnxAzHFk6DNwRQuCP6Bfc3dkcresTdBRuXR+oajmTuhLzJujh HQcjtlZ0wQ+MW3gZCGovHzvbv1VcLZQUwGzha/JIjP7wH6T+X0jXYX3jF8DxWcERNd/9 daJhJD4oNIjKQW3dEtLei4wFLa22oT3V1+a+ENVVq9a6wR8mxA+fn9oWj4qpUDaKnu4J Y3Pivo9lqrnanG6uJc5TXIJWwmhX0ZfJ8EQMAi7Ijda9B46viozjH2QikuQy8NF3fMHV UijZxLxyDfGzTYjrloo/x184DuH753FJAc2gQ8Dst8bxXULbhA1aUhjDaP2kTJEwO928 WIQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dmarc-filter:dkim-signature; bh=8Qw+tTYKmfo+R51gAXm+p/w4gZaBki6khK//GZ/Ewxw=; b=jFCGmTSAC8PEULjfT+Iuc1iQhL8AgVkeGCmxT4Zyyx8dRV/f3pda4Nj9OrlO6W7Xhq 8kHE5Nd9a8BgcKt6EaWX1P85tuTMll8QjKVKvqntZpXiIeKMfMgSNMl8jIih43nrn5Na 5+hH5fckuILPzdV2UqHSs091I0GAweDy0f0vSc//8ooP3cLKjbcGV+2F6QF5XPwugnUU 5osNATHBXG10HLzBBjnJ3pk/COOx4x7M0pCP2FnNp0wOB8a2u8QcEuISADw6r6+wf7Af 6+k9Kuxpleu0e49QWcnjuy3TTL1UM/501uHNRZIA9Qnp8tZLMOSujFtBnNuP9t7gn/zl TV7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=PwUufyCw; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si12772001ejd.159.2020.08.18.04.12.31; Tue, 18 Aug 2020 04:12:56 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=PwUufyCw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726611AbgHRLLd (ORCPT + 99 others); Tue, 18 Aug 2020 07:11:33 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:13403 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726552AbgHRLL1 (ORCPT ); Tue, 18 Aug 2020 07:11:27 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597749086; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Cc: To: From: Sender; bh=8Qw+tTYKmfo+R51gAXm+p/w4gZaBki6khK//GZ/Ewxw=; b=PwUufyCwAM/MtWK1ACUxVkkvBU8NhLkFb7tlgieFSkrC8+wboCl9cLk2UWw24b+VIrH8k8un Up5PWgAlA4UhmT1psnYc9fiw0km/xjd75VPCxh/8dXUPALhHDaXU7SYybaAf49dQnDUY4h+K t/MnPphJg2T27hecSuJ+PVgqS5w= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n08.prod.us-east-1.postgun.com with SMTP id 5f3bb753440a07969aff9f7a (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 18 Aug 2020 11:11:15 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6C410C43391; Tue, 18 Aug 2020 11:11:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from tingweiz-gv.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tingwei) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3D692C433CA; Tue, 18 Aug 2020 11:11:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3D692C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=tingwei@codeaurora.org From: Tingwei Zhang To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Greg Kroah-Hartman , Mike Leach Cc: Tingwei Zhang , tsoni@codeaurora.org, Sai Prakash Ranjan , Mao Jinlong , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] coresight: cti: disclaim device only when it's claimed Date: Tue, 18 Aug 2020 19:10:55 +0800 Message-Id: <20200818111057.19755-1-tingwei@codeaurora.org> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project