loongarch.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Huacai Chen <chenhuacai@kernel.org>
To: Bibo Mao <maobibo@loongson.cn>
Cc: Qiang Ma <maqianga@uniontech.com>,
	zhaotianrui@loongson.cn, kernel@xen0n.name,  kvm@vger.kernel.org,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] LoongArch: KVM: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS
Date: Wed, 29 Apr 2026 17:51:49 +0800	[thread overview]
Message-ID: <CAAhV-H7FH0Woxh4fvgZoL8LQKzNh4fkMvC3qzdpHFiRsZH=yJA@mail.gmail.com> (raw)
In-Reply-To: <0b8db33a-6c26-d9f5-b78f-d9249dd02c1c@loongson.cn>

On Tue, Apr 28, 2026 at 8:59 PM Bibo Mao <maobibo@loongson.cn> wrote:
>
> On 2026/4/28 下午8:18, Qiang Ma wrote:
> > It doesn't make sense to return the recommended maximum number of
> > vCPUs which exceeds the maximum possible number of vCPUs.
> >
> > Other architectures have already done this, such as Commit
> > 57a2e13ebdda ("KVM: MIPS: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS")
> >
> > Signed-off-by: Qiang Ma <maqianga@uniontech.com>
> > ---
> >   arch/loongarch/kvm/vm.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
> > index 8cc5ee1c53ef..1317c718f896 100644
> > --- a/arch/loongarch/kvm/vm.c
> > +++ b/arch/loongarch/kvm/vm.c
> > @@ -125,7 +125,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> >               r = 1;
> >               break;
> >       case KVM_CAP_NR_VCPUS:
> > -             r = num_online_cpus();
> > +             r = min_t(unsigned int, num_online_cpus(), KVM_MAX_VCPUS);
> >               break;
> >       case KVM_CAP_MAX_VCPUS:
> >               r = KVM_MAX_VCPUS;
> >
> Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Applied, thanks.

Huacai
>

      reply	other threads:[~2026-04-29  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 12:18 [PATCH v2] LoongArch: KVM: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS Qiang Ma
2026-04-28 12:56 ` Bibo Mao
2026-04-29  9:51   ` Huacai Chen [this message]

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='CAAhV-H7FH0Woxh4fvgZoL8LQKzNh4fkMvC3qzdpHFiRsZH=yJA@mail.gmail.com' \
    --to=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=maqianga@uniontech.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).