[PATCH v13 5/5] arm64: introduce copy_mc_to_kernel() implementation

Tong Tiangen tongtiangen at huawei.com
Fri Feb 14 13:57:24 AEDT 2025



在 2025/2/13 1:18, Catalin Marinas 写道:
> On Mon, Dec 09, 2024 at 10:42:57AM +0800, Tong Tiangen wrote:
>> The copy_mc_to_kernel() helper is memory copy implementation that handles
>> source exceptions. It can be used in memory copy scenarios that tolerate
>> hardware memory errors(e.g: pmem_read/dax_copy_to_iter).
>>
>> Currently, only x86 and ppc support this helper, Add this for ARM64 as
>> well, if ARCH_HAS_COPY_MC is defined, by implementing copy_mc_to_kernel()
>> and memcpy_mc() functions.
>>
>> Because there is no caller-saved GPR is available for saving "bytes not
>> copied" in memcpy(), the memcpy_mc() is referenced to the implementation
>> of copy_from_user(). In addition, the fixup of MOPS insn is not considered
>> at present.
> 
> Same question as on the previous patch, can we not avoid the memcpy()
> duplication if the only difference is entries in the exception table?
> IIUC in patch 2 fixup_exception() even ignores the new type. The error
> must come on the do_sea() path.

As I said in commit message, it is not normalized with the memcpy()
because of the lack of GPR. If there is no GPR shortage problem, we can
extract the common code of memcpy_mc() and memcpy(),The unextracted
code is using different exception table entries.

Thanks,
Tong.

> 


More information about the Linuxppc-dev mailing list