From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 D45E8286410 for ; Sat, 22 Nov 2025 16:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763830529; cv=none; b=m6ryNBD4B62zR6kscxLgjtEF7CAcrYlFtCX1pRfIrMjDBMjtZPMMxQIGg9lq5/QnkxGfJQNAi6fW8ap6tv6o249ISLkXGyigZ53mhxCisVnPhaYxym1AnT4MEZxzKOLy7biRDt/lVKrlzAkfdpkkpTEgKbKKQP4m6iNFKa4kWmY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763830529; c=relaxed/simple; bh=lWU/9zeo2qKBPm4wNxy0z0of8NcD+alMPwzONGps9R0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=squXHVypoImBLRU4ohN+IduY+7YoWyvRJxpt2GHJTX5CE6vnbmZLpfsjegRFrFUV6iW6AXwu8sAQ6cJnzL1/xRvUDawpU1inDDIM2p2tABCPn5KnpUNKeOu29LJF3lFIDTKHmfLIocMM4eUbjp7ul5kt2QIXRVYIq2E3fDf+Pto= 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=KD312rlu; arc=none smtp.client-ip=148.163.156.1 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="KD312rlu" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5AM31OdI023536; Sat, 22 Nov 2025 16:54:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=yxCnRd WFEz9koZvR7jcqjS3yrrrq1HsjsjGSEi4V59A=; b=KD312rluLKWYND+TrVBpXx aLcFDZt/YC0nMhnkWsE3iubmNcgGmeby3Dhze6zgR8JyIzQ0jzWWLzr7FCct6Ggz rpAoe13I/5wVwBLhURSaVtT5Ww9GTtS9bW3c4SCsjD/zelW3sakEmg/0wCrdUmGF W2qh7oxSyT64l5+1Lg9qgeXLbOeoBAOuuGpFDB2eWEYwH3xkZq3oZ1Pz+pq7AgVx fcc5ZzM5etxvoqDVKFRmb/xHcGfXIjGuoKWTFqJAQLTEvu8R4f7pMb8cfxqouRF3 q1fyKtJDd+Uct8I29ip1Hz/pTkHOYZ0HyotQJRt//7Wu8lQMifZ5/Zqfqowo+c6A == Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4ak4w91w17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Nov 2025 16:54:45 +0000 (GMT) Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 5AMGsiJ4012361; Sat, 22 Nov 2025 16:54:44 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4ak4w91w15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Nov 2025 16:54:44 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5AMCw8CQ006959; Sat, 22 Nov 2025 16:54:43 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4af62k23vq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Nov 2025 16:54:43 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5AMGsfkU53477644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Nov 2025 16:54:42 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E46732004F; Sat, 22 Nov 2025 16:54:41 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6ED0120040; Sat, 22 Nov 2025 16:54:39 +0000 (GMT) Received: from [9.39.28.28] (unknown [9.39.28.28]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 22 Nov 2025 16:54:39 +0000 (GMT) Message-ID: Date: Sat, 22 Nov 2025 22:24:38 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch V5 20/20] sched/mmcid: Switch over to the new mechanism To: Thomas Gleixner , Nathan Chancellor Cc: LKML , Peter Zijlstra , Gabriele Monaco , Mathieu Desnoyers , Michael Jeanson , Jens Axboe , "Paul E. McKenney" , "Gautham R. Shenoy" , Florian Weimer , Tim Chen , Yury Norov References: <20251119171016.815482037@linutronix.de> <20251119172550.280380631@linutronix.de> <20251122004358.GB2682494@ax162> <873466jekm.ffs@tglx> Content-Language: en-US From: Shrikanth Hegde In-Reply-To: <873466jekm.ffs@tglx> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTIyMDAyMSBTYWx0ZWRfX9NZzea6EBMi2 VItWGPzXVMVOwTJqASFzNIsXzZhiU0GSvva57aWt/Kd0H6dWepjvplC0rUF1C1PmiwmLhkHD4R+ Vorzy6su0hJv7W/Prwn9OszyCJm3W6iNfcLuHvkjUGR62ti/AL5RB9VvlsTPqGTYGYCR89MXOw8 qWmpTL7Yd1BmLdWMoUq+wvnhyBQiWdqagshBYHro7mVOkmtyIdjDN8PK3yNZjaJVtJUg4aO9Zke NSgxpaiSwtvZqzjA32TULTVstMKOZ8OM8WDdyF1yAAB4GlEV98Ol413erNnXqr5QBpxuugjtkqr 4dhtvtJrKPmAOHn1bVQdW3jjAOgkbio5IWk6MBSDFyv/VqruEl+ZxxEx+jcHbOz0VOJmTzH+Sx5 mQWhjpcVpOzyvUeKVJI9iDPepniEtg== X-Proofpoint-ORIG-GUID: 6QzlSRNk-M4m4kQP3ran3lQ8lkuhDaeI X-Proofpoint-GUID: P3dl0hLzIyDIn8CYllKIOIDeGix40SpK X-Authority-Analysis: v=2.4 cv=TMJIilla c=1 sm=1 tr=0 ts=6921ead5 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=uvIdqklGswhKepIN91QA:9 a=QEXdDO2ut3YA:10 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-22_06,2025-11-21_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 phishscore=0 impostorscore=0 clxscore=1011 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511220021 On 11/22/25 8:32 PM, Thomas Gleixner wrote: > On Fri, Nov 21 2025 at 17:43, Nathan Chancellor wrote: >> Our CI started seeing a hang in QEMU after getting to userspace when >> booting with a single CPU (our default logic when using TCG instead of >> KVM) that I bisected to this change as commit 2635fb0f0973 >> ("sched/mmcid: Switch over to the new mechanism") in -next. >> >> If I change '-smp 1' to '-smp 2', userspace runs properly. At the parent >> change, this issue does not exist but it is obviously possible that this >> change exposes a bug from earlier in the series, I did not test. > > Duh. Never tested with smp 1 :( > > Fix is below. Now let me stare at that num_possible_cpus() fallout. > > Thanks, > > tglx > ---- > Subject: sched/mmcid: Ensure that per CPU threshold is > 0 > From: Thomas Gleixner > Date: Sat, 22 Nov 2025 15:54:39 +0100 > > When num_possible_cpus() == 1 then the calculation for the threshold to > switch back from per CPU mode to per task mode results in 0, which > indicates that the per CPU mode is disabled. > > Ensure that the threshold is > 0 to prevent that. > > Fixes: 340af997d25d ("sched/mmcid: Provide CID ownership mode fixup functions") > Reported-by: Nathan Chancellor > Signed-off-by: Thomas Gleixner > Closes: https://lore.kernel.org/all/20251122004358.GB2682494@ax162 > --- > kernel/sched/core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -10364,7 +10364,8 @@ static inline unsigned int mm_cid_calc_p > unsigned int opt_cids; > > opt_cids = min(mc->nr_cpus_allowed, mc->users); > - return min(opt_cids - opt_cids / 4, num_possible_cpus() / 2); > + /* Has to be at least 1 because 0 indicates PCPU mode off */ > + return max(min(opt_cids - opt_cids / 4, num_possible_cpus() / 2), 1); > } > > static bool mm_update_max_cids(struct mm_struct *mm) Having both patches (this patch and num_possible_cpus fix) patch was necessary for successful boot of smp=1 on qemu.