From: Zhao Liu <zhao1.liu@intel.com>
To: Bibo Mao <maobibo@loongson.cn>
Cc: Song Gao <gaosong@loongson.cn>,
Paolo Bonzini <pbonzini@redhat.com>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
qemu-devel@nongnu.org, Xianglai Li <lixianglai@loongson.cn>,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [PATCH v2 4/4] hw/loongarch/virt: Enable cpu hotplug feature on virt machine
Date: Tue, 29 Oct 2024 21:48:22 +0800 [thread overview]
Message-ID: <ZyDnpk3tmG4KECWc@intel.com> (raw)
In-Reply-To: <20241029095335.2219343-5-maobibo@loongson.cn>
[snip]
> @@ -1382,8 +1384,40 @@ static void virt_cpu_pre_plug(HotplugHandler *hotplug_dev,
> }
>
> if (cpu->phy_id == UNSET_PHY_ID) {
> - error_setg(&local_err, "CPU hotplug not supported");
> - goto out;
> + if ((cpu->thread_id < 0) || (cpu->thread_id >= ms->smp.threads)) {
> + error_setg(&local_err,
> + "Invalid thread-id %u specified, must be in range 1:%u",
> + cpu->thread_id, ms->smp.threads - 1);
> + goto out;
> + }
> +
> + if ((cpu->core_id < 0) || (cpu->core_id >= ms->smp.cores)) {
> + error_setg(&local_err,
> + "Invalid core-id %u specified, must be in range 1:%u",
> + cpu->core_id, ms->smp.cores - 1);
> + goto out;
> + }
> +
> + if ((cpu->socket_id < 0) || (cpu->socket_id >= ms->smp.sockets)) {
> + error_setg(&local_err,
> + "Invalid socket-id %u specified, must be in range 1:%u",
> + cpu->socket_id, ms->smp.sockets - 1);
> + goto out;
> + }
> +
> + topo.socket_id = cpu->socket_id;
> + topo.core_id = cpu->core_id;
> + topo.thread_id = cpu->thread_id;
> + arch_id = virt_get_arch_id_from_topo(ms, &topo);
> + cpu_slot = virt_find_cpu_slot(ms, arch_id, &index);
> + if (CPU(cpu_slot->cpu)) {
> + error_setg(&local_err,
> + "cpu(id%d=%d:%d:%d) with arch-id %" PRIu64 " exists",
> + cs->cpu_index, cpu->socket_id, cpu->core_id,
> + cpu->thread_id, cpu_slot->arch_id);
> + goto out;
> + }
> + cpu->phy_id = arch_id;
> } else {
Here you allow user to specify topology IDs, but "else" still indicates
user could use "phy_id" instead of topology IDs, right?
Is it necessary to expose "phy_id" to user?
Thanks,
Zhao
next prev parent reply other threads:[~2024-10-29 13:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 9:53 [PATCH v2 0/4] hw/loongarch/virt: Add cpu hotplug support Bibo Mao
2024-10-29 9:53 ` [PATCH v2 1/4] hw/loongarch/virt: Add CPU topology support Bibo Mao
2024-10-29 13:19 ` Zhao Liu
2024-10-30 1:42 ` maobibo
2024-11-06 10:42 ` Igor Mammedov
2024-11-06 10:41 ` Igor Mammedov
2024-11-07 2:13 ` maobibo
2024-11-18 15:21 ` Igor Mammedov
2024-11-07 14:00 ` Zhao Liu
2024-11-22 14:09 ` Igor Mammedov
2024-10-29 9:53 ` [PATCH v2 2/4] hw/loongarch/virt: Implement cpu plug interface Bibo Mao
2024-10-29 13:37 ` Zhao Liu
2024-10-30 1:50 ` maobibo
2024-11-06 10:56 ` Igor Mammedov
2024-11-07 2:18 ` maobibo
2024-10-29 9:53 ` [PATCH v2 3/4] hw/loongarch/virt: Update the ACPI table for hotplug cpu Bibo Mao
2024-10-29 9:53 ` [PATCH v2 4/4] hw/loongarch/virt: Enable cpu hotplug feature on virt machine Bibo Mao
2024-10-29 13:48 ` Zhao Liu [this message]
2024-10-30 1:55 ` maobibo
2024-10-30 2:18 ` Zhao Liu
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=ZyDnpk3tmG4KECWc@intel.com \
--to=zhao1.liu@intel.com \
--cc=gaosong@loongson.cn \
--cc=imammedo@redhat.com \
--cc=jiaxun.yang@flygoat.com \
--cc=lixianglai@loongson.cn \
--cc=maobibo@loongson.cn \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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 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 NNTP newsgroup(s).