From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6E0D606A31F for ; Sun, 6 Dec 2026 01:27:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JMut3BZt Received: by kanga.kvack.org (Postfix) id 082006B05B9; Sat, 5 Dec 2026 20:26:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 00BA06B05BB; Sat, 5 Dec 2026 20:26:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E39C16B05B9; Sat, 5 Dec 2026 20:26:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A41FD6B05B9 for ; Sat, 5 Dec 2026 20:26:39 -0500 (EST) Received: from smtpin22.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B56CA1C411B for ; Sun, 6 Dec 2026 01:26:38 +0000 (UTC) X-FDA: 85511818476.22.75A239E Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf29.hostedemail.com (Postfix) with ESMTP id 29400120002 for ; Sun, 6 Dec 2026 01:26:36 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=fail ("headers rsa verify failed") header.d=kernel.org header.s=k20260515 header.b=JMut3BZt; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796520397; b=Bs3RM3k8hdPYgc2QdD5pWtP9hjZv8QIwkeiTUjR5qwxY+HG8ByonMjAIOF6fwzFHssAW+3 JSKXGM2RabnLBYhibyCihUzojoqCXibn9jF6puU1e1gNZ80+lH2G9T0yIUe2z5a9lBjTZe 1xZKGdoGobrSddwtsO5sQpvsSxtaOJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796520397; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8N0NNILBKTfz4aKZZb1fJ2sk74JAuzC5mbUe1PQdT0s=; b=4rTNU1OUgUJQ4FNQnNwOjEX1lZ9CWJA2I79oLiuVc9ytuk5KVQzdhuxtPXvUpG5i2G+6dp 01zoi7SiuqRNqhh8xVzxFsAWBaT9DEy577D4QboppZzUsEJetTJSH/c3nGxrXuvJDOv+4x drg+yewwouXRKKXMnpFKhaKyUIMs5zU= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=fail ("headers rsa verify failed") header.d=kernel.org header.s=k20260515 header.b=JMut3BZt; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id B138760E68; Sun, 6 Dec 2026 01:26:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F6E91F0092B; Sun, 6 Dec 2026 01:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796520396; bh=8N0NNILBKTfz4aKZZb1fJ2sk74JAuzC5mbUe1PQdT0s=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=JMut3BZtA1qIwbV3xOu2ncqlFU//oHKOXHR4dPW+Kv5RQRP4EnblU5Q19OdMqfoPd ALn4y7CUeAWhv3YQXSWXaaYpUu4ql0ThIvKWTQ2pQYpT5WJkQVM0hUVNiGC5v9F2wS LPse4LEZSCS1xR9z1R5GHIh5Har+g3+8LNh7tKFAZTy1Kj+N/knnNvLoTTt97ULj1G WEMOIWNr2+Zl+WQTFWdNQZ1vwLzqLcXbEiOsklNA1b+WAAMPaV5kaH6cvca4E9IEeC b1hwrRUwmi+t8gLwMJCBPRj5BujOjmH2pT8HAVVxVOI+y2gTO/65EsnAKHh4Xi0Qfu UeyIq442A3V6g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v16 9/9] lib/tests: memcpy_kunit: add memcpy_mc() and memcpy_mc_large() test Reply-To: sashiko-reviews@lists.linux.dev To: "Jiangtian Feng" , catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, rafael@kernel.org Cc: mark.rutland@arm.com, james.morse@arm.com, robin.murphy@arm.com, nikumbh.adi@gmail.com, tony.luck@intel.com, guohanjun@huawei.com, mchehab@kernel.org, lenb@kernel.org, xueshuai@linux.alibaba.com, tongtiangen@huawei.com, tianruidong@linux.alibaba.com, tongweilin@linux.alibaba.com, baolin.wang@linux.alibaba.com, ashok.raj@oss.qualcomm.com, jonathan.cameron@oss.qualcomm.com, david@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, mhocko@suse.com, ljs@kernel.org, surenb@google.com, shivankg@amd.com, wangkefeng.wang@huawei.com, xiangzao@linux.alibaba.com, ying.huang@linux.alibaba.com, linmiaohe@huawei.com, nao.horiguchi@gmail.com, ziy@nvidia.com, tujinjiang@huawei.com, mgorman@techsingularity.net, kaitao.cheng@linux.dev, chengkaitao@kylinos.cn, muchun.song@linux.dev, nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, usama.arif@linux.dev, kas@kernel.org, kees@kernel.org, andreyknvl@gmail.com, dvyukov@google.com, gli@kvack.org, der@google.com, ryabinin.a.a@gmail.com, vincenzo.frascino@arm.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com, sshegde@linux.ibm.com, aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com, linux-mm@kvack.org, kasan-dev@googlegroups.com, x86@kernel.org In-Reply-To: <20261205012435.1406255-10-jiangtianfeng@linux.alibaba.com> References: <20261205012435.1406255-1-jiangtianfeng@linux.alibaba.com> <20261205012435.1406255-10-jiangtianfeng@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 01:26:33 +0000 X-Rspamd-Server: rspam11 X-Rspam-User: X-Stat-Signature: oryshkwqkzxb3f6hcbuorz6zkpkm37fo X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Rspamd-Queue-Id: 29400120002 X-HE-Tag: 1796520396-402539 X-HE-Meta: U2FsdGVkX1/6TzLrwS24v0Ez7DhwHtyT7fc/uzOSOZu4nD3A41QiqULavRYGpDEOccwZnQFXScEjJ6H3Aqb/Nr+wFAOzZF21gRAK0L95J8Bwoh/PQKgkAuAbvOgmjB1D41H3zvgwTKHw+L3LmQTAPXiiZEjyzGHa8/5IzoQ4MkoyOhl3Duy8Q2PMbKTV5y1YNhd1yJgoQDhU6L29D2dti/EBu2sz47c+yQNUM5yid4fnVIFiMCQ2+ga3wLF+Db9kwZx8PHbi972Fl1POdIdC5sBWuuxFez8W/0hXnV8yPgR9k51eCpCUt2yo57heyVjl4odPoB+gPd3j9Cfo9aCp7a+wM8+aDtLBBpmpkM7cueUEk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+9XLA81CWEhBL3yacXTt+xXm09QP7Pe2Yg6XH8yZDbITWwuhoTw4eGzS7J0fgeM890Fk6hK3BGUBp0kdi/2yc3Vp4EmERWkDe5mdSSYF5kPJKPV/P9NVq+AB0ahL1zSoipBzenLqPzUUf6MqQ7Qpy3NcG4RnDpzgoCprPygH+1N/zF+TBf0h+8BfvyATsYuo2OWtEDCUNuLU/KDoVnTMgPOnAANrWaPXIZVkTeYsFBFU4CXDN3VmfUIEWspG3nVvOSS7s4+gqY7wd1o41/QAZlBE14J1S25V+BSkLZ/0nVE6z7m3o2OxlPBu5Cv+YviiJEpbxNeyafnGvC2LofQwq2Dkxr7BW1p3jSz3+nin3QgvY6ReZFYCboa216TC/Ez3VFQ/wSAunb+CqwkWeU5RnD/bNYmiLnxLB4z1+l9usMgH5ZpkuHyccCDNXAbQqLM1YtXPNUiD72hp9UaZ+dt40ht8SzdxQ== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Low] lib/tests: memcpy_mc_large_test() truncates unsigned long return value to int - [Low] lib/tests: use generic copy_mc_to_kernel() instead of arm64-only memcpy_mc() - [Low] lib/tests: memcpy_mc_large_test() skips unaligned-src paths in copy_template.S - [Low] lib/tests: duplicate copy_large_test() and memcpy_test() in memcpy_mc tests -- commit 5d6144c729bba5b735c9853da3f6e1e7481d3b4a Author: Ruidong Tian lib/tests: memcpy_kunit: add memcpy_mc() and memcpy_mc_large() test This patch adds KUnit test cases memcpy_mc_test() and memcpy_mc_large_test() to lib/tests/memcpy_kunit.c, guarded by __HAVE_ARCH_MEMCPY_MC. > diff --git a/lib/tests/memcpy_kunit.c b/lib/tests/memcpy_kunit.c > index 8bcaaf9ab1ea7..479fc9b880b3c 100644 > --- a/lib/tests/memcpy_kunit.c > +++ b/lib/tests/memcpy_kunit.c > @@ -554,6 +554,121 @@ static void copy_mc_page_test(struct kunit *test) > } > #endif /* __HAVE_ARCH_COPY_MC_PAGE */ > =20 > +#ifdef __HAVE_ARCH_MEMCPY_MC [Severity: Low] Should these tests call the generic copy_mc_to_kernel() API under CONFIG_ARCH_HAS_COPY_MC instead of gating on __HAVE_ARCH_MEMCPY_MC and calling memcpy_mc() directly? memcpy_mc() and __HAVE_ARCH_MEMCPY_MC only exist on arm64, where copy_mc_to_kernel() is an inline wrapper around memcpy_mc(). Testing copy_mc_to_kernel() exercises arm64 memcpy_mc() identically while also covering x86 and powerpc. [ ... ] > +static void memcpy_mc_large_test(struct kunit *test) > +{ > + init_large(test); [Severity: Low] Can memcpy_mc_large_test() reuse copy_large_test() instead of duplicating t= he sweep loop? copy_large_test() already shares this 1..1024 byte sweep between memcpy_large_test() and memmove_large_test(); extending it with an enum for the copy operation would avoid copying the loop and cleanup code. Likewise, memcpy_mc_test() duplicates the struct some_bytes tables and the static-initializer and direct-assignment checks from memcpy_test(). > + > + /* Sweep 1..1024 bytes x shifting offset to cover all template paths. */ > + for (int bytes =3D 1; bytes <=3D ARRAY_SIZE(large_src); bytes++) { > + for (int offset =3D 0; offset < ARRAY_SIZE(large_src); offset++) { > + int right_zero_pos =3D offset + bytes; > + int right_zero_size =3D ARRAY_SIZE(large_dst) - right_zero_pos; > + int ret; > + > + ret =3D memcpy_mc(large_dst + offset, large_src, bytes); [Severity: Low] Does keeping large_src at a fixed offset skip the unaligned-source paths in arch/arm64/lib/copy_template.S? __memcpy_mc() includes copy_template.S, whose alignment prologue aligns src (not dst) modulo 16 before branching to .LSrcAligned. Because large_src is= a fixed static array in .bss, at most one alignment residue is exercised, and if large_src is 16-byte aligned the unaligned-source prologue is never run. Sweeping source offsets across 0..15 would cover those paths. > + KUNIT_ASSERT_EQ_MSG(test, ret, 0, > + "memcpy_mc returned %d with size %d at offset %d", > + ret, bytes, offset); [Severity: Low] Does storing the return value of memcpy_mc() in int truncate its unsigned long result? On 64-bit architectures, narrowing unsigned long to a 32-bit signed int before checking ret =3D=3D 0 lets a non-zero upper 32 bits pass silently, a= nd %d misformats values with bit 31 set. Changing ret to unsigned long and the format specifier to %lu matches memcpy_mc() and memcpy_mc_test(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205012435.1406= 255-1-jiangtianfeng@linux.alibaba.com?part=3D9