mbox series

[0/3] S3 and S4 sleep for loongarch/virt & microvm

Message ID 20240613-loongarch64-sleep-v1-0-d2ef0aaa543a@flygoat.com
Headers show
Series S3 and S4 sleep for loongarch/virt & microvm | expand

Message

Jiaxun Yang June 13, 2024, 5:30 p.m. UTC
Hi all,

This series implemented S3 and S4 sleep for loongarch virt machine
and microvm.

For loongarch/virt a kernel patch is requried [1].

[1]: https://lore.kernel.org/loongarch/20240613-loongarch64-sleep-v1-0-a245232af5e4@flygoat.com/

Please review.
Thanks

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
Jiaxun Yang (3):
      acpi/ged: Implement S3 and S4 sleep
      hw/loongarch/virt: Wire up S3 and S4 sleep
      hw/i386/microvm: Wire up S3 and S4 sleep

 hw/acpi/generic_event_device.c         | 70 ++++++++++++++++++++++++++++++----
 hw/i386/acpi-microvm.c                 | 18 +++++++++
 hw/i386/microvm.c                      |  3 ++
 hw/loongarch/acpi-build.c              | 18 +++++++++
 hw/loongarch/virt.c                    |  3 ++
 include/hw/acpi/generic_event_device.h | 12 +++++-
 6 files changed, 115 insertions(+), 9 deletions(-)
---
base-commit: f3e8cc47de2bc537d4991e883a85208e4e1c0f98
change-id: 20240613-loongarch64-sleep-37b2466b8d76

Best regards,

Comments

Bibo Mao June 14, 2024, 3:32 a.m. UTC | #1
It is interesting.

How to wakeup VM if it sleeps in S3/S4, from emulated keyboard or 
ethernet magic packet or qemu monitor command in background?

Regards
Bibo Mao


On 2024/6/14 上午1:30, Jiaxun Yang wrote:
> Hi all,
> 
> This series implemented S3 and S4 sleep for loongarch virt machine
> and microvm.
> 
> For loongarch/virt a kernel patch is requried [1].
> 
> [1]: https://lore.kernel.org/loongarch/20240613-loongarch64-sleep-v1-0-a245232af5e4@flygoat.com/
> 
> Please review.
> Thanks
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> Jiaxun Yang (3):
>        acpi/ged: Implement S3 and S4 sleep
>        hw/loongarch/virt: Wire up S3 and S4 sleep
>        hw/i386/microvm: Wire up S3 and S4 sleep
> 
>   hw/acpi/generic_event_device.c         | 70 ++++++++++++++++++++++++++++++----
>   hw/i386/acpi-microvm.c                 | 18 +++++++++
>   hw/i386/microvm.c                      |  3 ++
>   hw/loongarch/acpi-build.c              | 18 +++++++++
>   hw/loongarch/virt.c                    |  3 ++
>   include/hw/acpi/generic_event_device.h | 12 +++++-
>   6 files changed, 115 insertions(+), 9 deletions(-)
> ---
> base-commit: f3e8cc47de2bc537d4991e883a85208e4e1c0f98
> change-id: 20240613-loongarch64-sleep-37b2466b8d76
> 
> Best regards,
>
Jiaxun Yang June 14, 2024, 4:27 a.m. UTC | #2
在2024年6月14日六月 上午4:32,maobibo写道:
> It is interesting.
>
> How to wakeup VM if it sleeps in S3/S4, from emulated keyboard or 
> ethernet magic packet or qemu monitor command in background?

Hi Bibo,

The best way to wake the guest is system_wakeup command in monitor.

Thanks
- Jiaxun

>
> Regards
> Bibo Mao
>
>
> On 2024/6/14 上午1:30, Jiaxun Yang wrote:
>> Hi all,
>> 
>> This series implemented S3 and S4 sleep for loongarch virt machine
>> and microvm.
>> 
>> For loongarch/virt a kernel patch is requried [1].
>> 
>> [1]: https://lore.kernel.org/loongarch/20240613-loongarch64-sleep-v1-0-a245232af5e4@flygoat.com/
>> 
>> Please review.
>> Thanks
>> 
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>> Jiaxun Yang (3):
>>        acpi/ged: Implement S3 and S4 sleep
>>        hw/loongarch/virt: Wire up S3 and S4 sleep
>>        hw/i386/microvm: Wire up S3 and S4 sleep
>> 
>>   hw/acpi/generic_event_device.c         | 70 ++++++++++++++++++++++++++++++----
>>   hw/i386/acpi-microvm.c                 | 18 +++++++++
>>   hw/i386/microvm.c                      |  3 ++
>>   hw/loongarch/acpi-build.c              | 18 +++++++++
>>   hw/loongarch/virt.c                    |  3 ++
>>   include/hw/acpi/generic_event_device.h | 12 +++++-
>>   6 files changed, 115 insertions(+), 9 deletions(-)
>> ---
>> base-commit: f3e8cc47de2bc537d4991e883a85208e4e1c0f98
>> change-id: 20240613-loongarch64-sleep-37b2466b8d76
>> 
>> Best regards,
>>
Bibo Mao June 14, 2024, 5:17 a.m. UTC | #3
On 2024/6/14 下午12:27, Jiaxun Yang wrote:
> 
> 
> 在2024年6月14日六月 上午4:32,maobibo写道:
>> It is interesting.
>>
>> How to wakeup VM if it sleeps in S3/S4, from emulated keyboard or
>> ethernet magic packet or qemu monitor command in background?
> 
> Hi Bibo,
> 
> The best way to wake the guest is system_wakeup command in monitor.
Ok, I see.

