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 F24EC3603DB for ; Fri, 17 Apr 2026 09:31:36 +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=1776418298; cv=none; b=Oafye+DG7BP26z/BHLeC28OvC6Opguaa6fslBVevrry+J2pEk4XMZ3jl37AaNrI9Kh5wrDlFb7bde/5BbL/aHPDfiW0jMLdMFwHY9gtQX/OqTcecCyVF50V3DtoxUJw/n46wpMndjtUrnW7kjnFi6VfCOeN41hJ5aDpJ5ahvqSE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776418298; c=relaxed/simple; bh=3EPz6IiI108W62eyFJwSke9CC9gLyWq2lyId8Hppl/k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=F4nKxSOT81g9ds7kANrxbBlnXUiRRbvXjoSqXyY2UXt70VCMlMIaGw3ECgrsLGZIK7Mge4OfHVJYzIXD31Q1gLq2HacZ38o0EGRM71nnPg44rllJFKvwZsnn6wWwqOUdsN7Sw8iwzwoDvXHbjqLsAeoDmADhIC57R+mvARJETkk= 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=hKJDYCv9; 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="hKJDYCv9" 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 63GJHOuc1860002; Fri, 17 Apr 2026 09:31:15 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=aTNYQ4 vlxZsF7qKS++O/rXIkEu7TBf95iK+pB/xw9cA=; b=hKJDYCv9XXnpE12W0IisE3 UVwulVov7OCfDHpM3V+HiaJrcNIKZUHKAnZEuNMtAMJ0yRA4Z13HDyAdyPnnc1Dz kp6Cs+4ZWAVuNoYIDkk6YcbjY9p1dpZwPXuJ01IqKXevFsltx561h2ncFt351jmx +cZzw9uiqV/p69AyJWINtZ1he0n5bStB5enPPQUnNL0OVDNYCKcGcBxmXfDmkZha /Muv3bs0rJK+Va4UtILhf13kJMDJ0vpNQX/SFNqGiogYD14ckaNwIip2Tavpneas dGRQt80MfnP/6Ly467KH4v+cfgQ5l+ujYjdydpBkvTNKkih3a43M0VWg6AHO2n9A == 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 4dh89prne7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Apr 2026 09:31:14 +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 63H7vOld003568; Fri, 17 Apr 2026 09:31:14 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4dg1mnpme8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Apr 2026 09:31:14 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 63H9VAnn35193106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Apr 2026 09:31:10 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0732A20040; Fri, 17 Apr 2026 09:31:10 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9AD232004B; Fri, 17 Apr 2026 09:30:30 +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:30:27 +0000 (GMT) Message-ID: <07956a80-2e1d-4b89-9b94-52b5fd500ff6@linux.ibm.com> Date: Fri, 17 Apr 2026 14:59:31 +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> Content-Language: en-US From: Shrikanth Hegde 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: _vKipUfTVtGjCeG7X6-8nFehme6UBX-4 X-Proofpoint-ORIG-GUID: _vKipUfTVtGjCeG7X6-8nFehme6UBX-4 X-Authority-Analysis: v=2.4 cv=WbE8rUhX c=1 sm=1 tr=0 ts=69e1fde2 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: AW1haW4tMjYwNDE3MDA5MiBTYWx0ZWRfX+sYQJpFvgelM qCz4M2EP0J5zzuCpGswd1tiHba4waNpIa6hUDN9vFD0O2JTlZCcXV3t8H6MRWuPx2aphGKikuwO SrDm6NEoM5TpvdhdSXtrw1bVPeIAMgD6gR56wlBfY5sVW2gC3NS48LtidvMci5nc+rMshhnpLGR Igk6Zadq8t4YnoEu1YNPvDaLGHcyn/KhTx+DjN8lUPTwUvo5hyjUKMrhZfNmjVjj4+wVN/Xtdre Mtjdy1rOoRGPC6xV4vmfXM6T5XaeEgWY1o1NPXASRpNfqSMOHdSIGtHpUkzMzP030AiLNtLBfbd 3p3KLcHS8TLYsOfUCN0GH4sAIBnnnu5Pj5oo9sKdjVzlQBfdKFOKdIv+26ei6jC/3XFDiWNskdA ryrN67lvtOuWiY5IyJOprZdJQRcHaBO8eWH4YoXsRp1Zc9LyTyOON66JCroiJ5Zdo2ag0BWrGfX wdbkiRcoIK8rq+IpGRw== 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=1011 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 this with peter too. Likely we need to do something using paca. I will go through your implementation. While there, maybe move preempt count to paca too which has been long pending. atleast for ppc64.