• cannot poweroff debian/mips64el on qemu

    From Jun Sun@21:1/5 to All on Sun Jan 19 23:40:02 2020
    When I do "poweroff" from debian/mips64el on qemu, qemu will hang in
    the end, rather than quitting the process. See the kernel messages
    below. Last time when I tried 32bit debian/mipsel I was able to quit
    qemu completely. Any thoughts?

    (No, I don't have "-no-shutdown" option in my qemu commandline.)

    Jun

    ....
    [ OK ] Stopped Raise network interfaces.
    [ OK ] Stopped Apply Kernel Variables.
    [ OK ] Stopped target Local File Systems.
    [ OK ] Stopped target Local File Systems (Pre).
    [ OK ] Stopped Create Static Device Nodes in /dev.
    [ OK ] Stopped Create System Users.
    [ OK ] Stopped Remount Root and Kernel File Systems.
    [ OK ] Stopped Load Kernel Modules.
    [ OK ] Reached target Shutdown.
    [ OK ] Reached target Final Step.
    [ OK ] Started Power-Off.
    [ OK ] Reached target Power-Off.
    [ 79.830354] systemd-shutdow: 33 output lines suppressed due to ratelimiting [ 80.113620] systemd-shutdown[1]: Syncing filesystems and block devices.
    [ 80.252235] systemd-shutdown[1]: Sending SIGTERM to remaining processes...
    [ 80.317935] systemd-journald[144]: Received SIGTERM from PID 1 (systemd-shutdow).
    [ 80.393924] systemd-shutdown[1]: Sending SIGKILL to remaining processes...
    [ 80.427856] systemd-shutdown[1]: Unmounting file systems.
    [ 80.467625] [383]: Remounting '/' read-only in with options 'errors=remount-ro'.
    [ 80.490593] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
    [ 80.508067] systemd-shutdown[1]: All filesystems unmounted.
    [ 80.508795] systemd-shutdown[1]: Deactivating swaps.
    [ 80.511447] systemd-shutdown[1]: All swaps deactivated.
    [ 80.512120] systemd-shutdown[1]: Detaching loop devices.
    [ 80.517216] systemd-shutdown[1]: All loop devices detached.
    [ 80.518078] systemd-shutdown[1]: Detaching DM devices.
    [ 80.564236] sd 0:0:0:0: [sda] Synchronizing SCSI cache
    [ 80.565791] sd 0:0:0:0: [sda] Stopping disk
    [ 80.568175] reboot: System halted

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter Maydell@21:1/5 to Jun Sun on Mon Jan 20 12:00:03 2020
    On Sun, 19 Jan 2020 at 22:40, Jun Sun <jsun@junsun.net> wrote:

    When I do "poweroff" from debian/mips64el on qemu, qemu will hang in
    the end, rather than quitting the process. See the kernel messages
    below. Last time when I tried 32bit debian/mipsel I was able to quit
    qemu completely. Any thoughts?

    Whether this is expected to work depends on the board model
    (you don't give your QEMU command line). "exit the QEMU process"
    happens when the guest powers down the emulated hardware,
    so for this to work:
    * the h/w board being modelled needs to actually have a
    software-controllable powerdown feature (eg some device
    register the guest has to prod)
    * the QEMU model of that board needs to actually implement
    whatever the powerdown control is
    * the guest OS has to know about the control feature and
    use it

    thanks
    -- PMM

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jun Sun@21:1/5 to peter.maydell@linaro.org on Tue Jan 21 02:40:01 2020
    Thanks, Peter.

    Here is the commandline. The board is Malta board. On the 32bit
    version which worked, it is also Malta board, but it could be the
    kernel difference.

    If you could point out where the code is, I'd be more than happy to fix it.

    Cheers.

    Jun

    qemu-system-mips64el \
    -M malta \
    -cpu MIPS64R2-generic \
    -m $GUEST_MEM \
    -hda hda.qcow2 \
    -kernel vmlinux \
    -initrd initrd.img \
    -append "root=/dev/sda1 console=ttyS0 nokaslr" \
    -nographic \
    -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::8080-:80,hostfwd=tcp::8443-:443
    \
    -net nic \
    -serial mon:stdio \

    On Mon, Jan 20, 2020 at 2:41 AM Peter Maydell <peter.maydell@linaro.org> wrote:

    On Sun, 19 Jan 2020 at 22:40, Jun Sun <jsun@junsun.net> wrote:

    When I do "poweroff" from debian/mips64el on qemu, qemu will hang in
    the end, rather than quitting the process. See the kernel messages
    below. Last time when I tried 32bit debian/mipsel I was able to quit
    qemu completely. Any thoughts?

    Whether this is expected to work depends on the board model
    (you don't give your QEMU command line). "exit the QEMU process"
    happens when the guest powers down the emulated hardware,
    so for this to work:
    * the h/w board being modelled needs to actually have a
    software-controllable powerdown feature (eg some device
    register the guest has to prod)
    * the QEMU model of that board needs to actually implement
    whatever the powerdown control is
    * the guest OS has to know about the control feature and
    use it

    thanks
    -- PMM

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jun Sun@21:1/5 to jsun@junsun.net on Sat Jan 25 04:10:02 2020
    Sorry. There is a typo. In both cases, qemu is v2.5.0.

    Jun

    On Fri, Jan 24, 2020 at 7:05 PM Jun Sun <jsun@junsun.net> wrote:

    Here are more testing results

    - qemu 2.5 + debian10.2 + Malta + kernel4.19.0 : hangs on
    poweroff ("reboot: System halted") for both 32bit and 64bit mipsel
    - qemu 2.6 + debian9.11 + Malta + kernel4.9.0 : poweroff successfully
    for both 32bit and 64bit mipsel

    Given these results, who is likely to blame? Debian? or kernel?

    Thanks.


    On Mon, Jan 20, 2020 at 5:31 PM Jun Sun <jsun@junsun.net> wrote:

    Thanks, Peter.

    Here is the commandline. The board is Malta board. On the 32bit
    version which worked, it is also Malta board, but it could be the
    kernel difference.

    If you could point out where the code is, I'd be more than happy to fix
    it.

    Cheers.

    Jun

    qemu-system-mips64el \
    -M malta \
    -cpu MIPS64R2-generic \
    -m $GUEST_MEM \
    -hda hda.qcow2 \
    -kernel vmlinux \
    -initrd initrd.img \
    -append "root=/dev/sda1 console=ttyS0 nokaslr" \
    -nographic \
    -net
    user,hostfwd=tcp::2222-:22,hostfwd=tcp::8080-:80,hostfwd=tcp::8443-:443
    \
    -net nic \
    -serial mon:stdio \

    On Mon, Jan 20, 2020 at 2:41 AM Peter Maydell <peter.maydell@linaro.org>
    wrote:

    On Sun, 19 Jan 2020 at 22:40, Jun Sun <jsun@junsun.net> wrote:

    When I do "poweroff" from debian/mips64el on qemu, qemu will hang in
    the end, rather than quitting the process. See the kernel messages
    below. Last time when I tried 32bit debian/mipsel I was able to quit
    qemu completely. Any thoughts?

    Whether this is expected to work depends on the board model
    (you don't give your QEMU command line). "exit the QEMU process"
    happens when the guest powers down the emulated hardware,
    so for this to work:
    * the h/w board being modelled needs to actually have a
    software-controllable powerdown feature (eg some device
    register the guest has to prod)
    * the QEMU model of that board needs to actually implement
    whatever the powerdown control is
    * the guest OS has to know about the control feature and
    use it

    thanks
    -- PMM



    <div dir="ltr">Sorry.  There is a typo.  In both cases, qemu is v2.5.0.<div><br></div><div>Jun</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 24, 2020 at 7:05 PM Jun Sun &lt;<a href="mailto:jsun@junsun.net">jsun@
    junsun.net</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Here are more testing results<div><ul><li>qemu 2.5 + debian10.2 + Malta + kernel4.
    19.0 : hangs on poweroff (&quot;reboot: System halted&quot;) for both 32bit and 64bit mipsel<br></li><li>qemu 2.6 + debian9.11 + Malta + kernel4.9.0 : poweroff successfully for both 32bit and 64bit mipsel</li></ul><div>Given these results, who is
    likely to blame?  Debian? or kernel?  </div></div><div><br></div><div>Thanks.</div></div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 20, 2020 at 5:31 PM Jun Sun &lt;<a href="mailto:jsun@junsun.net" target="_blank">
    jsun@junsun.net</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thanks, Peter.<br>

    Here is the commandline.  The board is Malta board.  On the 32bit<br>
    version which worked, it is also Malta board, but it could be the<br>
    kernel difference.<br>

    If you could point out where the code is, I&#39;d be more than happy to fix it.<br>

    Cheers.<br>

    Jun<br>

    qemu-system-mips64el \<br>
        -M malta \<br>
        -cpu MIPS64R2-generic \<br>
        -m $GUEST_MEM \<br>
        -hda hda.qcow2 \<br>
        -kernel vmlinux \<br>
        -initrd initrd.img \<br>
            -append &quot;root=/dev/sda1 console=ttyS0 nokaslr&quot; \<br>
        -nographic \<br>
        -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::8080-:80,hostfwd=tcp::8443-:443<br>
    \<br>
        -net nic \<br>
        -serial mon:stdio \<br>

    On Mon, Jan 20, 2020 at 2:41 AM Peter Maydell &lt;<a href="mailto:peter.maydell@linaro.org" target="_blank">peter.maydell@linaro.org</a>&gt; wrote:<br>
    &gt;<br>
    &gt; On Sun, 19 Jan 2020 at 22:40, Jun Sun &lt;<a href="mailto:jsun@junsun.net" target="_blank">jsun@junsun.net</a>&gt; wrote:<br>
    &gt; &gt;<br>
    &gt; &gt; When I do &quot;poweroff&quot; from debian/mips64el on qemu, qemu will hang in<br>
    &gt; &gt; the end, rather than quitting the process.  See the kernel messages<br>
    &gt; &gt; below. Last time when I tried 32bit debian/mipsel I was able to quit<br>
    &gt; &gt; qemu completely.  Any thoughts?<br>
    &gt;<br>
    &gt; Whether this is expected to work depends on the board model<br>
    &gt; (you don&#39;t give your QEMU command line). &quot;exit the QEMU process&quot;<br>
    &gt; happens when the guest powers down the emulated hardware,<br>
    &gt; so for this to work:<br>
    &gt;  * the h/w board being modelled needs to actually have a<br>
    &gt;    software-controllable powerdown feature (eg some device<br>
    &gt;    register the guest has to prod)<br>
    &gt;  * the QEMU model of that board needs to actually implement<br>
    &gt;    whatever the powerdown control is<br>
    &gt;  * the guest OS has to know about the control feature and<br>
    &gt;    use it<br>
    &gt;<br>
    &gt; thanks<br>
    &gt; -- PMM<br>
    </blockquote></div>
    </blockquote></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aurelien Jarno@21:1/5 to Jun Sun on Sat Jan 25 13:50:01 2020
    On 2020-01-24 19:05, Jun Sun wrote:
    Here are more testing results

    - qemu 2.5 + debian10.2 + Malta + kernel4.19.0 : hangs on
    poweroff ("reboot: System halted") for both 32bit and 64bit mipsel
    - qemu 2.6 + debian9.11 + Malta + kernel4.9.0 : poweroff successfully
    for both 32bit and 64bit mipsel

    Given these results, who is likely to blame? Debian? or kernel?

    Probably a bit of both ;-) The poweroff implementation has changed in
    kernel 4.19 (commit dd129c6374) and requires that the kernel is built
    with CONFIG_POWER_RESET_PIIX4_POWEROFF=y to work.

    I have pushed the fix to the Debian kernel repository. However I am not
    sure it will be fixed for Debian 10.3, maybe it will only appear in
    Debian 10.4.

    Aurelien

    --
    Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jun Sun@21:1/5 to aurelien@aurel32.net on Sat Jan 25 20:40:02 2020
    Wow! That is it! Thank you, Aurlien!

    I'm using debian 10.2 and clearly the kernel config option is not there.
    After adding it back, the guest machine powers off correctly.

    Now I only need to figure out how to properly update initrd in a crossbuild environment ...

    Cheers.

    Jun

    On Sat, Jan 25, 2020 at 4:49 AM Aurelien Jarno <aurelien@aurel32.net> wrote:

    On 2020-01-24 19:05, Jun Sun wrote:
    Here are more testing results

    - qemu 2.5 + debian10.2 + Malta + kernel4.19.0 : hangs on
    poweroff ("reboot: System halted") for both 32bit and 64bit mipsel
    - qemu 2.6 + debian9.11 + Malta + kernel4.9.0 : poweroff successfully
    for both 32bit and 64bit mipsel

    Given these results, who is likely to blame? Debian? or kernel?

    Probably a bit of both ;-) The poweroff implementation has changed in
    kernel 4.19 (commit dd129c6374) and requires that the kernel is built
    with CONFIG_POWER_RESET_PIIX4_POWEROFF=y to work.

    I have pushed the fix to the Debian kernel repository. However I am not
    sure it will be fixed for Debian 10.3, maybe it will only appear in
    Debian 10.4.

    Aurelien

    --
    Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net


    <div dir="ltr">Wow!  That is it!  Thank you, Aurlien!<div><br></div><div>I&#39;m using debian 10.2 and clearly the kernel config option is not there.  After adding it back, the guest machine powers off correctly.</div><div><br></div><div>Now I only
    need to figure out how to properly update initrd in a crossbuild environment ...</div><div><br></div><div>Cheers.</div><div><br></div><div>Jun</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 25, 2020 at 4:49 AM
    Aurelien Jarno &lt;<a href="mailto:aurelien@aurel32.net">aurelien@aurel32.net</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2020-01-24 19:05, Jun Sun
    wrote:<br>
    &gt; Here are more testing results<br>
    &gt; <br>
    &gt;    - qemu 2.5 + debian10.2 + Malta + kernel4.19.0 : hangs on<br>
    &gt;    poweroff (&quot;reboot: System halted&quot;) for both 32bit and 64bit mipsel<br>
    &gt;    - qemu 2.6 + debian9.11 + Malta + kernel4.9.0 : poweroff successfully<br>
    &gt;    for both 32bit and 64bit mipsel<br>
    &gt; <br>
    &gt; Given these results, who is likely to blame?  Debian? or kernel?<br>

    Probably a bit of both ;-) The poweroff implementation has changed in<br> kernel 4.19 (commit dd129c6374) and requires that the kernel is built<br>
    with CONFIG_POWER_RESET_PIIX4_POWEROFF=y to work.<br>

    I have pushed the fix to the Debian kernel repository. However I am not<br> sure it will be fixed for Debian 10.3, maybe it will only appear in<br>
    Debian 10.4.<br>

    Aurelien<br>

    -- <br>
    Aurelien Jarno                          GPG: 4096R/1DDD8C9B<br>
    <a href="mailto:aurelien@aurel32.net" target="_blank">aurelien@aurel32.net</a>                 <a href="http://www.aurel32.net" rel="noreferrer" target="_blank">http://www.aurel32.net</a><br>
    </blockquote></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jun Sun@21:1/5 to jsun@junsun.net on Sun Jan 26 22:30:02 2020
    If you are curious how I built debian/mips kernel, please refer to this
    site,
    https://sites.google.com/junsun.net/cross-build-debian-mips-kernel/home

    I gave up on updating initrd in cross-build environment. I just did an in-target deb package install.

    Jun

    On Sat, Jan 25, 2020 at 11:34 AM Jun Sun <jsun@junsun.net> wrote:

    Wow! That is it! Thank you, Aurlien!

    I'm using debian 10.2 and clearly the kernel config option is not there. After adding it back, the guest machine powers off correctly.

    Now I only need to figure out how to properly update initrd in a
    crossbuild environment ...

    Cheers.

    Jun

    On Sat, Jan 25, 2020 at 4:49 AM Aurelien Jarno <aurelien@aurel32.net>
    wrote:

    On 2020-01-24 19:05, Jun Sun wrote:
    Here are more testing results

    - qemu 2.5 + debian10.2 + Malta + kernel4.19.0 : hangs on
    poweroff ("reboot: System halted") for both 32bit and 64bit mipsel
    - qemu 2.6 + debian9.11 + Malta + kernel4.9.0 : poweroff successfully >> > for both 32bit and 64bit mipsel

    Given these results, who is likely to blame? Debian? or kernel?

    Probably a bit of both ;-) The poweroff implementation has changed in
    kernel 4.19 (commit dd129c6374) and requires that the kernel is built
    with CONFIG_POWER_RESET_PIIX4_POWEROFF=y to work.

    I have pushed the fix to the Debian kernel repository. However I am not
    sure it will be fixed for Debian 10.3, maybe it will only appear in
    Debian 10.4.

    Aurelien

    --
    Aurelien Jarno GPG: 4096R/1DDD8C9B
    aurelien@aurel32.net http://www.aurel32.net



    <div dir="ltr">If you are curious how I built debian/mips kernel, please refer to this site, 

    <a href="https://sites.google.com/junsun.net/cross-build-debian-mips-kernel/home">https://sites.google.com/junsun.net/cross-build-debian-mips-kernel/home</a><div><br></div><div>I gave up on updating initrd in cross-build environment.  I just did an in-
    target deb package install. </div><div><br></div><div>Jun</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 25, 2020 at 11:34 AM Jun Sun &lt;<a href="mailto:jsun@junsun.net">jsun@junsun.net</a>&gt; wrote:<br></div><
    blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Wow!  That is it!  Thank you, Aurlien!<div><br></div><div>I&#39;m using debian 10.2 and clearly the kernel config
    option is not there.  After adding it back, the guest machine powers off correctly.</div><div><br></div><div>Now I only need to figure out how to properly update initrd in a crossbuild environment ...</div><div><br></div><div>Cheers.</div><div><br></div>
    <div>Jun</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 25, 2020 at 4:49 AM Aurelien Jarno &lt;<a href="mailto:aurelien@aurel32.net" target="_blank">aurelien@aurel32.net</a>&gt; wrote:<br></div><blockquote class="
    gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2020-01-24 19:05, Jun Sun wrote:<br>
    &gt; Here are more testing results<br>
    &gt; <br>
    &gt;    - qemu 2.5 + debian10.2 + Malta + kernel4.19.0 : hangs on<br>
    &gt;    poweroff (&quot;reboot: System halted&quot;) for both 32bit and 64bit mipsel<br>
    &gt;    - qemu 2.6 + debian9.11 + Malta + kernel4.9.0 : poweroff successfully<br>
    &gt;    for both 32bit and 64bit mipsel<br>
    &gt; <br>
    &gt; Given these results, who is likely to blame?  Debian? or kernel?<br>

    Probably a bit of both ;-) The poweroff implementation has changed in<br> kernel 4.19 (commit dd129c6374) and requires that the kernel is built<br>
    with CONFIG_POWER_RESET_PIIX4_POWEROFF=y to work.<br>

    I have pushed the fix to the Debian kernel repository. However I am not<br> sure it will be fixed for Debian 10.3, maybe it will only appear in<br>
    Debian 10.4.<br>

    Aurelien<br>

    -- <br>
    Aurelien Jarno                          GPG: 4096R/1DDD8C9B<br>
    <a href="mailto:aurelien@aurel32.net" target="_blank">aurelien@aurel32.net</a>                 <a href="http://www.aurel32.net" rel="noreferrer" target="_blank">http://www.aurel32.net</a><br>
    </blockquote></div>
    </blockquote></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aurelien Jarno@21:1/5 to Jun Sun on Sat Feb 8 18:50:02 2020
    On 2020-01-25 11:34, Jun Sun wrote:
    Wow! That is it! Thank you, Aurlien!

    I'm using debian 10.2 and clearly the kernel config option is not there. After adding it back, the guest machine powers off correctly.


    The problem has been fixed in debian 10.3 which has just been released.

    Aurelien

    --
    Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)