Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1449077pxk; Thu, 10 Sep 2020 16:04:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy00DUSti75+RYI+u/FIqgVGdbjiA1R9wxa6xilD58rVTr69vIH+TGv61VVr7ORusRbuRGJ X-Received: by 2002:a50:8d4b:: with SMTP id t11mr12089413edt.5.1599779047802; Thu, 10 Sep 2020 16:04:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599779047; cv=none; d=google.com; s=arc-20160816; b=LRJsmXQhhcxXwqGKagsdWWTlKuMaw9aGkL8C1lBgPLWRdCI8d1sxrfbF2iIelvgtj4 CGauW3Aw8bO/m2fhum7tH3XaXvsyeFZyrBucjDE1H5KRSU9WPa9oled5zGxEg5Z+T8Lt A4NMuaurceHQtUwZaDltr8QnPCOxl44ceyRgGA3+B5D9UIV6Nr+0oIKI5/rgiQs1wrlH PElT6IpXpsmp+9i4R8i8PfCm6KJbiqISwEtTNghBRrDgK01j95HY9dq9sraiw2fL9VV6 JOeqZ7VpTpzre+2THxV2MHH8BtFWo4Vc97fWU4ZErY+70cPLWGYRBX+yHpg6O5YZFMVa w4nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=AEJBmoX8WsfyyVQZBwLDrC1Z1HfJ9zE1C+dj3rnnLIA=; b=TcJR/rHk2T7YLY5vDrfayVNSp8s7E6jVxEblnv9NPRqHv1YnrPyfqrt4f0vtWum0sB MYUDdfMOnxNjcWmruwvf1lnUzYrxte6RjNW4Aos+w59DW1twdKapfxAF93mMECoHOv7Q FxLBG6hRyT0Lq5WTNA94mBPFKQZrOvPc5WF66cNOrIdCW1PdeJ9CkEYjV9lAbq16jDE3 tBp8InCCz1ALfpnwESeCqVkSin7KSIthixSxy+mgX21nw5WzMRgIrk1xipWZGSuyIhGP owLmrZ1JS7z/KurC4p0BbIpFW6cIbK0gB7Bgdq6tKFonOGlinAPRG8Kp6owEgMLKuSr5 tuUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QBGwJrY2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si46643ejd.673.2020.09.10.16.03.44; Thu, 10 Sep 2020 16:04:07 -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=@linaro.org header.s=google header.b=QBGwJrY2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725772AbgIJXAs (ORCPT + 99 others); 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-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 >