From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 E72E24248CD for ; Thu, 16 Jul 2026 14:11:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211073; cv=none; b=Uu2ooaRBX9SO7tmBwlw0L5/52LU9SiHCYEguTdIVbVtCJ+l73Iv9EVH8ebyrpUMSSAJPBhAqWGlvL+l7EqCHsxSh2d+nvkPs4aokMTPRMPSeTIkSu4rrqnznSnbH+SWUtdo8dProPDNJINTbplNWDDHy5u+reT9wn1xNQnENT7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211073; c=relaxed/simple; bh=VdSrM8Fd8Og8p4MALRBaWDIz/aVawIHFve9OkaRw5PA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hVhFWp/4vIoPGD2icZSNjtTd9eh9Lqbsk7ejfPglgzqqGGVxAEt2L7Rnir005ecxD4rfZI3x7Y3s/VtHss3+z3qao8+3b90JeV0NvdlVtuxsrYGzXYYO7it/eqLEIeubp1YkGl3Pnz3wSVbMkNsENLEcyMnFFx9KbIA7yrtVZuw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ossHlQal; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Hj50smpN; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ossHlQal"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Hj50smpN" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66GDJn0d2734538 for ; Thu, 16 Jul 2026 14:11:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= OjIUystLYQEiwLo6aFI8saCO3ZV7wLC349fLsPtJmWs=; b=ossHlQalD6s8vBa8 8Zq84EMzX3ujU4YpDUxXC/FvT3BoIXerF4TI6PxpUEV3cPuDmGjqhPJuGtuoN0Z+ TH4jpq2wQO+85KZuePDxuppCy1qvGG840EhGRArFs1amjHVQDE2sOuhvibeDiNZl V+O64kUZ51rCqF2K3NfZLlCi8LAZ1UEaXOltwwWRYsIhINJGYuZmbJDXLYB1Klps EFX5dfWjRGsHxi4f6T+EKxeAs4oYeDMZkQiGI0j6ScnjN6/sIdo6fkUMq8ggVvBm /Hhn8CH9CufMDgRx6L447kr6YqGGQMCGraT6c92cqJ5MbZibCEvFyjI9HOnfeL4G qVs+kA== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fevkv17n7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Jul 2026 14:11:10 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2ccafc5e82cso43531415ad.3 for ; Thu, 16 Jul 2026 07:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784211070; x=1784815870; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OjIUystLYQEiwLo6aFI8saCO3ZV7wLC349fLsPtJmWs=; b=Hj50smpNLnSF85vaOkVxHoiSbNK9UfFbqz+wo7MK0o1p2nvdT4oxitXfW+IfrnSOUU FfOUWhSj6biQI6wEzHEwxNoua1YBBO7Rj8NfKAicIk/Cq9lfURW4jedMtWPrjylFGvEV MWhib3WvxIppRWBK8JovaXX1jliRZr8z6RimNYtqQN492IO94t+Q53RX6VIXFjkffj8Z T+XTzPktGXgm9YwZhs8uHKHYV12PLYi/9PxQoqfwbeQ++6fOeSz22nCiJMJK82ilyvgF L2oB6aBztDQdSeTY/Ry7cfpP25Xl7n0ybLPOuxu2ChR98pavYb7i5KJh9tWwYQaimo0y yUtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784211070; x=1784815870; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OjIUystLYQEiwLo6aFI8saCO3ZV7wLC349fLsPtJmWs=; b=ouWQFqTnJYsAe48OAkZkJRg3ysPRlOCTmcV3WZgbYJ213GE0UhbsZoyillebTKP26p S19gQMiQDcCElxe78LX7YWERp4fwpc0nmnculSbw06O5FWQAz/574vxz8XBE1H6sad3D ci2htg4vjlAMumCTGD8f07PgFbi7+j+Z4y9Kms4QPXD7zyssWCX7Ih0vnY3N3zLK7NBw IPLfDu4gZoI2lmi10iEAz7jVbH9icrQqBTxqYK3cBqsDoYPDqX0r+NNoI6riu7Zdkc4Y e9TgkoVn7L3h276DQEqTfXYiRYgeecccr2OoKH9xddV5US/R845t9SJEdBSgiSjnLIdn C6UA== X-Forwarded-Encrypted: i=1; AHgh+RrNSTsju79X/iXqzvcdR/zVjH+g0CQBSXnk/v/5WD7tLdwEc73L/bOUg/7sqYSUCYRkjM/2qoAdtPIRDMc=@vger.kernel.org X-Gm-Message-State: AOJu0YxUy73vwPldiij+oPqA/lPAItKBCMN4wJJY0x6laHBFk75kSaVN Jsn5CnTzZ4ZSdzN6sOol1dI5XzRNvJPIS3B4HMMqHwjZbt5Uz/mkV362sVV1tFGpwzivJhut4HI W6ch7uEiOIuLVrkXJLw1707tiiUhHeBfkl9oN0slGLHOSjJW2Mgo8n5UrxtjX6ynXWT4= X-Gm-Gg: AfdE7ckvdjbxT93TtlHNVm8ZNzMqh6ADt7VUOtrRjauCwooUj6FXXxmtD4Uv3Fzv3ye W/82BcFa/mXqL+amBTJKM7sLPJJ9VXl3OpZDGVab8G6XgOfQrgr6ZzaZI/oY1gg+wulGLHIwmjX BJSEWXNUbv1jD05q4+WrgiUiQucqORBD00DMUg6Oj/nzYXr6fnm1sLdjEgoenlxrdpaXgahvzk8 QT+sUZ/T+xkowELB/YMqKXXCiKt/j0Y8rf/kveG5PkwEvbbR67GnXZJdbpxf24+vPOsaaxBncgu NGACRNhCBfXjHo8kCVlr7fovGqVXQMu0xFTfUvDuDRdzyTIZdlqziH0uPeIHGIULh4DojiUXW7J Y20E9AnlyJ8szhMXVsjyVbgX6iGKd0g== X-Received: by 2002:a17:903:32cc:b0:2c9:854c:a45c with SMTP id d9443c01a7336-2ce9f02bb90mr225676925ad.34.1784211069514; Thu, 16 Jul 2026 07:11:09 -0700 (PDT) X-Received: by 2002:a17:903:32cc:b0:2c9:854c:a45c with SMTP id d9443c01a7336-2ce9f02bb90mr225676285ad.34.1784211069010; Thu, 16 Jul 2026 07:11:09 -0700 (PDT) Received: from [10.239.133.197] ([114.94.8.21]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf1059782csm20527265ad.58.2026.07.16.07.11.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Jul 2026 07:11:08 -0700 (PDT) Message-ID: <09b4f56e-0bc7-4b5e-8d97-a0c924be67f7@oss.qualcomm.com> Date: Thu, 16 Jul 2026 22:11:02 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] cpufreq: amd-pstate-ut: bail out early on non-AMD platform To: Qianheng Peng , ray.huang@amd.com, mario.limonciello@amd.com, perry.yuan@amd.com, kprateek.nayak@amd.com, rafael@kernel.org, viresh.kumar@linaro.org, skhan@linuxfoundation.org, li.meng@amd.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, wangxb12@chinatelecom.cn, xiongl24@chinatelecom.cn, zhangar@chinatelecom.cn, zhongqiu.han@oss.qualcomm.com References: <1784191899-28957-1-git-send-email-pengqh1@chinatelecom.cn> Content-Language: en-US From: Zhongqiu Han In-Reply-To: <1784191899-28957-1-git-send-email-pengqh1@chinatelecom.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE2MDE0NSBTYWx0ZWRfX9obLfJQzIBH1 Rjp54pyb9luePPlc9A/ozzRUfoRjtQ4ea8dZLH43knWmtPZl9kTnaz698vgarnR0JeRgqMKr4ub 11SNVfZsdtNVd0zUNS8QF+ZXg53eF/DPt/zYsAMmEUhC7Dq31tk6XQKcZkXHthW5NILwg4LoxOF P2jW1o3vyjlJ+avNds7a7QBAd99vguyXDMgQuhSJHwBlHRHH4i5Y7rTwddmEgks+xdlAO8PPtuK ndCGDRdyhbAcYTJllsXCzMAFgcZVNhs1a3VLChpNuvlVglr6e0BZL2td1fgE0qaW4zf9rQdNLye 8Xsov8qf3pPdTJCH5j098HMlOgc5TQbRHSvafkSO8ovTik45YbMynQryX0cV47wagWDNzIOQ5do thedWdkIa6dB6+QNNcNlJUO8eEx9H/VNq9uXRJFC7AvYjuOPiwXYD0S2bRutSHW4/pGhaJHbxZG DBi17R5C9loAEAD2HIg== X-Authority-Analysis: v=2.4 cv=WrEb99fv c=1 sm=1 tr=0 ts=6a58e67e cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=Uz3yg00KUFJ2y2WijEJ4bw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=KMAsm0FWdzjmD8Gr-2AA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-GUID: zAsEtFg8WFqtPkHl0IfZ5CbddDr-S23u X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE2MDE0NSBTYWx0ZWRfXxB78pbaz9F3y qVZlOzo3W10w3SYzcuEd9xDTTN3WjDEm68cTnECfOn2qsvYR5jSpLiwP1Qn7hDNSyHgNoKuLcqo BXMBEeLqvGL+LYtWVeOsz37e5xMR+5g= X-Proofpoint-ORIG-GUID: zAsEtFg8WFqtPkHl0IfZ5CbddDr-S23u X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-16_05,2026-07-15_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 clxscore=1015 spamscore=0 priorityscore=1501 adultscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607160145 Hi Qianheng, Thank you for your patience. It looks good to me overall, just a few nits inline. On 7/16/2026 4:51 PM, Qianheng Peng wrote: > The crash issue may occur when modprobe amd_pstate_ut on intel platform. > It is better to start with: "Loading the amd-pstate-ut module on a non-AMD platform triggers a NULL pointer dereference:" or "A kernel NULL pointer dereference occurs when loading the amd-pstate-ut module on a non-AMD (e.g. Intel) platform" > amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid success! > amd_pstate_ut: 2 amd_pstate_ut_check_enabled success! > BUG: kernel NULL pointer dereference, address: 0000000000000080 > #PF: supervisor read access in kernel mode > #PF: error_code(0x0000) - not-present page > PGD 0 P4D 0 > Oops: 0000 [#1] SMP NOPTI > CPU: 0 PID: 20300 Comm: modprobe > Kdump: loaded Tainted: G O 6.6.0-0010.rc1.ctl4.x86_64 #1 > Hardware name: FiberHome R2200 V5/Xeon Boards, BIOS 3.1a 02/24/2020 > RIP: 0010:amd_pstate_ut_check_perf+0x141/0x280 [amd_pstate_ut] > Call Trace: > > amd_pstate_ut_init+0x1b/0xff0 [amd_pstate_ut] > ? __pfx_amd_pstate_ut_init+0x10/0x10 [amd_pstate_ut] > do_one_initcall+0x42/0x2e0 > ? kmalloc_trace+0x26/0x90 > do_init_module+0x60/0x240 > __se_sys_init_module+0x185/0x1c0 > do_syscall_64+0x62/0x190 > entry_SYSCALL_64_after_hwframe+0x76/0x7e > > > Add state detection to amd pstate driver to prevent amd_pstate_ut driver This change fixes the amd-pstate-ut module rather than the amd-pstate driver itself. Maybe something like: "Add driver-state detection to the amd-pstate-ut module ..." > from testing on non-AMD platforms. It also covers the AMD_PSTATE_DISABLE case but not only non-AMD platforms. And likewise, the subject may be changed as well, for example: "cpufreq: amd-pstate-ut: Bail out early if the amd-pstate driver is not running" or "cpufreq: amd-pstate-ut: Skip tests when amd-pstate driver is not active" > > Fixes: 14eb1c96e3a3 ("cpufreq: amd-pstate: Add test module for amd-pstate driver") > Suggested-by: Li Xiong > Suggested-by: Xibo Wang > Signed-off-by: Qianheng Peng > > --- > v3: > - Remove unnecessary NULL check > - Add detection to driver state instead of driver name > > v2: https://lore.kernel.org/all/1784108124-19988-1-git-send-email-pengqh1@chinatelecom.cn > - Print policy->cpu instead of policy->kboj.name > - Add cpufreq driver name detection to amd_pstate_ut > > v1: https://lore.kernel.org/all/1784015941-26535-1-git-send-email-pengqh1@chinatelecom.cn > --- > drivers/cpufreq/amd-pstate-ut.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c > index 735b29f..2142838 100644 > --- a/drivers/cpufreq/amd-pstate-ut.c > +++ b/drivers/cpufreq/amd-pstate-ut.c > @@ -560,6 +560,11 @@ static int amd_pstate_ut_check_freq_attrs(u32 index) > static int __init amd_pstate_ut_init(void) > { > u32 i = 0, arr_size = ARRAY_SIZE(amd_pstate_ut_cases); > + enum amd_pstate_mode mode = amd_pstate_get_status(); > + > + /* don't test if no running amd-pstate driver */ How about: "/* Do not run tests when the amd-pstate driver is not active. */" > + if (mode == AMD_PSTATE_UNDEFINED || mode == AMD_PSTATE_DISABLE) > + return -EOPNOTSUPP; > > for (i = 0; i < arr_size; i++) { > int ret; Anyone, please feel free to correct or ignore any of the nits above. Regardless, the patch code looks good to me. Reviewed-by: Zhongqiu Han -- Thx and BRs, Zhongqiu Han