It is useful and it can be used to test S3/S4 in TCG mode at least.

Can we add feature capability, enabled in TCG mode, disabled in KVM mode 
by default? If vm deploys in cloud, users in general help it is power-on 
always.

Regards
Bibo Mao
> 
> Thanks
> - Jiaxun
> 
>>
>> Regards
>> Bibo Mao
>>
>>
>> On 2024/6/14 上午1:30, Jiaxun Yang wrote:
>>> Hi all,
>>>
>>> This series implemented S3 and S4 sleep for loongarch virt machine
>>> and microvm.
>>>
>>> For loongarch/virt a kernel patch is requried [1].
>>>
>>> [1]: https://lore.kernel.org/loongarch/20240613-loongarch64-sleep-v1-0-a245232af5e4@flygoat.com/
>>>
>>> Please review.
>>> Thanks
>>>
>>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>> ---
>>> Jiaxun Yang (3):
>>>         acpi/ged: Implement S3 and S4 sleep
>>>         hw/loongarch/virt: Wire up S3 and S4 sleep
>>>         hw/i386/microvm: Wire up S3 and S4 sleep
>>>
>>>    hw/acpi/generic_event_device.c         | 70 ++++++++++++++++++++++++++++++----
>>>    hw/i386/acpi-microvm.c                 | 18 +++++++++
>>>    hw/i386/microvm.c                      |  3 ++
>>>    hw/loongarch/acpi-build.c              | 18 +++++++++
>>>    hw/loongarch/virt.c                    |  3 ++
>>>    include/hw/acpi/generic_event_device.h | 12 +++++-
>>>    6 files changed, 115 insertions(+), 9 deletions(-)
>>> ---
>>> base-commit: f3e8cc47de2bc537d4991e883a85208e4e1c0f98
>>> change-id: 20240613-loongarch64-sleep-37b2466b8d76
>>>
>>> Best regards,
>>>
>
Jiaxun Yang June 14, 2024, 1:55 p.m. UTC | #4
在2024年6月14日六月 上午6:17,maobibo写道:
> On 2024/6/14 下午12:27, Jiaxun Yang wrote:
>> 
>> 
>> 在2024年6月14日六月 上午4:32,maobibo写道:
>>> It is interesting.
>>>
>>> How to wakeup VM if it sleeps in S3/S4, from emulated keyboard or
>>> ethernet magic packet or qemu monitor command in background?
>> 
>> Hi Bibo,
>> 
>> The best way to wake the guest is system_wakeup command in monitor.
> Ok, I see.
>
> It is useful and it can be used to test S3/S4 in TCG mode at least.
>
> Can we add feature capability, enabled in TCG mode, disabled in KVM mode 
> by default? If vm deploys in cloud, users in general help it is power-on 
> always.

Well, I think we should align both machines as much as possible.

It's also enabled for KVM on x86 piix4 and q35 machines.

Thanks
>
> Regards
> Bibo Mao
Daniel P. Berrangé June 14, 2024, 2:03 p.m. UTC | #5
On Fri, Jun 14, 2024 at 01:17:39PM +0800, maobibo wrote:
> 
> 
> On 2024/6/14 下午12:27, Jiaxun Yang wrote:
> > 
> > 
> > 在2024年6月14日六月 上午4:32,maobibo写道:
> > > It is interesting.
> > > 
> > > How to wakeup VM if it sleeps in S3/S4, from emulated keyboard or
> > > ethernet magic packet or qemu monitor command in background?
> > 
> > Hi Bibo,
> > 
> > The best way to wake the guest is system_wakeup command in monitor.
> Ok, I see.
> 
> It is useful and it can be used to test S3/S4 in TCG mode at least.
> 
> Can we add feature capability, enabled in TCG mode, disabled in KVM mode by
> default? If vm deploys in cloud, users in general help it is power-on
> always.

Please avoid creating differing defaults between TCG and KVM where
practical.

With regards,
Daniel
Bibo Mao June 15, 2024, 1:45 a.m. UTC | #6
On 2024/6/14 下午10:03, Daniel P. Berrangé wrote:
> On Fri, Jun 14, 2024 at 01:17:39PM +0800, maobibo wrote:
>>
>>
>> On 2024/6/14 下午12:27, Jiaxun Yang wrote:
>>>
>>>
>>> 在2024年6月14日六月 上午4:32,maobibo写道:
>>>> It is interesting.
>>>>
>>>> How to wakeup VM if it sleeps in S3/S4, from emulated keyboard or
>>>> ethernet magic packet or qemu monitor command in background?
>>>
>>> Hi Bibo,
>>>
>>> The best way to wake the guest is system_wakeup command in monitor.
>> Ok, I see.
>>
>> It is useful and it can be used to test S3/S4 in TCG mode at least.
>>
>> Can we add feature capability, enabled in TCG mode, disabled in KVM mode by
>> default? If vm deploys in cloud, users in general help it is power-on
>> always.
> 
> Please avoid creating differing defaults between TCG and KVM where
> practical.
There is bad experience for me, remote VM suddenly freezes and all 
network connection are lost if virt-machine does not support S3/S4 on 
LoongArch machines.

However it does not happen on x86 machine, how does x86 KVM VM machine 
stop this?

Regards
Bibo Mao
> 
> With regards,
> Daniel
>
Igor Mammedov July 25, 2024, 7:52 a.m. UTC | #7
On Sat, 15 Jun 2024 09:45:48 +0800
maobibo <maobibo@loongson.cn> wrote:

> On 2024/6/14 下午10:03, Daniel P. Berrangé wrote:
> > On Fri, Jun 14, 2024 at 01:17:39PM +0800, maobibo wrote:  
> >>
> >>
> >> On 2024/6/14 下午12:27, Jiaxun Yang wrote:  
> >>>
> >>>
> >>> 在2024年6月14日六月 上午4:32,maobibo写道:  
> >>>> It is interesting.
> >>>>
> >>>> How to wakeup VM if it sleeps in S3/S4, from emulated keyboard or
> >>>> ethernet magic packet or qemu monitor command in background?  
> >>>
> >>> Hi Bibo,
> >>>
> >>> The best way to wake the guest is system_wakeup command in monitor.  
> >> Ok, I see.
> >>
> >> It is useful and it can be used to test S3/S4 in TCG mode at least.
> >>
> >> Can we add feature capability, enabled in TCG mode, disabled in KVM mode by
> >> default? If vm deploys in cloud, users in general help it is power-on
> >> always.  
> > 
> > Please avoid creating differing defaults between TCG and KVM where
> > practical.  
> There is bad experience for me, remote VM suddenly freezes and all 
> network connection are lost if virt-machine does not support S3/S4 on 
> LoongArch machines.
> 
> However it does not happen on x86 machine, how does x86 KVM VM machine 
> stop this?

S3 support in linux was rather unreliable (that's the reason why RHEL
disables it downstream even for x86), it might be even more so for
LoongArch machines.

The best approach would be to find the actual reason why your guest
freezes in KVM mode. (it might be be a bug on qemu/kvm side or
a guest bug that needs fixing)

> Regards
> Bibo Mao
> > 
> > With regards,
> > Daniel
> >   
>
Igor Mammedov July 25, 2024, 8:29 a.m. UTC | #8
On Thu, 13 Jun 2024 18:30:14 +0100
Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:

> Hi all,
> 
> This series implemented S3 and S4 sleep for loongarch virt machine
> and microvm.
> 
> For loongarch/virt a kernel patch is requried [1].
> 
> [1]: https://lore.kernel.org/loongarch/20240613-loongarch64-sleep-v1-0-a245232af5e4@flygoat.com/

series also should include arm/virt patch to enable this
as it's another user of GED

> 
> Please review.
> Thanks
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> Jiaxun Yang (3):
>       acpi/ged: Implement S3 and S4 sleep
>       hw/loongarch/virt: Wire up S3 and S4 sleep
>       hw/i386/microvm: Wire up S3 and S4 sleep
> 
>  hw/acpi/generic_event_device.c         | 70 ++++++++++++++++++++++++++++++----
>  hw/i386/acpi-microvm.c                 | 18 +++++++++
>  hw/i386/microvm.c                      |  3 ++
>  hw/loongarch/acpi-build.c              | 18 +++++++++
>  hw/loongarch/virt.c                    |  3 ++
>  include/hw/acpi/generic_event_device.h | 12 +++++-
>  6 files changed, 115 insertions(+), 9 deletions(-)
> ---
> base-commit: f3e8cc47de2bc537d4991e883a85208e4e1c0f98
> change-id: 20240613-loongarch64-sleep-37b2466b8d76
> 
> Best regards,