From patchwork Wed Sep 25 23:24: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: 13812563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70782CCFA0A for ; Wed, 25 Sep 2024 23:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vXiJvRI7fnF7e1p9sgK0zH+kDAbVkIQGw9AK7Ri3GtA=; b=aXKKiaMP6/WQpVwFNWys3lyFXw 7Z1IOKQIvx8+lkeDu9x4bqwt1QVxmQaScdOo7fRahGqzS6ERyAPxH/UtXsizKPYPAjVd1jDhVrnWM 2S692rde6pMdGOwLAIOHWmxT4Ot8lUSWNp246xUsosXII0kt3JfADz9ISRMx8nDYzuxZYRElczlSQ htZplbHHrcce1w4OiR+/M2WR/8SbnYI3Dr6IU1pP5eV1mMrS845fTjoVKaa68fMXIDIOeMaM6ldZY 0K4L6XAEPcfzyw2LmxFqe2llwiYjAxlzXwW3Gd/f/IE1kJewkN0ZLOTTBRgWbKcMaBJSLe+uAED0f hRwDLfYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stbYK-00000006lyd-0oDy; Wed, 25 Sep 2024 23:36:12 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stbNk-00000006kJE-0CZc for linux-arm-kernel@lists.infradead.org; Wed, 25 Sep 2024 23:25:18 +0000 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 48PLn1jU009861; Wed, 25 Sep 2024 23:24:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=vXiJvRI7fnF7e1p9sgK0zH+kDAbVkIQGw9AK7Ri3GtA=; b= AlgG3I4ObtBzRttmLqrlceTqQ8n7DtQJ9PJocLt7lnaU7gPHeaEp9EUIaleyDNba 5zf97SoEf+39iTu0XB6B/kMmpy0n2TqieoMBvv7gzDSTyKfQ/U03OXFCD6gsNPqK MBqt18+UZGFQ7OxykqK90gUr0ASldYB4gR5jF68UWHExTmHDVe6j/Je/o7qnoFna j7oxzuFcY2SRKHc/ofZMJfjyONwKpjd0BHR/hYUKVkstYtSOrbuphfa21nVElFA9 ttAZbaLVFTOKySHObCvC6ojW8Mj3EMmTUGmFopF0XK3k0CHKFoSu4hqpVsnwW2B4 Xxm66q+/GAoCftR6WuKw5A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41sn2cutbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Sep 2024 23:24:41 +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 48PMMsFC010115; Wed, 25 Sep 2024 23:24:40 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2048.outbound.protection.outlook.com [104.47.56.48]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41smkb2kfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Sep 2024 23:24:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MiNkFDQK7OtRT0ca+YPnplwcmdjJuHuG3wsh3+bfZ3RshlwIcG3SklsLCfgsSxMu4sWOb7xvYroHvdpu370VTAc2iw7U/41iypxW9esW8zYCDlUlh4bXOMShYANitDZMo6+doZ4prm80QFY2TEceEsNBqkq8SCqyekRCqfEwJUMw/MkHmCA3YrKwq74LqP6WgWkLyv+2GfuGAg+3qKP1/Xdw1hmjxjIOqzYycs61cmEHYmIk1OwBQ9kBn8dK2TOXBqStlC46CTempIBtifwsykKHKZtEqRkN6goKEFeYaXeXfckGCB5EekIoyNvIIaIgHxJSy6/eqdkwzYG6De6ZkA== 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=vXiJvRI7fnF7e1p9sgK0zH+kDAbVkIQGw9AK7Ri3GtA=; b=tyW3+x14JfTYx0IOaMMhft5VJBU8KkDaInm8Tt6Roh/ZFt5bno2hQbmLGxYFK/K+cJOdxeCU5bGjMGprPhO2Ai1y+c/VBgUsDbBh7K7w5JGo7H2ffwQn0sRpG4XGYm6reMCujYrmnw8WOeShdC4blpLlogwW8C9QwKJjfEFVi2yVMr+LlAMCbp1VAeetiImashhi9JczZW52itLvQ0gLCVYx3vqjlVtiR27RoxwmmSXzpBPo8dRBLX4h3z1suMhIihdx2TqTjQKzPus6J2W/ajcYaKcn4AFuAvDmpvnBVwGCsAJTp0aBqNh95BtPXs56vpGrpnKM6r4x7+gtw1LStQ== 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=vXiJvRI7fnF7e1p9sgK0zH+kDAbVkIQGw9AK7Ri3GtA=; b=etsXHiLuIri8rckrBCDk2CzhYOe8MpRiuT09xrdMRKxUnRKdfmlg/+dM411Ftd7hPkC7kpiyubf0jL70Tn6jQWj9lpFZOtFhbyg/Q6mbaxmEOL3rnoFtynk/AhHDl8df/kUmiM8mGXMuhHdZVV5L/vd1+JysA3OVlhWJ3oSaXSc= Received: from DM8PR10MB5416.namprd10.prod.outlook.com (2603:10b6:8:3f::19) by PH0PR10MB7008.namprd10.prod.outlook.com (2603:10b6:510:287::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.13; Wed, 25 Sep 2024 23:24:37 +0000 Received: from DM8PR10MB5416.namprd10.prod.outlook.com ([fe80::e085:31f:84d1:e51a]) by DM8PR10MB5416.namprd10.prod.outlook.com ([fe80::e085:31f:84d1:e51a%5]) with mapi id 15.20.8005.010; Wed, 25 Sep 2024 23:24:37 +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 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, wanpengli@tencent.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, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v8 04/11] cpuidle-haltpoll: define arch_haltpoll_want() Date: Wed, 25 Sep 2024 16:24:18 -0700 Message-Id: <20240925232425.2763385-5-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240925232425.2763385-1-ankur.a.arora@oracle.com> References: <20240925232425.2763385-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW4PR04CA0379.namprd04.prod.outlook.com (2603:10b6:303:81::24) To DM8PR10MB5416.namprd10.prod.outlook.com (2603:10b6:8:3f::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM8PR10MB5416:EE_|PH0PR10MB7008:EE_ X-MS-Office365-Filtering-Correlation-Id: a994edae-7320-403e-83bc-08dcddb938f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: 2+He46q/8wWNfB1VvxgZFMLJ7Yo5fSn4jyLkZ4A1EYMnrMrNsFFFxpHVqEognT++fJbbXtmsarJamNXZ991V0qkFYu7hK/fLyw9OnUDE3KKKaIXZ+FtNXFRjvvwG/1j0WF3P7o5nxDLZa4FPt+ziPXgUfBr76p8pFC5EN0g0dyM0OYCQoM46qOb438rPiwPClFB+Vc6/h2NQ7LfkqpRANAObXsAwUn61HShSksmNhrdy9WYv9vQuEV/sAQ9wocccJYettK2AN9hSLokRRtD+iaP942HNSRQ5LxwFZJm6so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FV:NSPM;H:DM8PR10MB5416.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c1zWa6P0DMqcNpNxygZ2nbPrQxzF/n/FpZS/XOuDA6QrXkvWL+iblP9vk//HzgjKXLkkordRvx1yVofmNchXTmGTRvZoPwh6pPRLN7jFTeZXGAW458epXJxuBNxvTCfuuHI2gkQjdd94ELJKMhGOivfX2z2QqU+ilaGNs8TQ5JesCuFZb+WQRPwakDjcz3gGyL09S7pUAju8KHNBSQece1inABMTwVQLVAw7FWI3cGPloG5nCvcROBDQMadJ1rcDHutZqAW8kN3DtDbPPJNx7uNfOLfyn1cfvLtZKfvklx5WU0jU7zCjiwBvCqD0JpTWl5RKEXJqnBLXWhmnLoDszOxMjaoiRB790x1eprhI2hjfHxACCfhHmJPGczAkBdcpRbL2fN+KpWci31ib9a3j3nKt9xa4ME6yIFCztg8mKkvTVLD2YoE0ilCVWro/niYq4NVR+kV1g49tmCmKXW/OfQG9tBdLGKseQAfLy2vjywe+hx9gvu8ngzBuS0QOFdTTb37b2/hv+wi6dy7/uMCKqeX+u6i/wXctFRF+A6G+X3trOFimA5UzT0SJXWlbR2/fs/6Hmd3gXyVETvXk4P48/f0AB0O9NCGUUCLxFEKZmPnHd+RqpnSJNNGvIqhXfBjyv+iJ1h/py7Xeum0r99GxW8bKKDZdhhOYK4xwhyJ8Yo90Mr8JUMRO5T6rTbqvEqGeC3C81CVubPDyEfKNcV1srHgtOAurAngbEePc5Fh67tJDrkuzj+FMj7AvTol6BfbN60tOkgwjbiM9c7tJexVyknKfjx0d2B3jGig5YuEZdAVD5uPAOb8lmL3LSN3h1CVAah+KfWgzHF/kgaDTbH6QlIaSn3pFL8nyDnZopQyfXSwz9emyy8jXGcfn2OKUTLtp9cXm0kLKN0dghLMw09mFF2Lw/RmxN2HD0kt5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0tnxlveN/Vgs2mKhtO184YjqlSG4GntlDfBLSYha2nzY0idZTYMUrA7hHrFpzO+O6zgXwOGfRmZV13dv+sBnvCBPa2vihapSmEX0cvZYm7ueWFy/isinh26iQhvDIRGYUZqnISjkdpwUDJPMk0d9WLjeDqS2/icn8Sw4ABVzvJ93rRmWAecFm6nwLkoxbO+ehlg+FYA8g6yTG+qjREtEBGNvqJFpPwNZLhwooXLFwfWfu7fY+sjI4dcipjr4DrwmcAy4JwoJVLNLwauYoM4RwlcJmVhJA0mEtT5DSEAXo4F8ire7ivlHM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a994edae-7320-403e-83bc-08dcddb938f2 X-MS-Exchange-CrossTenant-AuthSource: DM8PR10MB5416.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 23:24:37.5360 (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: 7BVQsWWAjvrYDk2DMAlAJl4jgEa748hnXenfooKYjlG91hIiJURiLP2B/EiQE4YGz1ZxiaPw16L5k/NVd9ylpIwd4COGx4lWZc7SLIvTW1A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB7008 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-25_14,2024-09-25_02,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409250164 X-Proofpoint-GUID: KK9I7zk7DLS4dA90WFxBM8VZjcwFjjdA X-Proofpoint-ORIG-GUID: KK9I7zk7DLS4dA90WFxBM8VZjcwFjjdA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240925_162516_153702_BE44AF35 X-CRM114-Status: GOOD ( 17.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 263f8aed4e2c..63710cb1aa63 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -1151,4 +1151,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