[PATCH 2/3 V2] hv: add param to control INIT used to kick pCPU


Minggui Cao
 

By default, IPI used to kick sharing pCPU, INIT used to kick
partition pCPU. If use_init_only flag is pass to hypervisor,
only INIT will be used to kick pCPU.

Signed-off-by: Minggui Cao <minggui.cao@...>
---
hypervisor/arch/x86/guest/vcpu.c | 5 ++++-
hypervisor/debug/console.c | 11 +++++++++++
hypervisor/include/debug/console.h | 1 +
hypervisor/release/console.c | 2 ++
4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c
index 76babb891..c7bf3a4b0 100755
--- a/hypervisor/arch/x86/guest/vcpu.c
+++ b/hypervisor/arch/x86/guest/vcpu.c
@@ -21,6 +21,7 @@
#include <lib/sprintf.h>
#include <asm/lapic.h>
#include <asm/irq.h>
+#include <console.h>

/* stack_frame is linked with the sequence of stack operation in arch_switch_to() */
struct stack_frame {
@@ -526,11 +527,13 @@ int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn
vcpu->vcpu_id = vcpu_id;
per_cpu(ever_run_vcpu, pcpu_id) = vcpu;

- if (is_lapic_pt_configured(vm)) {
+ if (is_lapic_pt_configured(vm) || is_init_used_only()) {
per_cpu(mode_to_kick_pcpu, pcpu_id) = DEL_MODE_INIT;
} else {
per_cpu(mode_to_kick_pcpu, pcpu_id) = DEL_MODE_IPI;
}
+ pr_info("pcpu=%d, kick-mode=%d, use_init_flag=%d", pcpu_id,
+ per_cpu(mode_to_kick_pcpu, pcpu_id), is_init_used_only());

/* Initialize the parent VM reference */
vcpu->vm = vm;
diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c
index f94d170e6..9f3092499 100644
--- a/hypervisor/debug/console.c
+++ b/hypervisor/debug/console.c
@@ -25,6 +25,14 @@ struct hv_timer console_timer;
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */
uint16_t console_vmid = ACRN_INVALID_VMID;

+/* if use INIT to kick pcpu only, if not IPI still is used for sharing CPU */
+static bool use_init_only = false;
+
+bool is_init_used_only(void)
+{
+ return use_init_only;
+}
+
static void parse_hvdbg_cmdline(void)
{
const char *start = NULL;
@@ -43,6 +51,9 @@ static void parse_hvdbg_cmdline(void)

if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
/* if not handled by handle_dbg_cmd, it can be handled further */
+ if (strncmp(start, "use_init_only", (size_t)(end - start)) == 0) {
+ use_init_only = true;
+ }
}
start = end;
}
diff --git a/hypervisor/include/debug/console.h b/hypervisor/include/debug/console.h
index b61a94afd..c113b52f6 100644
--- a/hypervisor/include/debug/console.h
+++ b/hypervisor/include/debug/console.h
@@ -41,5 +41,6 @@ void console_vmexit_callback(struct acrn_vcpu *vcpu);
void suspend_console(void);
void resume_console(void);
struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm);
+bool is_init_used_only(void);

#endif /* CONSOLE_H */
diff --git a/hypervisor/release/console.c b/hypervisor/release/console.c
index 803d71678..273e4f039 100644
--- a/hypervisor/release/console.c
+++ b/hypervisor/release/console.c
@@ -29,5 +29,7 @@ void resume_console(void) {}
bool handle_dbg_cmd(__unused const char *cmd, __unused int32_t len) { return false; }
void console_vmexit_callback(__unused struct acrn_vcpu *vcpu) {}

+bool is_init_used_only(void) { return false; }
+
void shell_init(void) {}
void shell_kick(void) {}
--
2.25.1


Eddie Dong
 

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of Minggui Cao
Sent: Friday, September 23, 2022 12:08 AM
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT used to kick
pCPU

By default, IPI used to kick sharing pCPU, INIT used to kick partition pCPU. If
use_init_only flag is pass to hypervisor, only INIT will be used to kick pCPU.

