diff mbox

kvm-all: don't use stale dbg_data->cpu

Message ID 20161010154625.14881-1-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée Oct. 10, 2016, 3:46 p.m. UTC
The changes to run_on_cpu and friends mean that all helpers are passed
the CPUState of vCPU they are running on. The conversion missed the
field in commit e0eeb4a21a3ca4b296220ce4449d8acef9de9049 which
introduced bugs.

Reported-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 kvm-all.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Paolo Bonzini Oct. 10, 2016, 4:39 p.m. UTC | #1
On 10/10/2016 17:46, Alex Bennée wrote:
> The changes to run_on_cpu and friends mean that all helpers are passed
> the CPUState of vCPU they are running on. The conversion missed the
> field in commit e0eeb4a21a3ca4b296220ce4449d8acef9de9049 which
> introduced bugs.
> 
> Reported-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  kvm-all.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index efb5fe3..3dcce16 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -2215,15 +2215,14 @@ int kvm_sw_breakpoints_active(CPUState *cpu)
>  
>  struct kvm_set_guest_debug_data {
>      struct kvm_guest_debug dbg;
> -    CPUState *cpu;
>      int err;
>  };
>  
> -static void kvm_invoke_set_guest_debug(CPUState *unused_cpu, void *data)
> +static void kvm_invoke_set_guest_debug(CPUState *cpu, void *data)
>  {
>      struct kvm_set_guest_debug_data *dbg_data = data;
>  
> -    dbg_data->err = kvm_vcpu_ioctl(dbg_data->cpu, KVM_SET_GUEST_DEBUG,
> +    dbg_data->err = kvm_vcpu_ioctl(cpu, KVM_SET_GUEST_DEBUG,
>                                     &dbg_data->dbg);
>  }
>  
> 

Queued, thanks - or if Christian wants to send a pull request himself,
he can go ahead.

Paolo
Christian Borntraeger Oct. 10, 2016, 5:18 p.m. UTC | #2
On 10/10/2016 06:39 PM, Paolo Bonzini wrote:
> 
> 
> On 10/10/2016 17:46, Alex Bennée wrote:
>> The changes to run_on_cpu and friends mean that all helpers are passed
>> the CPUState of vCPU they are running on. The conversion missed the
>> field in commit e0eeb4a21a3ca4b296220ce4449d8acef9de9049 which
>> introduced bugs.
>>
>> Reported-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  kvm-all.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/kvm-all.c b/kvm-all.c
>> index efb5fe3..3dcce16 100644
>> --- a/kvm-all.c
>> +++ b/kvm-all.c
>> @@ -2215,15 +2215,14 @@ int kvm_sw_breakpoints_active(CPUState *cpu)
>>  
>>  struct kvm_set_guest_debug_data {
>>      struct kvm_guest_debug dbg;
>> -    CPUState *cpu;
>>      int err;
>>  };
>>  
>> -static void kvm_invoke_set_guest_debug(CPUState *unused_cpu, void *data)
>> +static void kvm_invoke_set_guest_debug(CPUState *cpu, void *data)
>>  {
>>      struct kvm_set_guest_debug_data *dbg_data = data;
>>  
>> -    dbg_data->err = kvm_vcpu_ioctl(dbg_data->cpu, KVM_SET_GUEST_DEBUG,
>> +    dbg_data->err = kvm_vcpu_ioctl(cpu, KVM_SET_GUEST_DEBUG,
>>                                     &dbg_data->dbg);
>>  }
>>  
>>
> 
> Queued, thanks - or if Christian wants to send a pull request himself,
> he can go ahead.

Lets wait for Claudio to verify and then it can go via your tree.

PS: Can you also have a look at Claudios 2nd patch?
Claudio Imbrenda Oct. 11, 2016, 11:48 a.m. UTC | #3
Tested-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>

On 10/10/16 17:46, Alex Bennée wrote:
> The changes to run_on_cpu and friends mean that all helpers are passed
> the CPUState of vCPU they are running on. The conversion missed the
> field in commit e0eeb4a21a3ca4b296220ce4449d8acef9de9049 which
> introduced bugs.
> 
> Reported-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  kvm-all.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index efb5fe3..3dcce16 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -2215,15 +2215,14 @@ int kvm_sw_breakpoints_active(CPUState *cpu)
> 
>  struct kvm_set_guest_debug_data {
>      struct kvm_guest_debug dbg;
> -    CPUState *cpu;
>      int err;
>  };
> 
> -static void kvm_invoke_set_guest_debug(CPUState *unused_cpu, void *data)
> +static void kvm_invoke_set_guest_debug(CPUState *cpu, void *data)
>  {
>      struct kvm_set_guest_debug_data *dbg_data = data;
> 
> -    dbg_data->err = kvm_vcpu_ioctl(dbg_data->cpu, KVM_SET_GUEST_DEBUG,
> +    dbg_data->err = kvm_vcpu_ioctl(cpu, KVM_SET_GUEST_DEBUG,
>                                     &dbg_data->dbg);
>  }
>
diff mbox

Patch

diff --git a/kvm-all.c b/kvm-all.c
index efb5fe3..3dcce16 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -2215,15 +2215,14 @@  int kvm_sw_breakpoints_active(CPUState *cpu)
 
 struct kvm_set_guest_debug_data {
     struct kvm_guest_debug dbg;
-    CPUState *cpu;
     int err;
 };
 
-static void kvm_invoke_set_guest_debug(CPUState *unused_cpu, void *data)
+static void kvm_invoke_set_guest_debug(CPUState *cpu, void *data)
 {
     struct kvm_set_guest_debug_data *dbg_data = data;
 
-    dbg_data->err = kvm_vcpu_ioctl(dbg_data->cpu, KVM_SET_GUEST_DEBUG,
+    dbg_data->err = kvm_vcpu_ioctl(cpu, KVM_SET_GUEST_DEBUG,
                                    &dbg_data->dbg);
 }