From patchwork Thu Nov 7 19:08:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 841625 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 5FBC6366; Thu, 7 Nov 2024 19:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006559; cv=fail; b=Ji+bLM5hyePrhh7xOsNK6nhJMnn7G+G4oDe4xqOAULDdrw5+PKTK7iZ4jLpvHDSwiaY5+tzzzLuCYCy9YZdimuEvpvyDjRIWs/1MhXEtsIBLGaWwQHPIABp0fBW+BZwTbuN1FBeKmrRx2j9rTkCjDB8Sb/MSar5cuHA5fBSYhNw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006559; c=relaxed/simple; bh=pjFZT0fb/gVn3I7dwMz3S9F9Z+DaEFtVfi7oVA/DSlc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EqVcLI0uWeH3kjG78fnHgqk5KIXSCAsZMUr8iNf4ST1x3KcFWSpA06LJ8tVhLBr5tcRzi85xdWZM+TXYe56XhwG1tR+65Ms4kxNbzyREnrtm7M3lUKP4WT+1EKXYCS+nucySQt+e2IDelbpnhwc9S5Cs3ktrEse1x8n05/pXJLs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=KiV+60nF; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Y2mn5WBp; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="KiV+60nF"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Y2mn5WBp" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBfMQ029239; Thu, 7 Nov 2024 19:08:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=SXIK4lyZNeGwltLFKkc++ba2e94bN0lRjiyisxGBoFo=; b= KiV+60nFQb8TomZQHsqbvBMJwlPomeLUy6uIGq0x993TOGyTiwKXW1XPBSd0oyHk XEI66pQX2Slfa2hNpjEPS4u1m9tIEWkeb/4tCWmUpMPfVAdTlA5Fd/vBpDxQ3fgh SKERh+fvYH4HMH+RA1Z7j1x8gb6TUChQYyZ3GXMmJpr0psVUoCkMUz9zV757oCzH e1kaCEgHpkBrgFh/bNCh3Yk1RDXc7EGVwVLP3Yfz0k6O0ntrBrMP7USiNrq/xwAb NRw1fROetDjp6h8CLEl+Iws5BFl8ntAEwssbngiak7hWy3MlXx1SodUNYNmY45q3 0tRKXq0WQsQ2RizbYKGnOQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42qh03efe4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:29 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HotYZ031469; Thu, 7 Nov 2024 19:08:29 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42naha6c5t-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JCjwV1XWdeGHF8fkqRSHR14Ncy4JpJ8br8XA1YjKgnKbf4rw4S44zNZye6znm9zNwrz+3kIQGooMnKPPnuBo3KIBfYvp2lyBi4SDPi2rpXK4EUIBSHJJESjaVOYqVwERZGeMg5tMfh6tSyXCq7HvrxS3jYuwUOQrMy3LGoQhV+hXoseOWbzn4npgJRRrLdZHvOUNQ6HxjRnvxMnKuV6WWAMqa8hcgN+hgzNZu7+BPnj+HRv8m9T4aom4pdZeNKrYhNRrSMN2lzaoqJbPbh1r4pCTB7FYDTwCTQXWgCp81zkNGHyVZeqIuEid4LDm5FDW5a0znUf97EqXcygY1ed+eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=SXIK4lyZNeGwltLFKkc++ba2e94bN0lRjiyisxGBoFo=; b=Jp5eKm6YYh5Rf55QE5UwD0mFySc6NTK+kFGF++Nqcksz5yo9+wRoNrTV37tkVRX420+7BhQu1H5br9VFw9qCc61zOJiSYR77hFu3b8hXQxcRf/VtsdKUYPNCsZ1jSSH6VdelPtnDIvjrROgfGqI6THMA8cDLtBYdIcjd1vxLvJ9HwSK/1LC2mWR2MrlUqCTospBZ0TVKbEwkTY93n75tGSMPyv0E3dBFb0YlZtTwfiliLkNtsI647Dd+BoGYg9A0A2Du/tGgzE+WeBfGXl/58NI5RBUWA6dAEZYc1IccwvKetCUi1J8vSv5GV55LlhTNy5f5MSnV2/v5GUmHl0VM+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SXIK4lyZNeGwltLFKkc++ba2e94bN0lRjiyisxGBoFo=; b=Y2mn5WBpxUkO6JcXvn7rzxGVZMtu51LPqWM9w4DMFKX8QQPixzH84EFauqPMii8Z6iLM1PEG3DN9XckEj4THYvzHJCtWHhtqao3LRJaoMt2brvIqR82nIEjs28qi/u359efpvhVsGvJuBKtHlV4hrhb/a0rYfEjICNwe2fRH2q4= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:22 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:22 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 01/15] asm-generic: add barrier smp_cond_load_relaxed_timeout() Date: Thu, 7 Nov 2024 11:08:04 -0800 Message-Id: <20241107190818.522639-2-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0102.namprd04.prod.outlook.com (2603:10b6:303:83::17) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ff19b90-d2ad-40d6-c917-08dcff5f8c82 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: UP5A9Zc/Q2hFCEIApnt+lvtB6z1e+vqNqZyTa9v5B4I4EvGuBGBu+7qdcmnRUPAjBqiVtx0XQNl+fzQ/WmA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c5Dhjlg57jiZPvnLxYUfXE41PDuzFRSdG/iM5Nw6TQT8qumkaxrAGPatPDfmsLgYliumk8YmpfeAjVqL8eS8shSzOeLMyaZzRELq1bUiLJMZdpuKueMbP23SE/cAu0xmWV7YntQfuu/JZEhb6zh3NsOA09H7oSY2jFd01FQ16pPCScf7YK92LvFRI1sA X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d2vo6+1ix52dNDu/gp/FtHrS08lJPyu5oOl6qZhw4/EwmgshDF6XxAiYp3vhSZgbuAbrO9mKKWye2Af9rfUpA8zH63ODgImFRKuBNQG/T6psmAiozqTNIUAobnpsUAlYo9BfKuDXeoKuqIbZI2+BP0aahnXmBHHDMVWR2GM2iRsIR6JzSFcyQ3yGv3FtOj5ID02BgSmYGRJccEckkwzCWcIDLOIs6WMpf+f5MJn9mWXSeQWbm1sPV5AYMYH4cSDEY2DAJMblpHEQ6fUSUBFSPhMrISfWxNEXH5/n6+ikKkOBLXE/RJbKJZP5AT/29m4jk14OU/YR0cBQueg03gsacyFJzMdx/Yc11GUgE+GFo302qD93c40T1rREnI/DMUul6ffjAEXjJ/4gTScqpfaIftJV4c7fXCzOMiI/uVOUDc9U6OKLoWcZkbB+HTYEAx5fDcro7KIroTPDj6gyfeEDPfsEk8n3SgL76BFOxUGsEXfSD3vyS58p7wc0KnRNWrR0gJ84FXRrzse/RvKqWEmUCEZwUrh1chm2A9eoesvBBS7/A4mU0T1OCp2e3uuXfBD/tXL+3RW+IZ6W0ic5Ckb72u2q1S5zTMFpQ9FoTwzUD/WMcgSrfsXfQTNGNbLCodSDE+vHHVoWCWEIvQLTK2gY6S0uFHWZAAxMwS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WsYmrHB1SQhJaMGJPhIE3cxgNogqZXru1S00Weh/Sc3QSHWZeu2036UViPNxoGMNXMmu1ztoZ+UKjQgHYR2Tz/ElchORfe0ZyppZyUWY0gVTcDRMAy/RlsnunxlEDdXo2MZNjBJbaNwo8VCxtkgy3zrq84EI50ciX9o+u5VWw0UDsirD5BVN+dwXoU9aaCXURwQYS015btqWXMShU6BFagaIz+eVOwAkFljgZp7XBJGNipikphWld6L86bQDQzCTTNwHWEuQ+C1DD/0OdDFuXab4kZIAwR0slvd1t1oFVy6+0cY9hKPrD5inEEOraT7AEnnjtKfEFLc9wT11ie+RLPmjf0J7TJuQg6sg+3KNt9S/UQtHMuxSjADlD3l7saiWn9K26PNmVqo9lINacDcxXe+F9CssmpCs4A82mJ7IGRTfzhwEdDGN1iXdn5HWqbs7yHaxo5kiPr10iDPdUI+ruoX/0e9pSdO8c31rmzRj2daN2O4aRRgJ68OwpxVkHRE+MgQvsF0hE2fKrQQdXD11/GO71NVTdnWoHHIEmkhjAZBUI9IHoKQdpv0pFrAwS30= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ff19b90-d2ad-40d6-c917-08dcff5f8c82 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:22.7396 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Gbv1xopQKs9qHy5z6s4drnxJssyJGNmBpKFMIX9k8rJ+YjVUA5X6sBOgjL5iigc/UJFU0kCoK7LG7ikT4VFIg75chaxCRE828ALkHzj1L18= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-GUID: PywjNqxFCDylieKsOIh960Pv61wAvhaX X-Proofpoint-ORIG-GUID: PywjNqxFCDylieKsOIh960Pv61wAvhaX Add a timed variant of smp_cond_load_relaxed(). This is useful because arm64 supports polling on a conditional variable by directly waiting on the cacheline instead of spin waiting for the condition to change. However, an implementation such as this has a problem that it can block forever -- unless there's an explicit timeout or another out-of-band mechanism which allows it to come out of the wait state periodically. smp_cond_load_relaxed_timeout() supports these semantics by specifying a time-check expression and an associated time-limit. However, note that for the generic spin-wait implementation we want to minimize the numbers of instructions executed in each iteration. So, limit how often we evaluate the time-check expression by doing it once every smp_cond_time_check_count. The inner loop in poll_idle() has a substantially similar structure and constraints as smp_cond_load_relaxed_timeout(), so define smp_cond_time_check_count to the same value used in poll_idle(). Signed-off-by: Ankur Arora --- include/asm-generic/barrier.h | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h index d4f581c1e21d..77726ef807e4 100644 --- a/include/asm-generic/barrier.h +++ b/include/asm-generic/barrier.h @@ -273,6 +273,48 @@ do { \ }) #endif +#ifndef smp_cond_time_check_count +/* + * Limit how often smp_cond_load_relaxed_timeout() evaluates time_expr_ns. + * This helps reduce the number of instructions executed while spin-waiting. + */ +#define smp_cond_time_check_count 200 +#endif + +/** + * smp_cond_load_relaxed_timeout() - (Spin) wait for cond with no ordering + * guarantees until a timeout expires. + * @ptr: pointer to the variable to wait on + * @cond: boolean expression to wait for + * @time_expr_ns: evaluates to the current time + * @time_limit_ns: compared against time_expr_ns + * + * Equivalent to using READ_ONCE() on the condition variable. + * + * Due to C lacking lambda expressions we load the value of *ptr into a + * pre-named variable @VAL to be used in @cond. + */ +#ifndef smp_cond_load_relaxed_timeout +#define smp_cond_load_relaxed_timeout(ptr, cond_expr, time_expr_ns, \ + time_limit_ns) ({ \ + typeof(ptr) __PTR = (ptr); \ + __unqual_scalar_typeof(*ptr) VAL; \ + unsigned int __count = 0; \ + for (;;) { \ + VAL = READ_ONCE(*__PTR); \ + if (cond_expr) \ + break; \ + cpu_relax(); \ + if (__count++ < smp_cond_time_check_count) \ + continue; \ + if ((time_expr_ns) >= time_limit_ns) \ + break; \ + __count = 0; \ + } \ + (typeof(*ptr))VAL; \ +}) +#endif + /* * pmem_wmb() ensures that all stores for which the modification * are written to persistent storage by preceding instructions have From patchwork Thu Nov 7 19:08:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 841624 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 CF302216E1B; Thu, 7 Nov 2024 19:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006560; cv=fail; b=IjEuuhqSz4CNrCdyeoLDFkh8RI0fyLlGtOHfGq8vIyJSkKYGfhd/Y9ZK+gZmm87rcneydRieygVknDn1p1+/UlowUudo2UWKN+HDGR78a2wnlAuBuVpqjjWOly1SMV0iat7wpFr2NGBKtWrItSHZIZIKYW0VkbOf5OtOmwmpjd8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006560; c=relaxed/simple; bh=BDCl1MhsWON2JFvI4wmDRNJbrX5sZLWtUuDRbN1J3P4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ozlJc/QPDkDWiiL0bNJVIAfMywMaKWNrJvnD/h63rlJKy0tXLK4LMk6VpjxJeO8ULIcJ6sDSQ1NE/KSYPAE+excobQeudRABCl520OcibekiQmFpVBO3Qr58gXy9Kmf6HMxAr1xoy86Nbb1EU1Dl94UY6VEZ7wuE6TrI/6a1zTM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Jr1gkE9c; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ag+ycG2B; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Jr1gkE9c"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ag+ycG2B" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBdq9002594; Thu, 7 Nov 2024 19:08:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=SHv9Cs/97issh5XVuPCDyjXjH4adZ/Hx6B4wv0PiYXc=; b= Jr1gkE9cOaR4qQqzPgjnBwV/3Oh9zPP5BsgI4jCY8ND3VUDvXMC5M9ywthr/j8Na 00iXnNy77f5GO9EutajSwqWOwx/skRsR8eiuSpdvrjY1/8ARB/xtyJCqycScGGW7 NyTprBfTKWDlOQDe4udbdi7vD7XCd/Uttppk+972776aNl+mC3B9Gnb5fMKfYeNs 47hCxXF4IKm6I9qv3f+3xpG9ADpkMRvUbfEwTDLow42jS6svYR8MXKk6FaXYiR3v fXy5+4LP3t5FU98NiKc6zgsXyFwwBU+HH9+n9KEUaN0oBiCNiO9pwHXjyK12MUJg QymoUaUtCUuIfqbGyT5rxA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42ncmtbbax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:33 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7I0lqj004996; Thu, 7 Nov 2024 19:08:32 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42p87duyxe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DB52quUMObLJ0HnX5CiICNgtgYfz6gDAlT7N6VNiwILbaAOZ2cLM/utqN88Jz/mQhfl/XJXby+w+gaGyMwC5ebhUzPkTNEPrkOuR2ZtlXw2RYtng9bb8JcMELmw2bfVfRLdD79MO1BGQUtviUQZ/O2Y3PsgF9ib06swKTcMEdXZfPZdhex7RPal31MzPUgHxX/2axPY1Yj6vsBuBvo8T+7qff2mT/TkDtPJQ8S/uwIPCGnPAkHjqB7CuBhamvpxDiOUOlpF/2IL8I//x0WVo7pDBS7FV07Ez0ulS8DuefE/fX4I/ukKK0nEIFl6Dj00r3uIAWpbKTBgODoh2p+yGUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=SHv9Cs/97issh5XVuPCDyjXjH4adZ/Hx6B4wv0PiYXc=; b=aP+j89vpfCBoB6/cMvbBea7N4DkY4XjVeY9+vJ7yyljBk1c9tr1/zZmuSHrYtF3BeeXuTEgWrWPX9UXHwZ6g6Q0feVtMTCEeMskml0h/R8DxA+EFOV2QgOcyK67qL7QqiJBETXLb9mUIqm0hKRsu5bMtKE663BnlWm+zC87Ql9ji7ILZwCRDLQ1gTyXI6dTWJG2xtf93FHoXSA/7nND1eF5CR8ayO3RoYW9LN2biKxu97KIEK0rdjledjiDmjBeUh2ZzE8amD3h8hDVQhPD7ovMQQJnMKqXPrfZdej2oLTb3t1/mWQ+DX+Sr3UPio3MPxyiSfOl1eokXIkI9d0mr5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SHv9Cs/97issh5XVuPCDyjXjH4adZ/Hx6B4wv0PiYXc=; b=ag+ycG2BuMOU8X1gHOl9+6jkaKoop6HyLzOPE3V5qRQ0YjZXPkMh3eQm1xpTjMqqy/U0fz+14nYGV3b6efaBPSbOoWWwo59Rp57R2xw92duUU/i8znnHhbvj6pnQpMTljlsop/rIskOPUdndXBPy+twMXM5OckRJmThQekuAuCw= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:24 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:24 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 02/15] cpuidle/poll_state: poll via smp_cond_load_relaxed_timeout() Date: Thu, 7 Nov 2024 11:08:05 -0800 Message-Id: <20241107190818.522639-3-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0119.namprd04.prod.outlook.com (2603:10b6:303:83::34) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: 496191a5-1878-475e-e1ca-08dcff5f8da0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: 0hgg8iECDlfMrJVT497GNuuC2359l9sNOBiOixGHERemZwXSvDnmzXyUDifD7AQuGuARtou6PxTYzeQxGZvDhd0bPNQy4JbMAarjuroGNwVEkC/1mAFj2i6HxuNwJGpeHHYNmsqeuEll84IpqEYUNmotRYPtJVqxtSMUA/7NiHASksmAE5zo2cDNllJN8f0Rno4MG43Luj67nibdZ2H7VwIjpiSQJoTC0GqxS5UWo/0n6jlae5o1m2B3fTPcYsMa7AVIkipUxbBohhNujyFWA6tgSEAxhLFKMASVCLfxbxrVvsTeruXjoa1TwEhvZ1F5j4k9++Ek4BYLwX3gudYgKhi706rEXMz9+3lmKPaK2NcSW5VmswomDbhgRm5PZvTeParNBu7tRL2aOPf0k79MVUChLlidvTQYyyz4k4iiQuGmAIt53BjjGBJ5yUDsss/Ocuk/kLX5aEhbCLQqeBV9Rjh7JIGK4vcQfRcCN1Oe78ZcyI23hkZcLqjjxG05PjKcg4+Tl2sKjD88oAxO18ibPNdKm2nWhokhb4vG4nj1RLTLjN1Ysv4t2yxVP7pbMLCEdk7KeqKI9K4t4MXkcblzySS3SizdsxzOOYkBUrIhinh7WjayV5JxGJlXlAWQCkR/fNTy1VbyByA4WQcJ9QAnPGqVlMdUk3HRwga4ZK5FA5IRv9yFp/PopYTvB4fYcSUo3lWVTspMPz2i8Yv8v7QEo2VWIzxd6EPod7+RPPmBgACuManKosoBua7xB3RrMP5vZrIC83dEl0yrUKr8rlW3pjGNCFyNafHmCfHb4u5m3WSz7jeIYtHTyXDD/rRjdrjERt5jyc/NGNFS+8RDSRA8UAGxKAchZ4ixHvS0IPxNv6D7h8CJfVhhJMhFbkz+QLbzrfqe8pkvQOQ5Vp6yLSXpUGWPGLzMsWFwKVzuE5FTjnmkT/B0jjMS1bXv3GsacvuArq6oa7WbYd5FsjTIGJKG1GkEmLgClc2JZAQgy3oO57Xy+4UyDIsyeeXR//WmGzwGu93k6dbo6fRwr3/QmDs5JDAttfXrBNZ0EeC7qoPcvcZzxklWWXUTkAcn9I8ZkbVYvi6yjkp1cp3IFnPbqXmX9t5wddMlKCL56ZqzwZFrNiryF5GhBIJBj5fpyg3h3Rn06zSaqZ+3YC33PVaEQSJbRAdKzRFcj0cHxsFHd2dA9OYf24Wy5I7Tk8QEDgHvkusxiM528Q0p9AObfnLxqdKUs+KYYfEDXA/HgwvIZsWHV2d2j4HOXQBAaLpgzPKhAgSiikuRB35AVPfi5wBLU7ail8KkFS3RLg3KU2hL/C8EYxU07AT9I8G40TbuX+zJOueP X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rej+Jse6ecDynO96bmye2pZSvmjMq9kAZJPxT/ncHRD5mQ6s9sVmmUUQICyzl42aVZZrR+fbHLjiEAOrD0IDA3ZmnQ6vfu2E1Pjex6W38oAjX9ns/3Of3GfXvAyhmz7+GxNBxbPMGsUUKyS5eYPLZ7oBp6UinfV7kI0XOw29BBStwEUBiatvL5OO4SbTVeWD9VmaF4Ocw/qsNrIKKLDB4iOUTYA9yXtiVyv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Zb2AvwWVTye3ATIQT63UTMn21eKpYn63vhmlsjw5fkH7WqtzE0N33SNdnp5dlIclTdN3/Nu/dwaoc4+EQtU2XY1fohI+L/1k/ELMvmMFktziPT09CH4+HE7QAS46DcAeKwkycAJ2nB65q9qsmRkav5n3i3tTNeH7j+7RAjDBF2hq200LIO5utMTn99Tlv/LOa+KX2zwYSb9EvBcTt15DncoYIG40+JFk7m0ofcFdI0izvLwJLH+IQ8dzVsAaTQXgARuiRpWjmJr9wMpGGyHwQEAyQ1Sy/MnbXxcPghqcqoZUD6wmgbRB7aY/9DJ2b6zjvbWHg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: j4zQ5Ppm0Hs3XQX6k714dkqePtgcKgxXMBlPMYS6cT/qKiRxLpdN52+QGoqRx0M0c+Ip2N53xaB+VQytLPSMbIKLMXG5GUzsdItm5Xg5TBfQYQ1cDMO4z8M7NaBole4EHMPIcU5U14sroMjxWztCoPcAHMk4au8s4fEjkPgwGtpalpI4+CYgViWZw8NQzPJzeLFevNYb0Po3c22Mkw7eig+gEmpL+y4aGoklvTx/AA36VGW4DlLuwx+TeOgtJ046NUsv0eD9VytoykR5dQq8H6jwcbCaUWJ4LtCS4k5Dp3Lp7XONMAOSponm7ouC6VlxkBde5z6x6SVkkM9DU3QAIPhSCD11hThVNoX+szY828Ex5P4Z+vynbpJcXCzbTGnEdOz/IfpJ+fwh6TI+O1E92WHa49L2g9Lvro/+6EMV5iPQShNkoEZD6qNviRscCsrN4926m4V+XhKd+SVZvWaJDqWsARSYpFjVNKxTBlL+wHmrXGb7EhZU46186AdTE0OE3EO5u9m6QVdOkMt7rhVmfat/svyk6LHN+z6uvlf5fbjKbCfKUb8NNhAcN1aQ1lCj/JiSIjJsqVTL4FsDTNnwM/Z2ivTD0G678btK5votWkU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 496191a5-1878-475e-e1ca-08dcff5f8da0 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:24.4522 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Pzka9mZ6XuFs1pIry/37ut3+5SEkXymxlIydrJItch0xjJPbt6OBtgRa6xT9j2T02fBRE51rakmSdrlKf48FhbXxhPIw+1hqonfGWUL9P5Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-GUID: yk1XHf2qy2c34TBbM0O0V8qKz8aAcW-i X-Proofpoint-ORIG-GUID: yk1XHf2qy2c34TBbM0O0V8qKz8aAcW-i The inner loop in poll_idle() polls to see if the thread's TIF_NEED_RESCHED bit is set. The loop exits once the condition is met, or if the poll time limit has been exceeded. To minimize the number of instructions executed in each iteration, the time check is rate-limited. In addition, each loop iteration executes cpu_relax() which on certain platforms provides a hint to the pipeline that the loop is busy-waiting, which allows the processor to reduce power consumption. However, cpu_relax() is defined optimally only on x86. On arm64, for instance, it is implemented as a YIELD which only serves as a hint to the CPU that it prioritize a different hardware thread if one is available. arm64, does expose a more optimal polling mechanism via smp_cond_load_relaxed_timeout() which uses LDXR, WFE to wait until a store to a specified region, or until a timeout. These semantics are essentially identical to what we want from poll_idle(). So, restructure the loop to use smp_cond_load_relaxed_timeout() instead. The generated code remains close to the original version. Suggested-by: Catalin Marinas Signed-off-by: Ankur Arora --- drivers/cpuidle/poll_state.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c index 9b6d90a72601..0b42971393c9 100644 --- a/drivers/cpuidle/poll_state.c +++ b/drivers/cpuidle/poll_state.c @@ -8,35 +8,24 @@ #include #include -#define POLL_IDLE_RELAX_COUNT 200 - static int __cpuidle poll_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - u64 time_start; - - time_start = local_clock_noinstr(); dev->poll_time_limit = false; raw_local_irq_enable(); if (!current_set_polling_and_test()) { - unsigned int loop_count = 0; - u64 limit; + unsigned long flags; + u64 time_start = local_clock_noinstr(); + u64 limit = cpuidle_poll_time(drv, dev); - limit = cpuidle_poll_time(drv, dev); + flags = smp_cond_load_relaxed_timeout(¤t_thread_info()->flags, + VAL & _TIF_NEED_RESCHED, + local_clock_noinstr(), + time_start + limit); - while (!need_resched()) { - cpu_relax(); - if (loop_count++ < POLL_IDLE_RELAX_COUNT) - continue; - - loop_count = 0; - if (local_clock_noinstr() - time_start > limit) { - dev->poll_time_limit = true; - break; - } - } + dev->poll_time_limit = !(flags & _TIF_NEED_RESCHED); } raw_local_irq_disable(); From patchwork Thu Nov 7 19:08:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 842023 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 788B0215033; Thu, 7 Nov 2024 19:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006560; cv=fail; b=dUHBn2+1WJRbDX5G7122xpspITBbAEVhBEfNMjGVQU/9AftPGhiTjBplTj33jxZkGR/xUk5PR3VAExauLnxrGw33GJ5+47mbeGTiiH4BmHicb9Ml5FFCghj2tXo38852GReTv6uY8MNPOSoG8n/8T61YOL+h95mLcSlifms/doI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006560; c=relaxed/simple; bh=PwVyUlZdbIDBF1/bUbXmwuOydrkBDC/BFxP00H3+CzA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fSmUM96+0o2yiSK5JK8lk3rM9YKtMziImOlm1udnRRXv6xHknJEAwN+uETJfyCdlhcV/1i88vbdemTpo+BaYama6982fSzMqqdvsZsOt5mKH0or2X16pHJjee95OhpiqGTBgIXRfk9mkXE03oxrhLY0GdXxzS2JcrL6jb37ISDk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=ZZL9Fo+y; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=eiAB0pCg; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ZZL9Fo+y"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="eiAB0pCg" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBgId004757; Thu, 7 Nov 2024 19:08:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=B6fLm9OqSkSyvw9TBx1v5GU+/szIZK9hzT9YLCixq4A=; b= ZZL9Fo+y/YCoZ/j4OwPmLqj6uMsaVW5oBJcabiIyifEi/tHcoJuoJCT4lmqTZtTZ 3occdQ1ijW5+fH6FZ0ZUwXb6NjXsobM+EIJTuXJ6EX2DVvDXMqzBtYObON/duvN0 CfNYO+St11386qvNtIMY8Zl3FatPX2lVuLMuaQQp4YpgD0gOxtSE+x93qEStvzWI mNj34pN9JmPfFfkrFJZA2+TiYC0BzV1sdcEKZMy7FTuTVetHx6gKp3ubC231WCXc BbDGNsE+if1JIYSC2x/Es9DA+9ArwGeQn0D0Xq6YuquDhQMsk+88sBmGVwiRMT2e uUJZS8fHEJ/1VGw0dceTAg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nap03d7n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:37 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7Ivawg031517; Thu, 7 Nov 2024 19:08:36 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42naha6cbw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sFMoF2hv8vhw9VEhzAu1MvxxUTEKCOHmlHotI6M/2s0L46HAr6fsekCdfZo/pCGUaf3v4ckMtLcPqXjZ/Xhn7549RcIFlpCtux2+eGnobUV4j2TdggiZGNnKbgqRtHeTbjUsGXc9ZwYun4SvAp1zdCa670pdjyTut/dca7HfpaZMf714SwsmlVLw8p9xUqEnDelvxWQ5dVkEHNKrLwZZpAgrIpq6Zpy//oNf4LJ68/RMwf6xuD3trXYzZYwLLlSxw1pwIbctmDXlf1f+2H8QC7/GugN3lobFGK7db+MBsqS0mRpmSzaK3lWAU7lnoXlI+bMeDxP1//01OOn0nUL+7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=B6fLm9OqSkSyvw9TBx1v5GU+/szIZK9hzT9YLCixq4A=; b=OZ9aQTskzYjUGIS5HWQJq0onngmrnpDzoeZ6V/3AGvD6pwgZxmnjq888bgFujP1tgzs3PeaStpF9c5eP/5uOHslLmMGgav4Tx0xoSCH2X10uWW3h3pn0IEww70rHcIs2cv5sW09qL5YTQuU7eFLToxHnNEpDnzWwgPdcEPdUaCk/DuFAVfD7AD/ZVvik57HC0tNbGq0jMQuSJeUFQEARrzov9vQsOfwg6upp6xZnxYXaOzIqJzQ08m0o49TtX1NnONmDGWbQTT5ZFctK43fJB975pCHWSIMUpb1gqBnRutPyq0XnNmICUiLXM1IeHCLQjibkm7T6GYB15e5bUHyPkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B6fLm9OqSkSyvw9TBx1v5GU+/szIZK9hzT9YLCixq4A=; b=eiAB0pCg5NpZZ3i0fF6j2JAXI6yV5YM2gCfiutNqnCPJPN/MfzgqGpdjn7siPbnJvsi9FexqcGgAEIUEMhXko7TTSNDni3VEDjAbWqbcARNTw8i3mreslyfR22a+z9Hetu72g3IdihbgMAMznoyKahyWnCGgcCSV483QQsdrf8E= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:29 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:29 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 03/15] cpuidle: rename ARCH_HAS_CPU_RELAX to ARCH_HAS_OPTIMIZED_POLL Date: Thu, 7 Nov 2024 11:08:06 -0800 Message-Id: <20241107190818.522639-4-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0091.namprd04.prod.outlook.com (2603:10b6:303:83::6) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: d10348a3-4941-4d8b-4751-08dcff5f908c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: 6MS+3T1y7OBib6UMi6vYmV9jZsQENBacWVrB75YeEr7Xs1emR3GWgGere0TMIIEHC6vNawlAdfTK7ilZr20DBYQMeZ7hdalzL2dNvghLnlSg8F+IBGtIYvS71AXNcO4DN9K+Cz26rG2jARXnAsOTnJiAMzXkIws6EykDperziKZtSD+xF6UPudKx0W6adpwvXMOHfxHi7Y5nHjVJQjPhqvh9+iGabl/30ckxVAtmJzDngDwsbAhhrCCZ0XV2geDu4MzkQaVeZbieX0CAJZRrJDJ8xeJGO3uufp16Ci3pyiPvh4pOcOc+ghQn3TggGkZAkqXhrD/7H3k/bTo8BHvVjjLe5+2Mr90ZSpARE9kubuAnCF9TeVwxJ3IYZQLQ+wbbozMSYu52hGhs54PUn0EAJHnWJOeQlXM8M+22OA3B7fxm3tyqkEkgS8sjluv0bFTUMaLgSq6rlqp8/b4QVS3S7QrHt1YXrnnZJSMBnOuWpfttQ1hN4PjEhpEaY77lqSOmvyZismVOzn/KgKVL3FNtBIEcafVbuDqJtJcS5ok/1wpVAUn/joSMv8NPQdS7hRwlJAWqY+8NK61A4m2y2AWvwysqC8a2HgYln3DK2pb6GA/l+Fk5xE8P+oqymxFrUlaFJ9vcmn9uKVPC3Tl5D+fxqNUz/w9YbXjA7PMKw74nggDbRFJBxHD6OCZV3cFZeD77qVVuOrFmhrNdSTJcAigG5ovbwhjW4dlswOhtpciT5njrErsqcxEeIyxLDsGPzZUPbpKSJkkWo1Hxd3ZXPCS1FI27aldT/VIGfn0y2t8XMhZbJ2poy7at2aOFLbdluAN34/Dm8o3C5oBcJcBY0xiDCbeFIH5ZMrsVl+TFTFTKkZ2WEFIXgO57FXMNjImsjHyUEMW26Ia8b8oqE4FcAv1Kti2xf477qmQS/n7joG45VGcgshR4RLRsHN6ikjP0HhvIsCUfkWtOlZTXpIzgdRc+wasofVq18VOnWKLD+Yd0N6txJWqim+tnpYt3b7G4QCwj4/tyh+OwvyFbFkG1/a7Qvi/bK5jcJAS/RS5/MId5vKoujz6fJzsdKHU6so/FPAPYbRYMQlaCcL2JjY4ebyq9yfwBMZrrG4IpRshZujd348z5bUJcT+Etcefu0XpNA2Um7ae16i3Mc1VbbstBBLKCXECYnEEtpbtqrRZpHP4nL3sfqgXYPkPo/bwjxUPfjDUuCS9x93LVod0j6qzrhYQ9iefnqkuea2jtliQt81N20pwAenniMHVy1/SiNvnfROHFEBkysWMw+JXZ7zI8gT8SSboQCaNsPnO4VPoTTW21O+BfAXKdra8I2f3a7VQ8NO5y X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR: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lCEp4lzvMFv+n4uvdX3d0EDHLb1P3fOdSTBWJ/i95uv6OlV+64snnQeMuVh/ZiN2+KiFnPhyt7hMNBin1Lnyw7M0KYyOO2BMBi6EB4uqXYUkFlBEf5+i12ZrV4/Pwachx0PrJfbvUuCP1fFSI9ntT+zr2V6Bv9DSYr7GPPwEoz3jiy7Apy9+XPh4KkP8AkP08Ix7F1TaY0M4mEReWOuAoNJwSzLqRObv1w96hZSjO/JxexAxT9SNI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d10348a3-4941-4d8b-4751-08dcff5f908c X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:29.3375 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vAgJI52or50C/025PDhNpMrwka2b5uKHpatSoq+3Uv38hWn8A1KSiRMDpM349pC4cgaQnVqnB8EnqILw66WVyOUZzW6SM32NV5zbh7Kt4iE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-ORIG-GUID: 9ej_sRjuyeQsq4-bgCB1cu4XLkKaJPGU X-Proofpoint-GUID: 9ej_sRjuyeQsq4-bgCB1cu4XLkKaJPGU ARCH_HAS_CPU_RELAX is defined on architectures that provide an primitive (via cpu_relax()) that can be used as part of a polling mechanism -- one that would be cheaper than spinning in a tight loop. However, recent changes in poll_idle() mean that a higher level primitive -- smp_cond_load_relaxed() is used for polling. This would in-turn use cpu_relax() or an architecture specific implementation. On ARM64 in particular this turns into a WFE which waits on a store to a cacheline instead of a busy poll. Accordingly condition the polling drivers on ARCH_HAS_OPTIMIZED_POLL instead of ARCH_HAS_CPU_RELAX. While at it, make both intel-idle and cpuidle-haltpoll explicitly depend on ARCH_HAS_CPU_RELAX. Suggested-by: Will Deacon Signed-off-by: Ankur Arora --- arch/x86/Kconfig | 2 +- drivers/acpi/processor_idle.c | 4 ++-- drivers/cpuidle/Kconfig | 2 +- drivers/cpuidle/Makefile | 2 +- drivers/idle/Kconfig | 1 + include/linux/cpuidle.h | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 16354dfa6d96..3fa741dc0445 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -378,7 +378,7 @@ config ARCH_MAY_HAVE_PC_FDC config GENERIC_CALIBRATE_DELAY def_bool y -config ARCH_HAS_CPU_RELAX +config ARCH_HAS_OPTIMIZED_POLL def_bool y config ARCH_HIBERNATION_POSSIBLE diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 831fa4a12159..44096406d65d 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -35,7 +35,7 @@ #include #endif -#define ACPI_IDLE_STATE_START (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX) ? 1 : 0) +#define ACPI_IDLE_STATE_START (IS_ENABLED(CONFIG_ARCH_HAS_OPTIMIZED_POLL) ? 1 : 0) static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; module_param(max_cstate, uint, 0400); @@ -782,7 +782,7 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr) if (max_cstate == 0) max_cstate = 1; - if (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX)) { + if (IS_ENABLED(CONFIG_ARCH_HAS_OPTIMIZED_POLL)) { cpuidle_poll_state_init(drv); count = 1; } else { diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig index cac5997dca50..75f6e176bbc8 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -73,7 +73,7 @@ endmenu config HALTPOLL_CPUIDLE tristate "Halt poll cpuidle driver" - depends on X86 && KVM_GUEST + depends on X86 && KVM_GUEST && ARCH_HAS_OPTIMIZED_POLL select CPU_IDLE_GOV_HALTPOLL default y help diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index d103342b7cfc..f29dfd1525b0 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -7,7 +7,7 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/ obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o obj-$(CONFIG_DT_IDLE_STATES) += dt_idle_states.o obj-$(CONFIG_DT_IDLE_GENPD) += dt_idle_genpd.o -obj-$(CONFIG_ARCH_HAS_CPU_RELAX) += poll_state.o +obj-$(CONFIG_ARCH_HAS_OPTIMIZED_POLL) += poll_state.o obj-$(CONFIG_HALTPOLL_CPUIDLE) += cpuidle-haltpoll.o ################################################################################## diff --git a/drivers/idle/Kconfig b/drivers/idle/Kconfig index 6707d2539fc4..6f9b1d48fede 100644 --- a/drivers/idle/Kconfig +++ b/drivers/idle/Kconfig @@ -4,6 +4,7 @@ config INTEL_IDLE depends on CPU_IDLE depends on X86 depends on CPU_SUP_INTEL + depends on ARCH_HAS_OPTIMIZED_POLL help Enable intel_idle, a cpuidle driver that includes knowledge of native Intel hardware idle features. The acpi_idle driver diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 3183aeb7f5b4..7e7e58a17b07 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -275,7 +275,7 @@ static inline void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, } #endif -#if defined(CONFIG_CPU_IDLE) && defined(CONFIG_ARCH_HAS_CPU_RELAX) +#if defined(CONFIG_CPU_IDLE) && defined(CONFIG_ARCH_HAS_OPTIMIZED_POLL) void cpuidle_poll_state_init(struct cpuidle_driver *drv); #else static inline void cpuidle_poll_state_init(struct cpuidle_driver *drv) {} From patchwork Thu Nov 7 19:08:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 841622 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 B8826217F5C; Thu, 7 Nov 2024 19:09:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006563; cv=fail; b=uH8+TBHH3PoYp07ba2q3sKCPX4h4sWNPZcr6pjm2T9UQxcDB6S8TmIx/KSD8gB96VRGQ/XIcTD0XZSdTDOk37sCaG9+TsYC4vd+vOTr6+RteMctfCDQFnjX1IBjeZmKGeqBZcra0N0KZE/jsmodghQ6LEcBG5ykzBqmnSjC46i0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006563; c=relaxed/simple; bh=hfPYdh7x51+QVluRmrqoK23L2K6qNApoULYegZCT5I0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qPs7rC5N9poS0jhdKcThslTspCbjLthriHNpDiQdHI5uAT+BYKkPlyN7i1PF+Sh/fqld2o6RIIAdINiVBxHy4xXTg5ItYTN0mBvh8jB5SFQ0iUQIs89xxVRqNA8KEZNZOoa9eUAcPKI3osreWXpEI5teDxFrNRCDz+8/qIldp/M= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Lt/tyFAT; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=qXWBKLjJ; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Lt/tyFAT"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="qXWBKLjJ" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBfIi004745; Thu, 7 Nov 2024 19:08:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=v/7lVyfIFoYvOw/bCZEaRVQqXNTqEcVFYh9ptR2EzVI=; b= Lt/tyFAT2WywQx13oK9zeshBd6/PhWBP4RzobJdrXq/q704g6RlDzbDzX8afVAIP J5fBkp1TX0Pgx2LaGiNSDm4hlVJd/NZ/97cQDntl9ywoKtl3tAEQ3oUudZnH7vev XOuE+kXiKMIv88PUK0yFIF71FGszqJqvaUNvTw7MHe9Xs6n4uBpvO2/gT3NXnRsr 1JGDEWgy9ZNwR8eKJ0KoR519/VjP0Vf50rMfHxyth826zd0JLSYC13hE1RnzZBu4 01u0ZnXvgIc6zZv2UUQg3MX17xxGYaJP8eKBCF+Mpud5Jw/JSjbrwZAc9fBFtIy4 2P62KP1NfcA4Qy6Uf4EcdQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nap03d7q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:40 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7I8FXA036113; Thu, 7 Nov 2024 19:08:38 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahgsuqx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B9WanmIovLtlnwGrab1sDs195fePP7ctFCxiSjhXfUkP6a25TaxYMvoqXADCcZBgAhDyAHRNQbCQCQcXjTAxH2YibpM+mOYF43o+Ej8mTvv6KF52T9zDbm8cmpNRaffLgrmzn2dlnciIq1ZkFh0/x76BNV7206E+WjLbBKAN0b0BBQzTYZytpxhIswYaosiUGQG0EzLF1NY4pA8CAdCtlPHMh/ANtNURHOLENjinTfNhag2UL/Blzz+FNpxjQw4uCF9DNJdnkyfLa034j/Goh6mlRPPJ6ZxGdbAyEMpMVgRqqCvUu/r5ovhwcvFKDlNSNt82iJmBurgY7Pu3nk17rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=v/7lVyfIFoYvOw/bCZEaRVQqXNTqEcVFYh9ptR2EzVI=; b=kmp9n1qW72EtDF0OL1OcqW/JxKCTFsuB+s/84ldcf55nRde5Hx+KdpbF44FJscXvb1hVrOIXXhoUaefsoMNTGtEgVSFImtG5LwAARdDHSWBKc9vsZRQS0nrQSoZHOcXYZKfi27WK8rW7YSM1EE+5jBlKa2mWSZC2cL2zDLcr/4iw13v4JwBn5U7Q/HTeALmLTS9yXOm0GUrnA44F1F5vo19aT8gtX9W3K5KOwObO0ESW9fTJWqVS6joBzW0FQFE7lpQncx5VwrSM4n5p4uYRhx4MrVFZ23XpO2YRKu4aVxuDc9oQrzMclBVOkirTV267VWsrabdzybMory/jMPWFOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v/7lVyfIFoYvOw/bCZEaRVQqXNTqEcVFYh9ptR2EzVI=; b=qXWBKLjJdf1d0rDDBfp//a2wUcfsCK67fuiA7zAGV4d/TiCImft2JBxT4YVs/Fdx4bdDGxCQgGXu2ub2i8hBGsU5rjmwHpoY3QSmDgAzsEjDQR97A06D5YYsXIVKQmL8W5MZ10FR835MFyMDIQ03icB2F4XibXdG1Kpae/9gcRM= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:31 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:31 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 04/15] Kconfig: move ARCH_HAS_OPTIMIZED_POLL to arch/Kconfig Date: Thu, 7 Nov 2024 11:08:07 -0800 Message-Id: <20241107190818.522639-5-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0096.namprd04.prod.outlook.com (2603:10b6:303:83::11) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: d5ba2132-184b-4f91-0ad2-08dcff5f91a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: BlWNPt+x7vHkxDjPY6q5KpTd8SHwx/astqD0kxR7jzsRr/+S6Wxmvm1Id6bL5P36R14GkP4E9RhJaijmIbx5JEPL1GbBfhKXQD0aL+uvDoU23/P7TXCihLIAeQKBni+lzvg+E4hD9FytSM3PVjToHhJsBEwOrLbQd+KsX3bnrAV5v0+GSEyytWnApCJUsqc+j6JCG/INA1jArhrV06gXqCBhlqiqCOR/iLncyqeXscdmWHrlJB8cLIews1vsnd2iWUbYbZpMp/l/lhKGD7ms/AOVBaukvcFlM+cXSyaw4UPJ+D5xEYQX2NBAYV9FBnAlqISHU/ZiM3h/ZJKC6OUePP8/7+4wJhsZJyjzWtZ9OH519EIW/KkA3jV8h+jbFqZxscf/9D0O1e69RyHYqQgqOYdoN+eYgLVpIAW7qxnmbKw2uxKzdNlVy5SIslbKxv3JY0yUqB+2uDrT0PHLdHdfIboGzlo/+tRlwqRUjEESRSNUH1zI2k+GoE+JEZKVOeV7D5Lnhiqij/8fsS/lf6ihDqCWnTg4ZA3UXF1rluqjAsYHbHBtG8A+WvtgHRqptNmYu9EFiIy84TjLFvc8GiZZW2aP5hk1jCS5gCsfDLCWiIzegN2CRm9SV9fwyTDg69nlINWv0QqB76VDTpKxM/rSxLC8lNFu/SFg7fhOrsrQky6bQfEd6yx4SVOlreS/v/xkoG3AMqNpc0swBUcwkZ/nuX5W/5lqh8nq66AHKggys4vGF6k81agqRKD2UAN6kjF+2cDjeqQ3sWpomAuxagapXuoeK+6IalnFqH3skZ34cJ6eAfcV+81Ef9emjM8V2NitYhS3ZhgBeujmbexZOUxehTOISY5bF1U9Ma6NwwYaB4z7N63ZkjLPfiqkKXnJczNJYBlKoBzoajG0L39ihu3Q1YmkI/W83Ly8X6geUdbxbMWLCyXIBo+OTVNkR32SVLuFpcZUcthfP6t9h/m5c1yWmGMsUMTWf0T0PmsGI++96CVCCIEJGS7NPgqCSVUuXlP4S/caZVHI+j69Lqb0lTMoz+qFBm/brV+cTV/fRlbmB+qqlM5y6VisqYvzHXJw/S+Kz9+3MNPGEQ+0QDzk3BaGLTQhUIgZLsHqLq1sBXLrm+Zo5LItmmAL3Dyr4qCHcXhoMZz4/19gSIB2poCIAw5nY/GjmVCyRVFNaZgfs214pC180G2zKArXscPdnL1M+FApVUOP2QUizoVdmOuBEwBxKV8r3FqDNhT1NMeb+oQiRV2Grvz+kii8EgoBPLCOg0zyCldfjxHXmJmP6ew1e2t1GyymthPRIN25HD/Dk1Blkz3aQ7RvSO+y8Iff9clIljQ8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aOq6QZbgzYmeh0c7AIBL+K2gHDeHba66gmv9B6BGb2mbtNzJIZDX+qMtOxBLoUd0Gb49Xueg1mzk++lPdXSEBVPizDHDXVnnVpswfj17mzsCashW4VGYf0ekRshpqZVMUEBzcktXdxzQFnrL64yh9NKTaPhkeEzR2s/vic8OO7VZ/pSm3Mf1B0kBnEY8jB2B/nthd0lfMYA0ysjvW5wyBGgu/RkhStoRxerfKCvKN1m5Hzh4bTT8AoBtB5rDY/XJKj0RiNIBUjsBrGenNt0Ss4h0Gt7EbYSzaB71TJT3QKaPn0omuJ50vCZNZm91yfXY83mJGDJ1XkHC91wDtyV/di8mRQ0uEIRWqPTWYX9NelQ+46+ZgklDzWSXMe1R2zEi+ACgB/CzGsJtqLD9UREUqZSuu8663G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9ZFFx7F8FYqAxQPxeVqmHZoMFGL0mlsaZ4UUyT6M1i6cDHnw0g0Un5gOf7orzxYF0ok66a4dKq2t8ItZ7Yfd+wEtoef8pHIpfD0gueAfxDfLPIEs6Rq3e9oshqqi038WxUoXyA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: He/+vt5GqqrpG4dJr0Iio3YXh6ABPaCA4hHgQfTQ9RsYzBZofUtHyLqeusgNB01WVHNvVpbfP72TkG7beX/7xppBA/fgNQK34ITx69F4NSKWCaVQZNZmT2GbAtBwHaH33nanj5sax4MyDo4H6WWDkLH1s4scJ+hdlWV6XEnDebOfvkaHz/ycKZ1bpkABSZmoXqNPEE0rrPpOu4ZsIMqbrsB+wZco/1bYUzgemDpmm9+4pj7XLb0r+4dZF25NLVpPxP+K4hgXrhnbhFreeZiGRQSIj3mBZmC43JqjCWJkmaLaqEmGy2l3GRORvv8h+nzjWPdhXl1oo2s6pbp28a/ScYmmOw7RL+b8+xhNR1yDEY/zXvOgTgDGIDsDrly8ZOXbOr3E6qOPByLIpnxsSPTme5+xdVzC+Ehs2nEWj0r+qHS0ThjF0jsQ4H/7aVyXHI5ictxWfwwZfF7UZweWxJJgzePOr/10R9bxrV4+90fa/3ZSfS5KEtAly23FaBw5I9xUU/Uxqn6iF7QRuzrXxMSEB3rFQwY4b3N2baL+mIT4ha/p6TLymIBng214FgCtk92f0KQo5iiv60o6YUh4SyYym0NTs2jCJReBd+CyOxmuubI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5ba2132-184b-4f91-0ad2-08dcff5f91a4 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:31.2781 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ar3g8dVwZCfJuo4Ria3tNAzYUoeR8DYLWTbkvkulhacLP50FEX2f4G7HCHwl2k80zSK1mvUWKZLRiFFVCB0iWHRzKotCm5vCtAlYJPUUlAw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-ORIG-GUID: aq1DsHo4V0hYNVc-lty7h9dL8F-XcWNh X-Proofpoint-GUID: aq1DsHo4V0hYNVc-lty7h9dL8F-XcWNh From: Joao Martins ARCH_HAS_OPTIMIZED_POLL gates selection of polling while idle in poll_idle(). Move the configuration option to arch/Kconfig to allow non-x86 architectures to select it. Note that ARCH_HAS_OPTIMIZED_POLL should probably be exclusive with GENERIC_IDLE_POLL_SETUP (which controls the generic polling logic in cpu_idle_poll()). However, that would remove boot options (hlt=, nohlt=). So, leave it untouched for now. Signed-off-by: Joao Martins Signed-off-by: Mihai Carabas Signed-off-by: Ankur Arora --- arch/Kconfig | 3 +++ arch/x86/Kconfig | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index bd9f095d69fa..c3a9de71c09f 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -273,6 +273,9 @@ config HAVE_ARCH_TRACEHOOK config HAVE_DMA_CONTIGUOUS bool +config ARCH_HAS_OPTIMIZED_POLL + bool + config GENERIC_SMP_IDLE_THREAD bool diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 3fa741dc0445..df75df8467d1 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -138,6 +138,7 @@ config X86 select ARCH_WANTS_NO_INSTR select ARCH_WANT_GENERAL_HUGETLB select ARCH_WANT_HUGE_PMD_SHARE + select ARCH_HAS_OPTIMIZED_POLL select ARCH_WANT_LD_ORPHAN_WARN select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP if X86_64 select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP if X86_64 @@ -378,9 +379,6 @@ config ARCH_MAY_HAVE_PC_FDC config GENERIC_CALIBRATE_DELAY def_bool y -config ARCH_HAS_OPTIMIZED_POLL - def_bool y - config ARCH_HIBERNATION_POSSIBLE def_bool y From patchwork Thu Nov 7 19:08:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 842020 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 834E5218322; Thu, 7 Nov 2024 19:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006564; cv=fail; b=onsHGRd/28nsU3NTYELPaM5M3oENjYk34MApNzWmWBt0HJe7rJinyvGa0MdTSW32rjMh2QSe6jafwbl2MBSMVRAnnIsD/zvjpmAoMY9BJL1XZwbOGzI+b/sHTnSNLfePY4mZgFYfxl4CtigMDwcKwiDNIUk7lL89wyawl+Dw2Lw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006564; c=relaxed/simple; bh=JYn5wVW8/k2YULpQUQWZW2RCzfJBbpHpkZ6dIdagIZI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=m3W7hQq5hw1xijKyp2GRDBHyKbMMKfNci8Sj9cKx0sRImXeYUaQcEcASNB4m5mlMm+M2YLREiVP/vR+Wgj7Bwq7sWSOw6jtUYJ/v3jL5moUAUOqI6YfNy1XXiv9U/4fyVwxTbtx+BaCp35cuhigU3g6KGeL80MuZGAzwtr1KTBI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=EFDl42AA; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=FRfcz6Rw; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="EFDl42AA"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="FRfcz6Rw" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBd6s002605; Thu, 7 Nov 2024 19:08:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=QVSV206N3GHQLIOxxufrNmI2FZJL2ktslxGjHp7FL+M=; b= EFDl42AA8IEjLuJqGFYM1drzrCOKXvxNhmRAaNbH61BsZZUmU4p6kiON623vSN5m eUCIKKCeXsU9TsPWIt8xQf1OgkzafzNcIn4Hk+49e5bWF2vw9PmOPR3DoxdC0MxL ZGfRsOAp9a68a7mMpgAgVNijs0ER7GQRMIduYUzVWcb2Btt84xZE0R3WujU84uQC VIf8Mbw41CxJkDrUHT2oAQzQwce0XHplxSxwM56scvZsUAZ1O9MVZyDt/2wDu9Ig RyiE7bs0h0viKkOmObKllKdtQ89Fht/Gxg0tgfrMF4sjSDqi0YxuYf5LuqAONCv8 YjzO4+VOoTx/luTGwRbBDA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42ncmtbbbg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:42 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7InMAG036151; Thu, 7 Nov 2024 19:08:41 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahgsus5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=seHSIipGPEQhS0/xIvBxEDaPTFGeTjMVFFukR7UAMzxT8djuIEpTKaabusYyfV35PRwcw+HnbZHxW7tO9KAezLdyzpo72D/+/UELQC8t0VC+mDdFTSmHfdxf4kziJ3lIY+cIgrZU+XEnuekAtjwYHX8tDz3qasS49qvr6pxrcDeFRqAchjl89H5jg7LsgtSZLuQytEQLjrl8iQRWEx5rW7FXnjNFhKHTk7jrRoJ5XNv+VCSZpscrEapY3QqafU95JHLzFHy1gsdTbzpHuPWpnV5fzY/zgt0pEOhipTnMZJ03VKW51EeUn+xQ0/ieK244p0t44WqO+XZMUs0xMzER0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=QVSV206N3GHQLIOxxufrNmI2FZJL2ktslxGjHp7FL+M=; b=CkEsD1aNb5G6NeTy7/768rpPkXRGpbK4+c7EFjCFStC5IdU9+Iwkq1Bvn8CR4GPLJP108C21JaQnczJJExsGDrh3IhEAs6Z+RR51xYPc8zQ5c0R4Wu+hwzjgFCpFgdZAjwATX1TDCRvYTTkeyCcU2f+2zZP4ES2eRyvI83VMXrYCrevsZucxEQKTJo6eeZpRd1WSJCfO+V+oUtUp6apfWi/LtsDPHGQJBaWyEWlM9wjbhxVxaT3sO9vgLJ5BkRl3WB+O1joVmEjnIvjU0jvWBQo1zSYqFXvvr9urbybIBZ9jOMfJZhfb3D2KDg++L+qi7jh0q2l7WSxu+f7jhL3vhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QVSV206N3GHQLIOxxufrNmI2FZJL2ktslxGjHp7FL+M=; b=FRfcz6RwAismBljLE0g0KttETzFHAQHEPzfQW7e8EcGY2BXXLVLGrfEWAkrPcrqiDFHYTgqFZE4s60xbha0ZYrr9t2FRxjGxXDlZzdAywwQ3kM9nqgisZxYpbHQtuKIq/uRAkvKsWiqP6giLXyrAx96Hh/cggU9pL7mqP7SH1So= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:33 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:33 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 05/15] arm64: barrier: add support for smp_cond_relaxed_timeout() Date: Thu, 7 Nov 2024 11:08:08 -0800 Message-Id: <20241107190818.522639-6-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0093.namprd04.prod.outlook.com (2603:10b6:303:83::8) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d913a48-1157-4b18-8cda-08dcff5f9312 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: Y6eHZHFZnflEs5voIF/jAN+045gU/c+X/ZcZqtYiflo7ekrFdlPhAGSnXamQwUY4DR+pEgI7SnzLNDkR8Abi8jG3qFyxyApsD63bpd9s4kRdkAMXepPyTWsTILbcwcxHBTdkuyIiq9QEO83Rf+yReOL9ykmA9E3XUw6568o7Xw0RXfJ/phdCkfkTuV4QYD6iJ6UCqAWN7paRmJ9gNq5lJQuubT5Stiy4zhI3b3qr0WHoLahQgja+zr24GJhhHBXX94Ol3ifn2BKxCSoQQfxQrAVU33z3ZJ9DpUB3JNw9xz4S+afzPgvi5scTSqwPWT9IsRs0+aJq98W8hPK/pzJEBg1U4r6hjoROVz8tiOx1lU0p5MZkc9e/fbXui26mJ9fv/Qb/LIau6heqLOENrqrIfilWAz09m6G471rTd12ubwUj3Y66vr2XlJ1xBCa5RT2u4o3JZnnGyo4rLy4xZlccmrr6U3UwRto1gLTeBE/T+7RR6NpH9JydJnwYNflOgkO8r2i9rRtGOLYWQiIvUJp5d5LJwbuj3rFfddhUq8mLy8bKFazaPLxuW9jjjHU7wd8ocOinOC+wfGylhfMvchfP5F9RuhiOw41vxycNWn67WRZ3Oh62F5/LDUWXFQEXUpN2JtRW/Z5sAU7xOxbNOWcU9OQPkFOLc7GkoRghE4MsafnBNgqKQyrTLUaMxwvCddtMrnJkWqlCYMEHx6zEW7WWYSrizrh/enQ1DQvtaOrf2/Na6WyP1YvMOHV8knbo6Z/VUSSyUl1pu5jY6vaLzWCjckl6X1jRTaUh+f7QfA21NXXxz8JhgHUKpIKskeFRIdxNlx2akySXg552tc3/c9QmDaTJTw4aCRvmB8KBgPw+dKVc+UUBn0VCG9B0btUOQTv/x7VCZhqK9F9nrdbGpB2ZzpZ2LxWfTOAeKQkhDHAG8gsAuyPKN6XmkWYvBj/Se5stklcOrvflCbGcZwcah+G76gZOVSOwjAZjZ3aOI65iqBffGfG0AiXvBn5tf6V/m/aeyxd3t56fI+2Q63zk1DfunlsAJv9q8SLxFo9RW+qPwuJf1DVkRfyF6IxxEVphvZJ1SplbbDdhSQbftzrF4BZY0jf8t9mA4ldcls/CmEIAcx0INYIxYaV7CFNWQyUYu0c6a2g+h00AdqK55NnNpYW7mZ5NYYkJ2h9uhG8aCd50plWgQeVo4mbX1/S1g0Nql7p7OjcO0ehYVobzoNGGCauxRYXh1FP596MirNuJTpi/vnpHtCyJZAXhIMwDVnvDPs5iwBLAPdSPd5uTSDKTVgPhy6BYVvwS8+nM654R3U2QpbM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7W98LfaNJCkCUYu5vCJaKEUyTYtdgFs5M0o6NHd5ZghjYE8srNmIbdof9dMnmxY93rGIv+JFRNAuQbItT+ZMDpDuHSvvHP4rKTfXepXZ7ZiHZczFGYVoaB+3SYlYVHMMpnI3WQQ6+s33fxYUMxlqMkwYPdMdWMYhreFOoNZad9P6xOvFXVQuOfqFOy6LKdDEYqHA/ccjx0mBcA4UAeuN8nqCgHK8T/6hwcsHIMJRt9TkUZuHQupQ5r54Q8y8IIcEtxfasHYB5jyM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r5lEC6YdxZ6W0PuzLiwqW+/BAAKuOaMJG58mIsse0OTf5pZnH9/NMNAecdFR6BBQrG4mvFkcUwjPSVqilUXooSYCWmkIA2YV0Z2CitS9lyVcycbSqse9qvs/+TSa1aDyosD2VdH0vngqEnRcCUdFbQjIo5N3n+LlORWhsTum8Qi0t8RF/my6vRGqxHd+RoUI5B+I6Jl9JSaGzg+dl0TsvDeVHJjMH9p2ItXNd166ZHOzEiEwHHwnnyC1DPOyE4+ztGXCN7PRS0pP+MCKw9XkUgQQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5mkCUPC9hoz2Z6uz3fW5rn8QW7hOCXmOqHvP4P6S7DCacNHsQbjYk4xh1QiPhH2/0cgOkYCr5hNWKPpPTXFSozVvkKfnz7FwRQMgWf6pcT6a+xMwF5wL115/HxO1cbDN+Yctm/rpFBF2WgbAJ5ZE7515Xmf8kUpxQXuNmKmSKZw2Xoh9ZtwBEDiWZjpZ5o0JQh/CmISNzvzMrsBeCPjOpjrx/S5G86W18OBvRq73rLCz4M0KFrgeOfLPpPjVoVeI3hBwLeBy9Oc4ySs+XeHGtVbqerqEV+FSxw3P78nRksMC3Lz9WCwZRgYMs9Ou3RQ23m4jhLNYFkj+iucLTRHaBO9QADl2YS9GIBJAOikAhRMcMfkpyI+QHQZAAjf4inyDCECJv3365Q2OazqCQ26Y7EJRaqRyQtO5r2cWseSxRWZPrTTWuY6vfBxnnCyYUIj029xW8MPfQQ02ljW7NSP1J7tNU9LUSvrzNb6Ibyj217j1bXW0xwKjxW9S2yQScnGoLd50RXTnnSXsY0GifGKxEfuMItuhTNZ2TjZLl4g/3ylG3/7UBWfyG9QiOW/j751+dnSP6wUXqY5FKnnaVZEjsSa+Ji5qEhXXzd+lr1miyo8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d913a48-1157-4b18-8cda-08dcff5f9312 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:33.7386 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YNe/rJaMsvCPSKTYLsm4zVnH8jovxrVFYCnphYZLll9JsE4NW00GBkYT92YhYtzjN3vDg//q+BcKhHa0Od8AmA6ntvT/F4sUQJuODg4nLR8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-GUID: -IyB3pGUmSkPCHRc5sUAyhKL3GwhKnnk X-Proofpoint-ORIG-GUID: -IyB3pGUmSkPCHRc5sUAyhKL3GwhKnnk Support a waited variant of polling on a conditional variable via smp_cond_relaxed_timeout(). This uses the __cmpwait_relaxed() primitive to do the actual waiting, when the wait can be guaranteed to not block forever (in case there are no stores to the waited for cacheline.) For this we depend on the availability of the event-stream. For cases when the event-stream is unavailable, we fallback to a spin-waited implementation which is identical to the generic variant. Signed-off-by: Ankur Arora --- arch/arm64/include/asm/barrier.h | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index 1ca947d5c939..ab2515ecd6ca 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h @@ -216,6 +216,60 @@ do { \ (typeof(*ptr))VAL; \ }) +#define __smp_cond_load_timeout_spin(ptr, cond_expr, \ + time_expr_ns, time_limit_ns) \ +({ \ + typeof(ptr) __PTR = (ptr); \ + __unqual_scalar_typeof(*ptr) VAL; \ + unsigned int __count = 0; \ + for (;;) { \ + VAL = READ_ONCE(*__PTR); \ + if (cond_expr) \ + break; \ + cpu_relax(); \ + if (__count++ < smp_cond_time_check_count) \ + continue; \ + if ((time_expr_ns) >= time_limit_ns) \ + break; \ + __count = 0; \ + } \ + (typeof(*ptr))VAL; \ +}) + +#define __smp_cond_load_timeout_wait(ptr, cond_expr, \ + time_expr_ns, time_limit_ns) \ +({ \ + typeof(ptr) __PTR = (ptr); \ + __unqual_scalar_typeof(*ptr) VAL; \ + for (;;) { \ + VAL = READ_ONCE(*__PTR); \ + if (cond_expr) \ + break; \ + __cmpwait_relaxed(__PTR, VAL); \ + if ((time_expr_ns) >= time_limit_ns) \ + break; \ + } \ + (typeof(*ptr))VAL; \ +}) + +#define smp_cond_load_relaxed_timeout(ptr, cond_expr, \ + time_expr_ns, time_limit_ns) \ +({ \ + __unqual_scalar_typeof(*ptr) _val; \ + \ + int __wfe = arch_timer_evtstrm_available(); \ + if (likely(__wfe)) \ + _val = __smp_cond_load_timeout_wait(ptr, cond_expr, \ + time_expr_ns, \ + time_limit_ns); \ + else \ + _val = __smp_cond_load_timeout_spin(ptr, cond_expr, \ + time_expr_ns, \ + time_limit_ns); \ + (typeof(*ptr))_val; \ +}) + + #include #endif /* __ASSEMBLY__ */ From patchwork Thu Nov 7 19:08:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 841623 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 88FB1217F4D; Thu, 7 Nov 2024 19:09:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006563; cv=fail; b=d2A6U/55Rzo7SCD3mzeS359SOinwf7PAvqifif9oosBRz0VsbCgwge4apqgvH1yLQpwmf1Yo+rznD9eDYPDNnj/ZtKygAhob6m/O5D48VMRH7sE/zM9JzoqtOBPTAZeZoBeCS70DmZtiRQDzWDkyAd6ItKstz1S2i23cvqCUqnk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006563; c=relaxed/simple; bh=v3GaWP172XiLqd+rXefIhasC9+l2FDu3nt3uIc2bu4I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=NRzdyuzsuQJzxk3A2IvC7CbM43dK9BUMnbKIx2sGd5kqv31Xm72jt56bbzGs2xF0g464ZWM2wsVz6luzoPM+izD+hVDymsjDdBd+rFrrBUpk6Q/PyzlX1/InMU2zJfFOjFDsuYsFCS1SBFanJFoCQ//isnZEVXEIswd/5gxJS88= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=k4X12CpD; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=PZBpaYqj; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="k4X12CpD"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="PZBpaYqj" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBgIf004757; Thu, 7 Nov 2024 19:08:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=z6wAIv17lLsyWur2fP5H/w7PeJyNJoRHHA9dyx1YnpM=; b= k4X12CpDpTZasbBn9MvgwceXLIz3Nlh6eyUr8gV7rjiVKpMi8jiuTVPr+qZ1y85C XoJ9OnFs2baNIcf0NAZdg/jS0RwrdYmBCmuZzudldrimecXbsy6IMyYxz45EwvK5 UWucS9KNvbJPVWSKl9FpN0IpjcXdtUIj7Cj0ZbPLtFxCexB2OSichUyfWiGjegnY yIPZEIF/UDxa8JN1HF4L/a4TF6J/8DLShocq6RV4nBNQnAvpwydqVOgGO+9ti2ay ggRGfsa3bir7HGqmxWKia9BVEI1eT9jXXY1A1UVDsEWf8pB3Aul6LHv8uxhump0D 9E/IDfpEPj1WqJlmzDTzfQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nap03d83-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:47 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7IMK31036797; Thu, 7 Nov 2024 19:08:46 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahakgst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AwMJ8smE67iUD+wDipq49H+nrGxzpi6+HTo6Ho4K/FOCY86OMAXknNOB/rxwsWWd66n8NIOxqyr80vCnsrAZ80sEu3ZObswEaVLboBl4zAlau6mUtzPG06mtVZEWUzT1z5djhv1N1NSVtrfPScrIhAh8DT5XXAlvFrBzZOPgPIWFY6xM7SkqwptO3zf36NGsmG6QENuJWiL5fhpqThaww65akBaOhu1b3vkPEKd7RzOAL0pdEECYY94Yhiy/TPuH8FLLyemUgUNBf+Cn47KCB4SPauIW/NRjBu9BdPPF1TMugbZmABwnhtBlhMLm/gmXIuF+4H3xDVNSAt8XiOarSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=z6wAIv17lLsyWur2fP5H/w7PeJyNJoRHHA9dyx1YnpM=; b=T8Fy4cSgGHYvjhTjOSQa12z19CtIA3OIicfeyoiW1lOIgRpb2YziNT+z3iBnAYJfLSqgFqFUb9SEVYAtSVGUjOtYREN0ts/5i8iryxR2HkZhBIQ8t/ATUD3Ngajzmx16WqDOqwRtNqJuyu6v92T04dZjOyNH0rEYsx0QKm7NXXlXFdeMDrCkwjz+x+6jHvnsx8YIf2DTqIn2KcWVGSg+xYKJdwht9gMD4qt2X7yqLuk+F3hTWbXsAziv6WNl7dIfFEL2WZKkkfJgmU2AkfviYmWlNEPwp67mR+g20ZkyzApjsdYiwljrNYVvy8a90nxl4AYqgSpXeEYMza+p4yxtGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z6wAIv17lLsyWur2fP5H/w7PeJyNJoRHHA9dyx1YnpM=; b=PZBpaYqjdI5CjpM3Qi1oxmsN5xEByknIEHdVpU2NxTjMDj8GpOe3oLcN3xGB4ri7+rBudtlHdmtSpqQvsKRF2SHSzxIbSkCVM3AyZyzsftQLNeJD5MlGhGo1PpC4z8N1v2rhvztqZhwQeBuMtQ7wH+RpNZ7wCZYpvZc2e/Cl8x8= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:38 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:38 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 06/15] arm64: define TIF_POLLING_NRFLAG Date: Thu, 7 Nov 2024 11:08:09 -0800 Message-Id: <20241107190818.522639-7-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR03CA0153.namprd03.prod.outlook.com (2603:10b6:303:8d::8) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: 274aaae1-98de-4447-113e-08dcff5f9615 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: 8BqH3T+VmMDVBdI1v6k75XDnTSQY6SgOF2NprQJ8iJTKRHDtz/xZXKIGz3eIxw1mYM4xgdkdLifoh56vheO6YQD6vroVHRRDhXZBZKawPySUdyubhETqJMkfJ0qaII+6yqRBPyi2DTGdFt7UyfA+4vRcr0+tTO+fbibJYC//Jtuh+8Y7PdplcFUEFVVdKjQhlyd4NyT5+srjQRpFQULevTC6R/t3wlrCAEQWrngu6cRNRkCiE3bPBfJO43Irx4Lmkuxj4uY0WtHoT3aqizVguPFo7E3dvLFmEPfyMrZeWv86NE8byovUsi14beZS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G:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vPR3I6XZHWIkEvOjzqM2rif9QDju851I2/3BNcINuvWieCh3cV9//xGTJd4ib3YY9vOmYTw4YwWL8/Kv3WYUwAvjDWBsNIM5CqfDF0oG+gX20fYAoAeYS30j4jpQhgbXPz/iLzFX/xmBnSSajddV8SAKnjdGfqW3R+Kh0W48EZu6lsKrdEGqWw2Ajx1wXyvtYjsikYzLkm0S1ZBBnvzelzzTA7/R/V9S6EO8oeLPUBQgb6oNkbdXuoyn/0xv7eKpCe70mWmcxw5+bN6du5eVLVfKgSTOIFn8zLEqINXPnntz6mFEyclsRWtNrE2GGvxE0bP3XoYjgVu1LzK3Ml4Hb2DlBL+zwcUs7UwrE7MqLNeFOSW/xm5vxsyLnzXqAF3EdkMVWwZ/cACazGBzYKhhTwXKHWMgsooC2zImxk6/Le3IPq+bbpGu1M/ufUSOd6cS/hoUIgMESRuFnnWOjizC3+W4KHvqsgO3G5dOwNxYo6c7TRyHLgC1js2QA2MI6sDsZf0y4LAnzhiQIqNmvyxbArBrZZgxKMJU3oN6kL/qKRBX9kJtJ8VlC7kUWTr5Xm2StJ2UFJrjt7nOUB2V0KVhYDdAdi4g5HlVjiicAoS4CRWnUKcMp3MALLcZnWr7kjaNYwSc1tiL9uGARUulDWnkkvtN3b//8FcOkyASIu7HC79/lWpF5myXQYS0epwUfxYAyfXclDKGUudH3DmlMLJ8v7ZfJSIwvxSMcGJxXeOqX6N96YAp7EZ/fPzAbbgrExe1rppZMGtxqa/zgbqbfVJJdw3c1UYSBEwT5X7fF6e6GFDSlAkLj3jUyM5FafYQfj+Vld15Y8Cwl32Rvs5tLRNlI2HDBKh314d+JkQrAhaQwJ3/qGQSsFm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U+X1uSBiNObrUIGBnYAEqbdkNNySgpZg42UiwRK6xpPy5zcVGUCZoxIhxUVQYAzxfhP3VYUQqJtkgZ8Q9VX3bg/RcybzN30sUzD5ge+A/Q5PZcqR6dgQcBlOJHHv/w/yt40j53l0SDHVnwcmQp6LzBxuu/ygvZffqxZaqjoUEYksycWA995/z5b7vHILoBYsilu/9q6rEgcGVpPMx4eTpjF0KiVDkYU+2Btu+N2OLrXEPIXqpUmWXcOwhZhp5KBHAfO1YFRPVCrOh9ibrcjNmmyq5dG/9MFW0Ms7tRIW3Rjk5HO7pXhE6LrWHLjLV3WFpfHUG+p1rudHUvYHhmKa7pphjhANxp0eZSSu6qroY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 274aaae1-98de-4447-113e-08dcff5f9615 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:38.6715 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ghJrKFmvtR4+H1jRqX2ccPJ9WK7Wrb2evQWM68OXNohvins7Dy8Emo7hJfatEZWWi7acIQFF9M8aDBoiqnvmpTWfp4Fj9bJrxeMe/ti6X2o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-ORIG-GUID: fpVnkxKb2ohbrqN5l2HpxxZtXsrLB_wX X-Proofpoint-GUID: fpVnkxKb2ohbrqN5l2HpxxZtXsrLB_wX From: Joao Martins Commit 842514849a61 ("arm64: Remove TIF_POLLING_NRFLAG") had removed TIF_POLLING_NRFLAG because arm64 only supported non-polled idling via cpu_do_idle(). To add support for polling via cpuidle-haltpoll, we want to use the standard poll_idle() interface, which sets TIF_POLLING_NRFLAG while polling. Reuse the same bit to define TIF_POLLING_NRFLAG. Signed-off-by: Joao Martins Signed-off-by: Mihai Carabas Reviewed-by: Christoph Lameter Acked-by: Will Deacon Signed-off-by: Ankur Arora --- arch/arm64/include/asm/thread_info.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 1114c1c3300a..5326cd583b01 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -69,6 +69,7 @@ void arch_setup_new_exec(void); #define TIF_SYSCALL_TRACEPOINT 10 /* syscall tracepoint for ftrace */ #define TIF_SECCOMP 11 /* syscall secure computing */ #define TIF_SYSCALL_EMU 12 /* syscall emulation active */ +#define TIF_POLLING_NRFLAG 16 /* set while polling in poll_idle() */ #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_FREEZE 19 #define TIF_RESTORE_SIGMASK 20 @@ -92,6 +93,7 @@ void arch_setup_new_exec(void); #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) #define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) +#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) #define _TIF_UPROBE (1 << TIF_UPROBE) #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) #define _TIF_32BIT (1 << TIF_32BIT) From patchwork Thu Nov 7 19:08:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 842021 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 B212B217F57; Thu, 7 Nov 2024 19:09:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006563; cv=fail; b=Gp5jcYVNbzzufnO98LYX4Hq+tL8yV//3Z7yXC4eS8JT1w/8rN3Xu2xgz7XQ2owi4bdUKw8zGuaP+lLh6XwWFYtYK2rz1Ca6GOK0zVzolz5KLVUpOTf5u5LMeIBBhGqKl2MUwmigqt+J9dh54gM7rj4qVAydMFlLTut5iYHJpdGY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006563; c=relaxed/simple; bh=P5KqMCBbw7Tz85lC8YXD6NTkITnpZKTc8pnpXCGWWuk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UdwQMDFivPCz9TJgQ3RLJDv65CtoeF80z9oGtOoo4tVxn5pUIY28MFSYJiHBud7Hb1ayxoR4PkBbGaL7wlEZ5mOLO7T259J1WOa6lCVEj4DPBFl/zG/NJ4b0ahmn4WwVtJT54mAJ04Jq8R1s33J/yIS8RFBMSLnpqFrTeP3tPf8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=L2nY6Q5m; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=snzK18tM; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="L2nY6Q5m"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="snzK18tM" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBdS4002626; Thu, 7 Nov 2024 19:08:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=1q6nQeCGiOFRAbGCFzLJlaf/ZZKfw59FJgWWVjOWKfY=; b= L2nY6Q5mCh2ASIpbSrsIl5C1tm9qw9KS/wAxgW9WqQSbIQxC0IbS6R1cL1utkbEO gP7ffyqyV2pP8qnmbi661+TrKNLqhe7yfaWl9loOzSV3Nj5Og6R+XI5BUy46q2hh CMzioOpZb8ZiWAhL3SZ2VsWXALPz8U0RouZAqhT1uxOFZhS//v66lJ3sU5SLAYD2 sV5GUw0HDtWvkO9keZ9/knckoHJygU6qIaQopgjMPn1WqR6DC5Pgql00VPdCGByZ fN0UgTH+J9dMpqUB4N66n/wsORimaWaogWjTAs2FoPIcY5KToBVSICxIPVgX42vT E4uxFfsaUfk8XVqSEWGKug== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42ncmtbbbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:49 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7IKU0T031448; Thu, 7 Nov 2024 19:08:49 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42naha6ck3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Sv11kPNPNnInttMyjpZYHgZILHvtPrMFQC2IEnfhOtqZaibf1xWhF3rKZPlHPurGo1LEVJbv4wkFEfLzRX95B5TJTaap0IRhe2JsGctXst2N/u+PQ2wS/uCSNpVzWe4AGPvMkBsPBPN8gYtQ1DHD09JMpfstr1ovYoHXYiWRDUELHbda6qGWFiokJTVWK9J3Mh/DiYD1ge3BQVe3z1z0rzO/4fWcr+Lj+uF8uv7GaR5lO3cm/DhvQuIiAksLopliNl6S/J6BZDI0io/wIQz2ZKO6njygrjaWKFfIYUaf0DhwoIjDgBn094P+c7SOzcRzaZHGScfZSXAnVRhe3Db/dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=1q6nQeCGiOFRAbGCFzLJlaf/ZZKfw59FJgWWVjOWKfY=; b=AvQmpOVl4EaXl0CCqIIXiDkLOBVSng+8W65pXNMLx6OQw6jq29hLr4uvmXw9w+W/qtYxnY2fz+OGFXhE0mit03Gg92m7z74t4848HEKaVh5XJY6ebsw2DGsp1vuQOxH0lG6SlZWNVSU46jJKhqy7gnt6il/lAFO8SFBm/M2BYIuF+4X2THhKW7rDkRy97HqiN85poM55W1mgHymQ9Hpb8KwbklVs9RKtKgO4I2v1pS7b82Gs1QgtFNZN3FCSGjXkjBCfUiRMCu0eWreHgDThh38YfhN/MjAO8mCsjQjslMkTeQIS1jpho95j3gA3XAKDWHdY7JWlCeKWTXGh/cs1Qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1q6nQeCGiOFRAbGCFzLJlaf/ZZKfw59FJgWWVjOWKfY=; b=snzK18tMOOscgG710bofND832iTgMMUR3hQ8MXj0vohyE2lAirtyyecGSa12UKn+QQVPduYYNTDOhkaBIS8WD8OazJ55VxZ2r9XuVAlyZnKDTyhCo+W8dtq60q0drdlwpSFU8ajDfMyKYZIqy7bPskDvOSlx47ssofF9ZymUJwM= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:40 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:40 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 07/15] arm64: add support for polling in idle Date: Thu, 7 Nov 2024 11:08:10 -0800 Message-Id: <20241107190818.522639-8-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR03CA0113.namprd03.prod.outlook.com (2603:10b6:303:b7::28) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fdccd6a-22ac-455c-255d-08dcff5f973f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: UIAEfUKHP9zdcN84Pg5Gkq8jqqlCOOt5YI0UvBh+fEfWA+g+chZ6V5HnrZ2vfxwQVfVEoHJeViXQu3ManJ8iOqM0bHG5VEIM251NQs+wWryEPFR4yAr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pNfwAhgFfNfhNLjyxR0CGGMRSuA79zjSiWkCWFTm/tJfO5SmSx7GCGK0Ogbl30862fIrj8BP0JzX0mRpCNUUDpk1SX4jFWp+zA8q+vjyKh4HRY+UNrNZsxYIRIHfCvcxriT8bpaqLWU+kQRvtGtC X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 090xko0aO6/3GjyHJP4DmDf1BlmDNwuyFpctgVLaX6x73KoeGdN4/i/IEhuOkKzcbSznsCU56b+lTgI1XrFKVP3ru753UqqbxH7JjqhoV7zDfsKKl2SIvRrQJo7Xk5jHIoM2ejhSqOS+RkjfxdcAlbxZqd7rXguq4lX1cd+Ek0rvyKIo2wgOGe10fUp81ER9UmlvDdyHZhljEbNfB688h1iiNSTw302TBBcOCp3/bUOypp42AU6dzWIxkHqCTEWRVHJUeCgmH9LBQdgkTWxMCN1JlQcMO5QK9L0J1puVimrQjNj9DTq/gUTjz0RJy+WB8J9ZTnz5Uoc96D0Ips7VjOYEhTSei67hRvElKDBaYLRPjmlxr5XxUUJgr5Ec6G8EE6UL7283yw/AkWiprx0/TD0JVpVU1x5gz9po3p/LwAKYLAWceJfGBsDxSJZg4tEVEKXW3Xhtjufznzabe0gvA4EbdNFWRYrZ0rkg8i62LWR9mg/vkdgFN9dlKs7GZ4FCjFoAs4xO8bNFGE9cFnvPeKdwbbTZRgI3lxjC7Conb5fwYTx4G60nBNcc7bDcNlS3VSS6oZoxTKc2lmxZ+bv8/rVf/vfoM726zDl5OFLT/br6IXxd9Wm52VbnJQyFG4u+6d92uDf9J2o16BWTh8RUjMjlhopHTflt+dDFTn4ssT/2hf8QCCJjDUXgB0fQjFAkx86E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7ZT71aDDWsoj77GK+2oeKnV2WLqOJJUh+n5KV4tqtfvdMJOoHHDrxuCJlUPYffHDsb3yDIIDH4C5SRJ7SBBpsv2PfqOaGk1cj6trTsVnz+DMME2EZG0U7UGDhuDg68op+Jegc4pQibSIgUZMYxxIkbGURh3cLuoj3FWADLVv2tvrLrKxzNC41Jbmctl9Dnvgrz+x2QgWFfxsZeGriXV6+ZMDZj15K7DPjYRoogZIwEZtHXEpy7lIOfF0a2pxHqDOYUFcu/UE87lggamt+Qimou1mZDx973LTJUN/TV3x2ZoBnMlLPxHl4GioWitQm0wBe35RHiF6WACuoI3ijTOelksPBdl4Alp5FumhH+YqJAETKEiMVW+CDaT40sYD0bepF2SWu+3M05x7RhKvlBxgp00TgCJujedsyFap38R/Az4cEvA3PSNYutLVu2D6qrxpQLsuWIYjvZLS6EQsi3ZgifKFvwx/BwDw8ner+qCgM3fhSOcEwet95RXtMQkJsqefNTUnsdNDnf3qAHw7y2E00= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1fdccd6a-22ac-455c-255d-08dcff5f973f X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:40.6121 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tsG+nL1mpNC6JOzcLxyUaf+Bg2r+tePj8qImxOB5wCQt7XMWzokHVOx2mm1NIeX1vWx22aRkKw94scgd+j6DMYjutXKyiRcOAismtGT/05I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-GUID: q-ZnQTNtF1NGdKq2LF_4BTj-hWqlLicE X-Proofpoint-ORIG-GUID: q-ZnQTNtF1NGdKq2LF_4BTj-hWqlLicE Polling in idle with poll_idle() needs TIF_POLLING_NRFLAG support, and a cheap mechanism to do the actual polling via smp_cond_load_relaxed_timeout(). Both of these are present on arm64. So, select ARCH_HAS_OPTIMIZED_POLL to enable it. Enabling this should help reduce the cost of remote wakeups, since if the target sets TIF_POLLING_NRFLAG (as it does while polling in idle), the scheduler does those just by setting the need-resched bit. This contrasts with sending an IPI, and incurring the cost of handling the interrupt on the receiver. Signed-off-by: Ankur Arora --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index fd9df6dcc593..43762c68e357 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -38,6 +38,7 @@ config ARM64 select ARCH_HAS_MEM_ENCRYPT select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + select ARCH_HAS_OPTIMIZED_POLL select ARCH_HAS_PTE_DEVMAP select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_HW_PTE_YOUNG From patchwork Thu Nov 7 19:08:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 842018 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 B5CB221A71C; Thu, 7 Nov 2024 19:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006575; cv=fail; b=VJF2Bq8jUjCWEFXUo/z4SFiFBv8OTvK2e32ZWYNzYYH6IogfWZUPIWiLqqdkleKRgY9SmjGrqLFxkDnGOde22GYXurXV9udjRT1UU0GZjWitRex88ALBeCt+0YkDi5Aa4XTnXeQeAaSeHJ6RoUkq/ppYW9X03l+1pgrU+JLoYEY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006575; c=relaxed/simple; bh=Yyb1NPNDFQmIjFeFqIjoUZ3foLaSLksfAmQDnFnTm10=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=lTYxDHulwFcFQzJVSOjRsAOyb0EEzenvnWXypyvhKAyA8dSffYKDdo/lcS+r3rIzIO3drc3f60423DZWKHWMhfxymPY/jpPOIQsk8b5X3LsmTjqEm+luNc+RCWfEJpOdqH6pA4rlOcbY6Cj4p4bamCgBO8k9C55MtwJtVJmMBik= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=gqNQqGAq; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=hPvGv8nW; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="gqNQqGAq"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="hPvGv8nW" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBaMF025221; Thu, 7 Nov 2024 19:08:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=H/q7eDW/ZTZz/lYx9cMAlhBkSvRSCxOpz53k9yto33k=; b= gqNQqGAqt/CWQqJQrHRIQsR8WpHPMgup6OqdpcQ/E+S1lnEtI2bw2yIIimTHmP+U rdWZeyixBD3qfzfX+/BPpEh+1iamVjkg17vGa3sdxfWwrN61mlwfcgVOqZFTbIIF SCdi1yzjpWMLqQs2l4MN8Zu458fIg1EhzA3cijxvEXS9PNrmxmsAqSEzw8aRS/rm gBIO6PwDS5kFjWizTopG38VdpIjjeKOy6jmCzBjuQM0SfQjb9ra8DrKXTV3CxOBR m7IgHsxNgiyD25Bbcf/Gtz4doa+kmuEV+ibWPrQ5Zu0mPHb/q+iyl1HC5kfYUIyQ Y7LJvaUkkTUBY+jZATQ/qw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nav2beda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:53 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HwLT0009736; Thu, 7 Nov 2024 19:08:52 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahgt619-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ru5VmeB1QXiwQ2l5Ms9NvUVnSyBITbafE9LrNplMygIdq5GRfTFeu2GVsurbKHBXnicbmVeXLijTGR1LbHJJIzf2XfPu6W+fKzTdg8SKmZqDiukHr+82BCBiXggICmJo+qJm3Uj6nQ3L2BmsgMXRARWp9RuW1YlWkAeI7NBYCNx9R9BGAq7mCpREf47M0yoqdnf8hp2TSWwcu/06o5a5vzjOUGtm57jO1EGoqUY7x6tApKnToUivhVwLHesWWbeSBRAhUWHwJjcsz4dB2VokoXxfGe/zdxdy6f1s0+nAElfStCj3LWIgI8c6Xfv2zlLHYosmGvK9DxMmnmjlURudkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=H/q7eDW/ZTZz/lYx9cMAlhBkSvRSCxOpz53k9yto33k=; b=J6zK5KDniGABtXlE/o2mSYoENzbRS4hb8RrYek2m+FDIEiSpAZUXxl7iL7f25Od/VyAYaZ8Uie4+RtN2zvxf/cL6tNBmteMn4QY0DjKY3yRZh8VwAZPNEXu1P2s0Sx9pPvB1IrVVhHUNJGBbH7IjCxSZL69Xsv5ENsunPdnHcg3EIgf3xQ2KCOCD5XNcjUHUl+TJU4CTa+3y+o2Sb8dIhjDfHhLKKD8QYs2/KO3MnV6l2dHrnT4O8+TG7vjG96AezHhkURdFn2iwWihhNqbynrCWzWDU55i/W7BCOaw8oXpXhASmaTlKSkKxIvGD5oulCnT1ABfTF9zFIDA8S1Axjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H/q7eDW/ZTZz/lYx9cMAlhBkSvRSCxOpz53k9yto33k=; b=hPvGv8nWJ8KpqUuf3V0n6hTvpaepgjGSvcVkkWQUw5OOjPeFqwNmQuO6WbMg0HpPNCJkfQymGyxHjsBPxZUnD/JNr/H9rJmtKB/MdNXHmShLfGbDVu1SPfJOmhcebBlpM00om0rd4iaEoKFatap5sNvJwy+9p2o/nihIq0vHRww= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:42 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:42 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 08/15] ACPI: processor_idle: Support polling state for LPI Date: Thu, 7 Nov 2024 11:08:11 -0800 Message-Id: <20241107190818.522639-9-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW2PR16CA0034.namprd16.prod.outlook.com (2603:10b6:907::47) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: 6521b7d1-605f-4d09-4b6f-08dcff5f9858 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: Okli0EHdgFuCgTYIDNkzqSi4bYC9eHI3xBxNU1kyA94cfJqRkdF912aYIV7h2ocJXtYzwvsIG1FntGi+TsZyP1qouTLvQ7KOEq9RbTD4kt1QUT0DQJfdoXc3k6d8LVgugZWgPpW/Ct8DdQoq0sjvkvM7sto6gwCyMKdy4sVO8KJW176KU1j8YFShyvdX8p4sGw/2xHb/vgF5LErQdeFXw5wHqWdekjV7quwEJ5Cy8IN4GJujVhD2KgJa7dJvGqahYfRhLvFvm1aqds68NxXL8xB/L5oKBVvlZIubR8RI2bAmozqxpzEDvAM1R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V:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9hK+gYJZhKt12RKxn9waiHd/dO/BUGDxTwqxozldiXpkRO1os1qNvOL5VMftw7noeCYCav8DyH8UpUVQfjgt2JWC60D8NK5zDwWugx405afvGwax2w8HPSpW3109mgw1mYu6AIEnD+P2jAE4R0z8Ap2jvL79Nf8MOsSo0uPrTGrEf52CwDuv9aSKt/TgybZP0D63H7IFr2zkjVsadtdX7OHWeXIEYydk/UmHzAQOKUjG+9eFJ9goB2Pwvxz5D0qnH19xq3m8WwBRNGFQ8yTqLMjiJjIptgHbjJ7vvJzIOh0ykReApSWdXdl7ObdbR5L7857W+VrT9W+35XMM65J250QXKkMqPv+ZSQfWlPeBq3SJQ2auxgnsamvjgDXeiKPXNQt5wbBniIibPJRNsV7IqDB3Ukj8NKKPRGa4HXJeQpC914go8Xd0s420TDLAYixUpZq8lT4It60CsV+hXIoaNaB/OXJ+IVs2xuNTVmSJGP3E579iZi8hX78xtd7XUiBRQw9ByETEVPfIoA+LXF8wsfcBEeDNnT/J75rnSlAyCoP6McNVvZ9SaGpZ8XtcZVPKUDuN8wzEoSxGfCWXaaWgiGQP01H7S0KFYg3mwl9gRjn0UI1pGzID5e02KaiMG9FgYxNpkZxqCwCN1r+QryeQQ/P6G+p+OZ4WjKkoLiNQtzMM4mCfM/t90e8mz16k2c5pIK1SsGH2tf2H/3DfumH0eY1YQzJvfJvBMStn0+I6o8N+n7UasCbCmA8mNUdo7ZSADxJWlubVcDplgGXm8I5EI/m84c4vDZMINORzdvOnvmHa7HVVfEK6UQrUfFZlnNvwtpoerIuMI2Oj1q3WAknmeuih/xFvysZoL04Eqq1wF6UZ1c1F5UV/O/CP6XdMamSBnVZ8IzC2HtErXSYKzJDyPh89doesB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6ThrekR0JoU1Xr96fjuxID839mK1wP5XBzHBnJP0hONXG0QwmBqkK4yNq3s+n08o+yXh2fuB9xWmKkBWUrB0TzWGLuCh+1G5N5dah7jUQlUBG1OsY+Z18rYnuTUL76NMluo77xu7unZm7C8V3hsb/XQj/1iHJLb+PfUXlYmvcjh0AL4m6mqLuNYxMdgG0EdR/sLbtCH4J1qDWPF9NOkAAr6v+p/1Eif1lbnWkt7KFCrcUPkk0y6suobRtR5tCVtnjjKiiWG7lrUf04ryuZirq1dESek6DCtpMEGFcvzxkv18M8u+ZO/I= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6521b7d1-605f-4d09-4b6f-08dcff5f9858 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:42.4259 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uycSn3V+2FW5WwAvGqWc65I4Yo1/aLhf71m+JxipN/UPqFNii6veaRydg1jdwpQpRyn0cl6ou5jJr5ADS99JrIw7fwmkXg1kYgBCNNF8LAc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-GUID: M7SmEWZiPkj0hDBLZYlG7S7Y98kPcCId X-Proofpoint-ORIG-GUID: M7SmEWZiPkj0hDBLZYlG7S7Y98kPcCId From: Lifeng Zheng Initialize an optional polling state besides LPI states. Wrap up a new enter method to correctly reflect the actual entered state when the polling state is enabled. Signed-off-by: Lifeng Zheng Reviewed-by: Jie Zhan --- drivers/acpi/processor_idle.c | 39 ++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 44096406d65d..d154b5d77328 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1194,20 +1194,46 @@ static int acpi_idle_lpi_enter(struct cpuidle_device *dev, return -EINVAL; } +/* To correctly reflect the entered state if the poll state is enabled. */ +static int acpi_idle_lpi_enter_with_poll_state(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + int entered_state; + + if (unlikely(index < 1)) + return -EINVAL; + + entered_state = acpi_idle_lpi_enter(dev, drv, index - 1); + if (entered_state < 0) + return entered_state; + + return entered_state + 1; +} + static int acpi_processor_setup_lpi_states(struct acpi_processor *pr) { - int i; + int i, count; struct acpi_lpi_state *lpi; struct cpuidle_state *state; struct cpuidle_driver *drv = &acpi_idle_driver; + typeof(state->enter) enter_method; if (!pr->flags.has_lpi) return -EOPNOTSUPP; + if (IS_ENABLED(CONFIG_ARCH_HAS_OPTIMIZED_POLL)) { + cpuidle_poll_state_init(drv); + count = 1; + enter_method = acpi_idle_lpi_enter_with_poll_state; + } else { + count = 0; + enter_method = acpi_idle_lpi_enter; + } + for (i = 0; i < pr->power.count && i < CPUIDLE_STATE_MAX; i++) { lpi = &pr->power.lpi_states[i]; - state = &drv->states[i]; + state = &drv->states[count]; snprintf(state->name, CPUIDLE_NAME_LEN, "LPI-%d", i); strscpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN); state->exit_latency = lpi->wake_latency; @@ -1215,11 +1241,14 @@ static int acpi_processor_setup_lpi_states(struct acpi_processor *pr) state->flags |= arch_get_idle_state_flags(lpi->arch_flags); if (i != 0 && lpi->entry_method == ACPI_CSTATE_FFH) state->flags |= CPUIDLE_FLAG_RCU_IDLE; - state->enter = acpi_idle_lpi_enter; - drv->safe_state_index = i; + state->enter = enter_method; + drv->safe_state_index = count; + count++; + if (count == CPUIDLE_STATE_MAX) + break; } - drv->state_count = i; + drv->state_count = count; return 0; } From patchwork Thu Nov 7 19:08:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 841621 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 70E90218584; Thu, 7 Nov 2024 19:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006565; cv=fail; b=itANnSaj8InbV+cFoz59kej6PeLR+pUSkGpvIaoTE3dkmvOyRmvfgGzd8sUPiL6LS7jGn/zD3676jr0Xipu9ZMX5BYO7cvi+ZWI0wjftczpCOYxY1UMgEvDRBgkX93DLYLTPBBU9ahQIdTCevmuLI0p6Ui6x5WQ8mR78FeG31Bc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006565; c=relaxed/simple; bh=fIkKve3d4s+tARoLQIvmf1GpLWbBKq2gD7ZxonS0CvU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=iP2qsJ6cdg3XaEc/deL4ZkkYa/VwWI4SZx4LhMIuwHbUiCB34v50jhN3MTy1VfXP5MZFYqtDI8DpOaZnqbpsgCP5W0sW0HcA6PflypO+kgfcwuFerB4crToVwz0dmuVmnqqwfzKgoZQAUKLuDFmPkvscoGinR+A1kmtCStAuJUA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=kwBb4JhA; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=GR1K+NBa; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="kwBb4JhA"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="GR1K+NBa" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBfNe030873; Thu, 7 Nov 2024 19:08:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=OsL8KmZV0GZqBzyYAkuNNp3MGpfw0D7lahQORSbuV9E=; b= kwBb4JhA8GvsC1H+/U3RBBE6mfigdBt8L0XlPfiClTNf2Qm1j8w9RyjM63xj1wRh d6IRmSVp5JPXxiAdATaded9E1GIN1o0SYxVRbq/XCD+IRgTk/0+Ki95qIHRlwXrl GIeQ/XzBOu/fDvHbsz3xLNeMOoiq9xuV8xTlCET0twotUXEI7HoxdE+LOUL0JTgO Qcwkg3DNrc7uDVTW0/Gw51WSSZHyExAyMP+3naKaT6Snikz0c6frB3egjxHLwXvK gdHsf8cdubvgOp0rT9nsdL/Nn3qPEjt80VEETTZHX+rcCP9DyxfhGZVlCxrslmy3 vZ9bbYCZ2Nk1FgyBDvyS8A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nb0ckd8p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:55 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7IeIrq008595; Thu, 7 Nov 2024 19:08:55 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42nahaer6a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mrR8MBaYID4DHRAxpIkdHtygrLcxjyPc/Zltc7O9XiGRsGp9e9NEyx+4zBTz3LQeBRzdn7u/EGP1/512lRQFR9d22pDy4pK/GH0hiwtn2cwVtMqdKdqTlR8+OQDdh/bqjjyoPh3PO/HbvqzBmCzUVFBJubqoM6Doa/QX0hJUk1rUjexF00SfQWUOwtIE1JY24HJL3Na6TVVfgaYK3dbf1GR0eEUNmBYYjwFBa/JlZuHXeBg377IqqJ+wAoK/CUHVuqlA+QuxpVp9E0JmiPvvNIOC3hZiJ0wXavRXGpR0mEXziwR7On5J2Nx4oJ1KNI31YTJDlhX6tuMM8lPsB+I8Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=OsL8KmZV0GZqBzyYAkuNNp3MGpfw0D7lahQORSbuV9E=; b=qgu8cuHQfECiZrUDGxcy+U+Lkd4m2V6Y6CapChwPHyi3dfsF17+XmIt+3WErsolG37mMZ+DCTl8ukA3RGQm2VTq9sy37HmWSQyZ9YPaRXCmzavmbfSdzzNNc5mOfui0+b77cNk7OJIziV0EzxCQsBadC8u6qF1d7CwpyfoGkP+rE6JBwbX+L4uYJkYC9lRZK4B7yHJTFgUy75ATQqUbwUX2UllY8BxprKtt3kJKKdSp6By7eh8/ibztpireWblJKo6Srmc0auaxSMq0Vs7hX0sphLRhj95KNjQNSOtkpv+zMvBPOxom0CRAXVkyWjltE66zwrSjW9P7gq2bcEMZEaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OsL8KmZV0GZqBzyYAkuNNp3MGpfw0D7lahQORSbuV9E=; b=GR1K+NBauDmKgSycHvWOQ7h1ncvsw6u0a5ku8Ut7imPlxjxtaAuSb8X+Cx7M56SNElIYmnOIny6Rn0ZbFeIcbv/JzZ1vNipA5/njS/9CwRKiFXnuAmkNqTvfiApID8VGWQbCbz5HNLTdyKqxNBb3S34o9YvqvoD5jvJpm9KZB1s= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:47 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:47 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 09/15] cpuidle-haltpoll: define arch_haltpoll_want() Date: Thu, 7 Nov 2024 11:08:12 -0800 Message-Id: <20241107190818.522639-10-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0119.namprd04.prod.outlook.com (2603:10b6:303:83::34) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: 24d18dd9-c2b4-40fa-46ef-08dcff5f9b5f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: 9weBdsu/RSPJPCIw79WjHRb0Nd/RJJ2uG1qMjljYoQ8WDv0a8uEQ+KicJb2VbpXxhuy+nYhlUSYvzf5t7j2T1vOwFHP3Sjn9xkzY2kNNyW+eYNdYgK8OjncsdTLwnp25uPHb+BFLtHvrCF8vRRoFPuZUvKmUgxcVXbWojI/fBsXHNSGehY5iiz1o/GO9E6FqIzhPfU46QR/20wJm0svOSihA0U9QNn5IHgNQzb0Mvl7qGDFtqXfFNjQjNIEvGZqc2jv/p1+tPvlplX26Oa12jqVBAEv/+bRUJ+lOwzq4hWwbUgJumYzsU83/uDng5UDr+B6LHpEEh2lVy6jlkxp+uDvvrBTkNuJREQdGWRTnCB0Nk69VWwECOgElX0GUisf74lPkd3PA02g22ectVAh/lW0xjL+V/J55CcjwWc81PpLicgToGxuqhk0jOEZqzH1os59mW+6QP/9YR+ZugTVAXmhAgQayI5z9qjSRt8yg4fantO4MgmAVmB2szU8cRmWm85dVY6LtzKb+tBAkj2ZRgAKqX1mXsMKl5h1nejika0kCEJodGsdarN0CJKucPSxXiN6qetTEq4bdsRAXPSm8h4ZRQK3IC69NIY+eG9OF/yygucHaHD+LgFc2JGT4scdg8hwWA1icV3E50dj0MIkEC5h6sPFgbLDxKm0SGDFfVu+qTJx1IQHe6/5TY4/TY4jbTBkgDgrFq1ZhSjnKfd2FuHM5utM9UA4/F4wsUXaoO6VR0MhUH0/zcGGNEJDgvWZW8Sbin/C+txeLEdFDS07+b7OUG2bs3p8bhaHEJKSRbrPbYk6HzES51JGXQ6z3joR0UEnySmlaiTMy09Xjwh3YZYwfSl7qnV7libdC9gHnT+QO/TMiF8FIGlGlQSCwraxzEEWDjb7JuXp4Z2xNzxlPY/LeEyJCvMOZ1v1+rkBMY5LvIPOPpw5RSDLTIryj1Gf6vDYsxg+Bu6eosj+oDqdxuJNF1DMJ6yeBNaXXVJN7QpeVxnAz2KLMG9iftYbwNJ7wt+Rybf1We7CHQM0EoSnQefNEjWkRYXKm12aZLQ+M+Kf+wHjMY8btmIv/FjqGJN+5eZvZOGZr6fetPGhs5Ioe0Y/yK4W8Y2QNrU5E58VhhefTVa1pEPiL77I7NBfrw53zAfX8Y3i/wGSFN8zwSg8MFfyNEhDui8T8BGScZ5GnV0S5tzGPLeHRuaTjhJpl/RV3h+dcGhqVhCqpD/XSRG6L4TRvo7XwbnmtVkjrWUt9H1E3vZiVqBUzubU+F+du3UyV7FzkqoKWmZNJjYapBP5wwQVPJrD/PYG/03UOvd9zEStkyOHKe32Lguyy/OZ99Vvy X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EkpEPTkH4eotBmxx0YGb/vWvzQdNITKPA74meeUZmdgQ8YJfxteBoU9QbG/5FJse/Eifq3tEozNoRjpPhWwvolwgbeFNDB7wzawjH45r8AVsbpoNIauJtGFsKDZAEdSOHdVP9S5Ovg2pZDxWz+v/12XdbSjv8lL2j0FVMzKHJpLAZoockkrnGmwFXL3CVbAjJ2Bs9gL8oeFfW8M+sw+kI+yzrAkDfVlIL4NDwBeZH6OfyWV7Dp6sbrtttbUPXyOhW4O6DXnhJcnvYLUPwvJQtDx/rqHM7rUDAHeTiJXVsR/MgSXxuVTYrLTyUT5i2JPby+wDTUHUHOEKj9Je5BFxZeVGkxG4hg/7POFLu97q7eYvf4oz4nWvBpApMcGo4IySyn8V6BJkuLIO7xwS6sQcZH88/LxQTXBH4gNwdzxqVFBG1V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RPrpBZIEQAxGqnOqWLz9tbIPGFc3NEAVhkyeOVOlApMatY5L4o1Q9IXuPZ9QHbrxcpouWJ3UT47iMhVmqyVMbsJiAsUpc0cDs/rQPiUrEi+P0nOg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 3GolPLKazFF67xNstX2YP0o76YxxVlBbB4DA1iUBMtrrnhsgnWPCJdDHzN2ilvv2IGnZVqxZJlFqZ99FgaQu2FwfrMl6QWsE/TVol8pLOFiBwUYdm3FwMXERPzIKYAiE6Ffgk7e5eZQQ2fGOzqqVrV8yiva//xTArp3EKAkHwJhM5ZATwKIzjVNPCn30e50mwwDRppcCSvmHqu1xpBOWTZQzXoqppDXf8Fy97cQE3WJRfZK3SZEapMeKMGjqAMgx8z0E8mN6PLmDkGpbhb+OVfg+WlBF8h/3tUb5HJ1IxdTmhazYyHO+zM/cXmWx9//oQZ5jZ10Ql+JgqH9FB29eomElil26LLRZ6H1zJLm6r78J0TaOzVlrARgSiFhGfPUY95MAP4HSjmop+CHKFHfU9ww2V85M0Syw2TLPtda9wee76uf019bIzcq/F1i9hkYOU4MWTL0ewGpRKQTCJPO8L4nKheUlfaly1Pivoqk8bHgLYWM2ekyj79GJpZL0B7btGuCpKflVDv6uozrjqpiA17oUpdD5Pfu+ZBl29mXYgjyM05OR9KXwvVIMwXpnXQhKMs/Afo1Vh71MKDuh0dhke8zKEQ5XwZFEoymOj1XhRlw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24d18dd9-c2b4-40fa-46ef-08dcff5f9b5f X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:47.5216 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dFu/g1zm900r5+s9LZa4/ixwEbWSYB86dhlHoZkmD1i6RUaNJ5fjM+PGUHpkIr/6r88Jv+6MSRwjrBpkiozPoP3+5E1A3IzGCCQu61ebHeA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-ORIG-GUID: rB57-W3UuIomLuCMMt7BWnRyBUZpOG0i X-Proofpoint-GUID: rB57-W3UuIomLuCMMt7BWnRyBUZpOG0i From: Joao Martins While initializing haltpoll we check if KVM supports the realtime hint and if idle is overridden at boot. Both of these checks are x86 specific. So, in pursuit of making cpuidle-haltpoll architecture independent, move these checks out of common code. Signed-off-by: Joao Martins Signed-off-by: Mihai Carabas Signed-off-by: Ankur Arora --- arch/x86/include/asm/cpuidle_haltpoll.h | 1 + arch/x86/kernel/kvm.c | 13 +++++++++++++ drivers/cpuidle/cpuidle-haltpoll.c | 12 +----------- include/linux/cpuidle_haltpoll.h | 5 +++++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/arch/x86/include/asm/cpuidle_haltpoll.h b/arch/x86/include/asm/cpuidle_haltpoll.h index c8b39c6716ff..8a0a12769c2e 100644 --- a/arch/x86/include/asm/cpuidle_haltpoll.h +++ b/arch/x86/include/asm/cpuidle_haltpoll.h @@ -4,5 +4,6 @@ void arch_haltpoll_enable(unsigned int cpu); void arch_haltpoll_disable(unsigned int cpu); +bool arch_haltpoll_want(bool force); #endif diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 21e9e4845354..6d717819eb4e 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -1155,4 +1155,17 @@ void arch_haltpoll_disable(unsigned int cpu) smp_call_function_single(cpu, kvm_enable_host_haltpoll, NULL, 1); } EXPORT_SYMBOL_GPL(arch_haltpoll_disable); + +bool arch_haltpoll_want(bool force) +{ + /* Do not load haltpoll if idle= is passed */ + if (boot_option_idle_override != IDLE_NO_OVERRIDE) + return false; + + if (!kvm_para_available()) + return false; + + return kvm_para_has_hint(KVM_HINTS_REALTIME) || force; +} +EXPORT_SYMBOL_GPL(arch_haltpoll_want); #endif diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c index bcd03e893a0a..e532aa2bf608 100644 --- a/drivers/cpuidle/cpuidle-haltpoll.c +++ b/drivers/cpuidle/cpuidle-haltpoll.c @@ -15,7 +15,6 @@ #include #include #include -#include #include static bool force __read_mostly; @@ -93,21 +92,12 @@ static void haltpoll_uninit(void) haltpoll_cpuidle_devices = NULL; } -static bool haltpoll_want(void) -{ - return kvm_para_has_hint(KVM_HINTS_REALTIME) || force; -} - static int __init haltpoll_init(void) { int ret; struct cpuidle_driver *drv = &haltpoll_driver; - /* Do not load haltpoll if idle= is passed */ - if (boot_option_idle_override != IDLE_NO_OVERRIDE) - return -ENODEV; - - if (!kvm_para_available() || !haltpoll_want()) + if (!arch_haltpoll_want(force)) return -ENODEV; cpuidle_poll_state_init(drv); diff --git a/include/linux/cpuidle_haltpoll.h b/include/linux/cpuidle_haltpoll.h index d50c1e0411a2..68eb7a757120 100644 --- a/include/linux/cpuidle_haltpoll.h +++ b/include/linux/cpuidle_haltpoll.h @@ -12,5 +12,10 @@ static inline void arch_haltpoll_enable(unsigned int cpu) static inline void arch_haltpoll_disable(unsigned int cpu) { } + +static inline bool arch_haltpoll_want(bool force) +{ + return false; +} #endif #endif From patchwork Thu Nov 7 19:08:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 841620 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 AE51F21A4D4; Thu, 7 Nov 2024 19:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006573; cv=fail; b=VUpIdq+SA9nBB0UofDKU863Wj6G4BdkLF9+QUhM7PRm1MXONKlY9xJfU3ZNbUsLHBSWJZfA1iWPPjAlG8IQ/I5v/2Lvyv87OjV1OKcs37n72TaUy3LOWB5kx1Lzm+LIaIlbVjSRnuvTGDZk0pvcSOoJyXGA2e8gUxH1MhQ1JPXY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006573; c=relaxed/simple; bh=DVVhYd/WrhOtb8aUDHlylIdNS9AATp/2thz35KUD9e4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=prH80AJKEM/IN3AwBMO/XdA4Anya6h5WazGlM8iXevt+HwCQ5UfA4HZeuqJM+9ORh/VvKEk63MwUDCVzBB5Ti5dWkEYQzs/9D4FJOaFPJY0MlqIhd0qcarq4kAgAXjuhwdo0zKGdYcMju4fzxcI57Hlylye5x+oo8qDCUFsPJY0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=JvyugIT6; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=QYyJ0E0W; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="JvyugIT6"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="QYyJ0E0W" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBgoh004777; Thu, 7 Nov 2024 19:08:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=vbxLcRDXwMau6ojZuyq/zCmmjpfyFtoL4t1auecO12s=; b= JvyugIT6yY5ZJv4nZ3OuS/ze3NLtBbSumtYaJweln09jFkKGoGNbSyN3QTaF4LmJ pS9qmCURkTsczP6mtoMNJ6gbhT39QTeF2h6zP2pB3+I9gkaKm9iNPSAitCvelVVQ kX4aPujzJTtd6NEK9UPqiZyddGhaMIQ0CoaqxPWywT+/7ZiLU8SlqHq6mW0O/Kzo SkImW6rP00ukU+euCtMvrTgF9x4AWaZTpkb7+fttnE23pKFZYHcQf6HLIFqxybRu pXOULLIcBnV5PqVn/pyfRSJUf7291K9DsC3U+jRO4oHRlj3KDIcic2HPm/ICP7xc dVg1hISwPIWxVm7712Kvug== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nap03d8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:57 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HuoFO031413; Thu, 7 Nov 2024 19:08:57 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42naha6cn5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jHYU7SuaOZjJrvGAewVU4vHppufYR7+3ucTqKmo2RJTOlrPEmCSVvopy0BA7XtMPXCKtmNhV63ODn4Z7tVWLb/xK453vKWT3OEnmhcQD5pILeHnXAgGl2q1+D8+wnI4BjV+0/SzHhfRG6ve9UQUdPOBi+BMh9oYlo/cU0/o/vTlEiZjXj2IQZQLXzDbX9UUScdUa6YqIGPHGp3FWy6DM8xYC0+xZVa68gcvRcAendtkoeyJPp56h6M9ln+xYsP9KbGv7FAhYzKEUH1oqydOBNzeB4/Ug80CHRb8t93lLmQ2aUC2BMSlYPXJAcs86riZHVL9otbihCiwsUPpRjag1lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=vbxLcRDXwMau6ojZuyq/zCmmjpfyFtoL4t1auecO12s=; b=XPvrIIQQV+w2g39xrH/bUZByDz8GyN3inpLKCGT1sxGUkQDkriVK2pYhm8w8zM2BawJ1tzPr9GP5O1Nxy/0Frc2Pp1Aqcemp58jjaTzXFlrSIDh9qZdvJjkqgSmVi8SPi80We4LVieBllknWHVsiCsneOwlEyWnQRxQbzv+XXw4LtPN3dU6I45KmOnI+R6ni6t7zdRAqB5++0Hjeu51+J81GexO0VYL/zbVpAEgoa/Je6y5cV5hqIeMhrgtpaz1na7d0nTytcFjdcAlTkTwpfVh86b71wh3D5rk9kUqOQJKDVb3AdFAI5mxheAPnig11XY4ETRlfyzCGgy2ES/5EVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vbxLcRDXwMau6ojZuyq/zCmmjpfyFtoL4t1auecO12s=; b=QYyJ0E0WWrNRvrGG/IcZrrpd/vB57sE2K6/4J+t8LjzYAk6FBT8fqzreHIqPkFg58LHojM1AYd0SpveMnVnFlmDbq9+H0jAaWJ3os7NWw+WEMHFwUTijTFROnPbAjNDIorXgCgCLJJzcYMf9wsiezSPjiEAdDY6o8tHocw04yA4= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by SJ2PR10MB7736.namprd10.prod.outlook.com (2603:10b6:a03:574::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Thu, 7 Nov 2024 19:08:49 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:49 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 10/15] governors/haltpoll: drop kvm_para_available() check Date: Thu, 7 Nov 2024 11:08:13 -0800 Message-Id: <20241107190818.522639-11-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW3PR05CA0021.namprd05.prod.outlook.com (2603:10b6:303:2b::26) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|SJ2PR10MB7736:EE_ X-MS-Office365-Filtering-Correlation-Id: da8681c3-1d68-42fd-cafe-08dcff5f9c87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: p7DBvckTMLZ0nFbzJij0clM6HDhC4QGIDzXzGkgPZAuwjLKkv4VrdTjqs4MHwJxE8mIknSQASV5hnL8/adaj8cSJr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aHSV8uXAJ+FacWY9iJVG4ogyU2uRRePMsequqshsgY+zEsCY0d7fFO35dl9uKmlxcqYRDq6JtpUnK/o00cI4egTqfCKEdkBWMasx2k8YRK/GaHV0oMv/50q789CwidhYziGbh18Jrk545YYTd3sjpASgk9tDT4gYyIDBQ1qWAbecHtU2Lt0TzGLdmIM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7416014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4kgiDIvdF9LLBnqtepMRCwW3usphjX5b8PP7zYT7/2lxStC8LRvDG/8mwdyD0JnInhkRBY1nAC85CYtsOQ2sP6QcfcpJmim0as69R19dq5gUUwyUYIit/eaWch8qIV9xqSs2EOxrgnFt3nL4sDKEUiacMuKvd3t1sB/OUlSHkTlqlyMvjxLbatuiKdeDvdKdBNhM0LIvOP3iHaRfx5+xGrvXf/knFkpzJ+KMgSvxubmGKRf39QC+5MsqZTZhqzyQ5RoBGRXWP4MG8fWbfevSv+2DeuMnW/kgsDM17c/N7VqB1Hfzfb1XvpX3sDN7XTGLiugi/3YteyXgvAMukyZ3V0qJWEYQRWoYZU9iQUA4mdwJTKLj1wyF80BlqhNKYG6QPurOI66E5gxlGmtB+Enz2wBNOOTijD3eHDUNCT+/M0WgJh8Q30Q1NcBvcE32fGqe4aJfj3918RtT6hlmPrK/sgO1KkciAgoEEgUe1zU2gEclGE1sMsgqKAi3FmOr19DbJY52MhuU5RBKM/ySG67K7XlmDMx8+ttf5iKIW82jWmlFEteD4yVpFZGCrCsULyxEetrV3FadVWBcgmWYLea1QI1ZBTG60viSvoFJ5PbM818X/JwT54SoXMzFJ93vqi8K051+J2XjKf5xnPO+njB00R9G+fDhvSXpNtLoqU40dJdSuQY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HeGyfrijtz1c8t3khFeuR5+IQ1E/vMwQQUCy0QDcyH6D06KHiOpv9U7Vr1if0Lw04a6qqzO9Zqlj511BO4z9H2SqJhGZGazntp6UY+6alpdefqmDzrpWq+CyAatz6ROKnGPpg4wRTrOPxhsiw5H2iTNX7cWiSTEF2FbpNfzn7px1AWwXzMYqiNTwk3Ye1ZBdJLJjGWu1gEPOdpD16i6JMN7RpiarrFEWaapMNjUHTXS7qfBCQ4vLSFTCFfwujhKXWdnWTz6lG7YJ9RJH9kSI+rx30hZoVr6IyEK7vzsGqekmqK9leDoM9lKPklZKzNEpBMhblZ6cwMBBmS5V4bHjy/ShlhqlWyRFR/nZB7mDGXbqhvIn/Bbt/nKPlfmsiSs2cDPioiXaC+oFiA5NHnMvAhhwYlPVUuTW846Zg9PhAXsGmhCqMwYQkVCba9INs9GM4AKIwbFuUo8XY3WHfZXwAIIbHRksCAzJWwhuV7tv+aKRAaa6juODZnsftioShcSq+1wZplsVn65Gs5CxHg5jhwvAAEbJY0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: da8681c3-1d68-42fd-cafe-08dcff5f9c87 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:49.5254 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2qpYzJIW1GWJt/qteBKNw70H8Hi2hXWa0C7ZuhvBbclxIfJwxWXZz7ZKMeHXtE8Vqwse8T07HhtzsPZD9mRkDYK8Sywlt/wzMgGJ9/EPJ8Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7736 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-ORIG-GUID: mvbRESuLZ7okeDC-4lhKifUqEaBRIEns X-Proofpoint-GUID: mvbRESuLZ7okeDC-4lhKifUqEaBRIEns From: Joao Martins The haltpoll governor is selected either by the cpuidle-haltpoll driver, or explicitly by the user. In particular, it is never selected by default since it has the lowest rating of all governors (menu=20, teo=19, ladder=10/25, haltpoll=9). So, we can safely forgo the kvm_para_available() check. This also allows cpuidle-haltpoll to be tested on baremetal. Signed-off-by: Joao Martins Signed-off-by: Mihai Carabas Acked-by: Rafael J. Wysocki Signed-off-by: Ankur Arora --- drivers/cpuidle/governors/haltpoll.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/cpuidle/governors/haltpoll.c b/drivers/cpuidle/governors/haltpoll.c index 663b7f164d20..c8752f793e61 100644 --- a/drivers/cpuidle/governors/haltpoll.c +++ b/drivers/cpuidle/governors/haltpoll.c @@ -18,7 +18,6 @@ #include #include #include -#include #include static unsigned int guest_halt_poll_ns __read_mostly = 200000; @@ -148,10 +147,7 @@ static struct cpuidle_governor haltpoll_governor = { static int __init init_haltpoll(void) { - if (kvm_para_available()) - return cpuidle_register_governor(&haltpoll_governor); - - return 0; + return cpuidle_register_governor(&haltpoll_governor); } postcore_initcall(init_haltpoll); From patchwork Thu Nov 7 19:08:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 842019 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 E600221A4A6; Thu, 7 Nov 2024 19:09:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006571; cv=fail; b=fCfAndn+bnkQe/KOvNEgpxyAiO6Cfopct0tQ90N2+WlqglFZfskQoS6dNtqeTh0VUzkMmxQKt4POsODWn+4T6Y0a7JC+ONC6gzbb+txf20I/ty9w2Q4LtYPbmpcDuXBw5nFHs3DR/KyhDz7P945VZfwjWwyPDlglrFYxuLlueJ4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006571; c=relaxed/simple; bh=0gtg5I8UrdEFmGzwwzLhTkyuFNRE9cj+/5Nj0z2oeWc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HAefGlgYeDW48QtSldqVzh6m9rrac+gBmHgUJR4RwsnQIqe14Ia6nUVz09kNMq2GkS2+2SMu4Ioilzf8MhGc117xzVJ0haiVerP0nLpmGURbiBbt9ePhAs50SdLhMgz9plPgwYeEsHgC7UHvsCFoyZw6gLrs0d7R8aZ7omz3CE4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Se3WNmQi; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=RCNqlWt3; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Se3WNmQi"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="RCNqlWt3" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBdqJ002594; Thu, 7 Nov 2024 19:08:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=X/9z53ljMQ/NRHaqaOXAe6l0c0K+wzupeQNkRnwToPA=; b= Se3WNmQiSwdq00UpLaauJk6b7UpHJa0rxQaHC/6Zsv7xmVenIOYRqNISMyQ/lwkz Lq4t6Fm5xA84PMSzNIeR62lyqyKrT++o089E3H/MyalJHaH2W+nSXmH22p07agvC hJG9Pjt435zNUH2vhFFMPk02H+iMqo48CGM8dLZ/jlTHAUFQEgUL0MEWIcXM1lCL flixrt2s0RNccOuauhm4MEyCJM+euRRIPgHWSn51FOqx+YJzrUNX56AA42+SdQvn Bk5fsSwP1IdbQ0na1WOQNbTziYWrtJ+X/gtSbKdFWdEqVnxUqQT0wiNHCB2eyoLN Uh8nTKCnTHuJqET5aiJP7w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42ncmtbbcc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:58 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HuoFP031413; Thu, 7 Nov 2024 19:08:58 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42naha6cn5-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zGfDRcmkq/U9/f+HaHkJqrXCUu4B5X/sRVLTJVzStN6WmDxGbGQcDDI673GEVE+MB3mJx2SMyQBgkA8uBSfDvauEMvexKIffBfS+75n02znAesLZ84iuhRMSr3nJmGbElj+YT2OVH6DE9qh1xmpQqdpCnaks5nlurgN3KMqSKfSFTpOoJ1ofOAEwepHSBLqrjxDLhG4J+hyKj4TcLd/ltgDIMhUPmR7CPXbXGUgiAG/lVLhRZTVy6YXblbk/oZTNZ/bYDh9jYAvZs/CyjnCjyeyAy38pQwperY/s6tmSig6AcAWhZqO1jnijNUWKzs+GOmXX/Pnevkia9xp1VbMubg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=X/9z53ljMQ/NRHaqaOXAe6l0c0K+wzupeQNkRnwToPA=; b=OhvZ91JFuZAiJHf75tyYgZ7BbZg8HMQcjNulSaG9iR7HOMsFky9EJU2Rxtk6sFsKgiLzMwgxsLkk7+7N4487fZjs+M1a8Bs4liz08ubJm2WBANL+Q2h1XZNu7iTJWNmP549kMG4VIIKKsLU82DPUACizlSSMI8eopGCaP+QZyEVBc+3WPjAUJn9CF5zavM/fu2YyruVeGWj27uaqQ3cyP7+H0x7ldphZwsNYi5tFmfL8148CIy6xSU/NsEsLx5TAFL+YbqwOkYBMtHDiQPWa3ZiwXXwZwaIVXixPS3dTiyRpof0a66PhpdepIetqEgRaCFC+eidpdqzrMlXvnYG62A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X/9z53ljMQ/NRHaqaOXAe6l0c0K+wzupeQNkRnwToPA=; b=RCNqlWt3ruoMgxjj1nPT2YtKy6Rb6xpa8rpCTHG98BCzQ2/rKOcKHAgSNoXmwVt/HGO6Q8euTaYTqsSGnMbKEHPlHXMSTP22vZB0AZN623zJR4j97vb0IJARKRghiO3TGkIsx+0Qk8dvKQwuOFsVdftuZa9DemSy+1YxrtIowRk= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by SJ2PR10MB7736.namprd10.prod.outlook.com (2603:10b6:a03:574::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Thu, 7 Nov 2024 19:08:51 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:51 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 11/15] cpuidle-haltpoll: condition on ARCH_CPUIDLE_HALTPOLL Date: Thu, 7 Nov 2024 11:08:14 -0800 Message-Id: <20241107190818.522639-12-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4P223CA0023.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::28) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|SJ2PR10MB7736:EE_ X-MS-Office365-Filtering-Correlation-Id: ea711910-06d4-4d83-1896-08dcff5f9da9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: U5oVryzgRGpXD7NQaxH+pmLNxrpe/HjcY7SYT/t75Is1Vab4PWZWVc8YOhXQNJjB7UO4zjA/HvOzHW5wJ6m8DJgxSuS+u00/9YZdVwjUc2YvxNLgoF0D5KZ3AI7pa8V1tiZnRm9ndurmlvc4Xlp1RO/dqwayxXXEjTvrgx3ZsD5KLNM+IsPzu9gJFpkqXpNMwAmlAMxXJZu/Koc22AsXDheUI1TZ7DCoQQMNGjovn3LL/HCL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b/9TiW4bAtvkcvf7ul0msTET4CtFlz0T X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7416014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nqJPCNMIWhzXuLalSeotGWwJJIqMpZTppIUXmsN8d9araHuNs0c2OINslx+qqqALwncaXb4U2pj86KxMWxixaer0esmglkuFYX4at+IWliU9Ho6xHq9FH2tl9DQaywpE6RQe7+fbnMemoJZj5yWNr/Gy/u+7lebfM0T8SuIGnkrEVlVjp9XEI9WWABGyRFCCHKk4cndP3EPo5qKFlAH76gJ15lcOvz8d5Dg5hA2SzN2uhxp1Cqm7D/9MWJ2dJ0gd+j6k2pOShxo6Z4cphyGpQIUnveuhodjgBEn+HczNLx1WgNdDVWTc5ZXHL7RLOgmpi/SQ1EzPikYHNb/7oe75/2mUDV8PS0aVmZ8s3RCrSMHyTY0PHIH8CfkRUvxyFdKR2nJN09FYknjE5g91GpczFLifXiin8uN5DGUXsmO8P0dqt62P/iZm98jMZw9378IEP2JyGWCGBUyfp2JjvOys4MXNirvLNzhCMrOcD+cnowXVjrhE06Hs/XEcT8KhV81LPYcSelUieFKTPvW0Y61GBfF4w7A/6wxq9BldExnCoL/Tia8IemvKZuh0hIV6b6s7lsyxIs0/kF/wxeAKs+xqxV29ujJPuIZRbOtadsdE8BAUC3gG8h7HSD+fGfuvg1UlDDmjD7iG0AJDqaBNQyqVY+atW2T3LRf0f+EVo2fIQtXezcsTTW1KYzxs+M7lKORTXqUmeRPIO3az5hrfhDHzTJa4AP9ZaTm1M93YSFDDkIGzjpcvWtp5ZC30TvautzwslQ7fRQT7KOMiFIdSXE+Cx7K4TRU/48O66pT5FWRvRcW1PAy0Wgc2zzKC7wHT2O13cxH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K1hLLj8q7kdoxkxjKjkE+1a3Zg6RlO/kOiWd2G6fXlltlS5ipDqMZldg7l2LCqHZm65CeK0g7h0iF+f4Ht/vBVGulMEPZ5vouqRoc2kcg5fSI3K9GL/KHCoss3HhyeXvzUyKXRrcWGgADfcqp1TPWN562AyLWR+qEJmKazK1k/KplTq6+/wC2BXYBTbq20yEtWbPJuDGXF9Q2W27dXHwReT3+4RHTpkM0dPmm4RUQw3NW+Yf7FK7nA69AQM9FFNBU/Kem+4n/YiaT8ogt5Pp8AUjq/GmdWHUzGZ4ghjw8NDC0/F0ImXmcnwccCNDOCsuusHr+FeuJshKSNlNFeq+Q2dyefhRtrkNkACQ1Zdhpq6dzPCv6e/qmPM8UISnrlHl1gkMxucf9iO0+TgLkWXnB2ZgyFkjZaYc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea711910-06d4-4d83-1896-08dcff5f9da9 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:51.3401 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: y2jzo8vWNJ1CfWyp+bHGp3Z+zKtt97RpuHoJf3wY3O48mSUBteLIYAoVmjih3hOxDbcipaA/40EoQO0yH/VQifBgiYEMwtdGnvDdJ6Qo9Sw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7736 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-GUID: VnjQweMphPRtdwNHdupaFgJrYu645lEl X-Proofpoint-ORIG-GUID: VnjQweMphPRtdwNHdupaFgJrYu645lEl The cpuidle-haltpoll driver and its namesake governor are selected under KVM_GUEST on X86. KVM_GUEST in-turn selects ARCH_CPUIDLE_HALTPOLL and defines the requisite arch_haltpoll_{enable,disable}() functions. So remove the explicit dependence of HALTPOLL_CPUIDLE on KVM_GUEST, and instead use ARCH_CPUIDLE_HALTPOLL as proxy for architectural support for haltpoll. Also change "halt poll" to "haltpoll" in one of the summary clauses, since the second form is used everywhere else. Signed-off-by: Ankur Arora --- arch/x86/Kconfig | 1 + drivers/cpuidle/Kconfig | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index df75df8467d1..fd0ff83a84f0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -844,6 +844,7 @@ config KVM_GUEST config ARCH_CPUIDLE_HALTPOLL def_bool n + depends on KVM_GUEST prompt "Disable host haltpoll when loading haltpoll driver" help If virtualized under KVM, disable host haltpoll. diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig index 75f6e176bbc8..c1bebadf22bc 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -35,7 +35,6 @@ config CPU_IDLE_GOV_TEO config CPU_IDLE_GOV_HALTPOLL bool "Haltpoll governor (for virtualized systems)" - depends on KVM_GUEST help This governor implements haltpoll idle state selection, to be used in conjunction with the haltpoll cpuidle driver, allowing @@ -72,8 +71,8 @@ source "drivers/cpuidle/Kconfig.riscv" endmenu config HALTPOLL_CPUIDLE - tristate "Halt poll cpuidle driver" - depends on X86 && KVM_GUEST && ARCH_HAS_OPTIMIZED_POLL + tristate "Haltpoll cpuidle driver" + depends on ARCH_CPUIDLE_HALTPOLL && ARCH_HAS_OPTIMIZED_POLL select CPU_IDLE_GOV_HALTPOLL default y help From patchwork Thu Nov 7 19:08:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 841619 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 2F30121C17A; Thu, 7 Nov 2024 19:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006580; cv=fail; b=XnDaRD5WdE2TRD5H0e0L3NR5dHDObhT7yshY/C1hS8+m6jikfTBHy2f3Nh022Sx2Xf3R6zXTpEInEAX4eZJLCY4+kIPZ4JcMnH6EuNDgkJaD+NFvFA0wN7sOc1ik+KuSYvXDLiZtHe74qoTUwM2C9b0CyywKW8lc9oiMzXRDB0Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006580; c=relaxed/simple; bh=h+s0zPrbvlVnDP7LgdMF6n/gdbD2X+UkkYRVL3akutM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WlrR2tWcQCbokWYhXpXrVwqn5SfMQ8yh3M+8qVNOA9LSkXpYGxQ9bHenbDTpW/tSI464k1tSkywnlsmMt+8C4mCcvB2IF6pKmoo8Be5vZcQaZJKsKpOQFnUR959i7hAhFV+gv+mt7qxynGD8+ZTenke08EdrLb9vxk+ojXdBv2w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=iyPh7D+X; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=esS9d9Fl; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="iyPh7D+X"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="esS9d9Fl" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBuGY014259; Thu, 7 Nov 2024 19:09:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=tuXMmugSwWVSw8iGwCPMmmKPajF8YRsj8SWgseskxsA=; b= iyPh7D+XfdSmXL5vEqE4RjOvI+aKuf1YY9vOd5FcxQfz6wsRsWi0L7W/1rQCAo6K HkZ7MmR4WftfUNKX5flj5uBtCOelXPwBhwRhUGX2hH/oQi/Ll9EQcQPzHhUa3p9x Y6h3mcs4lq6qPdD55dbVPZezB90K4WQ8atUgl8Xqwz0sfunpOzyh/5PIxtz5ZbVd ORbG+YWow8XqWlg7x8ZrDwaSRwVVMG4zW1CaxssqXNfPovU+/2T5MMdQET0Sf2uF Pco1nHlS1HTSIC0yTC94uFDu43jy77qwjXiiUiPtqx4cbqlnL8VUoYZDleq1FfMe uV0HG/mCgi1wreJNbQQerw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nbpsubqg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:09:09 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7Ho2IX009141; Thu, 7 Nov 2024 19:09:08 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahgt646-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:09:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xmO8yJWn/dV1q+A3Dpc1yH4IRrQBV8h/S6g134SQuo5K2OdgdVEpW6oR7OJyMkOqFwqXtYzHrT70Iv5aS6pn/hPEA8M6ZQx/2zKM5Xe2zUa6XrEdE8SBpO+KScppl7FuzfMR4/9kCFp1eINrZkHG0TzbEC+NjyWw0f9unqweeQ55eccxlTIiasHzMGG+JR9SB/iDJb0z8xyUTX4xsY5OAJ95I+zmbo1kM9gLVjAyGvJ2lEeu2w0aOZyZj4X/NRwAOAGPNbPuheKmPsHrS3izwqOSnlTTFs0rzuVLUdHTXj6H3o6s4JedPrbMHG4RpCfquy/hxPR1OnP/r9cA0Nxccg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=tuXMmugSwWVSw8iGwCPMmmKPajF8YRsj8SWgseskxsA=; b=yMscsV9bK8SiUWzOsQce1Nt6Mf8pD0cMnV7mNHbhR+zN+9kXP0KqZ+qzo7UPp+0ZIUU2JotE89T63Ee8kd0oU8GsTtA6zJp14BNApTHcxat03tpBGvlHPsT7pe79K3aKCWnXDgJAoXE2Hc4dYNnfWOZU0P+twIBJsDDqtsSDFyTFzeccSqmUIZWE2d/Q2iNiWpipsiD3f705Vb/hRZoO2Y57DNIeVbSUJoYu+7anjCHOymnIV14Y0mKvxwxNT+PZL8B+QgVrvPMTDX/cq3k41uSZwS6QAFtvYD3fcxo0zDi7wmWyBlEfXvPYAkVrX8oJ3vQNyoqRcZLp/nsodAdCfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tuXMmugSwWVSw8iGwCPMmmKPajF8YRsj8SWgseskxsA=; b=esS9d9FlNE5+Y4uGf8bveVrujUN3Pa+hdNmC9YHDe2Kxp86xUJDUe/J6LMPZq0E4Q1VXW2Uvf/G3X5GHMcKG0FeCZcTK1H7hAEZc+EQpPp5kZbUk/Ziu6uETF1GQYiOtTKlVivdvdL31VwNjTG84jq79yNFTAFl/H18Tbr/gCP0= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by SJ2PR10MB7037.namprd10.prod.outlook.com (2603:10b6:a03:4c5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Thu, 7 Nov 2024 19:08:56 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:56 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 12/15] arm64: idle: export arch_cpu_idle Date: Thu, 7 Nov 2024 11:08:15 -0800 Message-Id: <20241107190818.522639-13-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0096.namprd04.prod.outlook.com (2603:10b6:303:83::11) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|SJ2PR10MB7037:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cc7818b-9e33-4e83-9153-08dcff5fa086 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014; X-Microsoft-Antisp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ySU3BUq50kn/gM3nRgfEpA9N2JwwjsGT5evtd3UaAaV9YbUS0S7TBzps5s2/Ta6ppsB1oj6k+rHkNfyejW9jGjlAQeqTRdzS1Ojo6vcDIt4AYpUvE42pFGUSxMgCalXauZBxUZuzz52XRFNEE0ynbUWHNhSNv+jB8/v9gbOh2v2GLqcfkIZTQ0sCau8rQtgqvZ8DjAm9bNvJ+kMr6Yz0oE9itNekOxpopJ2CM6TONE8ld+Dolcm14ZwEuGAepl4PVuycpLXAwYssgslq3oUn59 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7416014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bAfNrhJZM61sSHpAadMW0Yh2czrUvcBMLZJ7K3qXIM1OADn+zy6AWSbBo6qn7FY1b5qbUYX1uBKZHHKSx7AwcvieHXOw0Y+U8R45dgX53YjCb0t+k2teruQpxiFSnV599lTmLZbon0hfM5oN30/oz0NYiqlS6lejdG8ZRaBIi0YQpav9Ofn5mK/sFoxmqLelHhOZvrmMxU6ke2CMunbKVsK1z8+aXNzMF0MgaG5B8cfaBQHlk6bWqamls+4dnfFIsHHtxX7QEConopofSdkEUDiYchyMJ8Cs0L8ibsSBBzgQ+rLgRjAJqw7/yPQ9ZacvqsGHa/lXbjiWtQ/0Du8S0WLbIsojv9LdIgnF/rihtY1SLGE03uvkYpNghdpZOVjvQFSLLg+WckBjAn98qelxsApEZJuvdPVL9UB9RG31qP6QktVr101kX/rCsR43N4AT6DH8C8vKEF3h4MCvpEBADEnXCkubeKS1WmUh4A3/sX8nWeXGEM0bENEWUsFIeWAdfm5V8EXjFahYy1yYzoJt3SGCc9luxp1aSYayZvYg010ZGS0/36gIAtnzOLrjKPc2s83vDFARuHNC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iSpam-ExternalHop-MessageData-0: Pfm4z0eCiTr7mH7GDKXhSYwsFSk//D7cZiXQ3T3ARLGSl9BT8xwvX/AeNAdUbF4leezO8y1U1cp+BmrW2xVWIw3pO0dhHGzSa+4AndETBvgcdgUVSCq+jm3XIs/FlWKmPpxYRm4bb36o+tMkifK6lrrR3l+fC0xO4CBmlJCqlojJBcYzuCxzfHlYDEH3nmZimRMLtTuHsdyJO875ed0W0RKJ5QLv5R8PTBdOGoY7YTTHuKDJfjja3aYeIxLTX+9BiGXzZeEG4NyO6R/9nXgj2bQezwTbEJouuzSC3LYmETmiFiKuVuRTA83rlyMjFGzPEOBlzZmgJMBwF51fwgi7x6mPYr8uTipzPetKPUIc2IDoQgBxHbMGizfwjJyYr1DyaoWa/BwcB4rHja4nPdTCj8/bC1UzsTDKxmeF8vOARcXKJbmbfSQd7JkQoWttHnQxyX0KAtyNPbXd/5/kgmJTrgH/7gI12f6r1n6rTaQ/iaW8w/TH1Wqfg5jkquF6OldBo9cdEm7ZZYmtV28MsYs05LcJ0R56vKJINUKQ2F6okuNxL3UCkvTVo5tohV+RH7Tx9dFwMKAFjecy+c/5BaXP0xphgAO8Srqqodljw+IEqKo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cc7818b-9e33-4e83-9153-08dcff5fa086 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:56.1376 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cFeWGxAFpwjkVqT//IzErFNAc5uyRn7S1had0WbQNF9PmxBmbfuyxMRUJjqUPrKSXMBEB72d1w2sczYEcKci9eiAQCCccj28SMSjtuGzJqI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7037 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-ORIG-GUID: frYy-i80U1jkbQ5KgQ9xaJEDRX3lkJBb X-Proofpoint-GUID: frYy-i80U1jkbQ5KgQ9xaJEDRX3lkJBb Needed for cpuidle-haltpoll. Acked-by: Will Deacon Signed-off-by: Ankur Arora --- arch/arm64/kernel/idle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/idle.c b/arch/arm64/kernel/idle.c index 05cfb347ec26..b85ba0df9b02 100644 --- a/arch/arm64/kernel/idle.c +++ b/arch/arm64/kernel/idle.c @@ -43,3 +43,4 @@ void __cpuidle arch_cpu_idle(void) */ cpu_do_idle(); } +EXPORT_SYMBOL_GPL(arch_cpu_idle); From patchwork Thu Nov 7 19:08:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 841618 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 3628E21F4B9; Thu, 7 Nov 2024 19:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006587; cv=fail; b=eXGODySaYQL11iDhpiEInpjIio6RBdBzi7xe+9TAicoZuqHDyEg/+VSXUh7au+Y3TBxPQSz0PcVux64KPzsOeFGr9IES7yHuavQHY3V1qhVsGza70Af8o+5ULbK8rstN0+9/MhLLKloaLBW4itnoxbe4FQK6G5Pj2IHuLEWvJGc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006587; c=relaxed/simple; bh=RWXJsQAWI8E4rVsNQMLP0FS5DAXuJLgRTPgVysLDiHI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UCZa/ISSb0raT4p7WGjiu/FfjBax4gvydjzXsbvLZtvoV+mEiikKuax5CkbH05xUR4BkNSsZ7Y9NfzBXNIdmYhSCXqcFf9onFlmKWuckUpjzUoJdHhsQhTyCTXjmgGn24HLL6C+P0zJlxcK7JGTjOFj9/X3uPiZnqXfkoKAPb20= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=RnhO4b3o; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Bm9LEFFv; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="RnhO4b3o"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Bm9LEFFv" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBWB1025022; Thu, 7 Nov 2024 19:09:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=fakUqzDmzaD3RTe7NO+yLwk8t6vTIFFk5+sqvN+b18w=; b= RnhO4b3o5Qi3hQFKGNlmNAaGBhDEMuizAQtwtgJqrv2m0RLdYKUdJpfhDybJgR0e CAGhI+bKrRvYdBcbSPW7wp9K0tsqToWDks/FV2RTym64n8v3+YFrryPRdaBvHr5T 4dWOoaxT37afxq+tOeldpURsEVPGRqyGPF5WRlNgEBDlzGYGJ1I2SzV9pc24BwAW hDBSZYlI/nk9kyOQPibqJhomJbpH1WnxqV+1I9+Ex616Igt6Z9t8evjVPFFZrDJ3 IisMf4Dp1IHep1IRWw/AxiQlV4E0EO36KnxKZ54IPx47SNWxKCzxhEkwo8GKlbsU 0M0rfadmg3/zYxtqIKCqog== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nc4c3g45-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:09:10 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7Ho2IY009141; Thu, 7 Nov 2024 19:09:09 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahgt646-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:09:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dvrAVstRyQg87Vo6qlf3PIHPCQsb7G+OYpxIQJS9Hur828scVHPoB6Lh1idmHatSbQHIKDpZUHzkvl2s5avEtYnjkj/YejwlUeoyBHwFO2vaaffHPLdPo/lQAgvG2T65NaeyepeSAwWpaM80/kxILls3fqNLcn4FMx5G+u0LmXP9UrxFuI2wJAODAheG/9zEQRDqwQinKhnl1hoM86t0Ho9fRCdkVM8gVgWyH3xy3ulp5txqvUQ0+/Tw9MTAbrpRM7chotAnCGt9wv4Zw0u2qGfyS0qqhTmCbVymLhXcPZcb2cALH61CRSDk8CYZqvYWHJgZaWNSkceYIwjesjEM6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=fakUqzDmzaD3RTe7NO+yLwk8t6vTIFFk5+sqvN+b18w=; b=o8vqaFcc2Oi9U/ZT5Sh46IpIP3fZCfEFrxWxitKHXr09ASKGr/J1aOhuSkqAR2Ca/ET9lzKANyz1JHNYTrzTlTXlv3SFbW6Q5WP6Z/JXkn8YYJ+VZHtg9dKc+wQNI5FQJrW2uDNpjtfAfRZyDaqZSRDTS6YIcwlpiL3sHr6pWKCPBb6bjzHjYQQLUs3Y4necidKigRO0TySOV6AOINsKAugMvtxWMTPp7qFp/4F2aBRP4kCpj+YXoAy2h7ohjy7H7qLQJ6za+q8r+JVsFeh5jQZ0VSkPX2/EJVmQUj8WSHmGCRgBRvk+WUxE0pEIbcWWGhZQCwuDyBrXF8AIFG4Z/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fakUqzDmzaD3RTe7NO+yLwk8t6vTIFFk5+sqvN+b18w=; b=Bm9LEFFvMvMSp2OiQDmiStSQ2CbCdNaAagWSUiVdFXsUYutvIrBAQMKdfm21wUbN+3neaK5n0SKnGOujkKP2R4wki4kIT+aPtKHJVzhd2Q90v8PuX+dpS2ljd31hU0titZteMWU39xWOaU+z9hnzUHhWUmtzRYGDdfTHImvkZpA= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by SJ2PR10MB7037.namprd10.prod.outlook.com (2603:10b6:a03:4c5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Thu, 7 Nov 2024 19:08:58 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:58 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 13/15] arm64: support cpuidle-haltpoll Date: Thu, 7 Nov 2024 11:08:16 -0800 Message-Id: <20241107190818.522639-14-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0097.namprd04.prod.outlook.com (2603:10b6:303:83::12) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|SJ2PR10MB7037:EE_ X-MS-Office365-Filtering-Correlation-Id: bca9db8c-87d0-439c-5148-08dcff5fa1ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: ZhQTkKcUC4Td7e26bSH3XdKBIVO5Cl2ODNeSUijfkipAlavkwM32UAQjgUc2yvckvNmKqDjQSHw62UOU/CJAOa7dFNvlHKUY9X0RG9As9sydu7ti7xnwPoUv9pnaLYjCP6FRo6qu8UMe12qswUgIjir5ZtQLYw3TZC02oWKhSq6RGLIkrg8dBI7Ej1MGzqb2tzoJ3lgbg/VS+9c411N92MHluGTNIWEvvtU5yXKJ+rSD/iLjJYyIjgSiQveEC/WYsfOVRyVHX99Jqnlw+uxC2rs7MsQhXARUIQAbZ6exilQQdTNuudMWZEKJ61mO1JK7Px7ZmD8tE8WjOx4baraYxKZkEVLkbavvDuEUnEUPIemS6gO920Dw4jB+4FY5Q0o3c0qwfpVTggACh7Swd7BgPH4CZEIwU8d0ZJDifwR6A/lxZwC9kNO2BekgYWHrjEM7EMRu24rKaiWcEbeTv7fbs2OOlPH+Xi5AWJerfpYK085xadmwoDaF7i7ZtGSr2x3wGLg+ZlD06HpDEC20xbJfCzPbOJZ8Vxxi63fdb2GDlPgSwD4Egoznv3QT1HW+lPtMbNDHrXMuQj9Mw/IWUI8rlr+OIfMSR/5AZgh0LjdgMKsXH9/jorTn0FR+mBMyAn5eH1xN+8naxXosYnUoFCtbfSuu0YFdLsj5IuihjHky1i7jbB+Fu/mkBaf5HVdjsTaWlPN97VEzguIKbXXxUUEpSEYfMEyGxsDTi5U68tyM1EoOLSWAz/4L2VTYSFLcQst02Yxd1BNHukike8omoZe7G5Xo9IEKJpQRGp8a4A3h4685OcGpDt42/TtgUlkDUu3RnCvAkRl6JMH68ZAT3MXQa+UeZoupWC7s4LJMR2BHsDj4UrHAJDACsoBlkHenv0nhrsq/jpd7Kvcy3gUUqHTajg93WiZrVVCdxM7XDLGa9Vk51FmjG4BPdZsMsKJctTj58SdY0oPbwKkDTv/lJh3pbvscE6Pi9LqwMVQEFzBbRWg7qif8AgTpf9ypLjFLqC0d8xPj+kilrk7r/os/qwOVt1NQ6GeHuH/cu5bUug67ABcEL3rr474wlUYsBQ/tT18DeMEDLTyY8aDfnD6PSXlVhJECJj5xgHiJ+s1uwzNVJvMBdDtN6/yZ2c5DKuNu27cHEaZSxToIH5x7EMiQyi+G+/GFOvfqKnsOla5X8ogZQQrngB5hxp7UD+al0vdGQsipdYZ5Vgqad38O+6tbEBsT6C/5gWTrf8TAiEjnduDcJ3ecKj7jOgOsKVrukCHjFJ9OY9OfQGbRbqCCciJy2Kr72D6RUnzpMfIUtyo/NJjZMao= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7416014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Kwkcu8nAI+q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GwD305oCcR52KwBuy7tUiuchofLZbpEfxB6peJ3xqotXTy3p4h7RiRGquDzCsnQLppjfeh+f6sORBscMWBJJBV5SZe+4PIAUBXWsTAgBfjjrHes2UBBfKlBGt/F2PFNS4ueuhuHuP4bL6kRB1438Ui4A= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bca9db8c-87d0-439c-5148-08dcff5fa1ae X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:58.0985 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2sMZfgTFZxtVnTX56hkvD2RHeB70+o7S1t8NW1pGweB8qLmuVChcbGCJJpiAdIS7k3pEVrebB3s3Zx2MTOdCL2Cvfu+DAZ1sev6im2Q3Rtc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7037 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-ORIG-GUID: lnBww-DGDsumJYMSR3YzDvrNzQ9WGIfl X-Proofpoint-GUID: lnBww-DGDsumJYMSR3YzDvrNzQ9WGIfl Add architectural support for the cpuidle-haltpoll driver by defining arch_haltpoll_*(). Also define ARCH_CPUIDLE_HALTPOLL to allow cpuidle-haltpoll to be selected. Tested-by: Haris Okanovic Tested-by: Misono Tomohiro Signed-off-by: Ankur Arora --- arch/arm64/Kconfig | 6 ++++++ arch/arm64/include/asm/cpuidle_haltpoll.h | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 arch/arm64/include/asm/cpuidle_haltpoll.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 43762c68e357..bd00647f6013 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2428,6 +2428,12 @@ config ARCH_HIBERNATION_HEADER config ARCH_SUSPEND_POSSIBLE def_bool y +config ARCH_CPUIDLE_HALTPOLL + bool "Enable selection of the cpuidle-haltpoll driver" + help + cpuidle-haltpoll allows for adaptive polling based on + current load before entering the idle state. + endmenu # "Power management options" menu "CPU Power Management" diff --git a/arch/arm64/include/asm/cpuidle_haltpoll.h b/arch/arm64/include/asm/cpuidle_haltpoll.h new file mode 100644 index 000000000000..aa01ae9ad5dd --- /dev/null +++ b/arch/arm64/include/asm/cpuidle_haltpoll.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _ARCH_HALTPOLL_H +#define _ARCH_HALTPOLL_H + +static inline void arch_haltpoll_enable(unsigned int cpu) { } +static inline void arch_haltpoll_disable(unsigned int cpu) { } + +static inline bool arch_haltpoll_want(bool force) +{ + /* + * Enabling haltpoll requires KVM support for arch_haltpoll_enable(), + * arch_haltpoll_disable(). + * + * Given that that's missing right now, only allow force loading for + * haltpoll. + */ + return force; +} +#endif From patchwork Thu Nov 7 19:08:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 842017 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 7216821F4A2; Thu, 7 Nov 2024 19:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006584; cv=fail; b=jlfafymkNtg9xD8e/nJpix9x50MGKWwhWQftIEHN0b1jrAZZOK+8R23GfKPcCrogjolsktSfReJW14fmmzbb/05F6JYG2p13VvecV0XA7vRCAQOf0L1eLBZGlINZqU+Ss9GR7wk1lHTyYBvCk4V0B38vpohoRzKOt6HNOBefUgQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006584; c=relaxed/simple; bh=NFQAxLEueiXIS9IF5F2KOhCX5nISajYBQNj8JAthBOo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WcqrWM2V7S5ANMGs23BojTTZCvvq0Z+uxFhIXVcjV7g0OCuUKlctnMsrB66xdaLgfspvnW2tpDsy8bwmnPJ4tAY7hCH3OnG3ujkHgWg6O/47Ec/pdxxZjepMOdASKCXoMdCDMxK3ZBhck0hlPAdewzC3doW1qGYyiRw6u89MKFk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=UBpHY7cc; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=tSU+emuZ; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="UBpHY7cc"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="tSU+emuZ" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBfAa029219; Thu, 7 Nov 2024 19:09:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=JRdc721AdJuu/iQtWTcIC0D/C8doc1qy09Cu9dA5yCs=; b= UBpHY7ccDjoBdafhsv4VKv9XG5U8Dj3zIlJ0O4ftUEr+dN4IipCYU6ceG9vXcLR/ C/xqWFG7tcTrV6JU3I121kG465npiS0T6nFRx8dg5NrLA+CXJSv0hovMVOhKQOke FVPZYZroe+3d19Hp5006mcE1rFIlBZMBHvXl1cTHOnDSnTZANFH3fcBtsn3fH7g4 MXypC8cn7rJJ1jWJ57gEeNSj7n/MM92ul/+i5LIhbUm0otF1JxiLsQs+G7goXlky cz12aIR4XoYWfm2yftPR6wZzjYOIFTcW4FXiLenUcbr8xUpxIfODC3rVG7E9u72W GXXALKIAx1noZPRKxrz8hg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42qh03efga-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:09:11 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7Ho2IZ009141; Thu, 7 Nov 2024 19:09:10 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahgt646-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:09:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kb6hMV5acQBYf5jgoG5ZR6GV64+hS+p0gHPWR2f9afteijgHgxo7GaLtJZR2tdxBDcbMZElZ9Qcu/ZmyUAGHY1NSDSWGiWr+6c1lzglbiKDGtwz0aKsAIO9Hoarivbs1QzltqnCAENZTsMs978hCPUzT7SjQnYdH42ketQdKrtTADihv+2PxtChNDxhG57Rb81Wull7qdo9V04yE9zAk4KZjdgKMSfciirH/dxxMvqnaOLp8AinRGB/xrmPBpDMiHeEfErPGIzp7H6IEuw36LGVO53ZSDbpHzI18og2/pIjjlZ3JRg9BBbKGNiju5zrJafcYWhgX0CGc7jNJm0aa7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JRdc721AdJuu/iQtWTcIC0D/C8doc1qy09Cu9dA5yCs=; b=ClIUvPOX3xZOfTlmmOsM3x01urtWju9BVp8qoypxoF7AHuTTHa7Q9HKDhcQ7ov7b8VVYiZege6tQrXwCyr9vLWP0Ho0V648lkesI3ZuVDjLOFgI696qRPo3SP1bAUe8qBBDQEnWhCbax76tgwh7AjZcWuPAXDK98JWBtH7AV9YBg/1dyYp6tc1v6wLBTra5bOZxL1baQb3aZ5pjMDsRx/Vx21UurGTEmHanX1ducEJ3gXw1gxeclejfU9H9SLvcgnBm9ghEEgmxyBEt0qvDEVUmQAPMhUOWmqyKsiWAMKltQasQluM7EfSaPSnfv3x6QI+pw8zd0qdKGFsfV8PHV7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JRdc721AdJuu/iQtWTcIC0D/C8doc1qy09Cu9dA5yCs=; b=tSU+emuZPG3Jdn+A5KrXQ1TOqdciGrcu76NZ5UiEDF87GGyd75lEd/I62+p1MrSE315FWXkhmwne9o2EwKGAlg0kDsnfyTQvtuEBN3Q4vhNW5C/7QpLsmpx6ID+Uh2AsVlka4WlxhlX+wQV1qwhU+8kdN6qRfr6XLWZgpkSsPvs= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by SJ2PR10MB7037.namprd10.prod.outlook.com (2603:10b6:a03:4c5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Thu, 7 Nov 2024 19:09:00 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:09:00 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [RFC PATCH v9 14/15] arm64/delay: move some constants out to a separate header Date: Thu, 7 Nov 2024 11:08:17 -0800 Message-Id: <20241107190818.522639-15-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4P221CA0013.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::18) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|SJ2PR10MB7037:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b99ad31-b75f-4263-b685-08dcff5fa2d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: 0HiVPkCu9esO3NbmATu7A3/YGgI1hYtLLr6FdW9oFV33egNler6pAK3+Q9CucZqczSZw+w5uvTq3tOeNTfqiA6l/7zfbpSyqsDgsYALGVJjF2+u0mi4SPNfagCW0ijTFwokeapz22cmZZQtuc9/eB0dCWJeoUKPlovwA+VlUwriQmgZ2K99dDBCIstm5rLfFwz0AhC8NqgJUGMne1FpFP7D7oCJWX25QqYaCb+5sMA42T/eUNHLJEi3FND/3i4SaCZRJGmR4KtN7qx1uf8Ebo6jlcsNuGNVbm/Y1m8C0ENrTBJbDhjW8K08T5HD0lQ1etisn0OVILx36B3DJUrY8XQ/Blv5OIrTqxepy65pLWvZ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10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7416014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lySE2DVzf6OZX8xCmOhynJulAAzzmVTQgMxj1FhNrK4E7VVzoaZfb7HUFJYA5a1JhErCtA1IPfme97eDPCtdUVwadOKt21LybjFtvXwD3DdV5+RRxc7koGPHSo6yP+1mMrZRs51fyApjGs7/yTslGf3v2mBpeZ+qLVKOiZsKrWzKrj8QZsq8texHryuaXM6K2bJEycy92SmJQaSuoP+pnV49cMvPpTYW4KmmmoRZjKNt0YLGtunwgZBPYrpsn0S51rUGFs2ZxhAhpg86llomSqs6dJZ5iCReagr+JdHSXVDVvkB36rlQAq3HoHtrdhCLy7ntvYFRJLOPN9dEiieeIK0tnEpUX2FIdTKYZapg+VVNGS9845x/CCgyukrb3uqkxNqv/0IrC/CrbaCJouqGmBYjEjXhZuBFin2D/zljsS4qwDuLU5XS14Nyn1I1c8YYllub+chOd2hjhICZrTbFftNZ5Vl9X2x4qkCuh6lzsNVNa6JhXvuMLkpUXngSmJzmBwvJYeaNzQnsJvR7hhtkVx8/n4AdIq3ORQkTwaNPvHGhcwyN1dfAOBfPJhI0cuQqt6bZLdgK+d+wVjicwKOBEoDVFFicHHPto4wwviwHSx71qhJs2Dn1XqJ+pUlyKrJheN5JWd5wTDSy6FnNDuMetAbL3EfNPmsuo1Qt5ik6DRvt/Xe9Iv+8tKADuz/Rf0EKyf2bIkkKOqnTeCBLarxq0Amrg9eCkv25CK94Icz1oZKLYdcyfVySshOtphhmA0+EUyn3fIrdMuVp7fQzz2XD6FZFjajCnu/Ad7KY8jHTHa+bWvD3BCG0gcSTRGlKWw48BOQpddaHYQCw262E8f/tV7t9PkyICT/dlI2r2xROaax0sIt04H3nG1IPyEEoIuKJMNKFp01xSuK2Ixmj0nyckW5G/Yq0V9SR92IR9nY+RH1DqrVOm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UxboEfL99z0rBOsNUMhQ5PmRLQYx2BYhWwCuS5lLujiVwUa6qwemve6WYXdsvA1a+CRNX6vEjm3XEcS0Ky8BawEqZbRJV24RZz2enNbiJNKb9e33yRbsINHybLhbs/fl2xN8EqnUL6WanNjfV+e6vuESf1jfnRdhgfwSFhJXnB6ZDjAUkjr5FNVdYCUy1YiTFdaZYJP1cm22J8+Kyogd4ekGHyOEAMfuc9be6F+YTDSPg1jefwJVeRr1ebxPo6+vL6LCNWCZ0Qx+noAWwyPcdHY9/0lD1jQmeBB/8wNwBtDNcw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b99ad31-b75f-4263-b685-08dcff5fa2d3 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:59.9894 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Due1nKfOIkfQz8sw3Ve2sVCCQZVlUqbqi3DwT0BhbjU6qVxJhgmlNZ1GfMoI9xyY4hYBqkLMpMNBeQ4cYz0UDYQzXugrVZz/SW8bpr7FmJI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7037 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-GUID: 4PjqjIBRC43LNInZQ5n8z8bOg8JeVw1P X-Proofpoint-ORIG-GUID: 4PjqjIBRC43LNInZQ5n8z8bOg8JeVw1P Moves some constants and functions related to xloops, cycles computation out to a new header. No functional change. Signed-off-by: Ankur Arora --- arch/arm64/include/asm/delay-const.h | 25 +++++++++++++++++++++++++ arch/arm64/lib/delay.c | 13 +++---------- 2 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 arch/arm64/include/asm/delay-const.h diff --git a/arch/arm64/include/asm/delay-const.h b/arch/arm64/include/asm/delay-const.h new file mode 100644 index 000000000000..63fb5fc24a90 --- /dev/null +++ b/arch/arm64/include/asm/delay-const.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ASM_DELAY_CONST_H +#define _ASM_DELAY_CONST_H + +#include /* For HZ */ + +/* 2**32 / 1000000 (rounded up) */ +#define __usecs_to_xloops_mult 0x10C7UL + +/* 2**32 / 1000000000 (rounded up) */ +#define __nsecs_to_xloops_mult 0x5UL + +extern unsigned long loops_per_jiffy; +static inline unsigned long xloops_to_cycles(unsigned long xloops) +{ + return (xloops * loops_per_jiffy * HZ) >> 32; +} + +#define USECS_TO_CYCLES(time_usecs) \ + xloops_to_cycles((time_usecs) * __usecs_to_xloops_mult) + +#define NSECS_TO_CYCLES(time_nsecs) \ + xloops_to_cycles((time_nsecs) * __nsecs_to_xloops_mult) + +#endif /* _ASM_DELAY_CONST_H */ diff --git a/arch/arm64/lib/delay.c b/arch/arm64/lib/delay.c index cb2062e7e234..511b5597e2a5 100644 --- a/arch/arm64/lib/delay.c +++ b/arch/arm64/lib/delay.c @@ -12,17 +12,10 @@ #include #include #include +#include #include -#define USECS_TO_CYCLES(time_usecs) \ - xloops_to_cycles((time_usecs) * 0x10C7UL) - -static inline unsigned long xloops_to_cycles(unsigned long xloops) -{ - return (xloops * loops_per_jiffy * HZ) >> 32; -} - void __delay(unsigned long cycles) { cycles_t start = get_cycles(); @@ -58,12 +51,12 @@ EXPORT_SYMBOL(__const_udelay); void __udelay(unsigned long usecs) { - __const_udelay(usecs * 0x10C7UL); /* 2**32 / 1000000 (rounded up) */ + __const_udelay(usecs * __usecs_to_xloops_mult); } EXPORT_SYMBOL(__udelay); void __ndelay(unsigned long nsecs) { - __const_udelay(nsecs * 0x5UL); /* 2**32 / 1000000000 (rounded up) */ + __const_udelay(nsecs * __nsecs_to_xloops_mult); } EXPORT_SYMBOL(__ndelay); From patchwork Thu Nov 7 19:08:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 842016 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 00C5F21F4D9; Thu, 7 Nov 2024 19:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006589; cv=fail; b=Psfac6ZbxP26XP3W+fHI32GHLrFLRfppFh8kH7F2R2PrKsTGs13wcxSmQtLNb0gQH76na2ou9nkTib15uP0PSOcG/jh1610UxVGZzwyz3TrUVkTYNTiSaQUxphJel/9HYx+gkYsNU0lwp/Wk1v6A+ggWwIWD80YaiNpuvzPFWrg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731006589; c=relaxed/simple; bh=MY1WUyiG3MlGsF9zGtV+TOUyfeJkWNCFZTQDiZEjs58=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=gGP73ZEbG+hjCBw9GcBA1o9HdRNLB7oJU6kjzPgSsXP1RrxcWB3Pm1mn3edxc2nYp8mcUunxFQFgAL73RBJ0MWMNrmbp7Vb6/34kDBXj7Gy/4aySPiCvFLgds6px22aYLrhp/OS2MBwSWpRrdNgV2C7noUxUSvGSMDYVjcEojhc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=ak8pQiLu; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=u2Ubfc2s; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ak8pQiLu"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="u2Ubfc2s" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBZ9u024688; Thu, 7 Nov 2024 19:09:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=KCpMsJmZCRizv1HK7VHHQLxW3ArzQmimptLDQTbndr0=; b= ak8pQiLuJbvexQ7OGSN7ay//bTPfi+pOQAPjXleZkndcESYLSFc6+nMyoGdZu+Tz Bq34nl46WySsQYd352MqYukJ0Mw3UFmZVVL6xIyBpfB4WW+SAvTfzFUWrTIWUGl3 wrhTO4VOA1d5AMgtX31EpWOPPkthP8TgwoDMd9brjuBT05Bz+4QowHHRFg5zsWB0 EeOKalGchOpdstxWTgzoORQ+8aK0mPGLcfsdDVfN8HDRnxSS5G76aM5Uwc8wk8T8 zvQaJp9STz+Sne3VJ9iLsEcxHnZtCQiUx2ayLzEaW3KnXiBW6ExaJVb4/7vXnzQQ bpric7OnZT+VQMD2OKeozQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nagcbc1a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:09:15 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7I2sU6008426; Thu, 7 Nov 2024 19:09:14 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42nahaercn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:09:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F9rrfYFLjxt50I6Lmac5FiP8uUFY4kHBI4saKamlSIvPa4OyNkVedw7EbzGZE7SuuK8GOEd60B2jX6viduVKFKAbJxmoBPeVXppMf84UpM4FucbxmXniQ8vEUA4Xvc1VfDZvzwJXClxSSc25rdyRMoDUgyF9N8BfGwGDtyYr/fhcHcdiMtgOQNI3oPzlxAAmfRQ/aT7wSUfQ0MxQC6Rw1CuYPMMy1Q+DT1XIdKBPIBb1CQW+zAnmGimuVU50wCgAA+ur0RkCX0810BRQzQkU7xVyHuxh6WL3O9ncqZ2x7B7byDgwSCiH0LYvt/Ipa+FSRlMvOro5UkyszsCyJ6Mh6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=KCpMsJmZCRizv1HK7VHHQLxW3ArzQmimptLDQTbndr0=; b=hxI2a9pG9ieIjQvo84I51gv71esLa9MIzTts5dG17lQxYzrFOx8m9gPpMoi1irgjkIu/fdjbHnjqI/NaqN4yQpJ/n+xx2h/qzXOVJ1YD1erp8xpXlSyxllzhOVgu3wVatXFgR+6s5rKpizNdNLvGF+446mbFvNfqEvehreddUbxHQwhHkomM/tkNCjgrprl08mUBCKQaXO02wsdzhMB8n6GBiuhk4IufET6acQQDec0Wr7z6tM2ko8V4J4WmLGB6J6ARCGsXUyV22jCuD0ggR1GzlIckZnL6vny9Hvuydlo0WwsLX3jWOf+JUXe0hBNEeDCM/A3DXj+5jyHD2U5/Ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KCpMsJmZCRizv1HK7VHHQLxW3ArzQmimptLDQTbndr0=; b=u2Ubfc2s1wjtYcJ5MeuuDHFR31s4X925cKVvHpI4MB7xOwMuViYmCEvRos8nJ9cP3J9HTWhO+AVrm1b5Pcd9Hu4noseFP8wk5/sOHLlQ3cNb0Iei5b17B/AJi43TuNegy8D5eoHMKBl1CgzTpn7IBNTYnv2DFi7QJlqOe4Tx2tA= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by SJ2PR10MB7037.namprd10.prod.outlook.com (2603:10b6:a03:4c5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Thu, 7 Nov 2024 19:09:04 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:09:04 +0000 From: Ankur Arora To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [RFC PATCH v9 15/15] arm64: support WFET in smp_cond_relaxed_timeout() Date: Thu, 7 Nov 2024 11:08:18 -0800 Message-Id: <20241107190818.522639-16-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW2PR2101CA0024.namprd21.prod.outlook.com (2603:10b6:302:1::37) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|SJ2PR10MB7037:EE_ X-MS-Office365-Filtering-Correlation-Id: 5438fedb-214c-43a5-5b82-08dcff5fa5b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: hYAWn1pUScq8HbbTR9vmDOBVkI96IXbZtC821AOvfX3hk52tctCxEcUrHKbbJ+mky8fqdA/Mx2/o64BW47TTtzd/C9OYxQUzeUJX9Dl3q1ybNUN0ZvqVFtzpGPBHlv/YV+zwpzUAJJoJ4s2GxxIZ+83BCMl+lqZs0O1UbZUoBnnsyck7Et5Xo7I7Vm5/8QK+ImI2nAMUKYJngNXrRKGvLLZVXDhDy06IWWlJ9Vn0RNnRm783zuEI1GHVZwdSc3TiqJaaKN5JhjPPexo4VVFYOIpVJQ/CCj5MRPOFMCa38oLwGMW1tTczIjzsoM8ivdc0aMnpmR6I8FR67qbmiXZtLnsj/fEkcDWerh3VlZGGqrwe1AULySHpy6VAvOWnt5rvcACEJBlkeaYvBZipioRMnFYX+hp4m2I7R8ifRUOhhZBMRyAc6XrpPpPzZdkH/5hdh5mYw0R5XjjU/Th6Jnb+HN7mN3maHNWG3QYoo1knjcdX8Yk2gwRs0B3RiVMNXAeAkzsbKUg/ZXlQErl0+7Z1HujA7Ckz5k/UM1rGwoLsB60NQVqO1lG9dFAi6MUGtzjlvkIJNtG97s+LhZ7Go/z+O/RgAmlqEkfcxS69o78bAAJHFraq9meSPuDgQkyOdTWKzMrmlovRVW9CrvH8lRSGA8WWIjii7N0K5bIAG6rgI/6Bo0Kfc5WasYtqBAB2pOqhDxLflb7IPmruuvJ+wsAzA/fMh3ihm6orvHyraYmqJFq6OF1g5bf7TkpCDok+QDf8eF4G4Uf0zMv8wMxjiGC2JGdTo+K3EN7bZDaGQmciabDgNuW9Hia4XUQEsmuF6EF1lISsR3BqJV4h2yiN8Mo+ceKvqFflbXInuo/dWCeTh4Jvo9dFhrnWd3J0vbAhDU4sNqsCEwDWfILdMsN463JFRahfmPLEWj/bBkweud6Wezn33k0EABvWkyb8IIZlYcEe8ri6GpBJ45T20XAnkGuJdMBR8xjduEgCMxpzcx1seouWnIBpkmC+MHvigsLW+XDc17fsjKTorLZg6h0WpjWOV2QUyN1VJM+6aXNPlyetmT8Emu/OMYDhCJShpG6Gc9H5L0B3LxELQ6pNGW+rTW8zG8bxHZv28Dz8E2aVaGpMFnsxa8pWdpgPZcUNOz+kaROqvKh8tiGi8bUNPY2qBUomZbIsegga/a9bo9TtVmJK4F+84qyAQMQC3ipwmY8xRHSHPDAuJJPRinnbrrTI+4aHyj/fvn3Ju9CDTp5UJy9320rv9S75HiNuRCABQoqoNibjWk3eyR+yIR25/kLPdfi+KDRo7HcwEC++yHLzwfRqIEo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5409.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7416014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: boZVpkwl2LPYemiwlo6Un7QLeWzOxOOZzhp+CE/8SGEN9gGVXMBO8Fl5tQFtXc8NoQ64ywzmA3TVrGzUPcSSN7fQv1vBjcA3Br4Ms7m4KlCqlOOa8uPAw7pTWeUqcSjLnWJ5blx6bDhbFOhVlsJUWHg0aayYxEhKyG488ZiFWieDz1nxi3OylsedSjkvrikVCm0FdfkXxYnxRTLpNjwoOECt92gaxSkor/4YdIq9oDNDTR1LiNtL+dh33NwUROK4Pw4rlf9fvFdXZYfVaqgBQrH2tH3DC5Ghcbf843I3T6Or4/kA2DbzQBjYUQMHNAz5Yh++ugpPtYPYs1Ak83YMmsgRIJccWGx/aj7k6PPJ5uVQdJXaspTryyBO10JI81DtaoRzSOklp1YCx92WNRLdltC9CsPzyGzDqG9c2OfNgU2yAgSp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WtySsU/VUZv+U/jnk7klqjAMmYdNvyjPGqETdnpzJnY2CKLtAws3JafYgWp+L4QY12HzDr8XyOJbr1ml29H+NpTXAPUC9HeLPf4AXNf5+BZNuRaUH7XvjvkceuA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: QqHW91sCpLQub1GK4qI1X9y586EIPiou+54IfagUSB5C6WJ1wPWeUFVTHnXPPn1OCZeoLH3kOqg3eXfYgU6VZa4GI9mOLGQUQ/Fk2+HMnHorC2t+FN2U+Thvl/KX0570rNQuQZjDrCHyi5VgJ3RyrOll/0W162L4H/4PK9j5MEqWanpWQuo6FRAKlOQlAstIc8wtWDNEsuBF0xyuTUOBMFsw+hPnnlut9FULweuNWxAVQw29SZ2BbtGktmRUzPR1lztsCySxJTTmzRdJQuvVDbaA/oNr1LcAaMe/Ohp1o+aMysLLgcagHzd/hEfBi5DY8lFh0b/HXDbAYDU0VABUovprpqEThVNsO3bMLTY6kD0RYyh0s4+Ho84qoEqrnkTQ08aL8U2jG/VzfWT6xBfMP27DQH4iTsqsScLmAtN6tJL2SnF48MRTdcgH8prdjd9C80tX0fUXZ+0Gx+ro2etiijbcavX0RecPprDVIE4HhArKsCg4MDJrrP16FGC3COyb6fM/0JF3wLcsySsTK9mncWbZHISoBgxqOE0jNox2HbA8/hHNy1ZKLL+0aPrK/EuUKst7QwWkvwL6MWMcj7HOlPriEqG5WUv/DquhNP67osk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5438fedb-214c-43a5-5b82-08dcff5fa5b5 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:09:04.8340 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NbwoBMTYz20pQQaaVXIOp7NSO3VmLObnk9tiltkb7ZtHh78R2Bm6fn1exkzKAaaO/wNaSjspjB58afVmMqR3LxmaikouolYCuNR9BC5Aig0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7037 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-ORIG-GUID: iWoBOumy3YHu1D3dDDRF7lMFulrb7bHm X-Proofpoint-GUID: iWoBOumy3YHu1D3dDDRF7lMFulrb7bHm Support a WFET based implementation of the waited variant of smp_cond_load_relaxed_timeout(). Signed-off-by: Ankur Arora --- arch/arm64/include/asm/barrier.h | 12 ++++++++---- arch/arm64/include/asm/cmpxchg.h | 26 +++++++++++++++++--------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index ab2515ecd6ca..6fcec5c12c4d 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h @@ -12,6 +12,7 @@ #include #include +#include #define __nops(n) ".rept " #n "\nnop\n.endr\n" #define nops(n) asm volatile(__nops(n)) @@ -198,7 +199,7 @@ do { \ VAL = READ_ONCE(*__PTR); \ if (cond_expr) \ break; \ - __cmpwait_relaxed(__PTR, VAL); \ + __cmpwait_relaxed(__PTR, VAL, ~0UL); \ } \ (typeof(*ptr))VAL; \ }) @@ -211,7 +212,7 @@ do { \ VAL = smp_load_acquire(__PTR); \ if (cond_expr) \ break; \ - __cmpwait_relaxed(__PTR, VAL); \ + __cmpwait_relaxed(__PTR, VAL, ~0UL); \ } \ (typeof(*ptr))VAL; \ }) @@ -241,11 +242,13 @@ do { \ ({ \ typeof(ptr) __PTR = (ptr); \ __unqual_scalar_typeof(*ptr) VAL; \ + const unsigned long __time_limit_cycles = \ + NSECS_TO_CYCLES(time_limit_ns); \ for (;;) { \ VAL = READ_ONCE(*__PTR); \ if (cond_expr) \ break; \ - __cmpwait_relaxed(__PTR, VAL); \ + __cmpwait_relaxed(__PTR, VAL, __time_limit_cycles); \ if ((time_expr_ns) >= time_limit_ns) \ break; \ } \ @@ -257,7 +260,8 @@ do { \ ({ \ __unqual_scalar_typeof(*ptr) _val; \ \ - int __wfe = arch_timer_evtstrm_available(); \ + int __wfe = arch_timer_evtstrm_available() || \ + alternative_has_cap_unlikely(ARM64_HAS_WFXT); \ if (likely(__wfe)) \ _val = __smp_cond_load_timeout_wait(ptr, cond_expr, \ time_expr_ns, \ diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h index d7a540736741..bb842dab5d0e 100644 --- a/arch/arm64/include/asm/cmpxchg.h +++ b/arch/arm64/include/asm/cmpxchg.h @@ -210,7 +210,8 @@ __CMPXCHG_GEN(_mb) #define __CMPWAIT_CASE(w, sfx, sz) \ static inline void __cmpwait_case_##sz(volatile void *ptr, \ - unsigned long val) \ + unsigned long val, \ + unsigned long time_limit_cycles) \ { \ unsigned long tmp; \ \ @@ -220,10 +221,12 @@ static inline void __cmpwait_case_##sz(volatile void *ptr, \ " ldxr" #sfx "\t%" #w "[tmp], %[v]\n" \ " eor %" #w "[tmp], %" #w "[tmp], %" #w "[val]\n" \ " cbnz %" #w "[tmp], 1f\n" \ - " wfe\n" \ + ALTERNATIVE("wfe\n", \ + "msr s0_3_c1_c0_0, %[time_limit_cycles]\n", \ + ARM64_HAS_WFXT) \ "1:" \ : [tmp] "=&r" (tmp), [v] "+Q" (*(u##sz *)ptr) \ - : [val] "r" (val)); \ + : [val] "r" (val), [time_limit_cycles] "r" (time_limit_cycles));\ } __CMPWAIT_CASE(w, b, 8); @@ -236,17 +239,22 @@ __CMPWAIT_CASE( , , 64); #define __CMPWAIT_GEN(sfx) \ static __always_inline void __cmpwait##sfx(volatile void *ptr, \ unsigned long val, \ + unsigned long time_limit_cycles, \ int size) \ { \ switch (size) { \ case 1: \ - return __cmpwait_case##sfx##_8(ptr, (u8)val); \ + return __cmpwait_case##sfx##_8(ptr, (u8)val, \ + time_limit_cycles); \ case 2: \ - return __cmpwait_case##sfx##_16(ptr, (u16)val); \ + return __cmpwait_case##sfx##_16(ptr, (u16)val, \ + time_limit_cycles); \ case 4: \ - return __cmpwait_case##sfx##_32(ptr, val); \ + return __cmpwait_case##sfx##_32(ptr, val, \ + time_limit_cycles); \ case 8: \ - return __cmpwait_case##sfx##_64(ptr, val); \ + return __cmpwait_case##sfx##_64(ptr, val, \ + time_limit_cycles); \ default: \ BUILD_BUG(); \ } \ @@ -258,7 +266,7 @@ __CMPWAIT_GEN() #undef __CMPWAIT_GEN -#define __cmpwait_relaxed(ptr, val) \ - __cmpwait((ptr), (unsigned long)(val), sizeof(*(ptr))) +#define __cmpwait_relaxed(ptr, val, time_limit_cycles) \ + __cmpwait((ptr), (unsigned long)(val), time_limit_cycles, sizeof(*(ptr))) #endif /* __ASM_CMPXCHG_H */