Signed-off-by: Minggui Cao <minggui.cao@...>
---
hypervisor/arch/x86/guest/vcpu.c | 5 ++++-
hypervisor/debug/console.c | 11 +++++++++++
hypervisor/include/debug/console.h | 1 +
hypervisor/release/console.c | 2 ++
4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/x86/guest/vcpu.c
b/hypervisor/arch/x86/guest/vcpu.c
index 76babb891..c7bf3a4b0 100755
--- a/hypervisor/arch/x86/guest/vcpu.c
+++ b/hypervisor/arch/x86/guest/vcpu.c
@@ -21,6 +21,7 @@
#include <lib/sprintf.h>
#include <asm/lapic.h>
#include <asm/irq.h>
+#include <console.h>

/* stack_frame is linked with the sequence of stack operation in
arch_switch_to() */ struct stack_frame { @@ -526,11 +527,13 @@ int32_t
create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn
vcpu->vcpu_id = vcpu_id;
per_cpu(ever_run_vcpu, pcpu_id) = vcpu;

- if (is_lapic_pt_configured(vm)) {
+ if (is_lapic_pt_configured(vm) || is_init_used_only()) {
per_cpu(mode_to_kick_pcpu, pcpu_id) =
DEL_MODE_INIT;
} else {
per_cpu(mode_to_kick_pcpu, pcpu_id) =
DEL_MODE_IPI;
}
+ pr_info("pcpu=%d, kick-mode=%d, use_init_flag=%d",
pcpu_id,
+ per_cpu(mode_to_kick_pcpu, pcpu_id),
is_init_used_only());

/* Initialize the parent VM reference */
vcpu->vm = vm;
diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c index
f94d170e6..9f3092499 100644
--- a/hypervisor/debug/console.c
+++ b/hypervisor/debug/console.c
@@ -25,6 +25,14 @@ struct hv_timer console_timer;
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */
uint16_t console_vmid = ACRN_INVALID_VMID;

+/* if use INIT to kick pcpu only, if not IPI still is used for sharing
+CPU */ static bool use_init_only = false;
+
+bool is_init_used_only(void)
+{
+ return use_init_only;
+}
+
static void parse_hvdbg_cmdline(void)
{
const char *start = NULL;
@@ -43,6 +51,9 @@ static void parse_hvdbg_cmdline(void)

if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
/* if not handled by handle_dbg_cmd, it can
be handled further */
+ if (strncmp(start, "use_init_only",
(size_t)(end - start)) == 0) {
+ use_init_only = true;
The patch is fine. But the parameter "use_init_only" may confuse readers since "init" has so many meanings.
In addition the term "IPI" typically includes NMI, INIT, SMI as well as interrupt using fixed vector. The term IPI we used in source code actually means " interrupt using fixed vector", and now we provides the choice of IPI using special purpose IPI, i.e. INIT .

It is time for us to clarify this confusion too. How about "USE_INIT_IPI" to replace "use_init_only" ? And is_init_used_only -> is_using_init_ipi ?

Please fix and PR.

+ }
}
start = end;
}
diff --git a/hypervisor/include/debug/console.h
b/hypervisor/include/debug/console.h
index b61a94afd..c113b52f6 100644
--- a/hypervisor/include/debug/console.h
+++ b/hypervisor/include/debug/console.h
@@ -41,5 +41,6 @@ void console_vmexit_callback(struct acrn_vcpu *vcpu);
void suspend_console(void); void resume_console(void); struct acrn_vuart
*vm_console_vuart(struct acrn_vm *vm);
+bool is_init_used_only(void);

#endif /* CONSOLE_H */
diff --git a/hypervisor/release/console.c b/hypervisor/release/console.c index
803d71678..273e4f039 100644
--- a/hypervisor/release/console.c
+++ b/hypervisor/release/console.c
@@ -29,5 +29,7 @@ void resume_console(void) {} bool
handle_dbg_cmd(__unused const char *cmd, __unused int32_t len) { return
false; } void console_vmexit_callback(__unused struct acrn_vcpu *vcpu) {}

+bool is_init_used_only(void) { return false; }
+
void shell_init(void) {}
void shell_kick(void) {}
--
2.25.1





Geoffroy Van Cutsem
 

Looking at where you put this, I _think_ this means the option will not be available when building the hypervisor in RELEASE mode. Is this intentional?

Thanks,
Geoffroy

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of Eddie Dong
Sent: Saturday, September 24, 2022 1:22 am
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: Re: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT used to
kick pCPU



-----Original Message-----
From: acrn-dev@... <acrn-dev@...>
On Behalf Of Minggui Cao
Sent: Friday, September 23, 2022 12:08 AM
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT used
to kick pCPU

By default, IPI used to kick sharing pCPU, INIT used to kick partition
pCPU. If use_init_only flag is pass to hypervisor, only INIT will be used to
kick pCPU.

Signed-off-by: Minggui Cao <minggui.cao@...>
---
hypervisor/arch/x86/guest/vcpu.c | 5 ++++-
hypervisor/debug/console.c | 11 +++++++++++
hypervisor/include/debug/console.h | 1 +
hypervisor/release/console.c | 2 ++
4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/x86/guest/vcpu.c
b/hypervisor/arch/x86/guest/vcpu.c
index 76babb891..c7bf3a4b0 100755
--- a/hypervisor/arch/x86/guest/vcpu.c
+++ b/hypervisor/arch/x86/guest/vcpu.c
@@ -21,6 +21,7 @@
#include <lib/sprintf.h>
#include <asm/lapic.h>
#include <asm/irq.h>
+#include <console.h>

/* stack_frame is linked with the sequence of stack operation in
arch_switch_to() */ struct stack_frame { @@ -526,11 +527,13 @@
int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct
acrn_vcpu **rtn
vcpu->vcpu_id = vcpu_id;
per_cpu(ever_run_vcpu, pcpu_id) = vcpu;

- if (is_lapic_pt_configured(vm)) {
+ if (is_lapic_pt_configured(vm) || is_init_used_only()) {
per_cpu(mode_to_kick_pcpu, pcpu_id) =
DEL_MODE_INIT;
} else {
per_cpu(mode_to_kick_pcpu, pcpu_id) =
DEL_MODE_IPI;
}
+ pr_info("pcpu=%d, kick-mode=%d, use_init_flag=%d",
pcpu_id,
+ per_cpu(mode_to_kick_pcpu, pcpu_id),
is_init_used_only());

/* Initialize the parent VM reference */
vcpu->vm = vm;
diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c
index
f94d170e6..9f3092499 100644
--- a/hypervisor/debug/console.c
+++ b/hypervisor/debug/console.c
@@ -25,6 +25,14 @@ struct hv_timer console_timer;
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE
*/
uint16_t console_vmid = ACRN_INVALID_VMID;

+/* if use INIT to kick pcpu only, if not IPI still is used for
+sharing CPU */ static bool use_init_only = false;
+
+bool is_init_used_only(void)
+{
+ return use_init_only;
+}
+
static void parse_hvdbg_cmdline(void) {
const char *start = NULL;
@@ -43,6 +51,9 @@ static void parse_hvdbg_cmdline(void)

if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
/* if not handled by handle_dbg_cmd, it can
be handled further */
+ if (strncmp(start, "use_init_only",
(size_t)(end - start)) == 0) {
+ use_init_only = true;
The patch is fine. But the parameter "use_init_only" may confuse readers
since "init" has so many meanings.
In addition the term "IPI" typically includes NMI, INIT, SMI as well as interrupt
using fixed vector. The term IPI we used in source code actually means "
interrupt using fixed vector", and now we provides the choice of IPI using
special purpose IPI, i.e. INIT .

It is time for us to clarify this confusion too. How about "USE_INIT_IPI" to
replace "use_init_only" ? And is_init_used_only -> is_using_init_ipi ?

Please fix and PR.

+ }
}
start = end;
}
diff --git a/hypervisor/include/debug/console.h
b/hypervisor/include/debug/console.h
index b61a94afd..c113b52f6 100644
--- a/hypervisor/include/debug/console.h
+++ b/hypervisor/include/debug/console.h
@@ -41,5 +41,6 @@ void console_vmexit_callback(struct acrn_vcpu
*vcpu); void suspend_console(void); void resume_console(void);
struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm);
+bool is_init_used_only(void);

#endif /* CONSOLE_H */
diff --git a/hypervisor/release/console.c
b/hypervisor/release/console.c index
803d71678..273e4f039 100644
--- a/hypervisor/release/console.c
+++ b/hypervisor/release/console.c
@@ -29,5 +29,7 @@ void resume_console(void) {} bool
handle_dbg_cmd(__unused const char *cmd, __unused int32_t len) {
return false; } void console_vmexit_callback(__unused struct
acrn_vcpu *vcpu) {}

+bool is_init_used_only(void) { return false; }
+
void shell_init(void) {}
void shell_kick(void) {}
--
2.25.1








Minggui Cao
 

Hi, Geoffroy,
You're right. This option of param is just used in debug mode to do further testing.

As Eddie's suggestions, we can open this param to do more testing, if no issue found, then

we'll switch to this mode: use INIT IPI to kick off VM's CPU, not use notification IPI further.

Thanks!
Minggui

-----Original Message-----
From: VanCutsem, Geoffroy <geoffroy.vancutsem@...>
Sent: Monday, September 26, 2022 4:26 PM
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: RE: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT used to kick pCPU

Looking at where you put this, I _think_ this means the option will not be available when building the hypervisor in RELEASE mode. Is this intentional?

Thanks,
Geoffroy

-----Original Message-----
From: acrn-dev@... <acrn-dev@...>
On Behalf Of Eddie Dong
Sent: Saturday, September 24, 2022 1:22 am
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: Re: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT
used to kick pCPU



-----Original Message-----
From: acrn-dev@...
<acrn-dev@...> On Behalf Of Minggui Cao
Sent: Friday, September 23, 2022 12:08 AM
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT
used to kick pCPU

By default, IPI used to kick sharing pCPU, INIT used to kick
partition pCPU. If use_init_only flag is pass to hypervisor, only
INIT will be used to
kick pCPU.

Signed-off-by: Minggui Cao <minggui.cao@...>
---
hypervisor/arch/x86/guest/vcpu.c | 5 ++++-
hypervisor/debug/console.c | 11 +++++++++++
hypervisor/include/debug/console.h | 1 +
hypervisor/release/console.c | 2 ++
4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/x86/guest/vcpu.c
b/hypervisor/arch/x86/guest/vcpu.c
index 76babb891..c7bf3a4b0 100755
--- a/hypervisor/arch/x86/guest/vcpu.c
+++ b/hypervisor/arch/x86/guest/vcpu.c
@@ -21,6 +21,7 @@
#include <lib/sprintf.h>
#include <asm/lapic.h>
#include <asm/irq.h>
+#include <console.h>

/* stack_frame is linked with the sequence of stack operation in
arch_switch_to() */ struct stack_frame { @@ -526,11 +527,13 @@
int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct
acrn_vcpu **rtn
vcpu->vcpu_id = vcpu_id;
per_cpu(ever_run_vcpu, pcpu_id) = vcpu;

- if (is_lapic_pt_configured(vm)) {
+ if (is_lapic_pt_configured(vm) || is_init_used_only()) {
per_cpu(mode_to_kick_pcpu, pcpu_id) =
DEL_MODE_INIT;
} else {
per_cpu(mode_to_kick_pcpu, pcpu_id) =
DEL_MODE_IPI;
}
+ pr_info("pcpu=%d, kick-mode=%d, use_init_flag=%d",
pcpu_id,
+ per_cpu(mode_to_kick_pcpu, pcpu_id),
is_init_used_only());

/* Initialize the parent VM reference */
vcpu->vm = vm;
diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c
index
f94d170e6..9f3092499 100644
--- a/hypervisor/debug/console.c
+++ b/hypervisor/debug/console.c
@@ -25,6 +25,14 @@ struct hv_timer console_timer;
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE
*/
uint16_t console_vmid = ACRN_INVALID_VMID;

+/* if use INIT to kick pcpu only, if not IPI still is used for
+sharing CPU */ static bool use_init_only = false;
+
+bool is_init_used_only(void)
+{
+ return use_init_only;
+}
+
static void parse_hvdbg_cmdline(void) {
const char *start = NULL;
@@ -43,6 +51,9 @@ static void parse_hvdbg_cmdline(void)

if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
/* if not handled by handle_dbg_cmd, it can
be handled further */
+ if (strncmp(start, "use_init_only",
(size_t)(end - start)) == 0) {
+ use_init_only = true;
The patch is fine. But the parameter "use_init_only" may confuse
readers since "init" has so many meanings.
In addition the term "IPI" typically includes NMI, INIT, SMI as well
as interrupt using fixed vector. The term IPI we used in source code actually means "
interrupt using fixed vector", and now we provides the choice of IPI
using special purpose IPI, i.e. INIT .

It is time for us to clarify this confusion too. How about
"USE_INIT_IPI" to replace "use_init_only" ? And is_init_used_only -> is_using_init_ipi ?

Please fix and PR.

+ }
}
start = end;
}
diff --git a/hypervisor/include/debug/console.h
b/hypervisor/include/debug/console.h
index b61a94afd..c113b52f6 100644
--- a/hypervisor/include/debug/console.h
+++ b/hypervisor/include/debug/console.h
@@ -41,5 +41,6 @@ void console_vmexit_callback(struct acrn_vcpu
*vcpu); void suspend_console(void); void resume_console(void);
struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm);
+bool is_init_used_only(void);

#endif /* CONSOLE_H */
diff --git a/hypervisor/release/console.c
b/hypervisor/release/console.c index
803d71678..273e4f039 100644
--- a/hypervisor/release/console.c
+++ b/hypervisor/release/console.c
@@ -29,5 +29,7 @@ void resume_console(void) {} bool
handle_dbg_cmd(__unused const char *cmd, __unused int32_t len) {
return false; } void console_vmexit_callback(__unused struct
acrn_vcpu *vcpu) {}

+bool is_init_used_only(void) { return false; }
+
void shell_init(void) {}
void shell_kick(void) {}
--
2.25.1








Geoffroy Van Cutsem
 

Thanks for the clarification.

Geoffroy

-----Original Message-----
From: Cao, Minggui <minggui.cao@...>
Sent: Monday, September 26, 2022 3:49 pm
To: VanCutsem, Geoffroy <geoffroy.vancutsem@...>
Cc: acrn-dev@...
Subject: RE: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT used to
kick pCPU

Hi, Geoffroy,
You're right. This option of param is just used in debug mode to do further
testing.

As Eddie's suggestions, we can open this param to do more testing, if no
issue found, then

we'll switch to this mode: use INIT IPI to kick off VM's CPU, not use
notification IPI further.

Thanks!
Minggui


-----Original Message-----
From: VanCutsem, Geoffroy <geoffroy.vancutsem@...>
Sent: Monday, September 26, 2022 4:26 PM
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: RE: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT used to
kick pCPU

Looking at where you put this, I _think_ this means the option will not be
available when building the hypervisor in RELEASE mode. Is this intentional?

Thanks,
Geoffroy

-----Original Message-----
From: acrn-dev@... <acrn-dev@...>
On Behalf Of Eddie Dong
Sent: Saturday, September 24, 2022 1:22 am
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: Re: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT
used to kick pCPU



-----Original Message-----
From: acrn-dev@...
<acrn-dev@...> On Behalf Of Minggui Cao
Sent: Friday, September 23, 2022 12:08 AM
To: acrn-dev@...
Cc: Cao, Minggui <minggui.cao@...>
Subject: [acrn-dev] [PATCH 2/3 V2] hv: add param to control INIT
used to kick pCPU

By default, IPI used to kick sharing pCPU, INIT used to kick
partition pCPU. If use_init_only flag is pass to hypervisor, only
INIT will be used to
kick pCPU.

Signed-off-by: Minggui Cao <minggui.cao@...>
---
hypervisor/arch/x86/guest/vcpu.c | 5 ++++-
hypervisor/debug/console.c | 11 +++++++++++
hypervisor/include/debug/console.h | 1 +
hypervisor/release/console.c | 2 ++
4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/x86/guest/vcpu.c
b/hypervisor/arch/x86/guest/vcpu.c
index 76babb891..c7bf3a4b0 100755
--- a/hypervisor/arch/x86/guest/vcpu.c
+++ b/hypervisor/arch/x86/guest/vcpu.c
@@ -21,6 +21,7 @@
#include <lib/sprintf.h>
#include <asm/lapic.h>
#include <asm/irq.h>
+#include <console.h>

/* stack_frame is linked with the sequence of stack operation in
arch_switch_to() */ struct stack_frame { @@ -526,11 +527,13 @@
int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct
acrn_vcpu **rtn
vcpu->vcpu_id = vcpu_id;
per_cpu(ever_run_vcpu, pcpu_id) = vcpu;

- if (is_lapic_pt_configured(vm)) {
+ if (is_lapic_pt_configured(vm) || is_init_used_only()) {
per_cpu(mode_to_kick_pcpu, pcpu_id) =
DEL_MODE_INIT;
} else {
per_cpu(mode_to_kick_pcpu, pcpu_id) =
DEL_MODE_IPI;
}
+ pr_info("pcpu=%d, kick-mode=%d, use_init_flag=%d",
pcpu_id,
+ per_cpu(mode_to_kick_pcpu, pcpu_id),
is_init_used_only());

/* Initialize the parent VM reference */
vcpu->vm = vm;
diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c
index
f94d170e6..9f3092499 100644
--- a/hypervisor/debug/console.c
+++ b/hypervisor/debug/console.c
@@ -25,6 +25,14 @@ struct hv_timer console_timer;
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE
*/
uint16_t console_vmid = ACRN_INVALID_VMID;

+/* if use INIT to kick pcpu only, if not IPI still is used for
+sharing CPU */ static bool use_init_only = false;
+
+bool is_init_used_only(void)
+{
+ return use_init_only;
+}
+
static void parse_hvdbg_cmdline(void) {
const char *start = NULL;
@@ -43,6 +51,9 @@ static void parse_hvdbg_cmdline(void)

if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
/* if not handled by handle_dbg_cmd, it can
be handled further */
+ if (strncmp(start, "use_init_only",
(size_t)(end - start)) == 0) {
+ use_init_only = true;
The patch is fine. But the parameter "use_init_only" may confuse
readers since "init" has so many meanings.
In addition the term "IPI" typically includes NMI, INIT, SMI as well
as interrupt using fixed vector. The term IPI we used in source code actually
means "
interrupt using fixed vector", and now we provides the choice of IPI
using special purpose IPI, i.e. INIT .

It is time for us to clarify this confusion too. How about
"USE_INIT_IPI" to replace "use_init_only" ? And is_init_used_only ->
is_using_init_ipi ?

Please fix and PR.

+ }
}
start = end;
}
diff --git a/hypervisor/include/debug/console.h
b/hypervisor/include/debug/console.h
index b61a94afd..c113b52f6 100644
--- a/hypervisor/include/debug/console.h
+++ b/hypervisor/include/debug/console.h
@@ -41,5 +41,6 @@ void console_vmexit_callback(struct acrn_vcpu
*vcpu); void suspend_console(void); void resume_console(void);
struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm);
+bool is_init_used_only(void);

#endif /* CONSOLE_H */
diff --git a/hypervisor/release/console.c
b/hypervisor/release/console.c index
803d71678..273e4f039 100644
--- a/hypervisor/release/console.c
+++ b/hypervisor/release/console.c
@@ -29,5 +29,7 @@ void resume_console(void) {} bool
handle_dbg_cmd(__unused const char *cmd, __unused int32_t len) {
return false; } void console_vmexit_callback(__unused struct
acrn_vcpu *vcpu) {}

+bool is_init_used_only(void) { return false; }
+
void shell_init(void) {}
void shell_kick(void) {}
--
2.25.1