Skip to contentSkip to conversation

mm/page_alloc: make bootscrub happen in idle-loop

PATCH In review Sergey Dyasli 2 participants 4 messages Nov 7, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mm/page_alloc: make bootscrub happen in idle-loop

Scrubbing RAM during boot may take a long time on machines with lots of RAM. Add 'idle' option to bootscrub which marks all pages dirty initially so they will eventually be scrubbed in idle-loop on every online CPU.

It's guaranteed that the allocator will return scrubbed pages by doing eager scrubbing during allocation (unless MEMF_no_scrub was provided).

Use the new 'idle' option as the default one.

---
v2 --> v3:
- Removed "= 0" from enum bootscrub_mode
- Removed num_online_nodes() from printk()
- Added Reviewed-by

CC Andrew Cooper <[email protected]>
CC Boris Ostrovsky <[email protected]>
CC George Dunlap <[email protected]>
CC Jan Beulich <[email protected]>
CC Julien Grall <[email protected]>
CC Wei Liu <[email protected]>
---
 docs/misc/xen-command-line.markdown |  9 ++++-
 xen/common/page_alloc.c             | 61 +++++++++++++++++++++++++++--
 2 files changed, 64 insertions(+), 6 deletions(-)
docs/misc/xen-command-line.markdown +7 -2
index 2c7046eb86..9028bcde2e 100644
@@ -227,14 +227,19 @@ that byte `0x12345678` is bad, you would place `badpage=0x12345` on
 Xen's command line.
 
 ### bootscrub
-> `= <boolean>`
+> `= idle | <boolean>`
 
-> Default: `true`
+> Default: `idle`
 
 Scrub free RAM during boot.  This is a safety feature to prevent
 accidentally leaking sensitive VM data into other VMs if Xen crashes
 and reboots.
 
+In `idle` mode, RAM is scrubbed in background on all CPUs during idle-loop
+with a guarantee that memory allocations always provide scrubbed pages.
+This option reduces boot time on machines with a large amount of RAM while
+still providing security benefits.
+
 ### bootscrub\_chunk
 > `= <size>`
 
xen/common/page_alloc.c +57 -4

92 lines not on this page · raw message

Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 10 lines · Sergey Dyasli

Scrubbing RAM during boot may take a long time on machines with lots of RAM. Add 'idle' option to bootscrub which marks all pages dirty initially so they will eventually be scrubbed in idle-loop on every online CPU.

It's guaranteed that the allocator will return scrubbed pages by doing eager scrubbing during allocation (unless MEMF_no_scrub was provided).

Use the new 'idle' option as the default one.

Quoted 7 lines

---
v2 --> v3:
- Removed "= 0" from enum bootscrub_mode
- Removed num_online_nodes() from printk()
- Added Reviewed-by

I think your patch (v2?) is already committed.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 19 lines · Wei Liu
Quoted 10 lines · Sergey Dyasli

Scrubbing RAM during boot may take a long time on machines with lots of RAM. Add 'idle' option to bootscrub which marks all pages dirty initially so they will eventually be scrubbed in idle-loop on every online CPU.

It's guaranteed that the allocator will return scrubbed pages by doing eager scrubbing during allocation (unless MEMF_no_scrub was provided).

Use the new 'idle' option as the default one.

Quoted 7 lines

---
v2 --> v3:
- Removed "= 0" from enum bootscrub_mode
- Removed num_online_nodes() from printk()
- Added Reviewed-by

Quoted 1 line

I think your patch (v2?) is already committed.

Hmm, you are right: CommitDate: Wed Nov 7 09:34:17 2018 +0100 Sorry, I wasn't expecting that.

Though printk() in the committed version has a typo:

    printk("Scrubbing free RAM on in background\n");
                               ^^

--
Thanks,
Sergey

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 22 lines · Sergey Dyasli
Quoted 19 lines · Wei Liu
Quoted 10 lines · Sergey Dyasli

Scrubbing RAM during boot may take a long time on machines with lots of RAM. Add 'idle' option to bootscrub which marks all pages dirty initially so they will eventually be scrubbed in idle-loop on every online CPU.

It's guaranteed that the allocator will return scrubbed pages by doing eager scrubbing during allocation (unless MEMF_no_scrub was provided).

Use the new 'idle' option as the default one.

Quoted 7 lines

---
v2 --> v3:
- Removed "= 0" from enum bootscrub_mode
- Removed num_online_nodes() from printk()
- Added Reviewed-by

Quoted 1 line

I think your patch (v2?) is already committed.

Quoted 7 lines

Hmm, you are right: CommitDate: Wed Nov 7 09:34:17 2018 +0100 Sorry, I wasn't expecting that.

Though printk() in the committed version has a typo:

    printk("Scrubbing free RAM on in background\n");
                               ^^

Feel free to send a followup patch to fix that.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel