diff mbox

[4/5] kvmtool: Handle exit reason KVM_EXIT_SYSTEM_EVENT

Message ID 1407228599-25065-5-git-send-email-anup.patel@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Anup Patel Aug. 5, 2014, 8:49 a.m. UTC
The KVM_EXIT_SYSTEM_EVENT exit reason was added to define
architecture independent system-wide events for a Guest.

Currently, it is used by in-kernel PSCI-0.2 emulation of
KVM ARM/ARM64 to inform user space about PSCI SYSTEM_OFF
or PSCI SYSTEM_RESET request.

For now, we simply treat all system-wide guest events as
same and shutdown the guest upon KVM_EXIT_SYSTEM_EVENT.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
---
 tools/kvm/kvm-cpu.c |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Will Deacon Aug. 6, 2014, 12:53 p.m. UTC | #1
On Tue, Aug 05, 2014 at 09:49:58AM +0100, Anup Patel wrote:
> The KVM_EXIT_SYSTEM_EVENT exit reason was added to define
> architecture independent system-wide events for a Guest.
> 
> Currently, it is used by in-kernel PSCI-0.2 emulation of
> KVM ARM/ARM64 to inform user space about PSCI SYSTEM_OFF
> or PSCI SYSTEM_RESET request.
> 
> For now, we simply treat all system-wide guest events as
> same and shutdown the guest upon KVM_EXIT_SYSTEM_EVENT.
> 
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> ---
>  tools/kvm/kvm-cpu.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools/kvm/kvm-cpu.c b/tools/kvm/kvm-cpu.c
> index ee0a8ec..e20ee4b 100644
> --- a/tools/kvm/kvm-cpu.c
> +++ b/tools/kvm/kvm-cpu.c
> @@ -160,6 +160,12 @@ int kvm_cpu__start(struct kvm_cpu *cpu)
>  			goto exit_kvm;
>  		case KVM_EXIT_SHUTDOWN:
>  			goto exit_kvm;
> +		case KVM_EXIT_SYSTEM_EVENT:
> +			/*
> +			 * Treat both SHUTDOWN & RESET system events
> +			 * as shutdown request.
> +			 */
> +			goto exit_kvm;

Can we figure out whether this was a SHUTDOWN or RESET request? If so,
printing a message for the latter "RESET request received -- exiting KVM"
might be informative.

Will
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anup Patel Aug. 7, 2014, 8:57 a.m. UTC | #2
On 6 August 2014 18:23, Will Deacon <will.deacon@arm.com> wrote:
> On Tue, Aug 05, 2014 at 09:49:58AM +0100, Anup Patel wrote:
>> The KVM_EXIT_SYSTEM_EVENT exit reason was added to define
>> architecture independent system-wide events for a Guest.
>>
>> Currently, it is used by in-kernel PSCI-0.2 emulation of
>> KVM ARM/ARM64 to inform user space about PSCI SYSTEM_OFF
>> or PSCI SYSTEM_RESET request.
>>
>> For now, we simply treat all system-wide guest events as
>> same and shutdown the guest upon KVM_EXIT_SYSTEM_EVENT.
>>
>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>> Signed-off-by: Anup Patel <anup.patel@linaro.org>
>> ---
>>  tools/kvm/kvm-cpu.c |    6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/tools/kvm/kvm-cpu.c b/tools/kvm/kvm-cpu.c
>> index ee0a8ec..e20ee4b 100644
>> --- a/tools/kvm/kvm-cpu.c
>> +++ b/tools/kvm/kvm-cpu.c
>> @@ -160,6 +160,12 @@ int kvm_cpu__start(struct kvm_cpu *cpu)
>>                       goto exit_kvm;
>>               case KVM_EXIT_SHUTDOWN:
>>                       goto exit_kvm;
>> +             case KVM_EXIT_SYSTEM_EVENT:
>> +                     /*
>> +                      * Treat both SHUTDOWN & RESET system events
>> +                      * as shutdown request.
>> +                      */
>> +                     goto exit_kvm;
>
> Can we figure out whether this was a SHUTDOWN or RESET request? If so,
> printing a message for the latter "RESET request received -- exiting KVM"
> might be informative.

OK, I will update this and make it more verbose.

--
Anup

>
> Will
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tools/kvm/kvm-cpu.c b/tools/kvm/kvm-cpu.c
index ee0a8ec..e20ee4b 100644
--- a/tools/kvm/kvm-cpu.c
+++ b/tools/kvm/kvm-cpu.c
@@ -160,6 +160,12 @@  int kvm_cpu__start(struct kvm_cpu *cpu)
 			goto exit_kvm;
 		case KVM_EXIT_SHUTDOWN:
 			goto exit_kvm;
+		case KVM_EXIT_SYSTEM_EVENT:
+			/*
+			 * Treat both SHUTDOWN & RESET system events
+			 * as shutdown request.
+			 */
+			goto exit_kvm;
 		default: {
 			bool ret;