Skip to content
This repository has been archived by the owner on Nov 25, 2023. It is now read-only.

Ethernet driver support for rk3288-firefly #9

Open
wenfengand opened this issue Jan 19, 2020 · 0 comments
Open

Ethernet driver support for rk3288-firefly #9

wenfengand opened this issue Jan 19, 2020 · 0 comments

Comments

@wenfengand
Copy link

Hello! I'm trying to port rk3288-firefly kernel to youku TV box, whose model is YK-K1.

When it comes to the network part, I found that rockchip gmac driver code is not compiled into the final kernel image. You can check that by looking at drivers/net/ethernet/Makefile, and there is no drivers/net/ethernet/rockchip. Even if I add rockchip gmac code, there are still endless compile error or runtime panic.

Can you give me a little insight into adding network driver for rk3288? Thank you!

SquallATF pushed a commit to SquallATF/kernel that referenced this issue May 14, 2020
commit cf3591e upstream.

Revert the commit bd293d0. The proper
fix has been made available with commit d0a255e ("loop: set
PF_MEMALLOC_NOIO for the worker thread").

Note that the fix offered by commit bd293d0 doesn't really prevent
the deadlock from occuring - if we look at the stacktrace reported by
Junxiao Bi, we see that it hangs in bit_wait_io and not on the mutex -
i.e. it has already successfully taken the mutex. Changing the mutex
from mutex_lock to mutex_trylock won't help with deadlocks that happen
afterwards.

PID: 474    TASK: ffff8813e11f4600  CPU: 10  COMMAND: "kswapd0"
   #0 [ffff8813dedfb938] __schedule at ffffffff8173f405
   FireflyTeam#1 [ffff8813dedfb990] schedule at ffffffff8173fa27
   FireflyTeam#2 [ffff8813dedfb9b0] schedule_timeout at ffffffff81742fec
   FireflyTeam#3 [ffff8813dedfba60] io_schedule_timeout at ffffffff8173f186
   FireflyTeam#4 [ffff8813dedfbaa0] bit_wait_io at ffffffff8174034f
   FireflyTeam#5 [ffff8813dedfbac0] __wait_on_bit at ffffffff8173fec8
   FireflyTeam#6 [ffff8813dedfbb10] out_of_line_wait_on_bit at ffffffff8173ff81
   FireflyTeam#7 [ffff8813dedfbb90] __make_buffer_clean at ffffffffa038736f [dm_bufio]
   FireflyTeam#8 [ffff8813dedfbbb0] __try_evict_buffer at ffffffffa0387bb8 [dm_bufio]
   FireflyTeam#9 [ffff8813dedfbbd0] dm_bufio_shrink_scan at ffffffffa0387cc3 [dm_bufio]
  FireflyTeam#10 [ffff8813dedfbc40] shrink_slab at ffffffff811a87ce
  FireflyTeam#11 [ffff8813dedfbd30] shrink_zone at ffffffff811ad778
  FireflyTeam#12 [ffff8813dedfbdc0] kswapd at ffffffff811ae92f
  FireflyTeam#13 [ffff8813dedfbec0] kthread at ffffffff810a8428
  FireflyTeam#14 [ffff8813dedfbf50] ret_from_fork at ffffffff81745242

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Fixes: bd293d0 ("dm bufio: fix deadlock with loop device")
Depends-on: d0a255e ("loop: set PF_MEMALLOC_NOIO for the worker thread")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SquallATF pushed a commit to SquallATF/kernel that referenced this issue May 31, 2022
[ Upstream commit 76e43c8 ]

When IOCB_CMD_POLL is used on the FUSE device, aio_poll() disables IRQs
and takes kioctx::ctx_lock, then fuse_iqueue::waitq.lock.

This may have to wait for fuse_iqueue::waitq.lock to be released by one
of many places that take it with IRQs enabled.  Since the IRQ handler
may take kioctx::ctx_lock, lockdep reports that a deadlock is possible.

Fix it by protecting the state of struct fuse_iqueue with a separate
spinlock, and only accessing fuse_iqueue::waitq using the versions of
the waitqueue functions which do IRQ-safe locking internally.

Reproducer:

	#include <fcntl.h>
	#include <stdio.h>
	#include <sys/mount.h>
	#include <sys/stat.h>
	#include <sys/syscall.h>
	#include <unistd.h>
	#include <linux/aio_abi.h>

	int main()
	{
		char opts[128];
		int fd = open("/dev/fuse", O_RDWR);
		aio_context_t ctx = 0;
		struct iocb cb = { .aio_lio_opcode = IOCB_CMD_POLL, .aio_fildes = fd };
		struct iocb *cbp = &cb;

		sprintf(opts, "fd=%d,rootmode=040000,user_id=0,group_id=0", fd);
		mkdir("mnt", 0700);
		mount("foo",  "mnt", "fuse", 0, opts);
		syscall(__NR_io_setup, 1, &ctx);
		syscall(__NR_io_submit, ctx, 1, &cbp);
	}

Beginning of lockdep output:

	=====================================================
	WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected
	5.3.0-rc5 FireflyTeam#9 Not tainted
	-----------------------------------------------------
	syz_fuse/135 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
	000000003590ceda (&fiq->waitq){+.+.}, at: spin_lock include/linux/spinlock.h:338 [inline]
	000000003590ceda (&fiq->waitq){+.+.}, at: aio_poll fs/aio.c:1751 [inline]
	000000003590ceda (&fiq->waitq){+.+.}, at: __io_submit_one.constprop.0+0x203/0x5b0 fs/aio.c:1825

	and this task is already holding:
	0000000075037284 (&(&ctx->ctx_lock)->rlock){..-.}, at: spin_lock_irq include/linux/spinlock.h:363 [inline]
	0000000075037284 (&(&ctx->ctx_lock)->rlock){..-.}, at: aio_poll fs/aio.c:1749 [inline]
	0000000075037284 (&(&ctx->ctx_lock)->rlock){..-.}, at: __io_submit_one.constprop.0+0x1f4/0x5b0 fs/aio.c:1825
	which would create a new lock dependency:
	 (&(&ctx->ctx_lock)->rlock){..-.} -> (&fiq->waitq){+.+.}

	but this new dependency connects a SOFTIRQ-irq-safe lock:
	 (&(&ctx->ctx_lock)->rlock){..-.}

	[...]

Reported-by: syzbot+af05535bb79520f95431@syzkaller.appspotmail.com
Reported-by: syzbot+d86c4426a01f60feddc7@syzkaller.appspotmail.com
Fixes: bfe4037 ("aio: implement IOCB_CMD_POLL")
Cc: <stable@vger.kernel.org> # v4.19+
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SquallATF pushed a commit to SquallATF/kernel that referenced this issue May 31, 2022
When do uvc hotplug test on RV1126 EVB, it may crash in the
uvc_v4l2_streamon() with the following error log. Because
it tries to enable the video stream after usb disconnect.

[ 1748.947755] configfs-gadget gadget: uvc_function_disable
[ 1748.947947] android_work: sent uevent USB_STATE=DISCONNECTED
[ 1748.955347] Unable to handle kernel NULL pointer dereference at virtual address 00000003
[ 1748.956158] pgd = ef2a7e72
[ 1748.956550] [00000003] *pgd=6dde7835
[ 1748.956893] Internal error: Oops: 17 [FireflyTeam#1] PREEMPT SMP ARM
[ 1748.957381] Modules linked in: galcore(O) bcmdhd
[ 1748.957819] CPU: 3 PID: 2706 Comm: uvc_gadget_pthr Tainted: G        W  O      4.19.111 FireflyTeam#9
[ 1748.958567] Hardware name: Generic DT based system
[ 1748.959218] PC is at uvcg_video_enable+0xb8/0x228
[ 1748.959775] LR is at vb2_core_streamon+0x11c/0x15c
......
[ 1749.041063] [<b056a2cc>] (uvcg_video_enable) from [<b0569968>] (uvc_v4l2_streamon+0x28/0x70)
[ 1749.041906] [<b0569968>] (uvc_v4l2_streamon) from [<b0590b54>] (__video_do_ioctl+0x1c8/0x3a0)
[ 1749.042681] [<b0590b54>] (__video_do_ioctl) from [<b0594288>] (video_usercopy+0x200/0x494)
[ 1749.043475] [<b0594288>] (video_usercopy) from [<b0220c38>] (do_vfs_ioctl+0xac/0x798)
[ 1749.044178] [<b0220c38>] (do_vfs_ioctl) from [<b0221358>] (ksys_ioctl+0x34/0x58)
[ 1749.044843] [<b0221358>] (ksys_ioctl) from [<b0101000>] (ret_fast_syscall+0x0/0x4c)

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: I6bb58133aaade0ff389fa4af2cfc05fe598de250
SquallATF pushed a commit to SquallATF/kernel that referenced this issue May 31, 2022
[  100.584484] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[  100.584500] pgd = 466047cd
[  100.584509] [00000000] *pgd=00000000
[  100.584526] Internal error: Oops - BUG: 17 [FireflyTeam#1] THUMB2
[  100.584534] Modules linked in: dw_mmc_rockchip(+) rknpu snd_soc_rv1106 rockit(O) mpp_vcodec(O) rga3
[  100.584586] CPU: 0 PID: 9 Comm: kworker/u2:1 Tainted: G           O      5.10.66 FireflyTeam#9
[  100.584593] Hardware name: Generic DT based system
[  100.584618] Workqueue: events_unbound async_run_entry_fn
[  100.584638] PC is at dw_mci_probe+0x10a/0x7dc
[  100.584655] LR is at clk_core_enable_lock+0x19/0x1c
[  100.584667] pc : [<b038428a>]    lr : [<b02f79ef>]    psr: 60000033
[  100.584676] sp : b00a1e88  ip : b1caf580  fp : af8c29f4
[  100.584686] r10: 00000000  r9 : af8c2c04  r8 : af8c29f4
[  100.584696] r7 : b00cc4e4  r6 : 00000001  r5 : b1caf450  r4 : b1c8c010
[  100.584706] r3 : 00000000  r2 : b05b095c  r1 : 00000000  r0 : 00000000
[  100.584720] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment user
[  100.584731] Control: 50c53c7d  Table: 01c88059  DAC: 00000055
[  100.584743] Process kworker/u2:1 (pid: 9, stack limit = 0xc7a2c6f9)
[  100.584753] Stack: (0xb00a1e88 to 0xb00a2000)
[  100.584769] 1e80:                   00000001 00000001 ff9a0000 b02cce69 b1caf410 00000000
[  100.584787] 1ea0: b1c8c010 b00cc400 b00cc410 b00cc410 b00cc400 00000001 b00cc4e4 af8c29f4
[  100.584805] 1ec0: af8c2c04 0000000a 00000000 af8c2469 00000000 b00cc410 af8c2c04 b05b1e04
[  100.584822] 1ee0: 00000000 b031b3e3 b00cc410 00000000 b05b1e08 b031a775 00000000 b00cc410
[  100.584840] 1f00: af8c2c04 b1caf2c0 b0008000 00000000 00000000 b1caf2d4 00000000 b031a959
[  100.584858] 1f20: b00bed00 b00cc410 b05a1018 b031a989 b1caf2d0 b0223ad5 b002f8a0 b1caf2d0
[  100.584877] 1f40: b0007000 b021f917 b002f8a0 b1caf2d0 b002f8a0 b002f8b4 b0007000 b057ed20
[  100.584896] 1f60: b05a191c b0007014 b0007040 b021fbc3 b009d300 b0094920 ffffe000 b005bed0
[  100.584914] 1f80: b021fae1 b002f8a0 b009d320 b0222553 b0094920 b02224b1 00000000 00000000
[  100.584931] 1fa0: 00000000 00000000 00000000 b02082e9 00000000 00000000 00000000 00000000
[  100.584946] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  100.584962] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[  100.585012] [<b038428a>] (dw_mci_probe) from [<af8c2469>] (dw_mci_rockchip_probe+0x79/0xbc [dw_mmc_rockchip])
[  100.585049] [<af8c2469>] (dw_mci_rockchip_probe [dw_mmc_rockchip]) from [<b031b3e3>] (platform_drv_probe+0x2d/0x5a)
[  100.585074] [<b031b3e3>] (platform_drv_probe) from [<b031a775>] (really_probe+0x16f/0x23e)
[  100.585096] [<b031a775>] (really_probe) from [<b031a959>] (driver_probe_device+0x5d/0x6c)
[  100.585118] [<b031a959>] (driver_probe_device) from [<b031a989>] (__driver_attach_async_helper+0x21/0x32)
[  100.585139] [<b031a989>] (__driver_attach_async_helper) from [<b0223ad5>] (async_run_entry_fn+0x25/0xa0)
[  100.585165] [<b0223ad5>] (async_run_entry_fn) from [<b021f917>] (process_one_work+0xd5/0x136)
[  100.585191] [<b021f917>] (process_one_work) from [<b021fbc3>] (worker_thread+0xe3/0x190)
[  100.585213] [<b021fbc3>] (worker_thread) from [<b0222553>] (kthread+0xa3/0xac)
[  100.585237] [<b0222553>] (kthread) from [<b02082e9>] (ret_from_fork+0x11/0x28)
[  100.585248] Exception stack(0xb00a1fb0 to 0xb00a1ff8)

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Change-Id: Ia0e2d83c53a757b1cf3703408a2803052ff78049
SquallATF pushed a commit to SquallATF/kernel that referenced this issue Jul 24, 2022
…QF_ONESHOT

The flag IRQF_ONESHOT is only for irq thread, so remove IRQF_ONESHOT for
devm_request_irq().

And with IRQF_ONESHOT, when enable CONFIG_PREEMPT_RT, kernel will report bug:
[    4.953930][    C4] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:970
[    4.953932][    C4] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 1, name: swapper/0
[    4.953936][    C4] INFO: lockdep is turned off.
[    4.953937][    C4] irq event stamp: 2481260
[    4.953938][    C4] hardirqs last  enabled at (2481259): [<ffffffc0113a5504>] _raw_spin_unlock_irqrestore+0x60/0xb8
[    4.953946][    C4] hardirqs last disabled at (2481260): [<ffffffc01139b7c0>] enter_el1_irq_or_nmi+0x20/0x54
[    4.953951][    C4] softirqs last  enabled at (2334926): [<ffffffc010056c20>] __local_bh_enable_ip+0x1f4/0x258
[    4.953957][    C4] softirqs last disabled at (2334920): [<ffffffc010123444>] local_bh_disable+0x4/0x30
[    4.953963][    C4] Preemption disabled at:
[    4.953964][    C4] [<ffffffc0100de3d0>] __raw_spin_lock_irqsave+0x3c/0x138
[    4.953971][    C4] CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.10.66-rt53 FireflyTeam#9
[    4.953974][    C4] Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
[    4.953976][    C4] Call trace:
[    4.953977][    C4]  dump_backtrace+0x0/0x1c4
[    4.953983][    C4]  show_stack+0x18/0x24
[    4.953989][    C4]  dump_stack_lvl+0xec/0x148
[    4.953992][    C4]  dump_stack+0x18/0x64
[    4.953996][    C4]  ___might_sleep+0x1b4/0x1c4
[    4.954002][    C4]  rt_spin_lock+0x70/0xd8
[    4.954005][    C4]  hdmirx_hdmi_irq_handler+0x44/0xcf4
[    4.954008][    C4]  __handle_irq_event_percpu+0xa8/0x1b4
[    4.954015][    C4]  handle_irq_event+0x8c/0x180
[    4.954021][    C4]  handle_fasteoi_irq+0x128/0x228
[    4.954025][    C4]  __handle_domain_irq+0xb0/0x11c
[    4.954030][    C4]  gic_handle_irq+0x74/0x14c
[    4.954034][    C4]  el1_irq+0xd0/0x1c0
[    4.954037][    C4]  _raw_spin_unlock_irqrestore+0x64/0xb8
[    4.954043][    C4]  __setup_irq+0x474/0x6a8
[    4.954046][    C4]  request_threaded_irq+0xfc/0x164
[    4.954049][    C4]  devm_request_threaded_irq+0x84/0xd4
[    4.954054][    C4]  hdmirx_probe+0xa2c/0x128c
[    4.954057][    C4]  platform_drv_probe+0x94/0xbc
[    4.954061][    C4]  really_probe+0x200/0x508
[    4.954067][    C4]  driver_probe_device+0x7c/0xb8
[    4.954072][    C4]  device_driver_attach+0x6c/0xac
[    4.954078][    C4]  __driver_attach+0xc4/0x148
[    4.954084][    C4]  bus_for_each_dev+0x7c/0xc8
[    4.954089][    C4]  driver_attach+0x24/0x30
[    4.954095][    C4]  bus_add_driver+0x100/0x1e0
[    4.954099][    C4]  driver_register+0x78/0x110
[    4.954106][    C4]  __platform_driver_register+0x44/0x50
[    4.954109][    C4]  hdmirx_init+0x44/0x50
[    4.954113][    C4]  do_one_initcall+0x98/0x188
[    4.954116][    C4]  do_initcall_level+0xa0/0xc0
[    4.954121][    C4]  do_initcalls+0x54/0x94
[    4.954125][    C4]  do_basic_setup+0x24/0x30
[    4.954130][    C4]  kernel_init_freeable+0x98/0xf0
[    4.954134][    C4]  kernel_init+0x14/0x184
[    4.954139][    C4]  ret_from_fork+0x10/0x30

Signed-off-by: Liang Chen <cl@rock-chips.com>
Change-Id: I32d3d7588e1eddc3f88fd5c1f47b6efef5da9e32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant