RE: Does earlyprintk=ttyS0 work for an AMD SNP guest on KVM?

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

 



> From: Jeremi Piotrowski <jpiotrowski@xxxxxxxxxxxxxxxxxxx>
> Sent: Thursday, February 16, 2023 1:15 AM
> > ...
> > alloc_pgt_page() fails to allocate memory because both
> > pages->pgt_buf_offset and pages->pgt_buf_size are zero.
> >
> >
> > pgt_data.pgt_buf_size is zero because of this line in
> > initialize_identity_maps()
> >      pgt_data.pgt_buf_size = BOOT_PGT_SIZE - BOOT_INIT_PGT_SIZE;
> >
> > void initialize_identity_maps(void *rmode)
> > {
> > ...
> >         top_level_pgt = read_cr3_pa();
> >         if (p4d_offset((pgd_t *)top_level_pgt, 0) == (p4d_t *)_pgtable) {
> >                 pgt_data.pgt_buf = _pgtable + BOOT_INIT_PGT_SIZE;
> >                 pgt_data.pgt_buf_size = BOOT_PGT_SIZE -
> > BOOT_INIT_PGT_SIZE;
> >                 memset(pgt_data.pgt_buf, 0, pgt_data.pgt_buf_size);
> >         } else {
> >                 pgt_data.pgt_buf = _pgtable;
> >                 pgt_data.pgt_buf_size = BOOT_PGT_SIZE;
> >                 memset(pgt_data.pgt_buf, 0, pgt_data.pgt_buf_size);
> >                 top_level_pgt = (unsigned
> > long)alloc_pgt_page(&pgt_data);
> 
> I just tested an SNP guest on KVM with and without
> CONFIG_RANDOMIZE_BASE.
> In both cases we end up in the else() branch.
> With CONFIG_RANDOMIZE_BASE BOOT_PGT_SIZE=0x13000
> Without CONFIG_RANDOMMIZE_BASE BOOT_PGT_SIZE=0x6000.
> 
> So in both cases pgt_data.pgt_buf_size != 0.
> 
> Getting into that first branch would require having 5-level paging supported
> (CONFIG_X86_5LEVEL=y) and enabled inside the guest, I don't have that on
> any
> hardware I have access to.
> 
> Jeremi

CONFIG_X86_5LEVEL is not set for my kernel.

The comment before the first branch says:
  On 4-level paging, p4d_offset(top_level_pgt, 0) is equal to 'top_level_pgt'.

IIUC this means 'top_level_pgt' is equal to '_pgtable'? i.e. without 
CONFIG_RANDOMIZE_BASE, pgt_data.pgt_buf_size should be 0.

Not sure why it's not getting into the first branch for you.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux