Re: [RFCv2 10/37] KVM: s390: protvirt: Secure memory is not mergeable

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

 



On 04.02.20 13:53, Christian Borntraeger wrote:
> 
> 
> On 04.02.20 13:15, David Hildenbrand wrote:
>>
>>>   * Enable storage key handling from now on and initialize the storage
>>>   * keys with the default key.
>>> @@ -2593,7 +2610,6 @@ static const struct mm_walk_ops enable_skey_walk_ops = {
>>>  int s390_enable_skey(void)
>>>  {
>>>  	struct mm_struct *mm = current->mm;
>>> -	struct vm_area_struct *vma;
>>>  	int rc = 0;
>>>  
>>>  	down_write(&mm->mmap_sem);
>>> @@ -2601,15 +2617,7 @@ int s390_enable_skey(void)
>>>  		goto out_up;
>>>  
>>>  	mm->context.uses_skeys = 1;
>>> -	for (vma = mm->mmap; vma; vma = vma->vm_next) {
>>> -		if (ksm_madvise(vma, vma->vm_start, vma->vm_end,
>>> -				MADV_UNMERGEABLE, &vma->vm_flags)) {
>>> -			mm->context.uses_skeys = 0;
>>> -			rc = -ENOMEM;
>>> -			goto out_up;
>>> -		}
>>> -	}
>>> -	mm->def_flags &= ~VM_MERGEABLE;
>>> +	gmap_mark_unmergeable();
>>
>>
>> I think I already complained about this patch *as is* and there was an
>> update. (ignoring errors, mm->context.uses_skeys handling in
>> gmap_mark_unmergeable() etc.)
>>
> Right something like this on top:
> 
> diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
> index bf365a09f900..b95bf40bb7a7 100644
> --- a/arch/s390/mm/gmap.c
> +++ b/arch/s390/mm/gmap.c
> @@ -2556,7 +2556,6 @@ int gmap_mark_unmergeable(void)
>         for (vma = mm->mmap; vma; vma = vma->vm_next) {
>                 if (ksm_madvise(vma, vma->vm_start, vma->vm_end,
>                                 MADV_UNMERGEABLE, &vma->vm_flags)) {
> -                       mm->context.uses_skeys = 0;
>                         return -ENOMEM;
>                 }
>         }
> @@ -2617,8 +2616,10 @@ int s390_enable_skey(void)
>                 goto out_up;
>  
>         mm->context.uses_skeys = 1;
> -       gmap_mark_unmergeable();
> -
> +       if (gmap_mark_unmergeable()) {
> +               mm->context.uses_skeys = 0;
> +               goto out_up;
> +       }

You have to set rc if I am not wrong.

-- 
Thanks,

David / dhildenb




[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