From nobody Tue Dec 2 02:29:43 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 90978352926 for ; Wed, 19 Nov 2025 12:45:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763556328; cv=none; b=HF9O0vF3yFGlfqB3dob7SYqi1vpCY+flaiIAl7n2f7fy9DMQ9nCz1emk2wAPm9MeuFM1h9YwtiyGUwZ3HqA044cSLplLxjINogb5tnOU488IUKuOBj+qZ5vuOTSgDy3nfvPr6oLreM2DUAPLWPzrf1HYLL91AwWjh1aXl4ZTAdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763556328; c=relaxed/simple; bh=cREaxyAp48cBSBXBPdHAukNZY7yUA9uAauUwUXgG0OE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZxMm+mzbinkCRfQ1Qgrlc0SEiTJ9ze0Kk90ODZIqStG0CNUNPO3RpnGxTTgrZ7t08vayAU+ygqcTznp4InP6P2VFPyhyRJYjymiw+k60Ukf38w4HVtgqn05GqePspa4xDQo5F0xXaqToXh0g8ZmiVstGhSSykcQz4fuRnhjR5nM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=rzTLRziw; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="rzTLRziw" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5AJ8QU5G022737; Wed, 19 Nov 2025 12:45:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=EMglGUXjxWB1AjAp9 b8xSMYJfDhPqEOirHFXTgrKt0g=; b=rzTLRziwI+yhqDejYviufCfQVLBqDJXl+ q0+m7+6H6IbmGvqfEMHv+xRZW+lBZEO8Z9mC2IuZzjTd5Vp+RjwA8Bd4m3so2IU2 BCASkoN99uIA5fFrJ/qaA06s0IJs1YhMMJXaR9jG52Jo4fc+qPDQTY1AdUUAK7kH VW++UA1AEePyzr8SNZA6aIPdXFzLU6bL3gKPSej3FTExyQTci4DBCteXtUP+pkRY 6d22BUTY70BDDvbWDBEOS6T/CBFvR2niYs9AeuA+ffpAdH9ZOClUJ11Pg62GAMqF 8YbxetUMS+7H8zb+CcD2J5VXk8FQPwpbu4iPV5A8McfI9cOpHN62g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aejjtykdq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 12:45:08 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 5AJCg5r0019331; Wed, 19 Nov 2025 12:45:08 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aejjtykdm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 12:45:08 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5AJAwIHE030795; Wed, 19 Nov 2025 12:45:07 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4af47y0rkc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 12:45:07 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5AJCj30S52953400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Nov 2025 12:45:03 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34B0120043; Wed, 19 Nov 2025 12:45:03 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E8C720040; Wed, 19 Nov 2025 12:44:59 +0000 (GMT) Received: from li-7bb28a4c-2dab-11b2-a85c-887b5c60d769.ibm.com.com (unknown [9.39.25.220]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 19 Nov 2025 12:44:58 +0000 (GMT) From: Shrikanth Hegde To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: sshegde@linux.ibm.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, tglx@linutronix.de, yury.norov@gmail.com, maddy@linux.ibm.com, srikar@linux.ibm.com, gregkh@linuxfoundation.org, pbonzini@redhat.com, seanjc@google.com, kprateek.nayak@amd.com, vschneid@redhat.com, iii@linux.ibm.com, huschle@linux.ibm.com, rostedt@goodmis.org, dietmar.eggemann@arm.com, christophe.leroy@csgroup.eu Subject: [PATCH 01/17] sched/docs: Document cpu_paravirt_mask and Paravirt CPU concept Date: Wed, 19 Nov 2025 18:14:33 +0530 Message-ID: <20251119124449.1149616-2-sshegde@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251119124449.1149616-1-sshegde@linux.ibm.com> References: <20251119124449.1149616-1-sshegde@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Bwe00pfcTtIZHxJTF01ltZiLY_X8wHlP X-Proofpoint-ORIG-GUID: EaFCTdmCdSwH1owybEo2RDLQ8-n0dzO2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE1MDAzMiBTYWx0ZWRfX/uCqO/hfeEIY LVNqqrV1DEtwSHo2nc2yurGrKHrF8faEiE8n1129GOCPAYKWM+F+jli0xqzaevNKuPuCKla+Kiu nk/CSwibVtWNQhTmUH/CLZOL5oEdKat7kqREBEcxymulhtwQnI6xRLJocmdWhFccBh7tfY31skU G1AIGxVa8DtLt6oRKO2vWueEOI3IUW9tVVn+/tRy6W+jFs2MmEwUzfiA7nbvpgOTYogpPliqAVL brKUoS6y1Tx5UIMGpPkXbVcaY+9C6D/8MRv/Co9XF1VxyVXZ7LOD8QrUJRetOx0aKHvZrsL2f0r OPnO0VWQHct3BsSgEk4jFyKSYHsz/yUFWQWVx1/+VW3QUIultPncD6aYtajze4WkARGRCeJjBcO lM16YMpJqbmaEA/YjCx3fR4wLGOj7w== X-Authority-Analysis: v=2.4 cv=SvOdKfO0 c=1 sm=1 tr=0 ts=691dbbd4 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=UMqL1o26Aa61VnK-UhoA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-19_03,2025-11-18_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 clxscore=1015 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511150032 Content-Type: text/plain; charset="utf-8" Add documentation for new cpumask called cpu_paravirt_mask. This could help users in understanding what this mask and the concept behind it. Signed-off-by: Shrikanth Hegde --- Documentation/scheduler/sched-arch.rst | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/scheduler/sched-arch.rst b/Documentation/schedul= er/sched-arch.rst index ed07efea7d02..6972c295013d 100644 --- a/Documentation/scheduler/sched-arch.rst +++ b/Documentation/scheduler/sched-arch.rst @@ -62,6 +62,43 @@ Your cpu_idle routines need to obey the following rules: arch/x86/kernel/process.c has examples of both polling and sleeping idle functions. =20 +Paravirt CPUs +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Under virtualised environments it is possible to overcommit CPU resources. +i.e sum of virtual CPU(vCPU) of all VM's is greater than number of physical +CPUs(pCPU). Under such conditions when all or many VM's have high utilizat= ion, +hypervisor won't be able to satisfy the CPU requirement and has to context +switch within or across VM. i.e hypervisor need to preempt one vCPU to run +another. This is called vCPU preemption. This is more expensive compared to +task context switch within a vCPU. + +In such cases it is better that VM's co-ordinate among themselves and ask = for +less CPU by not using some of the vCPUs. Such vCPUs where workload can be +avoided at the moment for less vCPU preemption are called as "Paravirt CPU= s". +Note that when the pCPU contention goes away, these vCPUs can be used again +by the workload. + +Arch need to set/unset the specific vCPU in cpu_paravirt_mask. When set, a= void +that vCPU and when unset, use it as usual. + +Scheduler will try to avoid paravirt vCPUs as much as it can. +This is achieved by +1. Not selecting paravirt CPU at wakeup. +2. Push the task away from paravirt CPU at tick. +3. Not selecting paravirt CPU at load balance. + +This works only for SCHED_RT and SCHED_NORMAL. SCHED_EXT and userspace can= make +choices accordingly using cpu_paravirt_mask. + +/sys/devices/system/cpu/paravirt prints the current cpu_paravirt_mask in +cpulist format. + +Notes: +1. A task pinned only on paravirt CPUs will continue to run there. +2. This feature is available under CONFIG_PARAVIRT +3. Refer to PowerPC for architecure implementation side. +4. Doesn't push out any task running on isolated CPUs. =20 Possible arch/ problems =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 2.47.3