From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39C582D3A72; Wed, 13 Aug 2025 07:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755069321; cv=none; b=CzYhb4Lsh1NBBLogPYvBcVSBCrjU5B5xij2JKT9Ldg+mP/v8OIFLquih2YiW5z3zO3HWKYlQAgHx+77j2XeurkBs4ZoSqCRP8ceyaNLftfLCN62/sCPJ3VNjix3Hi1BfNVD0sFkR5M9BxuZ7wpGWxy3jq//kU1QV1VFxplQpsFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755069321; c=relaxed/simple; bh=ZO4uXaV0NI/Fp2cMH1ZgqG/dmqdn8Lgy2YSgXofQT9A=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=lbthLDWG9zhGCYGG28T2lHAFi72QGyXSyYXrM0PVHDbeg7F9cVWYZTxFDGauFUN4gL+ai11Hfs8woNOX8XGQis6mWdiEOZNi39+omAnBhsGtJmFgMgmuJpALfQOUMamHDEHyTtClWyFQK7S7j4o8apHEKfB2YNc9MpNt50WR9II= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=hisilicon.com; spf=pass smtp.mailfrom=hisilicon.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=hisilicon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hisilicon.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4c20121PTTz13N7N; Wed, 13 Aug 2025 15:11:50 +0800 (CST) Received: from kwepemo100006.china.huawei.com (unknown [7.202.195.47]) by mail.maildlp.com (Postfix) with ESMTPS id 41C7E1401F1; Wed, 13 Aug 2025 15:15:14 +0800 (CST) Received: from [10.67.121.58] (10.67.121.58) by kwepemo100006.china.huawei.com (7.202.195.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 13 Aug 2025 15:15:13 +0800 Message-ID: <8aa1efad-8f30-9548-259a-09fccb9da48a@hisilicon.com> Date: Wed, 13 Aug 2025 15:15:12 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH 2/2] cpufreq: CPPC: Fix error handling in cppc_scale_freq_workfn() To: Prashant Malani CC: Viresh Kumar , Bowen Yu , , , , , , , , Beata Michalska , Ionela Voinescu References: <20250730032312.167062-1-yubowen8@huawei.com> <20250730032312.167062-3-yubowen8@huawei.com> <20250730063930.cercfcpjwnfbnskj@vireshk-i7> <9041c44e-b81a-879d-90cd-3ad0e8992c6c@hisilicon.com> <7a9030d0-e758-4d11-11aa-d694edaa79a0@hisilicon.com> From: Jie Zhan In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemo100006.china.huawei.com (7.202.195.47) On 05/08/2025 12:58, Prashant Malani wrote: > On Mon, 4 Aug 2025 at 18:12, Prashant Malani wrote: >> >> On Sun, 3 Aug 2025 at 23:21, Jie Zhan wrote >>> On 01/08/2025 16:58, Prashant Malani wrote: >>>> This begs the question: why is this work function being scheduled >>>> for CPUs that are in reset or offline/powered-down at all? >>>> IANAE but it sounds like it would be better to add logic to ensure this >>>> work function doesn't get scheduled/executed for CPUs that >>>> are truly offline/powered-down or in reset. >>> Yeah good question. We may discuss that on your thread. >> >> OK. >> Quickly looking around, it sounds having in the CPPC tick function [1] >> might be a better option (one probably doesn't want to lift it beyond the >> CPPC layer, since other drivers might have different behaviour). >> One can add a cpu_online/cpu_enabled check there. > > Fixed link: > [1] https://elixir.bootlin.com/linux/v6.13/source/drivers/cpufreq/cppc_cpufreq.c#L125 I don't think a cpu_online/cpu_enabled check there would help. Offlined CPUs don't make cppc_scale_freq_workfn() fail because they won't have FIE triggered. It fails from accessing perf counters on powered-down CPUs. Perhaps the CPPC FIE needs a bit rework. AFAICS, FIE is meant to run in ticks, but currently the CPPC FIE eventually runs in a thread due to the possible PCC path when reading CPC regs I guess.