From: Sean Christopherson <seanjc@google.com>
To: kvm-riscv@lists.infradead.org
Subject: [RFC PATCH v1 3/8] KVM: selftests: Add virt_arch_ucall_prealloc() arch specific implementation
Date: Wed, 31 Jan 2024 15:20:40 -0800 [thread overview]
Message-ID: <ZbrVyB1Pj9KrH-Cl@google.com> (raw)
In-Reply-To: <20231102155111.28821-4-guang.zeng@intel.com>
On Thu, Nov 02, 2023, Zeng Guang wrote:
> diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h
> index a18db6a7b3cf..dbaa2cf83c1c 100644
> --- a/tools/testing/selftests/kvm/include/kvm_util_base.h
> +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
> @@ -917,6 +917,23 @@ static inline void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)
> virt_arch_dump(stream, vm, indent);
> }
>
> +/*
> + * Virtual UCALL memory pre-processing
> + *
> + * Input Args:
> + * ucall_gva - Guest virtual address point to memory of ucall pool
> + *
> + * Output Args: None
> + *
> + * Return:
> + * Processed guest virtual address point to memory of ucall pool
> + */
Please omit the massive comments, they are yet another misguided remnant in
selftests that we are purging.
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> index 6f4295a13d00..525b714ee13c 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> @@ -388,6 +388,18 @@ void virt_arch_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)
> }
> }
>
> +void *virt_arch_ucall_prealloc(uint64_t ucall_gva)
> +{
> + unsigned short desc_cs;
> +
> + asm volatile ("mov %%cs,%0" : "=r" (desc_cs));
Strictly speaking, CS.DPL is not the source of truth for CPL, SS.DPL is. But
that's probably a moot point, because I again think this is a hack that shows the
overall approach isn't maintainable.
Can you post the actual usage of userspace selftests, i.e. the "full" series?
It's really hard to build a mental model of how this all fits together without
seeing the actual usage.
WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Zeng Guang <guang.zeng@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>, Marc Zyngier <maz@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>,
James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Anup Patel <anup@brainfault.org>,
Atish Patra <atishp@atishpatra.org>,
David Hildenbrand <david@redhat.com>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org
Subject: Re: [RFC PATCH v1 3/8] KVM: selftests: Add virt_arch_ucall_prealloc() arch specific implementation
Date: Wed, 31 Jan 2024 15:20:40 -0800 [thread overview]
Message-ID: <ZbrVyB1Pj9KrH-Cl@google.com> (raw)
In-Reply-To: <20231102155111.28821-4-guang.zeng@intel.com>
On Thu, Nov 02, 2023, Zeng Guang wrote:
> diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h
> index a18db6a7b3cf..dbaa2cf83c1c 100644
> --- a/tools/testing/selftests/kvm/include/kvm_util_base.h
> +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
> @@ -917,6 +917,23 @@ static inline void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)
> virt_arch_dump(stream, vm, indent);
> }
>
> +/*
> + * Virtual UCALL memory pre-processing
> + *
> + * Input Args:
> + * ucall_gva - Guest virtual address point to memory of ucall pool
> + *
> + * Output Args: None
> + *
> + * Return:
> + * Processed guest virtual address point to memory of ucall pool
> + */
Please omit the massive comments, they are yet another misguided remnant in
selftests that we are purging.
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> index 6f4295a13d00..525b714ee13c 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> @@ -388,6 +388,18 @@ void virt_arch_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)
> }
> }
>
> +void *virt_arch_ucall_prealloc(uint64_t ucall_gva)
> +{
> + unsigned short desc_cs;
> +
> + asm volatile ("mov %%cs,%0" : "=r" (desc_cs));
Strictly speaking, CS.DPL is not the source of truth for CPL, SS.DPL is. But
that's probably a moot point, because I again think this is a hack that shows the
overall approach isn't maintainable.
Can you post the actual usage of userspace selftests, i.e. the "full" series?
It's really hard to build a mental model of how this all fits together without
seeing the actual usage.
WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Zeng Guang <guang.zeng@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>, Marc Zyngier <maz@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>,
James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Anup Patel <anup@brainfault.org>,
Atish Patra <atishp@atishpatra.org>,
David Hildenbrand <david@redhat.com>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org
Subject: Re: [RFC PATCH v1 3/8] KVM: selftests: Add virt_arch_ucall_prealloc() arch specific implementation
Date: Wed, 31 Jan 2024 15:20:40 -0800 [thread overview]
Message-ID: <ZbrVyB1Pj9KrH-Cl@google.com> (raw)
In-Reply-To: <20231102155111.28821-4-guang.zeng@intel.com>
On Thu, Nov 02, 2023, Zeng Guang wrote:
> diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h
> index a18db6a7b3cf..dbaa2cf83c1c 100644
> --- a/tools/testing/selftests/kvm/include/kvm_util_base.h
> +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
> @@ -917,6 +917,23 @@ static inline void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)
> virt_arch_dump(stream, vm, indent);
> }
>
> +/*
> + * Virtual UCALL memory pre-processing
> + *
> + * Input Args:
> + * ucall_gva - Guest virtual address point to memory of ucall pool
> + *
> + * Output Args: None
> + *
> + * Return:
> + * Processed guest virtual address point to memory of ucall pool
> + */
Please omit the massive comments, they are yet another misguided remnant in
selftests that we are purging.
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> index 6f4295a13d00..525b714ee13c 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> @@ -388,6 +388,18 @@ void virt_arch_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)
> }
> }
>
> +void *virt_arch_ucall_prealloc(uint64_t ucall_gva)
> +{
> + unsigned short desc_cs;
> +
> + asm volatile ("mov %%cs,%0" : "=r" (desc_cs));
Strictly speaking, CS.DPL is not the source of truth for CPL, SS.DPL is. But
that's probably a moot point, because I again think this is a hack that shows the
overall approach isn't maintainable.
Can you post the actual usage of userspace selftests, i.e. the "full" series?
It's really hard to build a mental model of how this all fits together without
seeing the actual usage.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Zeng Guang <guang.zeng@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>, Marc Zyngier <maz@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>,
James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Anup Patel <anup@brainfault.org>,
Atish Patra <atishp@atishpatra.org>,
David Hildenbrand <david@redhat.com>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org
Subject: Re: [RFC PATCH v1 3/8] KVM: selftests: Add virt_arch_ucall_prealloc() arch specific implementation
Date: Wed, 31 Jan 2024 15:20:40 -0800 [thread overview]
Message-ID: <ZbrVyB1Pj9KrH-Cl@google.com> (raw)
In-Reply-To: <20231102155111.28821-4-guang.zeng@intel.com>
On Thu, Nov 02, 2023, Zeng Guang wrote:
> diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h
> index a18db6a7b3cf..dbaa2cf83c1c 100644
> --- a/tools/testing/selftests/kvm/include/kvm_util_base.h
> +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
> @@ -917,6 +917,23 @@ static inline void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)
> virt_arch_dump(stream, vm, indent);
> }
>
> +/*
> + * Virtual UCALL memory pre-processing
> + *
> + * Input Args:
> + * ucall_gva - Guest virtual address point to memory of ucall pool
> + *
> + * Output Args: None
> + *
> + * Return:
> + * Processed guest virtual address point to memory of ucall pool
> + */
Please omit the massive comments, they are yet another misguided remnant in
selftests that we are purging.
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> index 6f4295a13d00..525b714ee13c 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> @@ -388,6 +388,18 @@ void virt_arch_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)
> }
> }
>
> +void *virt_arch_ucall_prealloc(uint64_t ucall_gva)
> +{
> + unsigned short desc_cs;
> +
> + asm volatile ("mov %%cs,%0" : "=r" (desc_cs));
Strictly speaking, CS.DPL is not the source of truth for CPL, SS.DPL is. But
that's probably a moot point, because I again think this is a hack that shows the
overall approach isn't maintainable.
Can you post the actual usage of userspace selftests, i.e. the "full" series?
It's really hard to build a mental model of how this all fits together without
seeing the actual usage.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-01-31 23:20 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 15:51 [RFC PATCH v1 0/8] KVM: seftests: Support guest user mode execution and running Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` [RFC PATCH v1 1/8] KVM: selftests: x86: Fix bug in addr_arch_gva2gpa() Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2024-01-31 22:45 ` Sean Christopherson
2024-01-31 22:45 ` Sean Christopherson
2024-01-31 22:45 ` Sean Christopherson
2024-01-31 22:45 ` Sean Christopherson
2023-11-02 15:51 ` [RFC PATCH v1 2/8] KVM: selftests: x86: Support guest running on canonical linear-address organization Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2024-01-31 23:03 ` Sean Christopherson
2024-01-31 23:03 ` Sean Christopherson
2024-01-31 23:03 ` Sean Christopherson
2024-01-31 23:03 ` Sean Christopherson
2023-11-02 15:51 ` [RFC PATCH v1 3/8] KVM: selftests: Add virt_arch_ucall_prealloc() arch specific implementation Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2024-01-31 23:20 ` Sean Christopherson [this message]
2024-01-31 23:20 ` Sean Christopherson
2024-01-31 23:20 ` Sean Christopherson
2024-01-31 23:20 ` Sean Christopherson
2023-11-02 15:51 ` [RFC PATCH v1 4/8] KVM : selftests : Adapt selftest cases to kernel canonical linear address Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` [RFC PATCH v1 5/8] KVM: selftests: x86: Prepare setup for user mode support Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` [RFC PATCH v1 6/8] KVM: selftests: x86: Allow user to access user-mode address and I/O address space Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` [RFC PATCH v1 7/8] KVM: selftests: x86: Support vcpu run in user mode Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` [RFC PATCH v1 8/8] KVM: selftests: x86: Add KVM forced emulation prefix capability Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
2023-11-02 15:51 ` Zeng Guang
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=ZbrVyB1Pj9KrH-Cl@google.com \
--to=seanjc@google.com \
--cc=kvm-riscv@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.