lkml.org 
[lkml]   [2021]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH Part1 v5 17/38] x86/mm: Add support to validate memory when changing C-bit
From
Date


On 8/25/21 6:06 AM, Borislav Petkov wrote:
>
> I really meant putting the beginning of that string at the very first
> position on the line:
>
> if (WARN(hdr->end_entry > end_entry || cur_entry > hdr->cur_entry,
> "SEV-SNP: PSC processing going backward, end_entry %d (got %d) cur_entry %d (got %d)\n",
> end_entry, hdr->end_entry, cur_entry, hdr->cur_entry)) {
>
> Exactly like this!
>

Noted.

> ...
>
>> +static void set_page_state(unsigned long vaddr, unsigned int npages, int op)
>> +{
>> + unsigned long vaddr_end, next_vaddr;
>> + struct snp_psc_desc *desc;
>> +
>> + vaddr = vaddr & PAGE_MASK;
>> + vaddr_end = vaddr + (npages << PAGE_SHIFT);
>> +
>> + desc = kmalloc(sizeof(*desc), GFP_KERNEL_ACCOUNT);
>
> And again, from previous review:
>
> kzalloc() so that you don't have to memset() later in
> __set_page_state().
>

I replied to your previous comment. Depending on the npages value, the
__set_page_state() will be called multiple times and on each call it
needs to clear desc before populate it. So, I do not see strong reason
to use kzalloc() during the desc allocation. I thought you were okay
with that explanation.


>> + if (!desc)
>> + panic("SEV-SNP: failed to alloc memory for PSC descriptor\n");
>
> "allocate" fits just fine too.
>

Noted.

thanks

\
 
 \ /
  Last update: 2021-08-25 15:55    [W:0.117 / U:1.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site