mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jiaxun Yang" <jiaxun.yang@flygoat.com>
To: "Bibo Mao" <maobibo@loongson.cn>, "Huacai Chen" <chenhuacai@kernel.org>
Cc: "Tianrui Zhao" <zhaotianrui@loongson.cn>,
	"Xuerui Wang" <kernel@xen0n.name>,
	kvm@vger.kernel.org, loongarch@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/3] LoongArch: KVM: Add LBT feature detection function
Date: Fri, 05 Jul 2024 12:09:49 +0800	[thread overview]
Message-ID: <4cfc5292-6f1a-4409-b229-2433e18f012f@app.fastmail.com> (raw)
In-Reply-To: <9316cde1-26d0-54d5-43c3-1284288c685f@loongson.cn>



在2024年7月5日七月 上午11:46,maobibo写道:
> On 2024/7/5 上午11:19, Jiaxun Yang wrote:
>> 
>> 
>> 在2024年7月5日七月 上午9:21,maobibo写道:
>> [...]
>>>> for you.
>>> On the other hand, can you list benefits or disadvantage of approaches
>>> on different architecture?
>> 
>> So the obvious benefit of scratch vCPU would be maintaining consistency and simpleness
>> for UAPI.
> I do not find the simpleness, for the same feature function, both VM 
> feature and CPU feature is define as follows.  Do you think it is for 
> simple :)

So they made a mistake here :-(

We don't even need vCPU flag, just probing CPUCFG bits is sufficient.

Note that in Arm's case, some CPU features have system dependencies, that's why
they need to be entitled twice.

For us, we don't have such burden.

If Arm doesn't set a good example here, please check RISC-V's CONFIG reg on dealing
ISA extensions. We don't even need such register because our CPUCFG can perfectly
describe ISA status.

>
> VM CAPBILITY:
>      KVM_CAP_ARM_PTRAUTH_ADDRESS
>      KVM_CAP_ARM_PTRAUTH_GENERIC
>      KVM_CAP_ARM_EL1_32BIT
>      KVM_CAP_ARM_PMU_V3
>      KVM_CAP_ARM_SVE
>      KVM_CAP_ARM_PSCI
>      KVM_CAP_ARM_PSCI_0_2
>
> CPU:
>      KVM_ARM_VCPU_POWER_OFF
>      KVM_ARM_VCPU_EL1_32BIT
>      KVM_ARM_VCPU_PSCI_0_2
>      KVM_ARM_VCPU_PMU_V3
>      KVM_ARM_VCPU_SVE
>      KVM_ARM_VCPU_PTRAUTH_ADDRESS
>      KVM_ARM_VCPU_PTRAUTH_GENERIC
>      KVM_ARM_VCPU_HAS_EL2
>
> Also why scratch vcpu is created and tested on host cpu type rather than 
> other cpu type?  It wastes much time for host cpu type to detect capability.

To maximize supported features, on Arm there is KVM_ARM_VCPU_INIT ioctl.
For us that's unnecessary, our kernel does not need to be aware of CPU type,
only CPUCFG bits are necessary. RISC-V is following the same convention.

>> 
>> It can also maximum code reuse probabilities in other user space hypervisor projects.
>> 
>> Also, it can benefit a potential asymmetrical system. I understand that it won't appear
>> in near future, but we should always be prepared, especially in UAPI design.
> If for potential asymmetrical system, however there is only one scratch 
> vcpu. is that right? how does only one scratch vcpu detect ASMP 
> capability, and it is not bind to physical cpu to detect ASMP capability.
>
> In generic big.little is HMP rather than ASMP, are you agree.

So I was talking about emulating asymmetrical guest. Each guest CPU should have
it's own copy of properties. That's the lesson learnt.

[...]

Anyway I'm just trying to help out here, feel free to go ahead without taking my advice.

I've seen so many pitfalls on all other arches and I don't want them to repeat on LoongArch.
But sometimes people only learn from mistakes.

-- 
- Jiaxun

  reply	other threads:[~2024-07-05  4:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  6:32 [PATCH v4 0/3] LoongArch: KVM: Add Binary Translation extension support Bibo Mao
2024-06-26  6:32 ` [PATCH v4 1/3] LoongArch: KVM: Add HW " Bibo Mao
2024-06-26  6:32 ` [PATCH v4 2/3] LoongArch: KVM: Add LBT feature detection function Bibo Mao
2024-06-30  2:07   ` Huacai Chen
2024-07-01  1:27     ` maobibo
2024-07-01 10:26       ` Huacai Chen
2024-07-02  1:51         ` maobibo
2024-07-02  1:59           ` Huacai Chen
2024-07-02  2:25             ` maobibo
2024-07-02  2:34               ` Huacai Chen
2024-07-02  4:12                 ` maobibo
2024-07-02  7:28                   ` Huacai Chen
2024-07-02  8:42                     ` maobibo
2024-07-02 15:43                       ` Huacai Chen
2024-07-03  3:15                         ` maobibo
2024-07-03 15:35                           ` Huacai Chen
2024-07-04  1:24                             ` maobibo
2024-07-08  9:51                               ` Huacai Chen
2024-07-09  1:45                                 ` maobibo
2024-07-04  1:35                             ` maobibo
2024-07-04 19:44                               ` Jiaxun Yang
2024-07-05  1:21                                 ` maobibo
2024-07-05  3:19                                   ` Jiaxun Yang
2024-07-05  3:46                                     ` maobibo
2024-07-05  4:09                                       ` Jiaxun Yang [this message]
2024-07-05  5:05                                         ` maobibo
2024-06-26  6:32 ` [PATCH v4 3/3] LoongArch: KVM: Add vm migration support for LBT registers Bibo Mao

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=4cfc5292-6f1a-4409-b229-2433e18f012f@app.fastmail.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=maobibo@loongson.cn \
    --cc=zhaotianrui@loongson.cn \
    /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

all inboxes | Powered by JetHome®