From: Manali Shukla <manali.shukla@amd.com>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
pbonzini@redhat.com, seanjc@google.com, shuah@kernel.org,
nikunj@amd.com, thomas.lendacky@amd.com,
Manali Shukla <manali.shukla@amd.com>
Subject: Re: [PATCH v1 2/3] KVM: selftests: Change __vm_create() to create a vm without in-kernel APIC
Date: Thu, 28 Mar 2024 16:42:34 +0530 [thread overview]
Message-ID: <9cf21f90-87eb-5a20-6501-111fbd08a31c@amd.com> (raw)
In-Reply-To: <20240327-7ffafaa84cf972c38cc5f33c@orel>
Hi Andrew,
Thank you for reviewing my patches.
On 3/27/2024 4:57 PM, Andrew Jones wrote:
> On Wed, Mar 27, 2024 at 05:42:54AM +0000, Manali Shukla wrote:
> ...
>> diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h
>> index 4a40b332115d..00e37c376cf3 100644
>> --- a/tools/testing/selftests/kvm/include/kvm_util_base.h
>> +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
>> @@ -879,7 +879,7 @@ static inline vm_paddr_t vm_phy_pages_alloc(struct kvm_vm *vm, size_t num,
>> */
>> struct kvm_vm *____vm_create(struct vm_shape shape);
>> struct kvm_vm *__vm_create(struct vm_shape shape, uint32_t nr_runnable_vcpus,
>> - uint64_t nr_extra_pages);
>> + uint64_t nr_extra_pages, bool is_in_kernel_apic);
>
> Adding boolean flag parameters to functions, which will 99% of the time be
> called with the same value set for them, is not nice.
Agreed.
>
> ...
>> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
>> index adc51b0712ca..9c2a9e216d80 100644
>> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
>> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
>> @@ -354,7 +354,7 @@ static uint64_t vm_nr_pages_required(enum vm_guest_mode mode,
>> }
>>
>> struct kvm_vm *__vm_create(struct vm_shape shape, uint32_t nr_runnable_vcpus,
>> - uint64_t nr_extra_pages)
>> + uint64_t nr_extra_pages, bool is_in_kernel_apic)
>> {
>> uint64_t nr_pages = vm_nr_pages_required(shape.mode, nr_runnable_vcpus,
>> nr_extra_pages);
>> @@ -382,7 +382,12 @@ struct kvm_vm *__vm_create(struct vm_shape shape, uint32_t nr_runnable_vcpus,
>> slot0 = memslot2region(vm, 0);
>> ucall_init(vm, slot0->region.guest_phys_addr + slot0->region.memory_size);
>>
>> - kvm_arch_vm_post_create(vm);
>> + if (is_in_kernel_apic) {
>> + kvm_arch_vm_post_create(vm);
>> + } else {
>> + sync_global_to_guest(vm, host_cpu_is_intel);
>> + sync_global_to_guest(vm, host_cpu_is_amd);
>> + }
>
> __vm_create() is shared with other architectures, and duplicating part of
> kvm_arch_vm_post_create() here is not a good approach, even if the
> framework was only for x86.
>
> I suggest:
>
> 1. Extend vm_shape to include a flags field and create a flag called
> NO_IRQCHIP
>
> 2. Add a flags member to kvm_vm and set it to the value of vm_shape.flags
> in ____vm_create()
>
> 3. Check !(vm.flags & NO_IRQCHIP) in x86's kvm_arch_vm_post_create()
> before calling vm_create_irqchip()
>
> Then, in your tests, you'll create your vm shape with the NO_IRQCHIP flag
> set.
Sure. I will incorporate your suggestions in the next version.
>
> Thanks,
> drew
- Manali
next prev parent reply other threads:[~2024-03-28 11:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 5:42 [PATCH v1 0/3] Add a test case for KVM_X86_DISABLE_EXIT Manali Shukla
2024-03-27 5:42 ` [PATCH v1 1/3] KVM: selftests: Add safe_halt() and cli() helpers to common code Manali Shukla
2024-03-27 5:42 ` [PATCH v1 2/3] KVM: selftests: Change __vm_create() to create a vm without in-kernel APIC Manali Shukla
2024-03-27 11:27 ` Andrew Jones
2024-03-28 11:12 ` Manali Shukla [this message]
2024-03-27 5:42 ` [PATCH v1 3/3] KVM: selftests: Add a test case for KVM_X86_DISABLE_EXITS_HLT Manali Shukla
2024-03-29 20:13 ` Muhammad Usama Anjum
2024-04-01 5:28 ` Manali Shukla
2024-04-01 6:27 ` Manali Shukla
2024-04-01 9:41 ` Muhammad Usama Anjum
2024-04-01 12:31 ` Manali Shukla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9cf21f90-87eb-5a20-6501-111fbd08a31c@amd.com \
--to=manali.shukla@amd.com \
--cc=ajones@ventanamicro.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nikunj@amd.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox