Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp302293rwb; Wed, 16 Nov 2022 00:21:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf5VDiEzfR4FbV/F+th0lCC+xI9J0hl18MQSnuI7JMxZLpW6/fOfXrvYzFQca/AVMbdWM29P X-Received: by 2002:a17:907:8b8c:b0:7b2:7b45:2cd1 with SMTP id tb12-20020a1709078b8c00b007b27b452cd1mr3621040ejc.358.1668586897415; Wed, 16 Nov 2022 00:21:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668586897; cv=none; d=google.com; s=arc-20160816; b=ZtvANjy8I1AttuWHlTHmw3JsDkKF97kVuhJ0Hg9NH/302FUi1/xh8YDykJbyLrr/wd 8XfJQx5Z+Xe7MmADyU5g248Nx7qDKWIISmg3LEOzaYFfrTfN9NQaPRqv7NDnJCsE1YXj e9xXhv7OEVuf+/xRq+NOFc/xwDr4GKn1kzmCddA4FlehQ1bmA4fq5ozMauu6X4GWYDjZ DdCKaqyF87oKT4SwAqV7zlX/DtQjpOa9yyxA2GKOJ6O4h7yNGyOaZrZTsupTBF483cqV +GxCczX2KQT1aciOX9DUWtAQ6pJzhIfkCH0FM9ZLovhtE7JP7JOWPZAr6dpQoY4iaBbA 1V5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=JDmFZre2RoSV4rkEwMFn+4L+cs/Z4oDwP30U/wf1ABc=; b=W+92Xy7/whLpdBMJmyrcE+KWUEXr6osVaFdSwBzLY7dJHGcN1wVsdy03IAmyxvNrlC 7s/q1QuDJFFlArQXF6v4y9jNHpjvq6OJZCw4UVi35Y/ZL98QmYdScVNbXhKqBi3gBAuW fpJu5Isc5T3SE8hpFhypuupOwyGKUgoQdyE4DxHIx48GJ8lGVkjqTQ48Fq6AiimLG9Lv 5HNGNNTN0JgGLX6wtzHh8zQMpN2xx5m95h5NNwnkYOZseLQFgXQ7g/TtHfvNT7VkxSdz 5CCbXpA8zxaFjoVQYjeVzUsOPL1xnS9mTIZfCnzOpEHv2ForA9mXyz231SxPmOowTlzn OcHQ== ARC-Authentication-Results: i=1; mx.google.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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c7-20020a056402120700b004605f289f68si12702324edw.158.2022.11.16.00.21.15; Wed, 16 Nov 2022 00:21:37 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231871AbiKPH0n (ORCPT + 90 others); Wed, 16 Nov 2022 02:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbiKPH0l (ORCPT ); Wed, 16 Nov 2022 02:26:41 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9C21BA446; Tue, 15 Nov 2022 23:26:39 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3ADCB13D5; Tue, 15 Nov 2022 23:26:45 -0800 (PST) Received: from bogus (unknown [10.57.6.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E8E913F73B; Tue, 15 Nov 2022 23:26:36 -0800 (PST) Date: Wed, 16 Nov 2022 07:26:33 +0000 From: Sudeep Holla To: Pierre Gondois Cc: linux-kernel@vger.kernel.org, Rob.Herring@arm.com, Greg Kroah-Hartman , "Rafael J . Wysocki" , Linux-Renesas , Marek Szyprowski , Sudeep Holla , Geert Uytterhoeven Subject: Re: [PATCH -next] cacheinfo: Remove of_node_put() for fw_token Message-ID: <20221116072633.igvqiimtx2pzaa37@bogus> References: <20221115220520.2076189-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115220520.2076189-1-pierre.gondois@arm.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 15, 2022 at 11:05:20PM +0100, Pierre Gondois wrote: > fw_token is used for DT/ACPI systems to identify CPUs sharing caches. > For DT based systems, fw_token is set to a pointer to a DT node. > > commit ("cacheinfo: Decrement refcount in cache_setup_of_node()") Commit 3da72e18371c ("cacheinfo: Decrement refcount in cache_setup_of_node()") > doesn't increment the refcount of fw_token anymore in > cache_setup_of_node(). fw_token is indeed used as a token and not > as a (struct device_node*), so no reference to fw_token should be > kept. > > However, [1] is triggered when hotplugging a CPU multiple times > since cache_shared_cpu_map_remove() decrements the refcount to > fw_token at each CPU unplugging, eventually reaching 0. > > Remove of_node_put() for fw_token in cache_shared_cpu_map_remove(). > > [1] > [ 53.651182] ------------[ cut here ]------------ > [ 53.651186] refcount_t: saturated; leaking memory. > [ 53.651223] WARNING: CPU: 4 PID: 32 at lib/refcount.c:22 refcount_warn_saturate (lib/refcount.c:22 (discriminator 3)) > [ 53.651241] Modules linked in: > [ 53.651249] CPU: 4 PID: 32 Comm: cpuhp/4 Tainted: G W 6.1.0-rc1-14091-g9fdf2ca7b9c8 #76 > [ 53.651261] Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Oct 31 2022 > [ 53.651268] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) > [ 53.651279] pc : refcount_warn_saturate (lib/refcount.c:22 (discriminator 3)) > [ 53.651293] lr : refcount_warn_saturate (lib/refcount.c:22 (discriminator 3)) > [...] > [ 53.651513] Call trace: > [...] > [ 53.651735] of_node_release (drivers/of/dynamic.c:335) > [ 53.651750] kobject_put (lib/kobject.c:677 lib/kobject.c:704 ./include/linux/kref.h:65 lib/kobject.c:721) > [ 53.651762] of_node_put (drivers/of/dynamic.c:49) > [ 53.651776] free_cache_attributes.part.0 (drivers/base/cacheinfo.c:712) > [ 53.651792] cacheinfo_cpu_pre_down (drivers/base/cacheinfo.c:718) > [ 53.651807] cpuhp_invoke_callback (kernel/cpu.c:247 (discriminator 4)) > [ 53.651819] cpuhp_thread_fun (kernel/cpu.c:785) > [ 53.651832] smpboot_thread_fn (kernel/smpboot.c:164 (discriminator 3)) > [ 53.651847] kthread (kernel/kthread.c:376) > [ 53.651858] ret_from_fork (arch/arm64/kernel/entry.S:861) > [ 53.651869] ---[ end trace 0000000000000000 ]--- > Please remove the timestamp as they add no value to the commit log. Also it is worth adding IMO: Fixes: 3da72e18371c ("cacheinfo: Decrement refcount in cache_setup_of_node()") I did a quick test and so, Tested-by: Sudeep Holla Reviewed-by: Sudeep Holla Thanks for fixing the quickly and sorry for not noticing the extra of_node_put even though I thought if it was just incrementing the refcount earlier. -- Regards, Sudeep