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 3DA203264FC for ; Tue, 28 Jul 2026 16:51:56 +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=1785257518; cv=none; b=C0rhx0JAbLdIZDQlms2HXP5QL/2jelsus11iD/YFWlPkXPaEHQpiDw0qRJvnfa4/0MQTaz7xYjU/rSWozpbVzEms11+VcCsp/PtqWFyfdfg71OPlfjv6IsXLVlmruuXKhtRmCIsZsxZxrZg8/RaQiHB9Aq0XFQPK7lsYKsshVY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785257518; c=relaxed/simple; bh=E3maiESe8mBBQICYwkf1nnlqhrqWh1Lxzi+z/2+4xl8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WBxyIU1VpueXZR9ba+UX4DbF7YZpDHUrEYpwydWo2f9OrnwGNdCj3dGrG1moxr38PTwXsLN/t+HwYh/c4P7zGCPy671vwc61/HXN4wL9V6E/zGdBxiy0092ne+fgAsbZ1qglIZ4+M3ru+HCAh7X7KW0QGiQ+sJVVukDrNBwnviI= 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=bg/H2/WV; 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="bg/H2/WV" 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 66SElndC1380297; Tue, 28 Jul 2026 16:51:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=pp1; bh=/uX4XzmuF6ycAEwiMb6Zs36/2UF2kx g6CKDnOjgI5Pw=; b=bg/H2/WVGhjbTS325vqBEKveSdEU/ITMou/IR3GC+XqH/O XtiBzHUN78TIBguqD3ECANYZbn0pupzLtOHWkoAJ8/GaAhl85+HI9ZF/pcncibg8 tdsBE4u2UFfHAnBZpStPJuuOvzV+egrkL8fgmBaE6hxK/TBZRMRvM0DE4dbArUCr f97/BXfbV1VjnPVZTeukka7AZqEdmnILuZaoCM/gqczpgDpAG76SwZBFhgApLmZn 4ycVvYEq7C5yYwZfCta/s2dPaZ1AbOl1LW1eUbWDSVKXg1K5fJxvSELnj+3fS6A8 CYThLwUnwnLJcBYGvXprE31C5QMEi84HIUqZoMDQ== 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 4fmuyj5tet-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2026 16:51:34 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66SGfSAI000878; Tue, 28 Jul 2026 16:51:34 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fn8fk2v2h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2026 16:51:33 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66SGpVSx30933388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jul 2026 16:51:32 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CE28A20043; Tue, 28 Jul 2026 16:51:31 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66B3F2004B; Tue, 28 Jul 2026 16:51:31 +0000 (GMT) Received: from osiris (unknown [9.87.141.62]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTPS; Tue, 28 Jul 2026 16:51:31 +0000 (GMT) Date: Tue, 28 Jul 2026 18:51:29 +0200 From: Heiko Carstens To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, ada.coupriediaz@arm.com, ardb@kernel.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, maz@kernel.org, peterz@infradead.org, ruanjinjie@huawei.com, vladimir.murzin@arm.com, will@kernel.org, yang@os.amperecomputing.com Subject: Re: [RFC PATCH 06/13] arm64: percpu: Add infrastructure for preemptible this_cpu_*() ops Message-ID: <20260728165129.114152B00-hca@linux.ibm.com> References: <20260728123859.2911495-1-mark.rutland@arm.com> <20260728123859.2911495-7-mark.rutland@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260728123859.2911495-7-mark.rutland@arm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1ha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int-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-28_04,2026-07-28_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607280149 On Tue, Jul 28, 2026 at 01:38:52PM +0100, Mark Rutland wrote: > This patch adds infrastructure for a scheme where this_cpu_*() ops do > not need to transiently disable preemption, avoiding the negative > impacts described above. > > Each operation registers a critical section during which the exception > return code will adjust the offset and addresses if preemption occurs > mid-sequence. The critical section is registered/unregistered with a > small prologue and epilogue which encodes three distinct GPRRs (, > , ) into a new thread_info::pcp_gprs field: > > // Prologue. Enable fixups for and . > mrs , sp_el0 > mov , #__VAL_PCPU_GPRS(, , ) > strh , [, #TSK_TI_PCPU_GPRS] > > // Generate cpu-specific address > mrs , TPIDR_ELx > add , , > > // Perform access sequence > ldr , [] > > // Epilogue. Disable fixups > strh wzr, [, #TSK_TI_PCPU_GPRS] > > If an exception is taken from within the critical section, the exception > return code will adjust to be the current CPU's offset, and will > adjust to be ( + ). Distinct registers are used for > , , and , so that the fixup can be applied safely at any > point during the critical section. This looks indeed better than that what I came up with for s390. It works without comparing instruction pointers, also works out-of-the-box with kprobes, and hence the fixup is much simpler. I guess I'll try to change s390 to a similar mechanism and see what the result will look like. It will use one more instruction to the current version, as far as I can tell now, but the simplicity is probably worth it.