KVM/s390: Replace clear_user with kvm_clear_guest
diff mbox

Message ID 20180705101822.153870-1-frankja@linux.ibm.com
State New
Headers show

Commit Message

Janosch Frank July 5, 2018, 10:18 a.m. UTC
kvm_clear_guest also does the dirty tracking for us, which we want to
have.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 arch/s390/kvm/priv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Borntraeger July 5, 2018, 10:21 a.m. UTC | #1
On 07/05/2018 12:18 PM, Janosch Frank wrote:
> kvm_clear_guest also does the dirty tracking for us, which we want to
> have.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>


> ---
>  arch/s390/kvm/priv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
> index eb0eb60c7be6..c4da375553e8 100644
> --- a/arch/s390/kvm/priv.c
> +++ b/arch/s390/kvm/priv.c
> @@ -956,7 +956,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
>  			return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
> 
>  		if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) {
> -			if (clear_user((void __user *)useraddr, PAGE_SIZE))

we still need useraddr for the keyop below, so it seems we cannot get rid of it.
Makes sense.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>



> +			if (kvm_clear_guest(vcpu->kvm, start, PAGE_SIZE))
>  				return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
>  		}
>
David Hildenbrand July 5, 2018, 10:23 a.m. UTC | #2
On 05.07.2018 12:18, Janosch Frank wrote:

s/KVM/s390/KVM: s390/

Reviewed-by: David Hildenbrand <david@redhat.com>

> kvm_clear_guest also does the dirty tracking for us, which we want to
> have.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  arch/s390/kvm/priv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
> index eb0eb60c7be6..c4da375553e8 100644
> --- a/arch/s390/kvm/priv.c
> +++ b/arch/s390/kvm/priv.c
> @@ -956,7 +956,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
>  			return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
>  
>  		if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) {
> -			if (clear_user((void __user *)useraddr, PAGE_SIZE))
> +			if (kvm_clear_guest(vcpu->kvm, start, PAGE_SIZE))
>  				return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
>  		}
>  
>
Janosch Frank July 5, 2018, 10:49 a.m. UTC | #3
On 05.07.2018 12:23, David Hildenbrand wrote:
> On 05.07.2018 12:18, Janosch Frank wrote:
> 
> s/KVM/s390/KVM: s390/
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>


s/KVM\/s390/KVM: s390:/
Thanks, applied


> 
>> kvm_clear_guest also does the dirty tracking for us, which we want to
>> have.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  arch/s390/kvm/priv.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
>> index eb0eb60c7be6..c4da375553e8 100644
>> --- a/arch/s390/kvm/priv.c
>> +++ b/arch/s390/kvm/priv.c
>> @@ -956,7 +956,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
>>  			return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
>>  
>>  		if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) {
>> -			if (clear_user((void __user *)useraddr, PAGE_SIZE))
>> +			if (kvm_clear_guest(vcpu->kvm, start, PAGE_SIZE))
>>  				return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
>>  		}
>>  
>>
> 
>

Patch
diff mbox

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index eb0eb60c7be6..c4da375553e8 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -956,7 +956,7 @@  static int handle_pfmf(struct kvm_vcpu *vcpu)
 			return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
 		if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) {
-			if (clear_user((void __user *)useraddr, PAGE_SIZE))
+			if (kvm_clear_guest(vcpu->kvm, start, PAGE_SIZE))
 				return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 		}