2021-07-09 06:43:01

by chenlifu

[permalink] [raw]
Subject: [PATCH -next 1/2] selftests: Fix vm_handle_exception undefined error

Compile setftests on x86_64 occurs following error:
make -C tools/testing/selftests
...

x86_64/hyperv_features.c:618:2: warning: implicit declaration of function ‘vm_handle_exception’ [-Wimplicit-function-declaration]
618 | vm_handle_exception(vm, GP_VECTOR, guest_gp_handler);
/usr/bin/ld: /tmp/cclOnpml.o: in function `main':
tools/testing/selftests/kvm/x86_64/hyperv_features.c:618: undefined reference to `vm_handle_exception'
collect2: error: ld returned 1 exit status

The reason is that commit b78f4a596692 ("KVM: selftests: Rename vm_handle_exception")
renamed "vm_handle_exception" function to "vm_install_exception_handler" function.

Fix it by replacing "vm_handle_exception" with "vm_install_exception_handler"
in corresponding selftests files.

Signed-off-by: Chen Lifu <[email protected]>
---
tools/testing/selftests/kvm/x86_64/hyperv_features.c | 2 +-
tools/testing/selftests/kvm/x86_64/mmu_role_test.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_features.c b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
index 42bd658f52a8..af27c7e829c1 100644
--- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c
+++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
@@ -615,7 +615,7 @@ int main(void)

vm_init_descriptor_tables(vm);
vcpu_init_descriptor_tables(vm, VCPU_ID);
- vm_handle_exception(vm, GP_VECTOR, guest_gp_handler);
+ vm_install_exception_handler(vm, GP_VECTOR, guest_gp_handler);

pr_info("Testing access to Hyper-V specific MSRs\n");
guest_test_msrs_access(vm, addr_gva2hva(vm, msr_gva),
diff --git a/tools/testing/selftests/kvm/x86_64/mmu_role_test.c b/tools/testing/selftests/kvm/x86_64/mmu_role_test.c
index 523371cf8e8f..da2325fcad87 100644
--- a/tools/testing/selftests/kvm/x86_64/mmu_role_test.c
+++ b/tools/testing/selftests/kvm/x86_64/mmu_role_test.c
@@ -71,7 +71,7 @@ static void mmu_role_test(u32 *cpuid_reg, u32 evil_cpuid_val)
/* Set up a #PF handler to eat the RSVD #PF and signal all done! */
vm_init_descriptor_tables(vm);
vcpu_init_descriptor_tables(vm, VCPU_ID);
- vm_handle_exception(vm, PF_VECTOR, guest_pf_handler);
+ vm_install_exception_handler(vm, PF_VECTOR, guest_pf_handler);

r = _vcpu_run(vm, VCPU_ID);
TEST_ASSERT(r == 0, "vcpu_run failed: %d\n", r);
--
2.32.0


2021-08-13 17:06:56

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH -next 1/2] selftests: Fix vm_handle_exception undefined error

On 7/9/21 12:37 AM, Chen Lifu wrote:
> Compile setftests on x86_64 occurs following error:
> make -C tools/testing/selftests
> ...
>
> x86_64/hyperv_features.c:618:2: warning: implicit declaration of function ‘vm_handle_exception’ [-Wimplicit-function-declaration]
> 618 | vm_handle_exception(vm, GP_VECTOR, guest_gp_handler);
> /usr/bin/ld: /tmp/cclOnpml.o: in function `main':
> tools/testing/selftests/kvm/x86_64/hyperv_features.c:618: undefined reference to `vm_handle_exception'
> collect2: error: ld returned 1 exit status
>
> The reason is that commit b78f4a596692 ("KVM: selftests: Rename vm_handle_exception")
> renamed "vm_handle_exception" function to "vm_install_exception_handler" function.
>
> Fix it by replacing "vm_handle_exception" with "vm_install_exception_handler"
> in corresponding selftests files.
>
> Signed-off-by: Chen Lifu <[email protected]>
> ---
> tools/testing/selftests/kvm/x86_64/hyperv_features.c | 2 +-
> tools/testing/selftests/kvm/x86_64/mmu_role_test.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>


Please include kvm in the commit summary. I think it is not getting
the right attention because of the summary line.

Same for the second patch in this series.

thanks,
-- Shuah

2021-08-13 23:29:25

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH -next 1/2] selftests: Fix vm_handle_exception undefined error

