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=-11.5 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, USER_AGENT_SANE_1 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 A3578C433E0 for ; Thu, 6 Aug 2020 12:17:23 +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 8327322DCC for ; Thu, 6 Aug 2020 12:17:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bAAtovw3"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="YIBu3K+m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8327322DCC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.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=1tnQlTdvgVT9ImiM+z9pGmAdA9P4m41ChOZdJoSATqU=; b=bAAtovw3Xen1Q/ySizVJ8rtOl nqWRWBxbAlXr0YPjy41BgMwB1VpWSWp3NbSD2KmCS63NrF9xEJ5UZF5BS6VzwKovSHFbbKH3WPPCC ffasJcVXHy8SPQpGIOE45UN0B1uCpM3kIcnrbshXbAonfKvd/DgqW/oBF32QMdiBJ+1rKie8MOBz+ Y6xVnXHkXlOtgGiH0aPX+LLsU2XkFlNXtpDhJ7p7rQY+24uqmQQPutq4Hm4TNJa3PvZekSSIdPVey UvSiII40OkpOgtDO790imQw7mLseqd7yYur17TZ9XxQebxdhFmznG3itQsox1OzaAd3y88j0s6Qmz LnQopoLhQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3dvx-0004Qx-CJ; Thu, 06 Aug 2020 11:19:41 +0000 Received: from m43-7.mailgun.net ([69.72.43.7]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3dvu-0004Px-Oc for linux-arm-kernel@lists.infradead.org; Thu, 06 Aug 2020 11:19:39 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1596712778; h=In-Reply-To: Content-Type: MIME-Version: References: Message-ID: Subject: Cc: To: From: Date: Sender; bh=OyO8sWGKKmUaoPTGdwNScA+7C2M041n9AQkearekjgk=; b=YIBu3K+mhaxEq/LTenv0vCtDwnTBP7SgC/bDN2SoWltzMGV/hP3zfKMbkAcVvwHrh3q7G2kE vn7hyPhL7rQx6oCSFLeORYbzNuFjvI6nnk8+JYxwKW/C3VuElYM+yx823d4f5+0HpLdASU0o WTQeEA27bl6NpzaFYROkKlux2tA= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n19.prod.us-west-2.postgun.com with SMTP id 5f2be7482f4952907d5edbbe (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 06 Aug 2020 11:19:36 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 9F589C433C6; Thu, 6 Aug 2020 11:19:36 +0000 (UTC) Received: from codeaurora.org (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tingwei) by smtp.codeaurora.org (Postfix) with ESMTPSA id 530C8C433C9; Thu, 6 Aug 2020 11:19:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 530C8C433C9 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=tingweiz@codeaurora.org Date: Thu, 6 Aug 2020 19:19:23 +0800 From: Tingwei Zhang To: Suzuki K Poulose Subject: Re: [PATCH v7 11/25] coresight: etb: allow etb to be built as a module Message-ID: <20200806111923.GA31216@codeaurora.org> References: <20200805025458.2978-1-tingwei@codeaurora.org> <20200805025458.2978-12-tingwei@codeaurora.org> <02dab16e-521e-ad0e-ebf9-06450c117c98@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <02dab16e-521e-ad0e-ebf9-06450c117c98@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200806_071938_837700_2783B79D X-CRM114-Status: GOOD ( 26.63 ) 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, saiprakash.ranjan@codeaurora.org, kim.phillips@arm.com, mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com, gregkh@linuxfoundation.org, coresight@lists.linaro.org, rdunlap@infradead.org, ykaukab@suse.de, linux@armlinux.org.uk, jinlmao@codeaurora.org, tingwei@codeaurora.org, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org 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 Wed, Aug 05, 2020 at 11:43:36PM +0800, Suzuki K Poulose wrote: > On 08/05/2020 03:54 AM, Tingwei Zhang wrote: > >From: Kim Phillips > > > >Allow to build coresight-etb10 as a module, for ease of development. > > > >- Kconfig becomes a tristate, to allow =m > >- add an etb_remove function, for module unload > >- add a MODULE_DEVICE_TABLE for autoloading on boot > > > >Cc: Mathieu Poirier > >Cc: Leo Yan > >Cc: Alexander Shishkin > >Cc: Randy Dunlap > >Cc: Suzuki K Poulose > >Cc: Greg Kroah-Hartman > >Cc: Russell King > >Signed-off-by: Kim Phillips > >Signed-off-by: Tingwei Zhang > >Tested-by: Mike Leach > > > >--- > > drivers/hwtracing/coresight/Kconfig | 5 ++++- > > drivers/hwtracing/coresight/coresight-etb10.c | 20 ++++++++++++++++++- > > 2 files changed, 23 insertions(+), 2 deletions(-) > > > >diff --git a/drivers/hwtracing/coresight/Kconfig > >b/drivers/hwtracing/coresight/Kconfig > >index d6e107bbd30b..996d84a1edb8 100644 > >--- a/drivers/hwtracing/coresight/Kconfig > >+++ b/drivers/hwtracing/coresight/Kconfig > >@@ -57,13 +57,16 @@ config CORESIGHT_SINK_TPIU > > the on-board coresight memory can handle. > > > > config CORESIGHT_SINK_ETBV10 > >- bool "Coresight ETBv1.0 driver" > >+ tristate "Coresight ETBv1.0 driver" > > depends on CORESIGHT_LINKS_AND_SINKS > > help > > This enables support for the Embedded Trace Buffer version 1.0 driver > > that complies with the generic implementation of the component > >without > > special enhancement or added features. > > > >+ To compile this driver as a module, choose M here: the > >+ module will be called coresight-etb10. > >+ > > config CORESIGHT_SOURCE_ETM3X > > tristate "CoreSight Embedded Trace Macrocell 3.x driver" > > depends on !ARM64 > >diff --git a/drivers/hwtracing/coresight/coresight-etb10.c > >b/drivers/hwtracing/coresight/coresight-etb10.c > >index 04ee9cda988d..b40756497c9a 100644 > >--- a/drivers/hwtracing/coresight/coresight-etb10.c > >+++ b/drivers/hwtracing/coresight/coresight-etb10.c > >@@ -801,6 +801,16 @@ static int etb_probe(struct amba_device *adev, const > >struct amba_id *id) > > return ret; > > } > > > >+static int __exit etb_remove(struct amba_device *adev) > >+{ > >+ struct etb_drvdata *drvdata = dev_get_drvdata(&adev->dev); > >+ > >+ misc_deregister(&drvdata->miscdev); > >+ coresight_unregister(drvdata->csdev); > >+ > >+ return 0; > >+} > >+ > > I am worried about the dangling reference via the misc device to > the drvdata. Not sure, if we need to grab the reference the module > for each open fd on the misc device. The misc device infrastructure > doesn't seem to do any of this implicitly. This is something worth > checking. I will see if I can trigger this. > Misc device is one char device. cdev_get() is called in chrdev_open() to grab reference of module. Look like we are safe here. Thanks, Tingwei > i.e, > > CPU 0: CPU1: > > open("/dev/etb") > etb_open() > ... etb_remove() { > .. > coresight_unregister() > } > > > read() > etb_read() > deal with free'd drvdata ? > > > Cheers > Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel