From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57FCFC433E2 for ; Thu, 10 Sep 2020 23:00:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16C46206E9 for ; Thu, 10 Sep 2020 23:00:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QBGwJrY2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725782AbgIJXAs (ORCPT ); Thu, 10 Sep 2020 19:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725298AbgIJXAq (ORCPT ); Thu, 10 Sep 2020 19:00:46 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E47C061573 for ; Thu, 10 Sep 2020 16:00:46 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id 34so5134721pgo.13 for ; Thu, 10 Sep 2020 16:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AEJBmoX8WsfyyVQZBwLDrC1Z1HfJ9zE1C+dj3rnnLIA=; b=QBGwJrY226Z2o5SR7+/ZaEJqS00GKWQY5BKwSDFCSxgV7VBDWfvP0IzhD6bQkcfbvQ n5AhvvNI1zc7+yi7+k8O3/331t8W2e7zPfNgtJQ3gRPNPzdl2C0YO4Ad8Woj9sadt+Yh wZewRr7qJvofHUUEj9yW60BCenG37z02ElHuJBHKcESbEwPRA50yT2/u8pjpT4DWMaOp e4jTXqTzf+le1cai3EdqtuJhebsq6KHSTxYnh8JGD5VAcIF0sWnxtTWl78EyS+XC3JvE kFp3eXqCZjdWuWVdT9xTzK1/Am3AkHqKzZUzWOYGYGWBog6YRxtMIDBWQqc6v1YktMDl g7cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AEJBmoX8WsfyyVQZBwLDrC1Z1HfJ9zE1C+dj3rnnLIA=; b=tkPsaFDC9f13vrHBf5OLSMcFQayJ06ZUiv7JPt25gsSloNYCwaoRtWUpAHY3HdjHJm US6Vywo71B2ML+Qa/7pkR/R/Q3471lgK/nfs22jLUuWnph1ZKsntzXHACN/3cyRBSJqy C8y91vS3AYpPSPcJk4ZK2z4fe29sPeeSTL1fQyQvXd/PqPYQJ0Frq3ql+vBNeFsS3+ZH FNt25WmlA4Nin3aU0zTd8/2FVP8b8QE1IrbF+usFGwDQu+nzwesogLFkl+Xhcrs9xB21 WoVfPCeUignLwcXlbbjtsE0uUkBA8VJP3TXC0P5FA8zKb4I4+X0soAEAoKNEO8YQTnh+ u8KQ== X-Gm-Message-State: AOAM530V3VyJb7+Vkmjk26j3Bt7XkVGTVA7B9zLh42u8L/X5EZcM5stc ZUvqTxPLOjpnofsoLIQRjLUhOA== X-Google-Smtp-Source: ABdhPJzNBLPVWj1zi8MRD98x0w6/LGAgHbOrzn9dJrEC77bm4p349/phdk9vOTEIZTR4dZ1bJwyE3Q== X-Received: by 2002:a63:384b:: with SMTP id h11mr6430377pgn.113.1599778845655; Thu, 10 Sep 2020 16:00:45 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id t20sm70364pgj.27.2020.09.10.16.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 16:00:45 -0700 (PDT) Date: Thu, 10 Sep 2020 17:00:43 -0600 From: Mathieu Poirier To: Tingwei Zhang Cc: Suzuki K Poulose , Alexander Shishkin , Mike Leach , Greg Kroah-Hartman , Leo Yan , Randy Dunlap , Russell King , Kim Phillips , Mian Yousaf Kaukab , tsoni@codeaurora.org, Sai Prakash Ranjan , Mao Jinlong , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10 18/24] coresight: cti: Fix bug clearing sysfs links on callback Message-ID: <20200910230043.GD590446@xps15> References: <20200821034445.967-1-tingwei@codeaurora.org> <20200821034445.967-19-tingwei@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200821034445.967-19-tingwei@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 11:44:39AM +0800, Tingwei Zhang wrote: > From: Mike Leach > > During module unload, a coresight driver module will call back into > the CTI driver to remove any links between the two devices. > > The current code has 2 issues:- > 1) in the CTI driver the matching code is matching to the wrong device > so misses all the links. > 2) The callback is called too late in the unload process resulting in a > crash. > > This fixes both the issues. > > Fixes: 177af8285b59 ("coresight: cti: Enable CTI associated with devices") > Reported-by: Tingwei Zhang > Signed-off-by: Mike Leach > Signed-off-by: Tingwei Zhang > Acked-by: Suzuki K Poulose Reviewed-by: Mathieu Poirier > --- > drivers/hwtracing/coresight/coresight-cti.c | 2 +- > drivers/hwtracing/coresight/coresight.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c > index 73304374a155..ec286d617b73 100644 > --- a/drivers/hwtracing/coresight/coresight-cti.c > +++ b/drivers/hwtracing/coresight/coresight-cti.c > @@ -608,7 +608,7 @@ static void cti_remove_assoc_from_csdev(struct coresight_device *csdev) > ctidrv = csdev_to_cti_drvdata(csdev->ect_dev); > ctidev = &ctidrv->ctidev; > list_for_each_entry(tc, &ctidev->trig_cons, node) { > - if (tc->con_dev == csdev->ect_dev) { > + if (tc->con_dev == csdev) { > cti_remove_sysfs_link(ctidrv, tc); > tc->con_dev = NULL; > break; > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > index c2174fed263b..6c09be15d60c 100644 > --- a/drivers/hwtracing/coresight/coresight.c > +++ b/drivers/hwtracing/coresight/coresight.c > @@ -1254,8 +1254,6 @@ static void coresight_device_release(struct device *dev) > { > struct coresight_device *csdev = to_coresight_device(dev); > > - if (cti_assoc_ops && cti_assoc_ops->remove) > - cti_assoc_ops->remove(csdev); > fwnode_handle_put(csdev->dev.fwnode); > kfree(csdev->refcnt); > kfree(csdev); > @@ -1590,6 +1588,8 @@ void coresight_unregister(struct coresight_device *csdev) > { > etm_perf_del_symlink_sink(csdev); > /* Remove references of that device in the topology */ > + if (cti_assoc_ops && cti_assoc_ops->remove) > + cti_assoc_ops->remove(csdev); > coresight_remove_conns(csdev); > coresight_clear_default_sink(csdev); > coresight_release_platform_data(csdev, csdev->pdata); > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18830C43461 for ; Thu, 10 Sep 2020 23:02:13 +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 BBCED20882 for ; Thu, 10 Sep 2020 23:02:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EH0G0KiZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QBGwJrY2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBCED20882 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+linux-arm-kernel=archiver.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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NhyOw6jNiKNHq/Wrw9HirIvcxFpZYIcSOC2DEzVvQOA=; b=EH0G0KiZTuR4r8yczc3EErrjG Kh1BMF3nM+qwYCipm38MMvjbL17wYjgELIi/XQDeSAR0duJ6f9GOQ3qlE/KJwQabx3Nd3BB9le0p2 ry0kwPce+yw2dC2DHq72rYInDz4uodhGcRgszq6aix07MR/Fd+QKdtT99afCvsMsgdNG5Yc6PED5b XO2zbfRQOz9QrfFVHqbOsnIIWmgrm7x2+1PGU2nXJ4yuFQli+syY7g5NK5Z8XwSqIMfc253G5+SLH wQn5/L/cjKbIo9m//KIR/up4xRTeRvKkHPDB/nEaXOYmxEl7SFSgGahVqrnpFtC2YetVHQCTalGh/ eGaVkVDJQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGVYf-0000f5-98; Thu, 10 Sep 2020 23:00:49 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGVYd-0000eF-S6 for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2020 23:00:48 +0000 Received: by mail-pg1-x543.google.com with SMTP id u13so5180553pgh.1 for ; Thu, 10 Sep 2020 16:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AEJBmoX8WsfyyVQZBwLDrC1Z1HfJ9zE1C+dj3rnnLIA=; b=QBGwJrY226Z2o5SR7+/ZaEJqS00GKWQY5BKwSDFCSxgV7VBDWfvP0IzhD6bQkcfbvQ n5AhvvNI1zc7+yi7+k8O3/331t8W2e7zPfNgtJQ3gRPNPzdl2C0YO4Ad8Woj9sadt+Yh wZewRr7qJvofHUUEj9yW60BCenG37z02ElHuJBHKcESbEwPRA50yT2/u8pjpT4DWMaOp e4jTXqTzf+le1cai3EdqtuJhebsq6KHSTxYnh8JGD5VAcIF0sWnxtTWl78EyS+XC3JvE kFp3eXqCZjdWuWVdT9xTzK1/Am3AkHqKzZUzWOYGYGWBog6YRxtMIDBWQqc6v1YktMDl g7cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AEJBmoX8WsfyyVQZBwLDrC1Z1HfJ9zE1C+dj3rnnLIA=; b=R0/xT7RefsaaW13nn0D7Zm2IimXY4cbZiqKpF4IpFRPdek6hO57/8odbBXxRR+F6J/ aDnlIxAbAj8noLrNS774At6unwPA646HAGVOOC0S5YgOzRcZN2BTKavmhUav2xk1/5FM y+nElScz9aj0bxrt8xsENIHUlryLhHiwLeegfU9Uu9fFQULa6ilnceo+8mHO0b2+n6vV wv+/nQwkuePVay2cFTN0bIOMKoTEieZjR5CrYBsm2MwoTIfpNmU+EOy98b7GgsMZr4MQ /3FWKquocCQpZRzhVb1zx4IVsDDMV89gx+XJxdy50lW3QIY62WdaFFiOIPOd+ryRyG8a RE7A== X-Gm-Message-State: AOAM533qdkNElFaXhfpJCuPWeH8tLT6jo3bMId6ojcOzajwdIHtsmT9S MSJyDe0dLb2D/D+bKaCP2PvzxA== X-Google-Smtp-Source: ABdhPJzNBLPVWj1zi8MRD98x0w6/LGAgHbOrzn9dJrEC77bm4p349/phdk9vOTEIZTR4dZ1bJwyE3Q== X-Received: by 2002:a63:384b:: with SMTP id h11mr6430377pgn.113.1599778845655; Thu, 10 Sep 2020 16:00:45 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id t20sm70364pgj.27.2020.09.10.16.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 16:00:45 -0700 (PDT) Date: Thu, 10 Sep 2020 17:00:43 -0600 From: Mathieu Poirier To: Tingwei Zhang Subject: Re: [PATCH v10 18/24] coresight: cti: Fix bug clearing sysfs links on callback Message-ID: <20200910230043.GD590446@xps15> References: <20200821034445.967-1-tingwei@codeaurora.org> <20200821034445.967-19-tingwei@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200821034445.967-19-tingwei@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_190047_916614_C4951A99 X-CRM114-Status: GOOD ( 26.58 ) 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: tsoni@codeaurora.org, Sai Prakash Ranjan , Kim Phillips , Mao Jinlong , Suzuki K Poulose , Alexander Shishkin , Greg Kroah-Hartman , coresight@lists.linaro.org, Randy Dunlap , Mian Yousaf Kaukab , Russell King , linux-kernel@vger.kernel.org, Leo Yan , linux-arm-kernel@lists.infradead.org, Mike Leach Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 21, 2020 at 11:44:39AM +0800, Tingwei Zhang wrote: > From: Mike Leach > > During module unload, a coresight driver module will call back into > the CTI driver to remove any links between the two devices. > > The current code has 2 issues:- > 1) in the CTI driver the matching code is matching to the wrong device > so misses all the links. > 2) The callback is called too late in the unload process resulting in a > crash. > > This fixes both the issues. > > Fixes: 177af8285b59 ("coresight: cti: Enable CTI associated with devices") > Reported-by: Tingwei Zhang > Signed-off-by: Mike Leach > Signed-off-by: Tingwei Zhang > Acked-by: Suzuki K Poulose Reviewed-by: Mathieu Poirier > --- > drivers/hwtracing/coresight/coresight-cti.c | 2 +- > drivers/hwtracing/coresight/coresight.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c > index 73304374a155..ec286d617b73 100644 > --- a/drivers/hwtracing/coresight/coresight-cti.c > +++ b/drivers/hwtracing/coresight/coresight-cti.c > @@ -608,7 +608,7 @@ static void cti_remove_assoc_from_csdev(struct coresight_device *csdev) > ctidrv = csdev_to_cti_drvdata(csdev->ect_dev); > ctidev = &ctidrv->ctidev; > list_for_each_entry(tc, &ctidev->trig_cons, node) { > - if (tc->con_dev == csdev->ect_dev) { > + if (tc->con_dev == csdev) { > cti_remove_sysfs_link(ctidrv, tc); > tc->con_dev = NULL; > break; > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > index c2174fed263b..6c09be15d60c 100644 > --- a/drivers/hwtracing/coresight/coresight.c > +++ b/drivers/hwtracing/coresight/coresight.c > @@ -1254,8 +1254,6 @@ static void coresight_device_release(struct device *dev) > { > struct coresight_device *csdev = to_coresight_device(dev); > > - if (cti_assoc_ops && cti_assoc_ops->remove) > - cti_assoc_ops->remove(csdev); > fwnode_handle_put(csdev->dev.fwnode); > kfree(csdev->refcnt); > kfree(csdev); > @@ -1590,6 +1588,8 @@ void coresight_unregister(struct coresight_device *csdev) > { > etm_perf_del_symlink_sink(csdev); > /* Remove references of that device in the topology */ > + if (cti_assoc_ops && cti_assoc_ops->remove) > + cti_assoc_ops->remove(csdev); > coresight_remove_conns(csdev); > coresight_clear_default_sink(csdev); > coresight_release_platform_data(csdev, csdev->pdata); > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel