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=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 89951C433E1 for ; Fri, 24 Jul 2020 01:19:36 +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 524CB20825 for ; Fri, 24 Jul 2020 01:19:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Pke+PXsf"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="Q7uye4zy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 524CB20825 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=z4+lKraJ3H8D0MdcEaZvg9dQbcSc0zvavHHayPpuzs0=; b=Pke+PXsfElCFehm1+dcnjfsub 5511CFlwbNsl5dayL4DnEDLWR8wNraOUenx+GHSA1TFP9yTnXtUA/7FiGY/gg1sFQGihtymxZ4o4k Jcq9iUKKxHbAer45Xp24HrF/ArgmIhCN8LpU41XyPJk218nElNHfe9ahvw//EhWDWTN/uJUo73IaR AepQY+n7IQ5PHvRrsiZdwFeCRPynqQFyaPtLAlAD3a9cLGEMCgW4Gmpqi1LH3GzSpxpHZJCQWfCiu Ig7Sg1eV7wi/0t0WE3008Yj/Du+Yhr1wz5dE4C8s8+E3WxwCHsqjSmT7phZyrqedp5rRm8071xU11 i1hTMhl9w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jymLG-0007fV-7e; Fri, 24 Jul 2020 01:17:42 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jymLA-0007f0-FP for linux-arm-kernel@lists.infradead.org; Fri, 24 Jul 2020 01:17:40 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595553459; h=In-Reply-To: Content-Type: MIME-Version: References: Message-ID: Subject: Cc: To: From: Date: Sender; bh=6HxSfYaZ3Oib3v3YBmfh8pZKB8ttbTu1febTXuzcxtI=; b=Q7uye4zymOa97kUnMoW0Nj2rl4HWQ1bDXGCVL1MRE0KuLq5+Z043/TF0XFR3tc5mGL/1OZ2m tigWb4VHPiD40wTcaf7MP9cOQSA37o9GCmqALcMUYLv18buh4rKLjF58zz7Fbmy2F3imbMZ0 bvAw59eBHqhcZN260hWLaiPeJOg= X-Mailgun-Sending-Ip: 104.130.122.29 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-n04.prod.us-east-1.postgun.com with SMTP id 5f1a36aa427cd557669363c3 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 24 Jul 2020 01:17:30 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 74AF2C433A1; Fri, 24 Jul 2020 01:17:29 +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 6C74BC433C6; Fri, 24 Jul 2020 01:17:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6C74BC433C6 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: Fri, 24 Jul 2020 09:17:16 +0800 From: Tingwei Zhang To: Mathieu Poirier Subject: Re: [PATCH v3 19/20] coresight: add try_get_module() in coresight_grab_device() Message-ID: <20200724011716.GA5889@codeaurora.org> References: <20200717054536.7052-1-tingwei@codeaurora.org> <20200717054536.7052-20-tingwei@codeaurora.org> <7ef8d427-23c9-10cd-b337-03ae75476a8c@arm.com> <20200723193601.GC1323936@xps15> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200723193601.GC1323936@xps15> 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-20200723_211740_075386_D3AD2524 X-CRM114-Status: GOOD ( 26.46 ) 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, Suzuki K Poulose , alexander.shishkin@linux.intel.com, gregkh@linuxfoundation.org, coresight@lists.linaro.org, jinlmao@codeaurora.org, ykaukab@suse.de, linux@armlinux.org.uk, rdunlap@infradead.org, tingwei@codeaurora.org, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.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 Fri, Jul 24, 2020 at 03:36:01AM +0800, Mathieu Poirier wrote: > Hi Suzuki, > > On Wed, Jul 22, 2020 at 11:49:48AM +0100, Suzuki K Poulose wrote: > > Hi Tingwei, > > > > On 07/17/2020 06:45 AM, Tingwei Zhang wrote: > > > When coresight device is in an active session, driver module of > > > that device should not be removed. Use try_get_module() in > > > coresight_grab_device() to prevent module to be unloaded. > > > > > > > Is this really sufficient ? AFAIU, a device could be removed, but the > > module may still be alive due to the refcount on the module. This > > If I understand correctly you are worried about cases where drivers would > be > removed but not the reference of the devices using those drivers in the > coresight port connections? If so you are very right. Otherwise please > expand > on the scenario you have in mind. > Hi Mathieu and Suzuki, I didn't add get/put_device() here since coresight doesn't support dymanically add/remove device until this series. This series export one possiblity to add/remove device via load/unload module. Since coresight framework holds reference count for module when there's one active session, device won't be removed when it's used by one active session. Module unload routine checks module reference count before doing anything. With a second thought, I think it may be better to add get/put_device() with try_get_module()/put_module here to indicate we need protect both code and data when there's on active session. > The first version of this set was doing all that cleanup... I haven't > looked at > this set yet but from what I've seen the cleanup code is not present in > any > of the sets after V1. Tingwei, is the work done in > coresight_disable_match() > part of the later revisions? I didn't include cleanup patch in later revision. Module reference count is hold by coresight framework when there's one active session, so the cleanup code won't get chance to be executed. Thanks, Tingwei > > > could imply that we have stale pointers in the _path_, which could > > lead to corruption elsewhere. Should we do a get/put_device() instead ? > > > > Cheers > > Suzuki > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel