On Mon, 6 Jul 2026 15:49:21 +0200, [email protected] wrote:

> >>> +
> >>> +#define __HAVE_ARCH_MEMCPY_NT 1
> >>> +/*
> >>> + * Reuse the existing x86 flushcache backend as the nt copy primitive.
> >>> + * Callers pair it with memcpy_nt_drain() when later stores must be
> >>> + * ordered after the copy.
> >>> + */
> >>> +static __always_inline void memcpy_nt(void *dst, const void *src, size_t 
> >>> cnt)
> >>> +{
> >>> + memcpy_flushcache(dst, src, cnt);
> >>> +}
> >>
> >> In particular if you end up with a single function (that jsut requires a 
> >> write
> >> memory barrier afterwards), please make this
> >>
> >> #define memcpy_nt memcpy_nt
> >>
> >> instead.
> >
> > Thanks for the review.
> >
> > Just to make sure I understood this correctly: do you mean that, rather
> > than using a separate __HAVE_ARCH_MEMCPY_NT feature macro, you would
> > prefer the usual self-macro override pattern, with
> >
> >     #define memcpy_nt memcpy_nt
> >
> > in arch/x86/include/asm/string_64.h and the generic fallback kept under
> > #ifndef memcpy_nt in include/linux/string.h?
> 
> Yes, that's what Linus suggested as the preferred way for single functions 
> when
> it came up in different context recently.

Thanks for confirming. I will switch v6 to that self-macro override
pattern for memcpy_nt(), and I used the same style for
memcpy_nt_drain().

Thanks,
Zhe

Reply via email to