From nobody Mon Dec 1 22:36:51 2025 Received: from canpmsgout11.his.huawei.com (canpmsgout11.his.huawei.com [113.46.200.226]) (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 F36C53321B5 for ; Thu, 27 Nov 2025 12:36:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764247008; cv=none; b=Z/WaDVv3uZqOQwy+KeMqb7AuWvdfuJ1PqAFYV/11Qkd8HcKtyX/kC5b4HTs0o1hm7mo6lpY6TJ9zSaL0lmS9vSDVhy47CXHx7JZQlfKFj8exX+GgMnUh7zLFLFQU1/QaMmW3iThtS37SqXKBe0Lqt12N0rGpsycSle5r3/Cd7FA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764247008; c=relaxed/simple; bh=JCV3JcN0EcfD6ECV1nEjLw1hykZTo6a1FoDRktfsGIs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SZjMqaTOFXRZ1z1xoBT8zd8l//7oMMQB//t3TAjvNc6yaoI3jrblyxZdFXCvTzD/P3zl0YvhYtqtReFxyaXcMPaaipSHe/W5rgxXiuCDuWo79b7KykBWnnhD8Jn34HFumHPYwWrSCwLmosg3rE5lewE805LdQTyjF/93e7Ec6jc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=QzrpXeDr; arc=none smtp.client-ip=113.46.200.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="QzrpXeDr" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=qdym5IeHw7I5kk48d6CR/tnfKDpc0G1zl2j3QUelC4I=; b=QzrpXeDrGTUrKvr5L5/THoSnpQJB8zN9E7g6xw1FMoNBrxPc5+TgaRkPn2wctIyjdoLEHlT03 J1bf3lSmUGUCz/Q9HlekRDJaV0/5YTHZdr6EEUu4sda617GVsF/CF5IQop2fCNeQgkPTOu3jTNY abuLSHKw9mPnrvVv5ue8sQc= Received: from mail.maildlp.com (unknown [172.19.163.17]) by canpmsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4dHG8m1CrkzKm4J; Thu, 27 Nov 2025 20:34:48 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 6A7991A0188; Thu, 27 Nov 2025 20:36:37 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 27 Nov 2025 20:36:36 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , CC: Subject: [PATCH 2/2] arm64: Avoid memcpy() for syscall_get_arguments() Date: Thu, 27 Nov 2025 20:36:30 +0800 Message-ID: <20251127123630.4149828-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251127123630.4149828-1-ruanjinjie@huawei.com> References: <20251127123630.4149828-1-ruanjinjie@huawei.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="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500011.china.huawei.com (7.185.36.131) Do not use memcpy() to extract syscall arguments from struct pt_regs but rather just perform direct assignments. The performance benchmarks with Generic Entry patch[1] with audit on from perf bench basic syscall on kunpeng920 gives roughly a 1% performance uplift and also aligns the implementation with x86 and RISC-V. | Metric | W/O this patch | With this patch | Change | | ---------- | -------------- | --------------- | --------- | | Total time | 2.241 [sec] | 2.211 [sec] | =E2=86=931.36% | | usecs/op | 0.224157 | 0.221146 | =E2=86=931.36% | | ops/sec | 4,461,157 | 4,501,409 | =E2=86=910.9% | Before: : aa0103e2 mov x2, x1 91002003 add x3, x0, #0x8 f9408804 ldr x4, [x0, #272] f8008444 str x4, [x2], #8 a9409404 ldp x4, x5, [x0, #8] a9009424 stp x4, x5, [x1, #8] a9418400 ldp x0, x1, [x0, #24] a9010440 stp x0, x1, [x2, #16] f9401060 ldr x0, [x3, #32] f9001040 str x0, [x2, #32] d65f03c0 ret d503201f nop After: a9408e82 ldp x2, x3, [x20, #8] 2a1603e0 mov w0, w22 f9400e84 ldr x4, [x20, #24] f9408a81 ldr x1, [x20, #272] 9401c4ba bl ffff800080215ca8 <__audit_syscall_entry> [1]: https://lore.kernel.org/all/20251126071446.3234218-1-ruanjinjie@huawei= .com/ Signed-off-by: Jinjie Ruan --- arch/arm64/include/asm/syscall.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/sysc= all.h index f3853047c28e..f3564ba97f7e 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -82,9 +82,11 @@ static inline void syscall_get_arguments(struct task_str= uct *task, unsigned long *args) { args[0] =3D regs->orig_x0; - args++; - - memcpy(args, ®s->regs[1], 5 * sizeof(args[0])); + args[1] =3D regs->regs[1]; + args[2] =3D regs->regs[2]; + args[3] =3D regs->regs[3]; + args[4] =3D regs->regs[4]; + args[5] =3D regs->regs[5]; } =20 static inline void syscall_set_arguments(struct task_struct *task, --=20 2.34.1