linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SEV guest regression in 4.18
@ 2018-08-20 22:11 Brijesh Singh
  2018-08-21  8:39 ` Borislav Petkov
  0 siblings, 1 reply; 17+ messages in thread
From: Brijesh Singh @ 2018-08-20 22:11 UTC (permalink / raw)
  To: x86
  Cc: brijesh.singh, linux-kernel, kvm, Lendacky, Thomas,
	Borislav Petkov, Thomas Gleixner, Paolo Bonzini, Pavel Tatashin

Hi All,

The following commit

"
x86/kvmclock: Remove memblock dependency

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=368a540e0232ad446931f5a4e8a5e06f69f21343

"
broke the SEV support in 4.18.

Since the guest physical address holding the wall_clock and
vcpu_time_info are shared with the hypervisor  it must be mapped
as "decrypted" when SEV is active. To clear the C-bit we use 
kernel_physical_mapping_init() to split the large pages into 4K before
changing the C-bit. Now the kernel_physical_mapping_init() is failing to
allocate the memory because its called very early.

[    0.000000] Call Trace:
[    0.000000]  ? dump_stack+0x5c/0x80
[    0.000000]  ? panic+0xe7/0x247
[    0.000000]  ? alloc_low_pages+0x130/0x130
[    0.000000]  ? kernel_physical_mapping_init+0xe0/0x204
[    0.000000]  ? early_set_memory_enc_dec+0x123/0x174
[    0.000000]  ? 0xffffffffae000000
[    0.000000]  ? kvmclock_init+0x60/0x1ea
[    0.000000]  ? kvm_init_platform+0xa/0x16
[    0.000000]  ? setup_arch+0x434/0xce9
[    0.000000]  ? start_kernel+0x67/0x52e
[    0.000000]  ? load_ucode_bsp+0x76/0x12e
[    0.000000]  ? secondary_startup_64+0xa4/0xb0

I don't have proper solution to fix it. I have the following two
approaches in mind:

1)
  - reserve  a few pages in head_64.S
  - pass a flag in kernel_physical_mapping_init() to tell it to use
    the preallocated pages instead of alloc_low_pages().

or

2)
  - update hv_clock_boot and hv_clock_boot to align PMD_SIZE
  - when variables are PMD_SIZE aligned then we do not need to
    split the pages hence avoid the allocation issue.

Since the variables are static hence we also need to update the contents 
to match with updated C-bit. Currently, we use sme_early_decrypt() to
perform in-place decrypt but this routines can not be called before
pat_init() hence we probably need to do come up with some other approach
for this as well.


Any suggestions/recommendations ?


Thanks
Brijesh

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-08-25  4:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20 22:11 SEV guest regression in 4.18 Brijesh Singh
2018-08-21  8:39 ` Borislav Petkov
2018-08-21 14:37   ` Brijesh Singh
2018-08-21 15:19     ` Borislav Petkov
2018-08-21 16:07       ` Brijesh Singh
2018-08-22  8:14         ` Borislav Petkov
2018-08-22 15:00           ` Sean Christopherson
2018-08-22 20:11             ` Brijesh Singh
2018-08-23 11:26               ` Paolo Bonzini
2018-08-23 15:29                 ` Sean Christopherson
2018-08-23 16:16                   ` Paolo Bonzini
2018-08-24 15:41                     ` Brijesh Singh
2018-08-24 15:50                       ` Paolo Bonzini
2018-08-24 18:47                         ` Brijesh Singh
2018-08-25  4:47                           ` Borislav Petkov
2018-08-24 16:24                       ` Sean Christopherson
2018-08-24 18:48                         ` Brijesh Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).