x86: memcpy() / memset() (non-)ERMS flavors plus fallout
v4 cover x86: memcpy() / memset() (non-)ERMS flavors plus fallout
While the performance varies quite a bit on older (pre-ERMS) and newer (ERMS) hardware, so far we've been going with just a single flavor of these two functions, and oddly enough with ones not consistent with one another. Using plain memcpy() / memset() on MMIO (video frame buffer) is generally okay, but the ERMS variant of memcpy() turned out to regress (boot) performance in a way easily visible to the human eye.
01: x86: suppress ERMS for internal use when MISC_ENABLE.FAST_STRING is clear 02: x86: re-work memset()
03: x86: re-work memcpy()
04: x86: control memset() and memcpy() inlining
05: x86: introduce "hot" and "cold" page clearing functions
06: mm: allow page scrubbing routine(s) to be arch controlled
Jan
PATCH v4 1/6 x86: suppress ERMS for internal use when MISC_ENABLE.FAST_STRING is clear
Before we start actually adjusting behavior when ERMS is available, follow Linux commit 161ec53c702c ("x86, mem, intel: Initialize Enhanced REP MOVSB/STOSB") and zap the CPUID-derived feature flag when the MSR bit is clear. Don't extend the artificial clearing to guest view,
though: Guests can take their own decision in this regard, as they can read (most of) MISC_ENABLE.
---
TBD: Would be nice if "cpuid=no-erms" propagated to guest view (for
"cpuid=" generally meaning to affect guests as well as Xen), but since both disabling paths use setup_clear_cpu_cap() they're indistinguishable in guest_common_feature_adjustments(). A separate boolean could take care of this, but would look clumsy to me.
---
v4: Also adjust guest_common_max_feature_adjustments().
v3: New.
xen/arch/x86/cpu/intel.c +10 -0
@@ -337,8 +337,18 @@ static void cf_check early_init_intel(st paddr_bits =36 ;if (c == &boot_cpu_data) { +uint64_t misc_enable; +check_memory_type_self_snoop_errata (); +/* +* If fast string is not enabled in IA32_MISC_ENABLE for any reason, +* clear the enhanced fast string CPU capability. +*/ +rdmsrl (MSR_IA32_MISC_ENABLE , misc_enable); +if (!(misc_enable &MSR_IA32_MISC_ENABLE_FAST_STRING )) +setup_clear_cpu_cap (X86_FEATURE_ERMS ); +intel_init_levelling (); }
xen/arch/x86/cpu-policy.c +15 -0
@@ -487,6 +487,12 @@ static void __init guest_common_max_feat*/ if (test_bit (X86_FEATURE_RTM , fs) )__set_bit (X86_FEATURE_RTM_ALWAYS_ABORT , fs); + +/* +* We expose MISC_ENABLE to guests, so our internal clearing of ERMS when +* FAST_STRING is not set should not affect the view of migrating-in guests. +*/ +__set_bit (X86_FEATURE_ERMS , fs); }static void __init guest_common_default_feature_adjustments (uint32_t *fs)
@@ -591,6 +597,15 @@ static void __init guest_common_feature_*/ if ( host_cpu_policy.feat.ibrsb )__set_bit (X86_FEATURE_IBPB , fs); + +/* +* We expose MISC_ENABLE to guests, so our internal clearing of ERMS when +* FAST_STRING is not set should not propagate to guest view. Guests can +* judge on their own whether to ignore the CPUID bit when the MSR bit is +* clear. +*/ +if ( raw_cpu_policy.feat.erms ) +__set_bit (X86_FEATURE_ERMS , fs); }static void __init calculate_pv_max_policy (void )
xen/arch/x86/include/asm/msr-index.h +1 -0
@@ -490,6 +490,7 @@#define MSR_IA32_THERM_INTERRUPT 0x0000019b#define MSR_IA32_THERM_STATUS 0x0000019c#define MSR_IA32_MISC_ENABLE 0x000001a0 +#define MSR_IA32_MISC_ENABLE_FAST_STRING (1<<0)#define MSR_IA32_MISC_ENABLE_PERF_AVAIL (1<<7)#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1<<11)#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1<<12)
Re: [PATCH v4 1/6] x86: suppress ERMS for internal use when MISC_ENABLE.FAST_STRING is clear
Quoted 21 lines · Jan Beulich
xen/arch/x86/cpu-policy.c +8
-0@@ -487,6 +487,12 @@ static void __init guest_common_max_feat*/ if (test_bit (X86_FEATURE_RTM , fs) )__set_bit (X86_FEATURE_RTM_ALWAYS_ABORT , fs); + +/* +* We expose MISC_ENABLE to guests, so our internal clearing of ERMS when +* FAST_STRING is not set should not affect the view of migrating-in guests. +*/ +__set_bit (X86_FEATURE_ERMS , fs); }static void __init guest_common_default_feature_adjustments (uint32_t *fs)@@ -591,6 +597,15 @@ static void __init guest_common_feature_*/ if ( host_cpu_policy.feat.ibrsb )__set_bit (X86_FEATURE_IBPB , fs); + +/*
xen/arch/x86/cpu-policy.c static void __init guest_common_feature_ · line 611
Quoted 10 lines
xen/arch/x86/cpu-policy.c +7
-0+* We expose MISC_ENABLE to guests, so our internal clearing of ERMS when +* FAST_STRING is not set should not propagate to guest view. Guests can +* judge on their own whether to ignore the CPUID bit when the MSR bit is +* clear. +*/ +if ( raw_cpu_policy.feat.erms ) +__set_bit (X86_FEATURE_ERMS , fs); }static void __init calculate_pv_max_policy (void )
While doing unrelated work in this area I noticed that this hunk is wrong, and wants to be
@@ -567,6 +573,16 @@ static void __init guest_common_default_
__clear_bit(X86_FEATURE_RTM, fs);
__set_bit(X86_FEATURE_RTM_ALWAYS_ABORT, fs);
}
+
+ /*
+ * We expose MISC_ENABLE to guests, so our internal clearing of ERMS when
+ * FAST_STRING is not set should not propagate to guest view. Guests can
+ * judge on their own whether to ignore the CPUID bit when the MSR bit is
+ * clear. The bit being uniformly set in the max policies, we only need
+ * to clear it here (if hardware doesn't have it).
+ */+ if ( !raw_cpu_policy.feat.erms )
+ __clear_bit(X86_FEATURE_ERMS, fs);
}
static void __init guest_common_feature_adjustments(uint32_t *fs)
instead. Fixed locally.
Jan
PATCH v4 2/6 x86: re-work memset()
In reply to Jan BeulichMove the function to its own assembly file. Having it in C just for the entire body to be an asm() isn't really helpful. Then have two flavors:
A "basic" version using qword steps for the bulk of the operation, and an ERMS version for modern hardware, to be substituted in via alternatives patching.
---
We may want to consider branching over the REP STOSQ as well, if the number of qwords turns out to be zero.
We may also want to consider using non-REP STOS{L,W,B} for the tail.
---
v4: Use %r8 instead of %rsi in a few places.
v3: Re-base.
xen/arch/x86/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_INDIRECT_THUNK) += indirect obj-$(CONFIG_PV) += ioport_emulate.o obj-y += irq.o obj-$(CONFIG_KEXEC) += machine_kexec.o +obj-y += memset.o obj-y += mm.o x86_64/mm.o obj-$(CONFIG_HVM) += monitor.o obj-y += mpparse.o
xen/arch/x86/memset.S new file +30 -0
@@ -0,0 +1,30 @@ +#include <asm/asm_defns.h> + +.macro memset + and $7, %edx + shr $3, %rcx + movzbl %sil, %esi + mov $0x0101010101010101, %rax + imul %rsi, %rax + mov %rdi, %r8 + rep stosq + or %edx, %ecx + jz 0f + rep stosb +0: + mov %r8, %rax + ret +.endm + +.macro memset_erms + mov %esi, %eax + mov %rdi, %r8 + rep stosb + mov %r8, %rax + ret +.endm + +FUNC(memset) + mov %rdx, %rcx + ALTERNATIVE memset, memset_erms, X86_FEATURE_ERMS +END(memset)
xen/arch/x86/string.c +0 -13
@@ -22,19 +22,6 @@ void *(memcpy)(void *dest, const void *sreturn dest; } -void *(memset)(void *s,int c,size_t n) -{ -long d0, d1; - - asmvolatile ( -"rep stosb" - :"=&c" (d0),"=&D" (d1) - :"a" (c),"1" (s),"0" (n) - :"memory" ); - -return s; -} -void *(memmove)(void *dest,const void *src,size_t n) {long d0, d1, d2;
PATCH v4 3/6 x86: re-work memcpy()
In reply to Jan BeulichMove the function to its own assembly file. Having it in C just for the entire body to be an asm() isn't really helpful. Then have two flavors:
A "basic" version using qword steps for the bulk of the operation, and an ERMS version for modern hardware, to be substituted in via alternatives patching.
Alternatives patching, however, requires an extra precaution: It uses memcpy() itself, and hence the function may patch itself. Luckily the patched-in code only replaces the prolog of the original function. Make sure this remains this way.
Additionally alternatives patching, while supposedly safe via enforcing a control flow change when modifying already prefetched code, may not really be. Afaict a request is pending to drop the first of the two options in the SDM's "Handling Self- and Cross-Modifying Code" section. Insert a serializing instruction there.
---
We may want to consider branching over the REP MOVSQ as well, if the number of qwords turns out to be zero.
We may also want to consider using non-REP MOVS{L,W,B} for the tail.
TBD: We may further need a workaround similar to Linux'es 8ca97812c3c8
("x86/mce: Work around an erratum on fast string copy instructions").
---
v4: Use CR2 write as serializing insn, and limit its use to boot time.
v3: Re-base.
xen/arch/x86/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_INDIRECT_THUNK) += indirect obj-$(CONFIG_PV) += ioport_emulate.o obj-y += irq.o obj-$(CONFIG_KEXEC) += machine_kexec.o +obj-y += memcpy.o obj-y += memset.o obj-y += mm.o x86_64/mm.o obj-$(CONFIG_HVM) += monitor.o
xen/arch/x86/alternative.c +5 -1
@@ -153,12 +153,16 @@ void init_or_livepatch add_nops(void *in* executing. * * "noinline" to cause control flow change and thus invalidate I$ and -* cause refetch after modification. +* cause refetch after modification. While the SDM continues to suggest this +* is sufficient, it may not be - issue a serializing insn afterwards as well, +* unless this is for live-patching. */ static void init_or_livepatch noinlinetext_poke (void *addr,const void *opcode,size_t len) {memcpy (addr, opcode, len); +if ( system_state < SYS_STATE_active ) + asmvolatile ("mov %%rax, %%cr2" :::"memory" ); }extern void *const __initdata_cf_clobber_start[];
xen/arch/x86/memcpy.S new file +20 -0
@@ -0,0 +1,20 @@ +#include <asm/asm_defns.h> + +FUNC(memcpy) + mov %rdx, %rcx + mov %rdi, %rax + /* + * We need to be careful here: memcpy() is involved in alternatives + * patching, so the code doing the actual copying (i.e. past setting + * up registers) may not be subject to patching (unless further + * precautions were taken). + */ + ALTERNATIVE "and $7, %edx; shr $3, %rcx", \ + "rep movsb; ret", X86_FEATURE_ERMS + rep movsq + or %edx, %ecx + jz 1f + rep movsb +1: + ret +END(memcpy)
xen/arch/x86/string.c +0 -15
@@ -7,21 +7,6 @@#include <xen/lib.h> -void *(memcpy)(void *dest,const void *src,size_t n) -{ -long d0, d1, d2; - - asmvolatile ( -" rep ; movs" __OS" ; " -" mov %k4,%k3 ; " -" rep ; movsb " - :"=&c" (d0),"=&D" (d1),"=&S" (d2) - :"0" (n/BYTES_PER_LONG ),"r" (n%BYTES_PER_LONG ),"1" (dest),"2" (src) - :"memory" ); - -return dest; -} -void *(memmove)(void *dest,const void *src,size_t n) {long d0, d1, d2;
PATCH v4 4/6 x86: control memset() and memcpy() inlining
In reply to Jan BeulichStop the compiler from inlining non-trivial memset() and memcpy() (for memset() see e.g. map_vcpu_info() or kimage_load_segments() for examples). This way we even keep the compiler from using REP STOSQ / REP MOVSQ when we'd prefer REP STOSB / REP MOVSB (when ERMS is available).
With gcc10 this yields a modest .text size reduction (release build) of around 2k.
Unfortunately these options aren't understood by the clang versions I have readily available for testing with; I'm unaware of equivalents.
Note also that using cc-option-add is not an option here, or at least I couldn't make things work with it (in case the option was not supported by the compiler): The embedded comma in the option looks to be getting in the way.
---
v3: Re-base.
v2: New.
---
The boundary values are of course up for discussion - I wasn't really certain whether to use 16 or 32; I'd be less certain about using yet larger values.
Similarly whether to permit the compiler to emit REP STOSQ / REP MOVSQ for known size, properly aligned blocks is up for discussion.
xen/arch/x86/arch.mk +3 -0
@@ -65,6 +65,9 @@ endif $(call cc-option-add,CFLAGS_stack_boundary,CC,-mpreferred-stack-boundary=3) export CFLAGS_stack_boundary +CFLAGS += $(call cc-option,$(CC),-mmemcpy-strategy=unrolled_loop:16:noalign$(comma)libcall:-1:noalign) +CFLAGS += $(call cc-option,$(CC),-mmemset-strategy=unrolled_loop:16:noalign$(comma)libcall:-1:noalign) + ifeq ($(CONFIG_UBSAN),y) # Don't enable alignment sanitisation. x86 has efficient unaligned accesses, # and various things (ACPI tables, hypercall pages, stubs, etc) are wont-fix.
PATCH v4 5/6 x86: introduce "hot" and "cold" page clearing functions
In reply to Jan BeulichThe present clear_page_sse2() is useful in case a page isn't going to get touched again soon, or if we want to limit churn on the caches. Amend it by alternatively using CLZERO, which has been found to be quite a bit faster on Zen2 hardware at least. Note that to use CLZERO, we need to know the cache line size, and hence a feature dependency on CLFLUSH gets introduced.
For cases where latency is the most important aspect, or when it is expected that sufficiently large parts of a page will get accessed again soon after the clearing, introduce a "hot" alternative. Again use alternatives patching to select between a "legacy" and an ERMS variant.
Don't switch any callers just yet - this will be the subject of subsequent changes.
---
v3: Re-base.
v2: New.
---
Note: Ankur indicates that for ~L3-size or larger regions MOVNT/CLZERO
is better even latency-wise.
xen/arch/x86/clear_page.S +43 -4
@@ -1,9 +1,9 @@ .file __FILE__ -#include <xen/linkage.h> -#include <asm/page.h> +#include <xen/page-size.h> +#include <asm/asm_defns.h> -FUNC(clear_page_sse2) + .macro clear_page_sse2 mov $PAGE_SIZE/32, %ecx xor %eax,%eax
@@ -17,4 +17,43 @@ FUNC(clear_page_sse2) sfence ret -END(clear_page_sse2) + .endm + + .macro clear_page_clzero + mov %rdi, %rax + mov $PAGE_SIZE/64, %ecx + .globl clear_page_clzero_post_count +clear_page_clzero_post_count: + +0: clzero + sub $-64, %rax + .globl clear_page_clzero_post_neg_size +clear_page_clzero_post_neg_size: + sub $1, %ecx + jnz 0b + + sfence + ret + .endm + +FUNC(clear_page_cold) + ALTERNATIVE clear_page_sse2, clear_page_clzero, X86_FEATURE_CLZERO +END(clear_page_cold) + + .macro clear_page_stosb + mov $PAGE_SIZE, %ecx + xor %eax,%eax + rep stosb + ret + .endm + + .macro clear_page_stosq + mov $PAGE_SIZE/8, %ecx + xor %eax, %eax + rep stosq + ret + .endm + +FUNC(clear_page_hot) + ALTERNATIVE clear_page_stosq, clear_page_stosb, X86_FEATURE_ERMS +END(clear_page_hot)
xen/arch/x86/cpu/common.c +35 -2
@@ -58,6 +58,9 @@ DEFINE_PER_CPU(bool, full_gdt_loaded);DEFINE_PER_CPU (uint32_t, pkrs); +extern uint32_t clear_page_clzero_post_count[]; +extern int8_t clear_page_clzero_post_neg_size[]; +void __init setup_clear_cpu_cap (unsigned int cap) {const uint32_t *dfs;
@@ -355,8 +358,38 @@ void __init early_cpu_init(bool verbose) edx &= ~cleared_caps[FEATURESET_1d]; ecx &= ~cleared_caps[FEATURESET_1c]; -if (edx &cpufeat_mask (X86_FEATURE_CLFLUSH )) - c->x86_cache_alignment = ((ebx >>8 ) &0xff ) *8 ; +if (edx &cpufeat_mask (X86_FEATURE_CLFLUSH )) { +unsigned int size = ((ebx >>8 ) &0xff ) *8 ; + + c->x86_cache_alignment = size; + +/* +* Patch in parameters of clear_page_cold()'s CLZERO +* alternative. Note that for now we cap this at 128 bytes. +* Larger cache line sizes would still be dealt with +* correctly, but would cause redundant work done. +*/ +if (size >128 ) + size =128 ; +if (size && !(size & (size -1 ))) { +/* +* Need to play some games to keep the compiler from +* recognizing the negative array index as being out +* of bounds. The labels in assembler code really are +* _after_ the locations to be patched, so the +* negative index is intentional. +*/ +uint32_t *pcount = clear_page_clzero_post_count; +int8_t *neg_size = clear_page_clzero_post_neg_size; + +OPTIMIZER_HIDE_VAR (pcount); +OPTIMIZER_HIDE_VAR (neg_size); + pcount[-1 ] =PAGE_SIZE / size; + neg_size[-1 ] = -size; + } +else +setup_clear_cpu_cap (X86_FEATURE_CLZERO ); + }/* Leaf 0x1 capabilities filled in early for Xen. */ c->x86_capability[FEATURESET_1d] = edx; c->x86_capability[FEATURESET_1c] = ecx;
xen/arch/x86/include/asm/asm-defns.h +4 -0
@@ -20,6 +20,10 @@ .byte 0x0f, 0x01, 0xdd .endm +.macro clzero + .byte 0x0f, 0x01, 0xfc +.endm +/* * Call a noreturn function. This could be JMP, but CALL results in a more * helpful backtrace. BUG is to catch functions which do decide to return...
xen/arch/x86/include/asm/page.h +3 -2
@@ -219,10 +219,11 @@ typedef struct { u64 pfn; } pagetable_t;#define pagetable_from_paddr (p) pagetable_from_pfn((p)>>PAGE_SHIFT)#define pagetable_null () pagetable_from_pfn(0) -void clear_page_sse2 (void *pg); +void clear_page_hot (void *pg); +void clear_page_cold (void *pg);void copy_page_sse2 (void *to,const void *from); -#define clear_page (_p) clear_page_sse2(_p) +#define clear_page (_p) clear_page_cold(_p)#define copy_page (_t, _f) copy_page_sse2(_t, _f)/* Convert between Xen-heap virtual addresses and machine addresses. */
xen/tools/gen-cpuid.py +4 -0
@@ -212,6 +212,10 @@ def crunch_numbers(state): # the first place. APIC: [X2APIC, TSC_DEADLINE, EXTAPIC], + # The CLZERO insn requires a means to determine the cache line size, + # which is tied to the CLFLUSH insn. + CLFLUSH: [CLZERO], + # AMD built MMXExtentions and 3DNow as extentions to MMX. MMX: [MMXEXT, _3DNOW],
PATCH v4 6/6 mm: allow page scrubbing routine(s) to be arch controlled
In reply to Jan BeulichEspecially when dealing with large amounts of memory, memset() may not be very efficient; this can be bad enough that even for debug builds a custom function is warranted. We additionally want to distinguish "hot" and "cold" cases (with, as initial heuristic, "hot" being for any allocations a domain does for itself, assuming that in all other cases the page wouldn't be accessed [again] soon). The goal is for accesses of "cold" pages to not disturb caches (albeit finding a good balance between this and the higher latency looks to be difficult).
Keep the default fallback to clear_page_*() in common code; this may want to be revisited down the road.
---
v4: Re-base.
v3: Re-base.
v2: New.
---
The choice between hot and cold in scrub_one_page()'s callers is certainly up for discussion / improvement.
xen/arch/arm/include/asm/page.h +6 -0
@@ -144,6 +144,12 @@ extern size_t dcache_line_bytes;#define copy_page (dp, sp) memcpy(dp, sp, PAGE_SIZE) +#define clear_page_hot clear_page +#define clear_page_cold clear_page + +#define scrub_page_hot (page) memset(page, SCRUB_BYTE_PATTERN, PAGE_SIZE) +#define scrub_page_cold scrub_page_hot +static inline size_t read_dcache_line_bytes (void ) {register_t ctr;
xen/arch/ppc/include/asm/page.h +6 -0
@@ -190,6 +190,12 @@ static inline void invalidate_icache(voi#define clear_page (page) memset(page, 0, PAGE_SIZE)#define copy_page (dp, sp) memcpy(dp, sp, PAGE_SIZE) +#define clear_page_hot clear_page +#define clear_page_cold clear_page + +#define scrub_page_hot (page) memset(page, SCRUB_BYTE_PATTERN, PAGE_SIZE) +#define scrub_page_cold scrub_page_hot +/* TODO: Flush the dcache for an entire page. */ static inline void flush_page_to_ram (unsigned long mfn,bool sync_icache) {
xen/arch/riscv/include/asm/page.h +6 -0
@@ -177,6 +177,12 @@ static inline void invalidate_icache(voi#define clear_page (page) memset((void *)(page), 0, PAGE_SIZE)#define copy_page (dp, sp) memcpy(dp, sp, PAGE_SIZE) +#define clear_page_hot clear_page +#define clear_page_cold clear_page + +#define scrub_page_hot (page) memset(page, SCRUB_BYTE_PATTERN, PAGE_SIZE) +#define scrub_page_cold scrub_page_hot +static inline void flush_page_to_ram (unsigned long mfn,bool sync_icache) {const void *v =map_domain_page (_mfn (mfn));
xen/arch/x86/Makefile +1 -0
@@ -59,6 +59,7 @@ obj-y += pci.o obj-y += physdev.o obj-$(CONFIG_COMPAT) += x86_64/physdev.o obj-$(CONFIG_X86_PSR) += psr.o +obj-bin-$(CONFIG_DEBUG) += scrub_page.o obj-y += setup.o obj-y += shutdown.o obj-y += smp.o
xen/arch/x86/include/asm/page.h +5 -0
@@ -226,6 +226,11 @@ void copy_page_sse2(void *to, const void#define clear_page (_p) clear_page_cold(_p)#define copy_page (_t, _f) copy_page_sse2(_t, _f) +#ifdef CONFIG_DEBUG +void scrub_page_hot (void *); +void scrub_page_cold (void *); +#endif +/* Convert between Xen-heap virtual addresses and machine addresses. */ #define __pa (x) (virt_to_maddr(x))#define __va (x) (maddr_to_virt(x))
xen/arch/x86/scrub_page.S new file +39 -0
@@ -0,0 +1,39 @@ + .file __FILE__ + +#include <asm/asm_defns.h> +#include <xen/page-size.h> +#include <xen/scrub.h> + +FUNC(scrub_page_cold) + mov $PAGE_SIZE/32, %ecx + mov $SCRUB_PATTERN, %rax + +0: movnti %rax, (%rdi) + movnti %rax, 8(%rdi) + movnti %rax, 16(%rdi) + movnti %rax, 24(%rdi) + add $32, %rdi + sub $1, %ecx + jnz 0b + + sfence + ret +END(scrub_page_cold) + + .macro scrub_page_stosb + mov $PAGE_SIZE, %ecx + mov $SCRUB_BYTE_PATTERN, %eax + rep stosb + ret + .endm + + .macro scrub_page_stosq + mov $PAGE_SIZE/8, %ecx + mov $SCRUB_PATTERN, %rax + rep stosq + ret + .endm + +FUNC(scrub_page_hot) + ALTERNATIVE scrub_page_stosq, scrub_page_stosb, X86_FEATURE_ERMS +END(scrub_page_hot)
xen/common/page_alloc.c +27 -20
100 lines not on this page · raw message
xen/include/xen/scrub.h new file +24 -0
@@ -0,0 +1,24 @@ +#ifndef __XEN_SCRUB_H__ +#define __XEN_SCRUB_H__ + +#include <xen/const.h> + +/* SCRUB_PATTERN needs to be a repeating series of bytes. */ +#ifdef CONFIG_DEBUG +# define SCRUB_PATTERN _AC(0xc2c2c2c2c2c2c2c2,ULL) +#else +# define SCRUB_PATTERN _AC(0,ULL) +#endif +#define SCRUB_BYTE_PATTERN (SCRUB_PATTERN & 0xff) + +#endif /* __XEN_SCRUB_H__ */ + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/