From mboxrd@z Thu Jan 1 00:00:00 1970 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 AB2AE377559 for ; Fri, 17 Apr 2026 09:37:09 +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=1776418630; cv=none; b=qt3JEypdE738JttcBlLJ1munhPdTKuez1V+J8taN8X4gJ+fpwv/Hr4dI069h/MMaaZ58s1tP3yz9EGrFrN15Wuo97KICQqSqogNXcSF8SuhpfZHEI/zhcpl/tglnSlUg0JfIMF6mVF5aJ2d0Ixjdu+ITmSrrDTCQU34iHTHpbRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776418630; c=relaxed/simple; bh=IeSJAB3wOrRoNSCerr2UPugAS3PiaIzCPKYoHYquKx8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lPeFx0kUKJJtcruk87p9OJkz4A6YJphpZD0bm65iV0ynKgmZWmadLTfINX5nL8aLMv+JpALKbmbs0zu2cZ1O6JWbCPaC7FDqluaNUJiYI8C9HMB1wigrGRO+tFViIEVvdCDRWceJNFvDdrlXUlSwOpSX83O6AhA2oL7sJXZrknI= 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=eV1gPz/Z; 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="eV1gPz/Z" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63GKeIZq1861037; Fri, 17 Apr 2026 09:36:51 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=JzHEPr LTVChCkgBLYiYn7ukJTI5NIHTkcmqRUALUuOY=; b=eV1gPz/Z/S3YB4PfUVPLxc 2/t0Q3PT6Fu8NP33UWeN/Cb2DB99Sm0kOUJvgs8equfIb3NgwJE66z3/RARXs24c RqJJfKrlE7JvHAEcs1PRzikc13n8cfUSHZ4KoBrD5r3B0/mwoqIP58OK36LAoD5R 9wcRS1Z/v6ueAgN7AuI2n2vdU56ENVcSMvbNH3swWfPm4zQsN7UzzEVPHoRoZcEN 0ZMPQvN1zw+Av32E1nkar5pl8uRmKXqmkSjPU2Cg3asWHbklmmDOoXpx402kTAoy h+bpsEDdlgo3YWJ2Ki62B+lc+M/O8zHhU8IdrFp1eUqg4BgZULe00OFyRZIjyMjA == Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dh89prnxn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Apr 2026 09:36:51 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 63H7ZXPl003581; Fri, 17 Apr 2026 09:36:50 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4dg1mnpmw7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Apr 2026 09:36:50 +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 63H9alOw48890176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Apr 2026 09:36:47 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2282F2004E; Fri, 17 Apr 2026 09:36:47 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BDF0C20040; Fri, 17 Apr 2026 09:36:41 +0000 (GMT) Received: from [9.124.218.221] (unknown [9.124.218.221]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 17 Apr 2026 09:36:41 +0000 (GMT) Message-ID: <59241b6e-0481-4c41-9eb1-05d4b0b84801@linux.ibm.com> Date: Fri, 17 Apr 2026 15:06:11 +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: [RFC] in-kernel rseq To: Heiko Carstens , Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , mathieu.desnoyers@efficios.com, Mark Rutland , cmarinas@kernel.org, maddy@linux.ibm.com, ryan.roberts@arm.com, Christophe Leroy References: <20260223163843.GR1282955@noisy.programming.kicks-ass.net> <20260415085131.10321Abf-hca@linux.ibm.com> From: Shrikanth Hegde Content-Language: en-US In-Reply-To: <20260415085131.10321Abf-hca@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: A-3wgI4rBKAQbeSvfucLp2RAaMRW_dt3 X-Proofpoint-ORIG-GUID: A-3wgI4rBKAQbeSvfucLp2RAaMRW_dt3 X-Authority-Analysis: v=2.4 cv=WbE8rUhX c=1 sm=1 tr=0 ts=69e1ff33 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=fHXR3Nmm9WjYqAmXgKUA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE3MDA5MiBTYWx0ZWRfX5++qWbwPE6qH SfXjFoeiW8BERzhihFlye4oBabrdhHStgs5pJR47bqckTKfDbDX9oN3m6EjqN+g+EY0GI/iXf1+ weHJPKEzZiwmaehD5gikqE1cNvpqn3zQxz6jl6ugz2imFZKbtTwOsXeMeWDq7/Zx+IvdiXBJwq9 lXT9tZOXeAAEg8clVOZkKxw2H0eu4oEfESS+hBXNEkVZ7IYDAAmV85huzHu0vU38cu3F7MoB7IU IWKHErHW/Paig96WcpZnf6g3sbifpcoFudjly13UJ6KeImf/8+KTeXl80GHIvzKSnJTejsgEa17 e1YGH6VMbDVjajREGnfDidZ5OeG6HdoUcPZuP5rovKdkSCE3s5IpM8VREIhtkSOGKao8hf/FCMe KnLwFp21gVCUnUWAMFA5f0XR5NFUqh9MPuib2+dwcBxs/BkzWJ7PIe09kuxJJKVQu3trJqXpvzA Rg47n/OGP+GQVRox+3g== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_04,2026-04-16_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 priorityscore=1501 spamscore=0 clxscore=1015 phishscore=0 impostorscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604170092 Hi Heiko. On 4/15/26 2:21 PM, Heiko Carstens wrote: > On Fri, Apr 10, 2026 at 11:27:50PM +0530, Shrikanth Hegde wrote: >> Hi Peter, >> >> On 2/23/26 10:08 PM, Peter Zijlstra wrote: >>> Hi, >>> >>> It has come to my attention that various people are struggling with >>> preempt_disable()+preempt_enable() costs for various architectures. >>> >>> Mostly in relation to things like this_cpu_ and or local_. >>> >>> The below is a very crude (and broken, more on that below) POC. >>> >>> So the 'main' advantage of this over preempt_disable()/preempt_enable(), >>> it on the preempt_enable() side, this elides the whole conditional and >>> call schedule() nonsense. >> >> This might be a very stupid question. >> >> Why not just call preempt_enable_no_resched instead? >> >> this_cpu operations would have disabled preemption so the per_cpu >> structures are protected from thread migration right? intention >> here is likely not to call schedule. No? > > Doing that would make it unpredictable when the kernel is preempted for > cases where TIF_PREEMPT is set while within a code section which has > preemption disabled and where preemption is enabled again without checking > for TIF_PREEMPT. Ok. I discussed with this peter at OSPM. Likely ppc64 has to do with using paca pointets. Let me take a look at your implementation. Maybe while there, we need to move preempt count to paca too, which is currently in thread_info. (atleast for ppc64). This could lead to ifdeffery since only ppc64 has paca. I need to look into if there is way i can avoid those.