On 13/08/21 19:01, Shuah Khan wrote:
> On 7/9/21 12:37 AM, Chen Lifu wrote:
>> Compile setftests on x86_64 occurs following error:
>> make -C tools/testing/selftests
>> ...
>>
>> x86_64/hyperv_features.c:618:2: warning: implicit declaration of
>> function ‘vm_handle_exception’ [-Wimplicit-function-declaration]
>>    618 |  vm_handle_exception(vm, GP_VECTOR, guest_gp_handler);
>> /usr/bin/ld: /tmp/cclOnpml.o: in function `main':
>> tools/testing/selftests/kvm/x86_64/hyperv_features.c:618: undefined
>> reference to `vm_handle_exception'
>> collect2: error: ld returned 1 exit status
>>
>> The reason is that commit b78f4a596692 ("KVM: selftests: Rename
>> vm_handle_exception")
>> renamed "vm_handle_exception" function to
>> "vm_install_exception_handler" function.
>>
>> Fix it by replacing "vm_handle_exception" with
>> "vm_install_exception_handler"
>> in corresponding selftests files.
>>
>> Signed-off-by: Chen Lifu <[email protected]>
>> ---
>>   tools/testing/selftests/kvm/x86_64/hyperv_features.c | 2 +-
>>   tools/testing/selftests/kvm/x86_64/mmu_role_test.c   | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>
>
> Please include kvm in the commit summary. I think it is not getting
> the right attention because of the summary line.

The same patch was already committed:

commit f8f0edabcc09fafd695ed2adc0eb825104e35d5c
Author: Marc Zyngier <[email protected]>
Date: Thu Jul 1 08:19:28 2021 +0100

KVM: selftests: x86: Address missing vm_install_exception_handler conversions

Commit b78f4a59669 ("KVM: selftests: Rename vm_handle_exception")
raced with a couple of new x86 tests, missing two vm_handle_exception
to vm_install_exception_handler conversions.

Help the two broken tests to catch up with the new world.

Cc: Andrew Jones <[email protected]>
CC: Ricardo Koller <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Reviewed-by: Ricardo Koller <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>

For the other patch, returning 0 is going to cause issues elsewhere
in the tests. Either the test is failed immediately, or all callers
must be examined carefully.

Paolo

2021-08-16 02:55:46

by chenlifu

[permalink] [raw]
Subject: Re: [PATCH -next 1/2] selftests: Fix vm_handle_exception undefined error

Thanks. Got it.

在 2021/8/14 7:26, Paolo Bonzini 写道:
> On 13/08/21 19:01, Shuah Khan wrote:
>> On 7/9/21 12:37 AM, Chen Lifu wrote:
>>> Compile setftests on x86_64 occurs following error:
>>> make -C tools/testing/selftests
>>> ...
>>>
>>> x86_64/hyperv_features.c:618:2: warning: implicit declaration of
>>> function ‘vm_handle_exception’ [-Wimplicit-function-declaration]
>>>    618 |  vm_handle_exception(vm, GP_VECTOR, guest_gp_handler);
>>> /usr/bin/ld: /tmp/cclOnpml.o: in function `main':
>>> tools/testing/selftests/kvm/x86_64/hyperv_features.c:618: undefined
>>> reference to `vm_handle_exception'
>>> collect2: error: ld returned 1 exit status
>>>
>>> The reason is that commit b78f4a596692 ("KVM: selftests: Rename
>>> vm_handle_exception")
>>> renamed "vm_handle_exception" function to
>>> "vm_install_exception_handler" function.
>>>
>>> Fix it by replacing "vm_handle_exception" with
>>> "vm_install_exception_handler"
>>> in corresponding selftests files.
>>>
>>> Signed-off-by: Chen Lifu <[email protected]>
>>> ---
>>>   tools/testing/selftests/kvm/x86_64/hyperv_features.c | 2 +-
>>>   tools/testing/selftests/kvm/x86_64/mmu_role_test.c   | 2 +-
>>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>
>>
>> Please include kvm in the commit summary. I think it is not getting
>> the right attention because of the summary line.
>
> The same patch was already committed:
>
>    commit f8f0edabcc09fafd695ed2adc0eb825104e35d5c
>    Author: Marc Zyngier <[email protected]>
>    Date:   Thu Jul 1 08:19:28 2021 +0100
>
>    KVM: selftests: x86: Address missing vm_install_exception_handler
> conversions
>    Commit b78f4a59669 ("KVM: selftests: Rename vm_handle_exception")
>    raced with a couple of new x86 tests, missing two vm_handle_exception
>    to vm_install_exception_handler conversions.
>    Help the two broken tests to catch up with the new world.
>    Cc: Andrew Jones <[email protected]>
>    CC: Ricardo Koller <[email protected]>
>    Cc: Paolo Bonzini <[email protected]>
>    Signed-off-by: Marc Zyngier <[email protected]>
>    Message-Id: <[email protected]>
>    Reviewed-by: Andrew Jones <[email protected]>
>    Reviewed-by: Ricardo Koller <[email protected]>
>    Signed-off-by: Paolo Bonzini <[email protected]>
>
> For the other patch, returning 0 is going to cause issues elsewhere
> in the tests.  Either the test is failed immediately, or all callers
> must be examined carefully.
>
> Paolo
>
> .