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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E3B7C001DE for ; Fri, 28 Jul 2023 13:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=f3HtADGgu+J0ekPSAEZ5Po1qyMZXt4VckmubaxdyKa4=; b=0fFfIhYw9iqNvE MTZ7Zj2/rvx1FadWbm5tRD0rEmEXtiW8bwVuc0JahrZVIM5PKH9IsqvoBPs4aDyIxe8KnXEaxrstk AavLOPfQvktEfA7sF2dMfm5/9zBamhuhKTLyzD4jzbm6l3ReoNm7uOou9ILgnATuHOgPM8HJy8ebk tLtNNPbtya9nKdZqnyP1QGFCPe0SnaVMpJrVK5yv2wx2j+9zi1NJPRhUpBcd+4L9VhZCBbNJh+r/l INM3xwZMt4IOl74xLdfjf5OPOvYMKk6g4c2pWQ4aL+voTvrlAzPsdPXAqbSWL0OrURrySV7krQdjI rRbdMgKuTr5JvjIvfKZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPNQJ-003WKb-0x; Fri, 28 Jul 2023 13:22:27 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPNQG-003WKE-0x for linux-arm-kernel@lists.infradead.org; Fri, 28 Jul 2023 13:22:25 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDC1462111; Fri, 28 Jul 2023 13:22:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABD2BC433C8; Fri, 28 Jul 2023 13:22:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690550543; bh=W/bcRxC7HKPq+WV1f0L7wqNL6qKipJr/pW8p28YHdiw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WRfiWNezqz7bKg30pZXD9X14kxEezE9wiYwkdXSnfB9e+W2dalsxwO+Ip8ZQuQ4kI 49CdbPIsyF8p+LM4O80t51G+DEGUm8blJxgq8PTJsh/LGn/lN28HdcE3PM/U9TfJ2+ dBcI+nCVLbcN38q9DDzvYOcCcjUxVlp77CpntqV8yxVWTBgozAzX/YpQLpCPnrJlz5 cMzM2yTUOo47ItovedppYQM4XN6YXyRNnihXTUxD2QNB2Mh5/SWATuzDw/pLSEijwL CQaZuhmta93WbqOlceD4iFd6vElUnKsoNOdEJI1vw9Qh263vGKqEH3r6rFufzRUtQw MII83kK+lAC3g== Date: Fri, 28 Jul 2023 14:22:17 +0100 From: Will Deacon To: Besar Wicaksono , suzuki.poulose@arm.com Cc: robin.murphy@arm.com, ilkka@os.amperecomputing.com, catalin.marinas@arm.com, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, treding@nvidia.com, jonathanh@nvidia.com, vsethi@nvidia.com, rwiley@nvidia.com, efunsten@nvidia.com Subject: Re: [PATCH v5] perf: arm_cspmu: Separate Arm and vendor module Message-ID: <20230728132216.GA21394@willie-the-truck> References: <20230705104745.52255-1-bwicaksono@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230705104745.52255-1-bwicaksono@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230728_062224_376937_094032F9 X-CRM114-Status: GOOD ( 18.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Jul 05, 2023 at 05:47:45AM -0500, Besar Wicaksono wrote: > Arm Coresight PMU driver consists of main standard code and > vendor backend code. Both are currently built as a single module. > This patch adds vendor registration API to separate the two to > keep things modular. The main driver requests each known backend > module during initialization and defer device binding process. > The backend module then registers an init callback to the main > driver and continue the device driver binding process. > > Signed-off-by: Besar Wicaksono > --- > > Changes from v4: > * Fix warning reported by kernel test robot > v4: https://lore.kernel.org/linux-arm-kernel/20230620041438.32514-1-bwicaksono@nvidia.com/T/#u One minor comment below, but this mostly looks good to me. I'd like Suzuki's Ack before I queue it, though. > + /* Load implementer module and initialize the callbacks. */ > + if (match) { > + mutex_lock(&arm_cspmu_lock); > + > + if (match->impl_init_ops) { > + if (try_module_get(match->module)) { > + cspmu->impl.match = match; > + ret = match->impl_init_ops(cspmu); > + module_put(match->module); Why is it safe to drop the module reference here? If I'm understanding the flow correctly, ->impl_init_ops() will populate more function pointers in the cspmu->impl.ops structure, and we don't appear to take a module reference when calling those. What happens if the backend module is unloaded while the core module is executed those functions? Cheers, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel