* 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
@ 2024-11-04 17:54 Haowei Cheng(Harvey)
2024-11-05 8:41 ` 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Greg Kroah-Hartman
0 siblings, 1 reply; 7+ messages in thread
From: Haowei Cheng(Harvey) @ 2024-11-04 17:54 UTC (permalink / raw)
To: chunfeng.yun@mediatek.com
Cc: Greg Kroah-Hartman, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
[-- Attachment #1.1: Type: text/plain, Size: 2 bytes --]
[-- Attachment #1.2: Type: text/html, Size: 397 bytes --]
[-- Attachment #2: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch --]
[-- Type: application/octet-stream, Size: 1769 bytes --]
From 88aa779c60f99f47f42ca4f6e85b2776e87b494c Mon Sep 17 00:00:00 2001
From: "haowei.cheng" <harvey.cheng@fibocom.com>
Date: Sun, 3 Nov 2024 10:51:22 -0800
Subject: [PATCH] usb: mtu3: fix panic in mtu3_gadget_wakeup
When the mtu3_gadget_wakeup function is used in an interrupt or a
non-schedulable context,it may trigger a system scheduling exception
due to the usleep_range_state function. We have replaced it with
the non-schedulable delay function udelay, which can fix this issue.
BUG: scheduling while atomic: swapper/3/0/0x00000500
Call trace:
dump_backtrace+0x0/0x174
show_stack+0x18/0x24
dump_stack_lvl+0x64/0x80
dump_stack+0x18/0x34
__schedule_bug+0x50/0x6c
__schedule+0x94/0x468
schedule+0xa0/0xe8
schedule_hrtimeout_range_clock+0xa8/0xe0
schedule_hrtimeout_range+0x14/0x20
usleep_range_state+0x5c/0x90
mtu3_gadget_wakeup+0x90/0xd4
usb_gadget_wakeup+0x1c/0x30
Signed-off-by: haowei.cheng <harvey.cheng@fibocom.com>
---
drivers/usb/mtu3/mtu3_gadget.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 9977600616d7..2ab732701551 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -9,6 +9,7 @@
#include "mtu3.h"
#include "mtu3_trace.h"
+#include <linux/delay.h>
void mtu3_req_complete(struct mtu3_ep *mep,
struct usb_request *req, int status)
@@ -450,7 +451,7 @@ static int mtu3_gadget_wakeup(struct usb_gadget *gadget)
} else {
mtu3_setbits(mtu->mac_base, U3D_POWER_MANAGEMENT, RESUME);
spin_unlock_irqrestore(&mtu->lock, flags);
- usleep_range(10000, 11000);
+ udelay(10000);
spin_lock_irqsave(&mtu->lock, flags);
mtu3_clrbits(mtu->mac_base, U3D_POWER_MANAGEMENT, RESUME);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
2024-11-04 17:54 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Haowei Cheng(Harvey)
@ 2024-11-05 8:41 ` Greg Kroah-Hartman
2024-11-06 19:39 ` 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Haowei Cheng(Harvey)
0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2024-11-05 8:41 UTC (permalink / raw)
To: Haowei Cheng(Harvey)
Cc: chunfeng.yun@mediatek.com, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
On Mon, Nov 04, 2024 at 05:54:43PM +0000, Haowei Cheng(Harvey) wrote:
>
For some reason you only attached a patch, please send it properly so we
can actually review and apply it if needed.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
2024-11-05 8:41 ` 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Greg Kroah-Hartman
@ 2024-11-06 19:39 ` Haowei Cheng(Harvey)
2024-11-07 5:13 ` Greg Kroah-Hartman
2024-11-07 5:14 ` Greg Kroah-Hartman
0 siblings, 2 replies; 7+ messages in thread
From: Haowei Cheng(Harvey) @ 2024-11-06 19:39 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: chunfeng.yun@mediatek.com, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Hi greg k-h,
We found during development that when there are data packets to be sent on the USB RNDIS network card,
unplugging the USB cable will trigger a certain probability of system warning or panic.
We observed that the mtu3_gadget_wakeup function uses the usleep_range_state function,
which has certain scenario limitations. Therefore, we made this optimization.
The specific call trace information is as follows:
[ 594.638749] Call trace:
[ 594.639059] dump_backtrace+0x0/0x174
[ 594.639531] show_stack+0x18/0x24
[ 594.639953] dump_stack_lvl+0x64/0x80
[ 594.640420] dump_stack+0x18/0x34
[ 594.640842] __schedule_bug+0x50/0x6c
[ 594.641308] __schedule+0x94/0x468
[ 594.641741] schedule+0xa0/0xe8
[ 594.642140] schedule_hrtimeout_range_clock+0xa8/0xe0
[ 594.642780] schedule_hrtimeout_range+0x14/0x20
[ 594.643352] usleep_range_state+0x5c/0x90
[ 594.643859] mtu3_gadget_wakeup+0x90/0xd4
[ 594.644369] usb_gadget_wakeup+0x1c/0x30
[ 594.644868] 0xffffffc00150f110
[ 594.645315] 0xffffffc00151006c
[ 594.645723] netdev_start_xmit+0x40/0x6c
[ 594.646223] dev_hard_start_xmit+0x90/0xe4
[ 594.646743] sch_direct_xmit+0x100/0x270
[ 594.647242] __dev_queue_xmit+0x404/0x600
[ 594.647750] dev_queue_xmit+0x14/0x20
[ 594.648214] br_dev_queue_push_xmit+0x13c/0x1b4
[ 594.648788] NF_HOOK.constprop.0+0x5c/0xd4
[ 594.649307] br_forward_finish+0x34/0x40
[ 594.649804] NF_HOOK.constprop.0+0x5c/0xd4
[ 594.650323] __br_forward+0xcc/0xe0
[ 594.650766] br_forward+0x80/0x98
[ 594.651187] br_dev_xmit+0x354/0x380
[ 594.651639] netdev_start_xmit+0x40/0x6c
[ 594.652137] dev_hard_start_xmit+0x90/0xe4
[ 594.652656] __dev_queue_xmit+0x52c/0x600
[ 594.653164] dev_queue_xmit+0x14/0x20
[ 594.653628] neigh_resolve_output+0xf4/0x12c
[ 594.654170] __neigh_update+0x514/0x650
[ 594.654656] neigh_update+0x14/0x20
[ 594.655098] arp_ioctl+0x410/0x58c
[ 594.655531] inet_ioctl+0x11c/0x1b4
[ 594.655974] sock_do_ioctl+0x48/0xf8
[ 594.656429] sock_ioctl+0x150/0x338
[ 594.656871] vfs_ioctl+0x28/0x48
[ 594.657283] __arm64_sys_ioctl+0x78/0xac
[ 594.657781] invoke_syscall+0x6c/0xf8
[ 594.658247] el0_svc_common.constprop.0+0x78/0xe4
[ 594.658842] do_el0_svc+0x64/0x70
[ 594.659263] el0_svc+0x18/0x44
[ 594.659652] el0t_64_sync_handler+0xb4/0x134
[ 594.660193] el0t_64_sync+0x184/0x188
[ 594.662319] ------------[ cut here ]------------
[ 594.662322] WARNING: CPU: 2 PID: 14162 at kernel/softirq.c:362 __local_bh_enable_ip+0x1c/0x80
________________________________________
发件人: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
发送时间: 2024年11月5日 16:41
收件人: Haowei Cheng(Harvey)
抄送: chunfeng.yun@mediatek.com; linux-usb@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-mediatek@lists.infradead.org; linux-kernel@vger.kernel.org
主题: Re: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
On Mon, Nov 04, 2024 at 05:54:43PM +0000, Haowei Cheng(Harvey) wrote:
>
For some reason you only attached a patch, please send it properly so we
can actually review and apply it if needed.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
2024-11-06 19:39 ` 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Haowei Cheng(Harvey)
@ 2024-11-07 5:13 ` Greg Kroah-Hartman
2024-11-07 5:14 ` Greg Kroah-Hartman
1 sibling, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2024-11-07 5:13 UTC (permalink / raw)
To: Haowei Cheng(Harvey)
Cc: chunfeng.yun@mediatek.com, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
On Wed, Nov 06, 2024 at 07:39:59PM +0000, Haowei Cheng(Harvey) wrote:
> Hi greg k-h,
>
> We found during development that when there are data packets to be sent on the USB RNDIS network card,
> unplugging the USB cable will trigger a certain probability of system warning or panic.
> We observed that the mtu3_gadget_wakeup function uses the usleep_range_state function,
> which has certain scenario limitations. Therefore, we made this optimization.
Please do not top-post :(
Just resend your patch properly, in a format that we can apply it in,
and we will be glad to review and discuss it that way.
Look for thousands of examples on the lists for how to do this, as well
as the documentation in the kernel tree itself which explains this in
way-too-much detail.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
2024-11-06 19:39 ` 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Haowei Cheng(Harvey)
2024-11-07 5:13 ` Greg Kroah-Hartman
@ 2024-11-07 5:14 ` Greg Kroah-Hartman
2024-11-07 7:47 ` 回复: " Haowei Cheng(Harvey)
1 sibling, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2024-11-07 5:14 UTC (permalink / raw)
To: Haowei Cheng(Harvey)
Cc: chunfeng.yun@mediatek.com, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
On Wed, Nov 06, 2024 at 07:39:59PM +0000, Haowei Cheng(Harvey) wrote:
> Hi greg k-h,
>
> We found during development that when there are data packets to be sent on the USB RNDIS network card,
Also, wait, why in the world are you using RNDIS when it is documented
to be an insecure and broken protocol? Do you really trust both sides
of that connection? If so, that's fine, but if not, please do not use
that protocol at all.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* 回复: 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
2024-11-07 5:14 ` Greg Kroah-Hartman
@ 2024-11-07 7:47 ` Haowei Cheng(Harvey)
2024-11-07 8:14 ` Greg Kroah-Hartman
0 siblings, 1 reply; 7+ messages in thread
From: Haowei Cheng(Harvey) @ 2024-11-07 7:47 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: chunfeng.yun@mediatek.com, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Hi greg k-h,
We have configured the USB RNDIS port protocol by default on the product and conducted extensive stress testing and validation.
This issue was discovered during compatibility verification, and after making clear modifications to the API usage,
the issue has not been reproduced in subsequent tests.
________________________________________
发件人: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
发送时间: 2024年11月7日 13:14
收件人: Haowei Cheng(Harvey)
抄送: chunfeng.yun@mediatek.com; linux-usb@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-mediatek@lists.infradead.org; linux-kernel@vger.kernel.org
主题: Re: 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
On Wed, Nov 06, 2024 at 07:39:59PM +0000, Haowei Cheng(Harvey) wrote:
> Hi greg k-h,
>
> We found during development that when there are data packets to be sent on the USB RNDIS network card,
Also, wait, why in the world are you using RNDIS when it is documented
to be an insecure and broken protocol? Do you really trust both sides
of that connection? If so, that's fine, but if not, please do not use
that protocol at all.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 回复: 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch
2024-11-07 7:47 ` 回复: " Haowei Cheng(Harvey)
@ 2024-11-07 8:14 ` Greg Kroah-Hartman
0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2024-11-07 8:14 UTC (permalink / raw)
To: Haowei Cheng(Harvey)
Cc: chunfeng.yun@mediatek.com, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
On Thu, Nov 07, 2024 at 07:47:14AM +0000, Haowei Cheng(Harvey) wrote:
> Hi greg k-h,
> We have configured the USB RNDIS port protocol by default on the product and conducted extensive stress testing and validation.
Where are the RNDIS stress testing and validation tests? What host did
you use for this testing, Linux or Windows?
> This issue was discovered during compatibility verification, and after making clear modifications to the API usage,
> the issue has not been reproduced in subsequent tests.
I do not understand what you mean by this, sorry.
Again, you need to submit this patch properly if you wish to have it
applied...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-07 8:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 17:54 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Haowei Cheng(Harvey)
2024-11-05 8:41 ` 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Greg Kroah-Hartman
2024-11-06 19:39 ` 回复: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch Haowei Cheng(Harvey)
2024-11-07 5:13 ` Greg Kroah-Hartman
2024-11-07 5:14 ` Greg Kroah-Hartman
2024-11-07 7:47 ` 回复: " Haowei Cheng(Harvey)
2024-11-07 8:14 ` Greg Kroah-Hartman
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).