From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4516E43785F for ; Tue, 28 Jul 2026 12:39:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785242391; cv=none; b=XDKb7Fq3mN9tGbX4pJ/8jVL5rCiEjw93+RmbaWU1Uecxfua2Yt/ShplPp3qeHbxOU19cCUIEaFaQmtQZFyaiEXBvE5Xn73RnAHKz4n4J8vDW5fbn45FrnTgSkAVBi3jkgTrWSz4UyyeIBh6w5bXZzyzlkbNbB1O6GQhAnyIGCI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785242391; c=relaxed/simple; bh=TSKrCYwIYLAtwEuZITiFKuqghJNMJv2A7s4nheGUQQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Z4qty2AFmKAlgbBjNGwK5eQMqhzaOKpj80llrmJZrjYy1xIiACS7jNZjR/yyEdHb6w6Dil36Qw4fZ/SdVVUm3cBTGBaBMNx2lyJJnzCdgN8xzzmYVQJRiyQ+qOzbShCY4Ev+k9IRNZWnedPle2nJY8EZIiWTDXdAQRnNHpMXrCc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=nJLMT+tn; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="nJLMT+tn" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7CE621A9A; Tue, 28 Jul 2026 05:39:44 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B351C3F86F; Tue, 28 Jul 2026 05:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1785242388; bh=TSKrCYwIYLAtwEuZITiFKuqghJNMJv2A7s4nheGUQQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJLMT+tn6NZriNVutvjd5SvrSf775dyqYddSiw0VCO407rflM5lArTWXovtjxQu6J F8V7yD2G1GbCqALnt7bN4vjX1+LGA9S8KU3lE7+b+vwAAxBsD51GmptCeTjnB6Xu0q dXqWpN3LtJZJ8iEtfJLNP8ciMEfMhH1qVGpMBl/M= From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: ada.coupriediaz@arm.com, ardb@kernel.org, catalin.marinas@arm.com, hca@linux.ibm.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com, maz@kernel.org, peterz@infradead.org, ruanjinjie@huawei.com, vladimir.murzin@arm.com, will@kernel.org, yang@os.amperecomputing.com Subject: [RFC PATCH 03/13] arm64: ptrace: Always inline pt_regs_[read,write}_reg() Date: Tue, 28 Jul 2026 13:38:49 +0100 Message-Id: <20260728123859.2911495-4-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20260728123859.2911495-1-mark.rutland@arm.com> References: <20260728123859.2911495-1-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-Transfer-Encoding: 8bit In subsequent patches we'll want to use pt_regs_read_reg() and pt_regs_write_reg() in noinstr code. To ensure noinstr safety, both functions must be inlined into their caller. As both functions are marked as 'inline' rather than '__always_inline', that's not strictly guaranteed, and the compiler is permitted to generate out-of-line copies. Mark both functions as '__always_inline' to ensure this. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Cc: Ada Couprie Diaz Cc: Ard Biesheuvel Cc: Catalin Marinas Cc: Jinjie Ruan Cc: Marc Zyngier Cc: Peter Zijlstra Cc: Vladimir Murzin Cc: Will Deacon Cc: Yang Shi --- arch/arm64/include/asm/ptrace.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index 39582511ad72f..a1aa668aad50e 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h @@ -268,7 +268,8 @@ static inline u64 regs_get_register(struct pt_regs *regs, unsigned int offset) * Read a register given an architectural register index r. * This handles the common case where 31 means XZR, not SP. */ -static inline unsigned long pt_regs_read_reg(const struct pt_regs *regs, int r) +static __always_inline unsigned long +pt_regs_read_reg(const struct pt_regs *regs, int r) { return (r == 31) ? 0 : regs->regs[r]; } @@ -277,8 +278,8 @@ static inline unsigned long pt_regs_read_reg(const struct pt_regs *regs, int r) * Write a register given an architectural register index r. * This handles the common case where 31 means XZR, not SP. */ -static inline void pt_regs_write_reg(struct pt_regs *regs, int r, - unsigned long val) +static __always_inline void +pt_regs_write_reg(struct pt_regs *regs, int r, unsigned long val) { if (r != 31) regs->regs[r] = val; -- 2.30.2