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

Jiaxun Yang posted 3 patches 5 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240613-loongarch64-sleep-v1-0-d2ef0aaa543a@flygoat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Sergio Lopez <slp@redhat.com>, Song Gao <gaosong@loongson.cn>
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(-)
[PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by Jiaxun Yang 5 months, 2 weeks ago
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 <jiaxun.yang@flygoat.com>
Re: [PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by Igor Mammedov 4 months ago
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,
Re: [PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by maobibo 5 months, 1 week ago
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,
> 


Re: [PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by Jiaxun Yang 5 months, 1 week ago

在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,
>>

-- 
- Jiaxun
Re: [PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by maobibo 5 months, 1 week ago

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,
>>>
> 


Re: [PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by Daniel P. Berrangé 5 months, 1 week ago
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
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Re: [PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by maobibo 5 months, 1 week ago

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
> 


Re: [PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by Igor Mammedov 4 months ago
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
> >   
> 
Re: [PATCH 0/3] S3 and S4 sleep for loongarch/virt & microvm
Posted by Jiaxun Yang 5 months, 1 week ago

在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
-- 
- Jiaxun