[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 8/8] mm: Make sure pages are scrubbed



>>> On 19.05.17 at 17:50, <boris.ostrovsky@xxxxxxxxxx> wrote:
> --- a/xen/Kconfig.debug
> +++ b/xen/Kconfig.debug
> @@ -114,6 +114,13 @@ config DEVICE_TREE_DEBUG
>         logged in the Xen ring buffer.
>         If unsure, say N here.
>  
> +config SCRUB_DEBUG
> +    bool "Page scrubbing test"
> +    default DEBUG
> +    ---help---

Indentation.

> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -170,6 +170,10 @@ boolean_param("bootscrub", opt_bootscrub);
>  static unsigned long __initdata opt_bootscrub_chunk = MB(128);
>  size_param("bootscrub_chunk", opt_bootscrub_chunk);
>  
> +#ifdef CONFIG_SCRUB_DEBUG
> +static bool boot_scrub_done;

It's not all that important as it's debugging code only, but -
__read_mostly?

> +static void check_one_page(struct page_info *pg)
> +{
> +#ifdef CONFIG_SCRUB_DEBUG
> +    mfn_t mfn = _mfn(page_to_mfn(pg));
> +    uint64_t *ptr;

const

> +    unsigned i;

unsigned int

> @@ -2269,7 +2325,8 @@ void scrub_one_page(struct page_info *pg)
>  
>  #ifndef NDEBUG
>      /* Avoid callers relying on allocations returning zeroed pages. */
> -    unmap_domain_page(memset(__map_domain_page(pg), 0xc2, PAGE_SIZE));
> +    unmap_domain_page(memset(__map_domain_page(pg),
> +                             SCRUB_BYTE_PATTERN, PAGE_SIZE));
>  #else
>      /* For a production build, clear_page() is the fastest way to scrub. */
>      clear_domain_page(_mfn(page_to_mfn(pg)));

With EXPERT=y SCRUB_DEBUG can also be selected for non-debug
builds, in which case they will be zeroed but check_one_page() will
nevertheless check for the non-zero pattern. IOW I think the
pattern needs to be zero for non-debug builds, at which point the
#if here would probably better check whether the pattern is non-
zero.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.