qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Michael Tokarev <mjt@tls.msk.ru>, qemu-devel@nongnu.org
Subject: Re: [PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
Date: Mon, 5 Jun 2023 10:40:33 +0100	[thread overview]
Message-ID: <CAFEAcA_L8XCdRLGU_xeMC3JGzK_4h0LDWXz0VFLMgdkWigc1VQ@mail.gmail.com> (raw)
In-Reply-To: <4377a8d5-54d1-e0b3-e87a-0c04ec3b1360@roeck-us.net>

On Sat, 3 Jun 2023 at 19:06, Guenter Roeck <linux@roeck-us.net> wrote:
>
> On 6/3/23 10:46, Michael Tokarev wrote:
> > 03.06.2023 18:03, Guenter Roeck wrote:
> >> Hi,
> >>
> >> On Tue, May 02, 2023 at 01:14:55PM +0100, Peter Maydell wrote:
> >>> The Allwinner PIC model uses set_bit() and clear_bit() to update the
> >>> values in its irq_pending[] array when an interrupt arrives.  However
> >>> it is using these functions wrongly: they work on an array of type
> >>> 'long', and it is passing an array of type 'uint32_t'.  Because the
> >>> code manually figures out the right array element, this works on
> >>> little-endian hosts and on 32-bit big-endian hosts, where bits 0..31
> >>> in a 'long' are in the same place as they are in a 'uint32_t'.
> >>> However it breaks on 64-bit big-endian hosts.
> >>>
> >>> Remove the use of set_bit() and clear_bit() in favour of using
> >>> deposit32() on the array element.  This fixes a bug where on
> >>> big-endian 64-bit hosts the guest kernel would hang early on in
> >>> bootup.
> >>>
> >>> Cc: qemu-stable@nongnu.org
> >>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> >>> Reviewed-by: Thomas Huth <thuth@redhat.com>
> >>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> >>> Message-id: 20230424152833.1334136-1-peter.maydell@linaro.org
> >>
> >> In v8.0.2, the cubieboard emulation running Linux crashes during reboot
> >> with a hung task error. Tested with mainline Linux (v6.4-rc4-78-g929ed21dfdb6)
> >> and with v5.15.114. Host is AMD Ryzen 5900X.
> >>
> >> Requesting system reboot
> >> [   61.927460] INFO: task kworker/0:1:13 blocked for more than 30 seconds.
> >> [   61.927896]       Not tainted 5.15.115-rc2-00038-g31e35d9f1b8d #1
> >> [   61.928144] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> >> [   61.928419] task:kworker/0:1     state:D stack:    0 pid:   13 ppid:     2 flags:0x00000000
> >> [   61.928972] Workqueue: events_freezable mmc_rescan
> >> [   61.929739] [<c13734f0>] (__schedule) from [<c1373c98>] (schedule+0x80/0x15c)
> >> [   61.930041] [<c1373c98>] (schedule) from [<c137ad64>] (schedule_timeout+0xd4/0x12c)
> >> [   61.930270] [<c137ad64>] (schedule_timeout) from [<c137477c>] (do_wait_for_common+0xa0/0x154)
> >> [   61.930523] [<c137477c>] (do_wait_for_common) from [<c1374870>] (wait_for_completion+0x40/0x4c)
> >> [   61.930764] [<c1374870>] (wait_for_completion) from [<c1044cd0>] (mmc_wait_for_req_done+0x6c/0x90)
> >> [   61.931012] [<c1044cd0>] (mmc_wait_for_req_done) from [<c1044e34>] (mmc_wait_for_cmd+0x70/0xa8)
> >> [   61.931252] [<c1044e34>] (mmc_wait_for_cmd) from [<c10512a0>] (sdio_reset+0x58/0x124)
> >> [   61.931478] [<c10512a0>] (sdio_reset) from [<c1046328>] (mmc_rescan+0x294/0x30c)
> >> [   61.931692] [<c1046328>] (mmc_rescan) from [<c036be10>] (process_one_work+0x28c/0x720)
> >> [   61.931924] [<c036be10>] (process_one_work) from [<c036c308>] (worker_thread+0x64/0x53c)
> >> [   61.932153] [<c036c308>] (worker_thread) from [<c03753e0>] (kthread+0x15c/0x180)
> >> [   61.932365] [<c03753e0>] (kthread) from [<c030015c>] (ret_from_fork+0x14/0x38)
> >> [   61.932628] Exception stack(0xc31ddfb0 to 0xc31ddff8)
> >>
> >> This was not seen with v8.0.0. Bisect points to this patch. Reverting it
> >> fixes the problem.
> >
> > Does this happen on master too, or just on stable-8.0 ?
> >
>
> It does. Tested with v8.0.0-1542-g848a6caa88.
>
> Here is my command line in case you want to give it a try:
>
> qemu-system-arm -M cubieboard -kernel arch/arm/boot/zImage -no-reboot \
>      -initrd rootfs-armv5.cpio -m 512 \
>      --append "panic=-1 rdinit=/sbin/init earlycon=uart8250,mmio32,0x1c28000,115200n8 console=ttyS0" \
>      -dtb arch/arm/boot/dts/sun4i-a10-cubieboard.dtb -nographic \
>      -monitor null -serial stdio
>
> initrd is https://github.com/groeck/linux-build-test/blob/master/rootfs/arm-v7/rootfs-armv5.cpio.gz
>
> This is with multi_v7_defconfig with some debug options added. If necessary
> I'll be happy to provide the exact configuration.

If you can provide a link to the zImage and the dtb to reproduce
as well, that would be helpful.

thanks
-- PMM


  reply	other threads:[~2023-06-05  9:41 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02 12:14 [PULL 00/35] target-arm queue Peter Maydell
2023-05-02 12:14 ` [PULL 01/35] target/arm: Move cortex sysregs into a separate file Peter Maydell
2023-05-02 12:14 ` [PULL 02/35] target/arm: Remove dead code from cpu_max_set_sve_max_vq Peter Maydell
2023-05-02 12:14 ` [PULL 03/35] target/arm: Extract TCG -cpu max code into a function Peter Maydell
2023-05-02 12:14 ` [PULL 04/35] target/arm: Do not expose all -cpu max features to qtests Peter Maydell
2023-05-02 12:14 ` [PULL 05/35] target/arm: Move 64-bit TCG CPUs into tcg/ Peter Maydell
2023-05-02 12:14 ` [PULL 06/35] tests/qtest: Adjust and document query-cpu-model-expansion test for arm Peter Maydell
2023-05-02 12:14 ` [PULL 07/35] target/arm: move cpu_tcg to tcg/cpu32.c Peter Maydell
2023-05-02 12:14 ` [PULL 08/35] tests/qtest: Fix tests when no KVM or TCG are present Peter Maydell
2023-05-02 12:14 ` [PULL 09/35] tests/avocado: Pass parameters to migration test Peter Maydell
2023-05-02 12:14 ` [PULL 10/35] arm/Kconfig: Always select SEMIHOSTING when TCG is present Peter Maydell
2023-05-02 12:14 ` [PULL 11/35] arm/Kconfig: Do not build TCG-only boards on a KVM-only build Peter Maydell
2023-05-04  7:12   ` Thomas Huth
2023-05-04 12:27     ` Fabiano Rosas
2023-05-08 22:19       ` Paolo Bonzini
2023-05-09  6:57       ` Thomas Huth
2023-05-02 12:14 ` [PULL 12/35] tests/qtest: Restrict tpm-tis-i2c-test to CONFIG_TCG Peter Maydell
2023-05-02 12:14 ` [PULL 13/35] gitlab-ci: Check building KVM-only aarch64 target Peter Maydell
2023-05-02 12:14 ` [PULL 14/35] hw/net: npcm7xx_emc: set MAC in register space Peter Maydell
2023-05-02 12:14 ` [PULL 15/35] hw/arm/bcm2835_property: Implement "get command line" message Peter Maydell
2023-05-02 12:14 ` [PULL 16/35] make one-insn-per-tb an accel option Peter Maydell
2023-05-02 12:14 ` [PULL 17/35] softmmu: Don't use 'singlestep' global in QMP and HMP commands Peter Maydell
2023-05-02 12:14 ` [PULL 18/35] accel/tcg: Use one_insn_per_tb global instead of old singlestep global Peter Maydell
2023-05-02 12:14 ` [PULL 19/35] linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' Peter Maydell
2023-05-02 12:14 ` [PULL 20/35] bsd-user: " Peter Maydell
2023-05-02 12:14 ` [PULL 21/35] Document that -singlestep command line option is deprecated Peter Maydell
2023-05-02 12:14 ` [PULL 22/35] accel/tcg: Report one-insn-per-tb in 'info jit', not 'info status' Peter Maydell
2023-05-02 12:14 ` [PULL 23/35] hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' Peter Maydell
2023-05-02 12:14 ` [PULL 24/35] qapi/run-state.json: Fix missing newline at end of file Peter Maydell
2023-05-02 12:14 ` [PULL 25/35] qmp: Deprecate 'singlestep' member of StatusInfo Peter Maydell
2023-05-02 12:14 ` [PULL 26/35] docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation Peter Maydell
2023-05-02 12:14 ` [PULL 27/35] hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc() Peter Maydell
2023-05-02 12:14 ` [PULL 28/35] hw/arm/boot: Make write_bootloader() public as arm_write_bootloader() Peter Maydell
2023-05-02 12:14 ` [PULL 29/35] hw/arm/aspeed: Use arm_write_bootloader() to write the bootloader Peter Maydell
2023-05-02 12:14 ` [PULL 30/35] hw/arm/raspi: Use arm_write_bootloader() to write boot code Peter Maydell
2023-05-02 12:14 ` [PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit() Peter Maydell
2023-06-03 15:03   ` Guenter Roeck
2023-06-03 17:46     ` Michael Tokarev
2023-06-03 18:06       ` Guenter Roeck
2023-06-05  9:40         ` Peter Maydell [this message]
2023-06-05 13:35           ` Guenter Roeck
2023-06-06 10:33             ` Peter Maydell
2023-05-02 12:14 ` [PULL 32/35] target/arm: Define and use new load_cpu_field_low32() Peter Maydell
2023-05-02 12:14 ` [PULL 33/35] target/arm: Add compile time asserts to load/store_cpu_field macros Peter Maydell
2023-05-02 12:14 ` [PULL 34/35] hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields Peter Maydell
2023-05-02 12:14 ` [PULL 35/35] hw/net/allwinner-sun8i-emac: " Peter Maydell
2023-05-02 14:09 ` [PULL 00/35] target-arm queue Richard Henderson
2023-05-02 14:47   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA_L8XCdRLGU_xeMC3JGzK_4h0LDWXz0VFLMgdkWigc1VQ@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=linux@roeck-us.net \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).