* SNP guest crash in memblock with unaccepted memory
@ 2025-04-27 15:01 Tom Lendacky
2025-04-28 14:04 ` David Hildenbrand
0 siblings, 1 reply; 8+ messages in thread
From: Tom Lendacky @ 2025-04-27 15:01 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Andrew Morton, Mike Rapoport, David Hildenbrand, Vlastimil Babka,
Mel Gorman, Kalra, Ashish, Rick Edgecombe, linux-mm, linux-coco,
linux-kernel, Michael Roth
Hi Kirill,
Every now and then I experience an SNP guest boot failure for accessing
memory that hasn't been accepted. I managed to get a back trace:
RIP: 0010:memcpy_orig+0x68/0x130
Code: ...
RSP: 0000:ffffffff9cc03ce8 EFLAGS: 00010006
RAX: ff11001ff83e5000 RBX: 0000000000000000 RCX: fffffffffffff000
RDX: 0000000000000bc0 RSI: ffffffff9dba8860 RDI: ff11001ff83e5c00
RBP: 0000000000002000 R08: 0000000000000000 R09: 0000000000002000
R10: 000000207fffe000 R11: 0000040000000000 R12: ffffffff9d06ef78
R13: ff11001ff83e5000 R14: ffffffff9dba7c60 R15: 0000000000000c00
memblock_double_array+0xff/0x310
memblock_add_range+0x1fb/0x2f0
memblock_reserve+0x4f/0xa0
memblock_alloc_range_nid+0xac/0x130
memblock_alloc_internal+0x53/0xc0
memblock_alloc_try_nid+0x3d/0xa0
swiotlb_init_remap+0x149/0x2f0
mem_init+0xb/0xb0
mm_core_init+0x8f/0x350
start_kernel+0x17e/0x5d0
x86_64_start_reservations+0x14/0x30
x86_64_start_kernel+0x92/0xa0
secondary_startup_64_no_verify+0x194/0x19b
I don't know a lot about memblock, but it appears that it needs to
allocate more memory for it's regions array and returns a range of memory
that hasn't been accepted. When the memcpy() runs, the SNP guest gets a
#VC 0x404 because of this.
Do you think it is as simple as calling accept_memory() on the memory
range returned from memblock_find_in_range() in memblock_double_array()?
Thanks,
Tom
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SNP guest crash in memblock with unaccepted memory
2025-04-27 15:01 SNP guest crash in memblock with unaccepted memory Tom Lendacky
@ 2025-04-28 14:04 ` David Hildenbrand
2025-04-28 18:10 ` Tom Lendacky
2025-04-30 9:14 ` Kirill A. Shutemov
0 siblings, 2 replies; 8+ messages in thread
From: David Hildenbrand @ 2025-04-28 14:04 UTC (permalink / raw)
To: Tom Lendacky, Kirill A. Shutemov
Cc: Andrew Morton, Mike Rapoport, Vlastimil Babka, Mel Gorman, Kalra,
Ashish, Rick Edgecombe, linux-mm, linux-coco, linux-kernel,
Michael Roth
On 27.04.25 17:01, Tom Lendacky wrote:
> Hi Kirill,
>
> Every now and then I experience an SNP guest boot failure for accessing
> memory that hasn't been accepted. I managed to get a back trace:
>
> RIP: 0010:memcpy_orig+0x68/0x130
> Code: ...
> RSP: 0000:ffffffff9cc03ce8 EFLAGS: 00010006
> RAX: ff11001ff83e5000 RBX: 0000000000000000 RCX: fffffffffffff000
> RDX: 0000000000000bc0 RSI: ffffffff9dba8860 RDI: ff11001ff83e5c00
> RBP: 0000000000002000 R08: 0000000000000000 R09: 0000000000002000
> R10: 000000207fffe000 R11: 0000040000000000 R12: ffffffff9d06ef78
> R13: ff11001ff83e5000 R14: ffffffff9dba7c60 R15: 0000000000000c00
> memblock_double_array+0xff/0x310
> memblock_add_range+0x1fb/0x2f0
> memblock_reserve+0x4f/0xa0
> memblock_alloc_range_nid+0xac/0x130
> memblock_alloc_internal+0x53/0xc0
> memblock_alloc_try_nid+0x3d/0xa0
> swiotlb_init_remap+0x149/0x2f0
> mem_init+0xb/0xb0
> mm_core_init+0x8f/0x350
> start_kernel+0x17e/0x5d0
> x86_64_start_reservations+0x14/0x30
> x86_64_start_kernel+0x92/0xa0
> secondary_startup_64_no_verify+0x194/0x19b
>
> I don't know a lot about memblock, but it appears that it needs to
> allocate more memory for it's regions array and returns a range of memory
> that hasn't been accepted. When the memcpy() runs, the SNP guest gets a
> #VC 0x404 because of this.
>
> Do you think it is as simple as calling accept_memory() on the memory
> range returned from memblock_find_in_range() in memblock_double_array()?
(not Kirill, but replying :) )
Yeah, we seem to be effectively allocating memory from memblock ("from
ourselves") without considering that memory must be accepted first.
accept_memory() on the new memory (in case of !slab) should be the right
thing to do.
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SNP guest crash in memblock with unaccepted memory
2025-04-28 14:04 ` David Hildenbrand
@ 2025-04-28 18:10 ` Tom Lendacky
2025-04-28 21:00 ` David Hildenbrand
2025-04-29 7:33 ` Mike Rapoport
2025-04-30 9:14 ` Kirill A. Shutemov
1 sibling, 2 replies; 8+ messages in thread
From: Tom Lendacky @ 2025-04-28 18:10 UTC (permalink / raw)
To: David Hildenbrand, Kirill A. Shutemov
Cc: Andrew Morton, Mike Rapoport, Vlastimil Babka, Mel Gorman, Kalra,
Ashish, Rick Edgecombe, linux-mm, linux-coco, linux-kernel,
Michael Roth
On 4/28/25 09:04, David Hildenbrand wrote:
> On 27.04.25 17:01, Tom Lendacky wrote:
>> Hi Kirill,
>>
>> Every now and then I experience an SNP guest boot failure for accessing
>> memory that hasn't been accepted. I managed to get a back trace:
>>
>> RIP: 0010:memcpy_orig+0x68/0x130
>> Code: ...
>> RSP: 0000:ffffffff9cc03ce8 EFLAGS: 00010006
>> RAX: ff11001ff83e5000 RBX: 0000000000000000 RCX: fffffffffffff000
>> RDX: 0000000000000bc0 RSI: ffffffff9dba8860 RDI: ff11001ff83e5c00
>> RBP: 0000000000002000 R08: 0000000000000000 R09: 0000000000002000
>> R10: 000000207fffe000 R11: 0000040000000000 R12: ffffffff9d06ef78
>> R13: ff11001ff83e5000 R14: ffffffff9dba7c60 R15: 0000000000000c00
>> memblock_double_array+0xff/0x310
>> memblock_add_range+0x1fb/0x2f0
>> memblock_reserve+0x4f/0xa0
>> memblock_alloc_range_nid+0xac/0x130
>> memblock_alloc_internal+0x53/0xc0
>> memblock_alloc_try_nid+0x3d/0xa0
>> swiotlb_init_remap+0x149/0x2f0
>> mem_init+0xb/0xb0
>> mm_core_init+0x8f/0x350
>> start_kernel+0x17e/0x5d0
>> x86_64_start_reservations+0x14/0x30
>> x86_64_start_kernel+0x92/0xa0
>> secondary_startup_64_no_verify+0x194/0x19b
>>
>> I don't know a lot about memblock, but it appears that it needs to
>> allocate more memory for it's regions array and returns a range of memory
>> that hasn't been accepted. When the memcpy() runs, the SNP guest gets a
>> #VC 0x404 because of this.
>>
>> Do you think it is as simple as calling accept_memory() on the memory
>> range returned from memblock_find_in_range() in memblock_double_array()?
>
> (not Kirill, but replying :) )
>
> Yeah, we seem to be effectively allocating memory from memblock ("from
> ourselves") without considering that memory must be accepted first.
>
> accept_memory() on the new memory (in case of !slab) should be the right
> thing to do.
Thanks, David. Let me add a call in for accept_memory in the !slab case
and see if that resolves it. May take a bit to repro, but should find
out eventually.
I'll submit a patch once I verify.
Thanks,
Tom
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SNP guest crash in memblock with unaccepted memory
2025-04-28 18:10 ` Tom Lendacky
@ 2025-04-28 21:00 ` David Hildenbrand
2025-04-29 7:46 ` Mike Rapoport
2025-04-29 7:33 ` Mike Rapoport
1 sibling, 1 reply; 8+ messages in thread
From: David Hildenbrand @ 2025-04-28 21:00 UTC (permalink / raw)
To: Tom Lendacky, Kirill A. Shutemov
Cc: Andrew Morton, Mike Rapoport, Vlastimil Babka, Mel Gorman, Kalra,
Ashish, Rick Edgecombe, linux-mm, linux-coco, linux-kernel,
Michael Roth
On 28.04.25 20:10, Tom Lendacky wrote:
> On 4/28/25 09:04, David Hildenbrand wrote:
>> On 27.04.25 17:01, Tom Lendacky wrote:
>>> Hi Kirill,
>>>
>>> Every now and then I experience an SNP guest boot failure for accessing
>>> memory that hasn't been accepted. I managed to get a back trace:
>>>
>>> RIP: 0010:memcpy_orig+0x68/0x130
>>> Code: ...
>>> RSP: 0000:ffffffff9cc03ce8 EFLAGS: 00010006
>>> RAX: ff11001ff83e5000 RBX: 0000000000000000 RCX: fffffffffffff000
>>> RDX: 0000000000000bc0 RSI: ffffffff9dba8860 RDI: ff11001ff83e5c00
>>> RBP: 0000000000002000 R08: 0000000000000000 R09: 0000000000002000
>>> R10: 000000207fffe000 R11: 0000040000000000 R12: ffffffff9d06ef78
>>> R13: ff11001ff83e5000 R14: ffffffff9dba7c60 R15: 0000000000000c00
>>> memblock_double_array+0xff/0x310
>>> memblock_add_range+0x1fb/0x2f0
>>> memblock_reserve+0x4f/0xa0
>>> memblock_alloc_range_nid+0xac/0x130
>>> memblock_alloc_internal+0x53/0xc0
>>> memblock_alloc_try_nid+0x3d/0xa0
>>> swiotlb_init_remap+0x149/0x2f0
>>> mem_init+0xb/0xb0
>>> mm_core_init+0x8f/0x350
>>> start_kernel+0x17e/0x5d0
>>> x86_64_start_reservations+0x14/0x30
>>> x86_64_start_kernel+0x92/0xa0
>>> secondary_startup_64_no_verify+0x194/0x19b
>>>
>>> I don't know a lot about memblock, but it appears that it needs to
>>> allocate more memory for it's regions array and returns a range of memory
>>> that hasn't been accepted. When the memcpy() runs, the SNP guest gets a
>>> #VC 0x404 because of this.
>>>
>>> Do you think it is as simple as calling accept_memory() on the memory
>>> range returned from memblock_find_in_range() in memblock_double_array()?
>>
>> (not Kirill, but replying :) )
>>
>> Yeah, we seem to be effectively allocating memory from memblock ("from
>> ourselves") without considering that memory must be accepted first.
>>
>> accept_memory() on the new memory (in case of !slab) should be the right
>> thing to do.
>
> Thanks, David. Let me add a call in for accept_memory in the !slab case
> and see if that resolves it. May take a bit to repro, but should find
> out eventually.
>
> I'll submit a patch once I verify.
BTW, I was wondering if we could use memblock_alloc_range_nid() in
memblock_double_array(); maybe not that easy, just a thought.
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SNP guest crash in memblock with unaccepted memory
2025-04-28 18:10 ` Tom Lendacky
2025-04-28 21:00 ` David Hildenbrand
@ 2025-04-29 7:33 ` Mike Rapoport
1 sibling, 0 replies; 8+ messages in thread
From: Mike Rapoport @ 2025-04-29 7:33 UTC (permalink / raw)
To: Tom Lendacky
Cc: David Hildenbrand, Kirill A. Shutemov, Andrew Morton,
Vlastimil Babka, Mel Gorman, Kalra, Ashish, Rick Edgecombe,
linux-mm, linux-coco, linux-kernel, Michael Roth
On Mon, Apr 28, 2025 at 01:10:31PM -0500, Tom Lendacky wrote:
> On 4/28/25 09:04, David Hildenbrand wrote:
> > On 27.04.25 17:01, Tom Lendacky wrote:
> >> Hi Kirill,
> >>
> >> Every now and then I experience an SNP guest boot failure for accessing
> >> memory that hasn't been accepted. I managed to get a back trace:
> >>
> >> RIP: 0010:memcpy_orig+0x68/0x130
> >> Code: ...
> >> RSP: 0000:ffffffff9cc03ce8 EFLAGS: 00010006
> >> RAX: ff11001ff83e5000 RBX: 0000000000000000 RCX: fffffffffffff000
> >> RDX: 0000000000000bc0 RSI: ffffffff9dba8860 RDI: ff11001ff83e5c00
> >> RBP: 0000000000002000 R08: 0000000000000000 R09: 0000000000002000
> >> R10: 000000207fffe000 R11: 0000040000000000 R12: ffffffff9d06ef78
> >> R13: ff11001ff83e5000 R14: ffffffff9dba7c60 R15: 0000000000000c00
> >> memblock_double_array+0xff/0x310
> >> memblock_add_range+0x1fb/0x2f0
> >> memblock_reserve+0x4f/0xa0
> >> memblock_alloc_range_nid+0xac/0x130
> >> memblock_alloc_internal+0x53/0xc0
> >> memblock_alloc_try_nid+0x3d/0xa0
> >> swiotlb_init_remap+0x149/0x2f0
> >> mem_init+0xb/0xb0
> >> mm_core_init+0x8f/0x350
> >> start_kernel+0x17e/0x5d0
> >> x86_64_start_reservations+0x14/0x30
> >> x86_64_start_kernel+0x92/0xa0
> >> secondary_startup_64_no_verify+0x194/0x19b
> >>
> >> I don't know a lot about memblock, but it appears that it needs to
> >> allocate more memory for it's regions array and returns a range of memory
> >> that hasn't been accepted. When the memcpy() runs, the SNP guest gets a
> >> #VC 0x404 because of this.
> >>
> >> Do you think it is as simple as calling accept_memory() on the memory
> >> range returned from memblock_find_in_range() in memblock_double_array()?
> >
> > (not Kirill, but replying :) )
> >
> > Yeah, we seem to be effectively allocating memory from memblock ("from
> > ourselves") without considering that memory must be accepted first.
> >
> > accept_memory() on the new memory (in case of !slab) should be the right
> > thing to do.
>
> Thanks, David. Let me add a call in for accept_memory in the !slab case
> and see if that resolves it. May take a bit to repro, but should find
> out eventually.
I think sticking a loop of memblock_alloc() somewhere before mm_core_init()
should trigger the issue.
> I'll submit a patch once I verify.
>
> Thanks,
> Tom
>
> >
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SNP guest crash in memblock with unaccepted memory
2025-04-28 21:00 ` David Hildenbrand
@ 2025-04-29 7:46 ` Mike Rapoport
0 siblings, 0 replies; 8+ messages in thread
From: Mike Rapoport @ 2025-04-29 7:46 UTC (permalink / raw)
To: David Hildenbrand
Cc: Tom Lendacky, Kirill A. Shutemov, Andrew Morton, Vlastimil Babka,
Mel Gorman, Kalra, Ashish, Rick Edgecombe, linux-mm, linux-coco,
linux-kernel, Michael Roth
On Mon, Apr 28, 2025 at 11:00:36PM +0200, David Hildenbrand wrote:
> On 28.04.25 20:10, Tom Lendacky wrote:
> > On 4/28/25 09:04, David Hildenbrand wrote:
> > > On 27.04.25 17:01, Tom Lendacky wrote:
> > > > Hi Kirill,
> > > >
> > > > Every now and then I experience an SNP guest boot failure for accessing
> > > > memory that hasn't been accepted. I managed to get a back trace:
> > > >
> > > > RIP: 0010:memcpy_orig+0x68/0x130
> > > > Code: ...
> > > > RSP: 0000:ffffffff9cc03ce8 EFLAGS: 00010006
> > > > RAX: ff11001ff83e5000 RBX: 0000000000000000 RCX: fffffffffffff000
> > > > RDX: 0000000000000bc0 RSI: ffffffff9dba8860 RDI: ff11001ff83e5c00
> > > > RBP: 0000000000002000 R08: 0000000000000000 R09: 0000000000002000
> > > > R10: 000000207fffe000 R11: 0000040000000000 R12: ffffffff9d06ef78
> > > > R13: ff11001ff83e5000 R14: ffffffff9dba7c60 R15: 0000000000000c00
> > > > memblock_double_array+0xff/0x310
> > > > memblock_add_range+0x1fb/0x2f0
> > > > memblock_reserve+0x4f/0xa0
> > > > memblock_alloc_range_nid+0xac/0x130
> > > > memblock_alloc_internal+0x53/0xc0
> > > > memblock_alloc_try_nid+0x3d/0xa0
> > > > swiotlb_init_remap+0x149/0x2f0
> > > > mem_init+0xb/0xb0
> > > > mm_core_init+0x8f/0x350
> > > > start_kernel+0x17e/0x5d0
> > > > x86_64_start_reservations+0x14/0x30
> > > > x86_64_start_kernel+0x92/0xa0
> > > > secondary_startup_64_no_verify+0x194/0x19b
> > > >
> > > > I don't know a lot about memblock, but it appears that it needs to
> > > > allocate more memory for it's regions array and returns a range of memory
> > > > that hasn't been accepted. When the memcpy() runs, the SNP guest gets a
> > > > #VC 0x404 because of this.
> > > >
> > > > Do you think it is as simple as calling accept_memory() on the memory
> > > > range returned from memblock_find_in_range() in memblock_double_array()?
> > >
> > > (not Kirill, but replying :) )
> > >
> > > Yeah, we seem to be effectively allocating memory from memblock ("from
> > > ourselves") without considering that memory must be accepted first.
> > >
> > > accept_memory() on the new memory (in case of !slab) should be the right
> > > thing to do.
> >
> > Thanks, David. Let me add a call in for accept_memory in the !slab case
> > and see if that resolves it. May take a bit to repro, but should find
> > out eventually.
> >
> > I'll submit a patch once I verify.
>
> BTW, I was wondering if we could use memblock_alloc_range_nid() in
> memblock_double_array(); maybe not that easy, just a thought.
Not easy at all for memblock.reserved, memblock_double_array() makes sure
to avoid memory that's being reserved in this call chain:
memblock_alloc_range_nid()
memblock_reserve()
memblock_add_range()
memblock_double_array()
> --
> Cheers,
>
> David / dhildenb
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SNP guest crash in memblock with unaccepted memory
2025-04-28 14:04 ` David Hildenbrand
2025-04-28 18:10 ` Tom Lendacky
@ 2025-04-30 9:14 ` Kirill A. Shutemov
2025-04-30 14:39 ` Mike Rapoport
1 sibling, 1 reply; 8+ messages in thread
From: Kirill A. Shutemov @ 2025-04-30 9:14 UTC (permalink / raw)
To: Mike Rapoport, David Hildenbrand
Cc: Tom Lendacky, Andrew Morton, Vlastimil Babka, Mel Gorman, Kalra,
Ashish, Rick Edgecombe, linux-mm, linux-coco, linux-kernel,
Michael Roth
On Mon, Apr 28, 2025 at 04:04:50PM +0200, David Hildenbrand wrote:
> On 27.04.25 17:01, Tom Lendacky wrote:
> > Hi Kirill,
> >
> > Every now and then I experience an SNP guest boot failure for accessing
> > memory that hasn't been accepted. I managed to get a back trace:
> >
> > RIP: 0010:memcpy_orig+0x68/0x130
> > Code: ...
> > RSP: 0000:ffffffff9cc03ce8 EFLAGS: 00010006
> > RAX: ff11001ff83e5000 RBX: 0000000000000000 RCX: fffffffffffff000
> > RDX: 0000000000000bc0 RSI: ffffffff9dba8860 RDI: ff11001ff83e5c00
> > RBP: 0000000000002000 R08: 0000000000000000 R09: 0000000000002000
> > R10: 000000207fffe000 R11: 0000040000000000 R12: ffffffff9d06ef78
> > R13: ff11001ff83e5000 R14: ffffffff9dba7c60 R15: 0000000000000c00
> > memblock_double_array+0xff/0x310
> > memblock_add_range+0x1fb/0x2f0
> > memblock_reserve+0x4f/0xa0
> > memblock_alloc_range_nid+0xac/0x130
> > memblock_alloc_internal+0x53/0xc0
> > memblock_alloc_try_nid+0x3d/0xa0
> > swiotlb_init_remap+0x149/0x2f0
> > mem_init+0xb/0xb0
> > mm_core_init+0x8f/0x350
> > start_kernel+0x17e/0x5d0
> > x86_64_start_reservations+0x14/0x30
> > x86_64_start_kernel+0x92/0xa0
> > secondary_startup_64_no_verify+0x194/0x19b
> >
> > I don't know a lot about memblock, but it appears that it needs to
> > allocate more memory for it's regions array and returns a range of memory
> > that hasn't been accepted. When the memcpy() runs, the SNP guest gets a
> > #VC 0x404 because of this.
> >
> > Do you think it is as simple as calling accept_memory() on the memory
> > range returned from memblock_find_in_range() in memblock_double_array()?
>
> (not Kirill, but replying :) )
>
> Yeah, we seem to be effectively allocating memory from memblock ("from
> ourselves") without considering that memory must be accepted first.
>
> accept_memory() on the new memory (in case of !slab) should be the right
> thing to do.
Right, it should do the trick.
BTW, Mike, is there any other codepath where memblock allocates memory for
itself? We need to cover them too.
--
Kiryl Shutsemau / Kirill A. Shutemov
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SNP guest crash in memblock with unaccepted memory
2025-04-30 9:14 ` Kirill A. Shutemov
@ 2025-04-30 14:39 ` Mike Rapoport
0 siblings, 0 replies; 8+ messages in thread
From: Mike Rapoport @ 2025-04-30 14:39 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: David Hildenbrand, Tom Lendacky, Andrew Morton, Vlastimil Babka,
Mel Gorman, Kalra, Ashish, Rick Edgecombe, linux-mm, linux-coco,
linux-kernel, Michael Roth
On Wed, Apr 30, 2025 at 12:14:08PM +0300, Kirill A. Shutemov wrote:
> On Mon, Apr 28, 2025 at 04:04:50PM +0200, David Hildenbrand wrote:
> > On 27.04.25 17:01, Tom Lendacky wrote:
> > > Hi Kirill,
> > >
> > > Every now and then I experience an SNP guest boot failure for accessing
> > > memory that hasn't been accepted. I managed to get a back trace:
> > >
> > > RIP: 0010:memcpy_orig+0x68/0x130
> > > Code: ...
> > > RSP: 0000:ffffffff9cc03ce8 EFLAGS: 00010006
> > > RAX: ff11001ff83e5000 RBX: 0000000000000000 RCX: fffffffffffff000
> > > RDX: 0000000000000bc0 RSI: ffffffff9dba8860 RDI: ff11001ff83e5c00
> > > RBP: 0000000000002000 R08: 0000000000000000 R09: 0000000000002000
> > > R10: 000000207fffe000 R11: 0000040000000000 R12: ffffffff9d06ef78
> > > R13: ff11001ff83e5000 R14: ffffffff9dba7c60 R15: 0000000000000c00
> > > memblock_double_array+0xff/0x310
> > > memblock_add_range+0x1fb/0x2f0
> > > memblock_reserve+0x4f/0xa0
> > > memblock_alloc_range_nid+0xac/0x130
> > > memblock_alloc_internal+0x53/0xc0
> > > memblock_alloc_try_nid+0x3d/0xa0
> > > swiotlb_init_remap+0x149/0x2f0
> > > mem_init+0xb/0xb0
> > > mm_core_init+0x8f/0x350
> > > start_kernel+0x17e/0x5d0
> > > x86_64_start_reservations+0x14/0x30
> > > x86_64_start_kernel+0x92/0xa0
> > > secondary_startup_64_no_verify+0x194/0x19b
> > >
> > > I don't know a lot about memblock, but it appears that it needs to
> > > allocate more memory for it's regions array and returns a range of memory
> > > that hasn't been accepted. When the memcpy() runs, the SNP guest gets a
> > > #VC 0x404 because of this.
> > >
> > > Do you think it is as simple as calling accept_memory() on the memory
> > > range returned from memblock_find_in_range() in memblock_double_array()?
> >
> > (not Kirill, but replying :) )
> >
> > Yeah, we seem to be effectively allocating memory from memblock ("from
> > ourselves") without considering that memory must be accepted first.
> >
> > accept_memory() on the new memory (in case of !slab) should be the right
> > thing to do.
>
> Right, it should do the trick.
>
> BTW, Mike, is there any other codepath where memblock allocates memory for
> itself? We need to cover them too.
memblock_double_arrayi() is the only place where memblock allocates memory
for itself.
> --
> Kiryl Shutsemau / Kirill A. Shutemov
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-04-30 14:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-27 15:01 SNP guest crash in memblock with unaccepted memory Tom Lendacky
2025-04-28 14:04 ` David Hildenbrand
2025-04-28 18:10 ` Tom Lendacky
2025-04-28 21:00 ` David Hildenbrand
2025-04-29 7:46 ` Mike Rapoport
2025-04-29 7:33 ` Mike Rapoport
2025-04-30 9:14 ` Kirill A. Shutemov
2025-04-30 14:39 ` Mike Rapoport
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox