Message ID | 20230322040933.924813-3-tanmay.shah@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2155451wrt; Tue, 21 Mar 2023 21:30:25 -0700 (PDT) X-Google-Smtp-Source: AK7set/5mdQTxfkPdB//oakBS79osGhqRd5Bx5EXnfmGCHz1VVqJS6iYFpCNOL2aMS4qCFkX9ixk X-Received: by 2002:a17:90b:4c08:b0:233:d12f:f43a with SMTP id na8-20020a17090b4c0800b00233d12ff43amr2494166pjb.1.1679459425605; Tue, 21 Mar 2023 21:30:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679459425; cv=pass; d=google.com; s=arc-20160816; b=ppdE+FuFtmKTROhP8GpmX4+cPB8nx98CZiFq8j6wzbtnIKDBRKNqWgvCRbWHI5uyvz 5l77JAxMjMZ325NoZfyKzJ1ZitPMObQZV02aFOGgT3G6vHjrqMsx4NUQfH1+ySypAlv/ 5AV3S0O8FBFJGV7OeQXuryePfIMEzpEBIHmZk4NDhqP/Wf2a492Fu/BWpSgbwMAIKE8d dEY5NssMuDsD+mCgDasn4veoaS4K6nRs8JdBJ1vq42trFOcr43IUq7lNy9YmQcDe/I6A BadARlVExIPwcWtmfX/DLrk8JvZRnmv8ylQGr56+OG8WoX66jJyUAwFzZAiEHa6MuoNz ThbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0IDJdz1gtlGCKa6X2xH2XCQDLw7SPd0NOoZLJrZ6c2E=; b=nrzmNFTl5TbQjwLJvQ1hUMF/uWFa+M7ES7PHmP2nEMm6IehvZ3MNrExFeoy7VQLEck a/EKPGzK+kVp00iQ/MjH8tJWBX4cilLAVc5XOXzbSuunTMxHFDvybBJnPtQfoayUBqwd 9TU4DN5RomaAI/OkMclFg0NhdoSBinIK5NgO8HkC4U40/UXEY8l2BEftqZDFFyqh94I0 4HWoYtN+nBCV5hE5I4nyI49c3RVu1ER2YSbcGlSkGJ5SVXMr63J+kd7pdYGqDN17DOfV 1RcblMTevielgZfhzMK93eCOeKwaGkTdBMOtxRuz1JBm9cQh1WixJS69NK9+llw5hcyc C1Bw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=hNEb0UR1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a170902ecc700b001a1c005bd39si10278137plh.97.2023.03.21.21.30.13; Tue, 21 Mar 2023 21:30:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=hNEb0UR1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbjCVEKw (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Wed, 22 Mar 2023 00:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbjCVEKt (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Mar 2023 00:10:49 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2052.outbound.protection.outlook.com [40.107.92.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7361C4E5F0; Tue, 21 Mar 2023 21:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aEiUYZWmv7BjBub/Gx7EXFryxMcACEf2dDyXKZmawp9vyB0catx8zmlhrRnhLGT4Z86FYQ9ZORyu4/A38MOwmK6fwtKSxb1ngXIaFlT+IDaratn0LrWCqsTh/BqwVvF9XmgrbJeWEmbTJ/2gAuYwownBaZM7C1SlXjr1M9ABR86dwm0bl9haUBGzpUWRr6ayioUixi8mtegsa/CQEq3nT/ps4FG3qDlZh27dmk7yJ7LbGl5WIvu6nInJ32LM6XNV3unQ+rcobcea2S+D05bN8dhDIsDJvvEWRc12IHzrGvY5YizVTzhah72FDnFU1DvnKmLHgFcPRVUgA3tMFYVkJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0IDJdz1gtlGCKa6X2xH2XCQDLw7SPd0NOoZLJrZ6c2E=; b=RNCfaHSs9CXMTj0giklq8MLPylBt/qwVORjk/Wa4JEdkKCSxdRwcTW8Z4nBVUZWWMTJA+mSa/kqMizQo45Ijv88TVw23dTBIpIbjl8kEv9IQ7AvQqxdvcZ8cdEGIBbejsLrYdYnQ7bHGHOuyZuPcnzbnZcjeOLUsgLDxRkO/J3K4T5N6MG3CKmCDQphviBtEim/yhaXv3I+KhiITm4JYWt+irKP6tfZj/RQFEqh36NFr7SwhIF76UV9P6R4z8SDcxr71aTCqOxRO7YEYyzD9LMSK0SkLf2UaPq3OdvA0fzNU2LKE4ZXHBY3TV82izGtLr0aaaziAAWS8ED7cWILucQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0IDJdz1gtlGCKa6X2xH2XCQDLw7SPd0NOoZLJrZ6c2E=; b=hNEb0UR1GaPs1j5gLOG4dmYOMFvmL9iubCaYj3KDV+tPvI2/WXD4iHOMk7kj8J/4DR1DfSqcqPQjcOJv3tqgjd/R7lYixc4CgbhgeF3LWJ5djXQFn5rfxFSBixJDuq655s9Eb0s/piomzbjZ9Tne6w1R9gk6IlqJjlvf7MCq1HY= Received: from DS7PR05CA0069.namprd05.prod.outlook.com (2603:10b6:8:57::21) by MW4PR12MB5643.namprd12.prod.outlook.com (2603:10b6:303:188::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 04:10:31 +0000 Received: from DS1PEPF0000B077.namprd05.prod.outlook.com (2603:10b6:8:57:cafe::cd) by DS7PR05CA0069.outlook.office365.com (2603:10b6:8:57::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Wed, 22 Mar 2023 04:10:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000B077.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.26 via Frontend Transport; Wed, 22 Mar 2023 04:10:30 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 21 Mar 2023 23:10:30 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 21 Mar 2023 21:10:30 -0700 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 21 Mar 2023 23:10:29 -0500 From: Tanmay Shah <tanmay.shah@amd.com> To: <andersson@kernel.org>, <mathieu.poirier@linaro.org> CC: <linux-remoteproc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Tanmay Shah <tanmay.shah@amd.com>, Tarak Reddy <tarak.reddy@amd.com> Subject: [PATCH v2 2/2] remoteproc: enhance rproc_put() for clusters Date: Tue, 21 Mar 2023 21:09:36 -0700 Message-ID: <20230322040933.924813-3-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322040933.924813-1-tanmay.shah@amd.com> References: <20230322040933.924813-1-tanmay.shah@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000B077:EE_|MW4PR12MB5643:EE_ X-MS-Office365-Filtering-Correlation-Id: 22419b43-55e5-4666-30ea-08db2a8b6065 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0Dw9CN8XRAO/vJnpN2Bp/7vG6zFJ05Pe8yUAXyWm/JQ2ON6PtdAs9nXgTrLW7el2uvRUcgCrpVmr2QzCbl4oI0qjIyQNuqbaUs1uIBSU3UImqsGIEjmuWQXw9wQl69S9PvIOzc1RlkdXKVoHOYI3OXZNdQKfXgpQNlLctX9Jb0Kc6EVU/tDxKe3/ffttEj43qC3kHB3V6+PSUMKTK8yz2632i0PfQfDL8hUGYGtyq3unPS83dkXotb6Hr7J6aOLuu41SwJhPlVEauX/GACQeCTBsVaPsdSYgkvq4Hw3hSB5OuS+6GHm9YGn3ZQV0bGS6qjm67IbXq4W8n0uF40t+tRn6Y+cTphdMbeFJDh0fsXlJPhLmYVLWU8Xs2FcSmVpA5Xko2gUZ8hUYrnTZT6b0H7HoRelUOukng490HSeZTiU0JTQ+AtFfodz/ZB8aLk6TxPwE05f0/il0j+5Gl0rMSiDk0nY13OASohhtf9VTmSZiys0Fs3+NYdSbwbGnKpDsueAyckT0bHtbkSHixtsXxPP21iGo+TyIOmfCu1LDFWQ6CXK4am9b3iU8Vs9FZK9JaOXPX03KqHcKHe+/eM5TWgjcwea5ROXd24ziOGgIIKQMgIkodNESZs9lZFOFRoa63BlKqzpLZJD5ZtWN4RjtvrFtH224ZOUsWxZA0b/eWO7zJD8+0pXvqqjL1bPi3qgjvGv6dZMr1st9ulFTRn2tsJabSFpHf7QbFJnlNgvOC6E= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(396003)(136003)(39860400002)(376002)(451199018)(46966006)(40470700004)(36840700001)(426003)(47076005)(336012)(6666004)(26005)(82310400005)(54906003)(478600001)(316002)(2616005)(186003)(86362001)(110136005)(1076003)(8676002)(70206006)(70586007)(36860700001)(41300700001)(5660300002)(40460700003)(8936002)(4326008)(40480700001)(82740400003)(2906002)(44832011)(356005)(36756003)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 04:10:30.8341 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22419b43-55e5-4666-30ea-08db2a8b6065 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000B077.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5643 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761040846626416838?= X-GMAIL-MSGID: =?utf-8?q?1761040846626416838?= |
Series |
remoteproc: get rproc devices for clusters
|
|
Commit Message
Tanmay Shah
March 22, 2023, 4:09 a.m. UTC
This patch enhances rproc_put() to support remoteproc clusters with multiple child nodes as in rproc_get_by_phandle(). Signed-off-by: Tarak Reddy <tarak.reddy@amd.com> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> --- drivers/remoteproc/remoteproc_core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Comments
Hi Tanmay, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on e19967994d342a5986d950a1bfddf19d7e1191b7] url: https://github.com/intel-lab-lkp/linux/commits/Tanmay-Shah/remoteproc-Make-rproc_get_by_phandle-work-for-clusters/20230322-121102 base: e19967994d342a5986d950a1bfddf19d7e1191b7 patch link: https://lore.kernel.org/r/20230322040933.924813-3-tanmay.shah%40amd.com patch subject: [PATCH v2 2/2] remoteproc: enhance rproc_put() for clusters config: arm-randconfig-r013-20230322 (https://download.01.org/0day-ci/archive/20230322/202303221441.cuBnpvye-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://github.com/intel-lab-lkp/linux/commit/573d22d13a697097d02d6c29a75fb0fb1ac6d8fe git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Tanmay-Shah/remoteproc-Make-rproc_get_by_phandle-work-for-clusters/20230322-121102 git checkout 573d22d13a697097d02d6c29a75fb0fb1ac6d8fe # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/remoteproc/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303221441.cuBnpvye-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/remoteproc/remoteproc_core.c:2563:26: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement] struct platform_device *cluster_pdev; ^ 1 warning generated. vim +2563 drivers/remoteproc/remoteproc_core.c 2550 2551 /** 2552 * rproc_put() - release rproc reference 2553 * @rproc: the remote processor handle 2554 * 2555 * This function decrements the rproc dev refcount. 2556 * 2557 * If no one holds any reference to rproc anymore, then its refcount would 2558 * now drop to zero, and it would be freed. 2559 */ 2560 void rproc_put(struct rproc *rproc) 2561 { 2562 module_put(rproc->dev.parent->driver->owner); > 2563 struct platform_device *cluster_pdev; 2564 2565 if (rproc->dev.parent) { 2566 if (rproc->dev.parent->driver) { 2567 module_put(rproc->dev.parent->driver->owner); 2568 } else { 2569 cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent); 2570 if (cluster_pdev) { 2571 module_put(cluster_pdev->dev.driver->owner); 2572 put_device(&cluster_pdev->dev); 2573 } 2574 } 2575 } 2576 put_device(&rproc->dev); 2577 } 2578 EXPORT_SYMBOL(rproc_put); 2579
Hi Tanmay, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on e19967994d342a5986d950a1bfddf19d7e1191b7] url: https://github.com/intel-lab-lkp/linux/commits/Tanmay-Shah/remoteproc-Make-rproc_get_by_phandle-work-for-clusters/20230322-121102 base: e19967994d342a5986d950a1bfddf19d7e1191b7 patch link: https://lore.kernel.org/r/20230322040933.924813-3-tanmay.shah%40amd.com patch subject: [PATCH v2 2/2] remoteproc: enhance rproc_put() for clusters config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20230322/202303221514.3xIiCbpk-lkp@intel.com/config) compiler: ia64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/573d22d13a697097d02d6c29a75fb0fb1ac6d8fe git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Tanmay-Shah/remoteproc-Make-rproc_get_by_phandle-work-for-clusters/20230322-121102 git checkout 573d22d13a697097d02d6c29a75fb0fb1ac6d8fe # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303221514.3xIiCbpk-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/remoteproc/remoteproc_core.c: In function 'rproc_put': >> drivers/remoteproc/remoteproc_core.c:2563:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 2563 | struct platform_device *cluster_pdev; | ^~~~~~ vim +2563 drivers/remoteproc/remoteproc_core.c 2550 2551 /** 2552 * rproc_put() - release rproc reference 2553 * @rproc: the remote processor handle 2554 * 2555 * This function decrements the rproc dev refcount. 2556 * 2557 * If no one holds any reference to rproc anymore, then its refcount would 2558 * now drop to zero, and it would be freed. 2559 */ 2560 void rproc_put(struct rproc *rproc) 2561 { 2562 module_put(rproc->dev.parent->driver->owner); > 2563 struct platform_device *cluster_pdev; 2564 2565 if (rproc->dev.parent) { 2566 if (rproc->dev.parent->driver) { 2567 module_put(rproc->dev.parent->driver->owner); 2568 } else { 2569 cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent); 2570 if (cluster_pdev) { 2571 module_put(cluster_pdev->dev.driver->owner); 2572 put_device(&cluster_pdev->dev); 2573 } 2574 } 2575 } 2576 put_device(&rproc->dev); 2577 } 2578 EXPORT_SYMBOL(rproc_put); 2579
Hi Tanmay, url: https://github.com/intel-lab-lkp/linux/commits/Tanmay-Shah/remoteproc-Make-rproc_get_by_phandle-work-for-clusters/20230322-121102 base: e19967994d342a5986d950a1bfddf19d7e1191b7 patch link: https://lore.kernel.org/r/20230322040933.924813-3-tanmay.shah%40amd.com patch subject: [PATCH v2 2/2] remoteproc: enhance rproc_put() for clusters config: powerpc-randconfig-m041-20230322 (https://download.01.org/0day-ci/archive/20230322/202303221916.LgKkr8Gk-lkp@intel.com/config) compiler: powerpc-linux-gcc (GCC) 12.1.0 If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Reported-by: Dan Carpenter <error27@gmail.com> | Link: https://lore.kernel.org/r/202303221916.LgKkr8Gk-lkp@intel.com/ smatch warnings: drivers/remoteproc/remoteproc_core.c:2565 rproc_put() warn: variable dereferenced before check 'rproc->dev.parent' (see line 2562) drivers/remoteproc/remoteproc_core.c:2566 rproc_put() warn: variable dereferenced before check 'rproc->dev.parent->driver' (see line 2562) vim +2565 drivers/remoteproc/remoteproc_core.c 160e7c840fe858 Ohad Ben-Cohen 2012-07-04 2560 void rproc_put(struct rproc *rproc) 400e64df6b237e Ohad Ben-Cohen 2011-10-20 2561 { fbb6aacb078285 Bjorn Andersson 2016-10-02 @2562 module_put(rproc->dev.parent->driver->owner); ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unchecked dereferences. 573d22d13a6970 Tanmay Shah 2023-03-21 2563 struct platform_device *cluster_pdev; 573d22d13a6970 Tanmay Shah 2023-03-21 2564 573d22d13a6970 Tanmay Shah 2023-03-21 @2565 if (rproc->dev.parent) { ^^^^^^^^^^^^^^^^^ Checked too late. 573d22d13a6970 Tanmay Shah 2023-03-21 @2566 if (rproc->dev.parent->driver) { ^^^^^^^^^^^^^^^^^^^^^^^^^ 573d22d13a6970 Tanmay Shah 2023-03-21 2567 module_put(rproc->dev.parent->driver->owner); 573d22d13a6970 Tanmay Shah 2023-03-21 2568 } else { 573d22d13a6970 Tanmay Shah 2023-03-21 2569 cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent); 573d22d13a6970 Tanmay Shah 2023-03-21 2570 if (cluster_pdev) { 573d22d13a6970 Tanmay Shah 2023-03-21 2571 module_put(cluster_pdev->dev.driver->owner); 573d22d13a6970 Tanmay Shah 2023-03-21 2572 put_device(&cluster_pdev->dev); 573d22d13a6970 Tanmay Shah 2023-03-21 2573 } 573d22d13a6970 Tanmay Shah 2023-03-21 2574 } 573d22d13a6970 Tanmay Shah 2023-03-21 2575 } b5ab5e24e960b9 Ohad Ben-Cohen 2012-05-30 2576 put_device(&rproc->dev); 400e64df6b237e Ohad Ben-Cohen 2011-10-20 2577 }
Hi Tanmay, On Tue, Mar 21, 2023 at 09:09:36PM -0700, Tanmay Shah wrote: > This patch enhances rproc_put() to support remoteproc clusters > with multiple child nodes as in rproc_get_by_phandle(). > > Signed-off-by: Tarak Reddy <tarak.reddy@amd.com> > Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> > --- > drivers/remoteproc/remoteproc_core.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index a3e7c8798381..e7e451012615 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -2560,6 +2560,19 @@ EXPORT_SYMBOL(rproc_free); > void rproc_put(struct rproc *rproc) > { > module_put(rproc->dev.parent->driver->owner); There is something wrong here - this should have been removed. > + struct platform_device *cluster_pdev; > + > + if (rproc->dev.parent) { This condition is not needed, please remove. > + if (rproc->dev.parent->driver) { > + module_put(rproc->dev.parent->driver->owner); > + } else { > + cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent); > + if (cluster_pdev) { > + module_put(cluster_pdev->dev.driver->owner); > + put_device(&cluster_pdev->dev); > + } > + } > + } Some in-lined documentation, the way I did in patch 1/2 would be appreciated. Otherwize I think the above enhancement make sense. Thanks, Mathieu > put_device(&rproc->dev); > } > EXPORT_SYMBOL(rproc_put); > -- > 2.25.1 >
On 3/22/23 9:05 AM, Mathieu Poirier wrote: > Hi Tanmay, > > On Tue, Mar 21, 2023 at 09:09:36PM -0700, Tanmay Shah wrote: >> This patch enhances rproc_put() to support remoteproc clusters >> with multiple child nodes as in rproc_get_by_phandle(). >> >> Signed-off-by: Tarak Reddy <tarak.reddy@amd.com> >> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> >> --- >> drivers/remoteproc/remoteproc_core.c | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c >> index a3e7c8798381..e7e451012615 100644 >> --- a/drivers/remoteproc/remoteproc_core.c >> +++ b/drivers/remoteproc/remoteproc_core.c >> @@ -2560,6 +2560,19 @@ EXPORT_SYMBOL(rproc_free); >> void rproc_put(struct rproc *rproc) >> { >> module_put(rproc->dev.parent->driver->owner); > There is something wrong here - this should have been removed. Thanks Mathieu. Sure this needs to be fixed. This is result of manually picking up patch from my side. I will try to find better automated way to pick-up patches not available on mailing list. > >> + struct platform_device *cluster_pdev; >> + >> + if (rproc->dev.parent) { > This condition is not needed, please remove. Ack. > >> + if (rproc->dev.parent->driver) { >> + module_put(rproc->dev.parent->driver->owner); >> + } else { >> + cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent); >> + if (cluster_pdev) { >> + module_put(cluster_pdev->dev.driver->owner); >> + put_device(&cluster_pdev->dev); I am not sure if cluster_pdev->dev should be dropped here. Should we drop it in platform driver after rproc_free() ? >> + } >> + } >> + } > Some in-lined documentation, the way I did in patch 1/2 would be appreciated. > Otherwize I think the above enhancement make sense. Ack I will document in next revision. > > Thanks, > Mathieu > >> put_device(&rproc->dev); Also, if we decide to drop cluster->dev hereĀ then, should we drop reference of rproc->dev before cluster->dev ? >> } >> EXPORT_SYMBOL(rproc_put); >> -- >> 2.25.1 >>
On Wed, Mar 22, 2023 at 10:34:57AM -0700, Tanmay Shah wrote: > > On 3/22/23 9:05 AM, Mathieu Poirier wrote: > > Hi Tanmay, > > > > On Tue, Mar 21, 2023 at 09:09:36PM -0700, Tanmay Shah wrote: > > > This patch enhances rproc_put() to support remoteproc clusters > > > with multiple child nodes as in rproc_get_by_phandle(). > > > > > > Signed-off-by: Tarak Reddy <tarak.reddy@amd.com> > > > Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> > > > --- > > > drivers/remoteproc/remoteproc_core.c | 13 +++++++++++++ > > > 1 file changed, 13 insertions(+) > > > > > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > > > index a3e7c8798381..e7e451012615 100644 > > > --- a/drivers/remoteproc/remoteproc_core.c > > > +++ b/drivers/remoteproc/remoteproc_core.c > > > @@ -2560,6 +2560,19 @@ EXPORT_SYMBOL(rproc_free); > > > void rproc_put(struct rproc *rproc) > > > { > > > module_put(rproc->dev.parent->driver->owner); > > There is something wrong here - this should have been removed. > > > Thanks Mathieu. Sure this needs to be fixed. > > This is result of manually picking up patch from my side. > > I will try to find better automated way to pick-up patches not available on > mailing list. > That would certainly help avoid problems such as this one. > > > > > > + struct platform_device *cluster_pdev; > > > + > > > + if (rproc->dev.parent) { > > This condition is not needed, please remove. > Ack. > > > > > + if (rproc->dev.parent->driver) { > > > + module_put(rproc->dev.parent->driver->owner); > > > + } else { > > > + cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent); > > > + if (cluster_pdev) { > > > + module_put(cluster_pdev->dev.driver->owner); > > > + put_device(&cluster_pdev->dev); > > I am not sure if cluster_pdev->dev should be dropped here. > It needs to be done here. > Should we drop it in platform driver after rproc_free() ? > > > > + } > > > + } > > > + } > > Some in-lined documentation, the way I did in patch 1/2 would be appreciated. > > Otherwize I think the above enhancement make sense. > Ack I will document in next revision. > > > > Thanks, > > Mathieu > > > > > put_device(&rproc->dev); > > > Also, if we decide to drop cluster->dev hereĀ then, > > should we drop reference of rproc->dev before cluster->dev ? > > > > > } > > > EXPORT_SYMBOL(rproc_put); > > > -- > > > 2.25.1 > > >
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index a3e7c8798381..e7e451012615 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2560,6 +2560,19 @@ EXPORT_SYMBOL(rproc_free); void rproc_put(struct rproc *rproc) { module_put(rproc->dev.parent->driver->owner); + struct platform_device *cluster_pdev; + + if (rproc->dev.parent) { + if (rproc->dev.parent->driver) { + module_put(rproc->dev.parent->driver->owner); + } else { + cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent); + if (cluster_pdev) { + module_put(cluster_pdev->dev.driver->owner); + put_device(&cluster_pdev->dev); + } + } + } put_device(&rproc->dev); } EXPORT_SYMBOL(rproc_put);