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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5991C46467 for ; Mon, 16 Jan 2023 15:55:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231455AbjAPPy7 (ORCPT ); Mon, 16 Jan 2023 10:54:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231248AbjAPPys (ORCPT ); Mon, 16 Jan 2023 10:54:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0E8D2278A for ; Mon, 16 Jan 2023 07:54:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8A6A7B81059 for ; Mon, 16 Jan 2023 15:54:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E133DC433EF; Mon, 16 Jan 2023 15:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673884482; bh=60p8QE83Ztk/TuSwLNwYkgzqK+iuZ9nzVr4FnkjINuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bVrc3V/4Prh2YiYZvSW6JHlq7/ck29jRMEVlVVe5dBvCUPX3+/h7kE44Ibpkv417V YKTABscBYsqh+CLJ5sihOOg0bkg7Qz1fcslgB0MI+LecmODumKwdGqG4uJTKwegYw4 z9/3CBYy9M5Xqc/2eYg79GO5Ls0L7RuF2QBUTbRY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Huang Rui , Mario Limonciello , Wyes Karny , Perry Yuan , "Rafael J. Wysocki" Subject: [PATCH 6.1 023/183] cpufreq: amd-pstate: fix kernel hang issue while amd-pstate unregistering Date: Mon, 16 Jan 2023 16:49:06 +0100 Message-Id: <20230116154804.368439704@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154803.321528435@linuxfoundation.org> References: <20230116154803.321528435@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Perry Yuan commit 4f3085f87b51a551a0647f218d4f324796ecb703 upstream. In the amd_pstate_adjust_perf(), there is one cpufreq_cpu_get() call to increase increments the kobject reference count of policy and make it as busy. Therefore, a corresponding call to cpufreq_cpu_put() is needed to decrement the kobject reference count back, it will resolve the kernel hang issue when unregistering the amd-pstate driver and register the `amd_pstate_epp` driver instance. Fixes: 1d215f0319 ("cpufreq: amd-pstate: Add fast switch function for AMD P-State") Acked-by: Huang Rui Reviewed-by: Mario Limonciello Tested-by: Wyes Karny Signed-off-by: Perry Yuan Cc: 5.17+ # 5.17+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/amd-pstate.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -307,6 +307,7 @@ static void amd_pstate_adjust_perf(unsig max_perf = min_perf; amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true); + cpufreq_cpu_put(policy); } static int amd_get_min_freq(struct amd_cpudata *cpudata)