All of lore.kernel.org
 help / color / mirror / Atom feed
* usb raw gadget impossible to sent buffer bigger than 3MB
@ 2020-05-28  6:19 Belisko Marek
  2020-05-28  9:06 ` Felipe Balbi
  2020-05-28 11:17 ` Peter Chen
  0 siblings, 2 replies; 7+ messages in thread
From: Belisko Marek @ 2020-05-28  6:19 UTC (permalink / raw)
  To: Linux USB Mailing List

Hi,

we're using USB RAW gadget for communicating with PC application. We
have created loopback test which send file (any size) from PC to
device and then same data are sent back to PC to verify roundtrip time
(using bulk data transfer). Everything works fine up to 3MB file size.
If we sent bigger file like e.g. 5M we can receive file on device but
when we want to write to output endpoint we got:

WARNING: CPU: 0 PID: 12299 at /kernel-source//mm/page_alloc.c:3725
__alloc_pages_nodemask+0x1b0/0xde4
[<c010fa08>] (unwind_backtrace) from [<c010c45c>] (show_stack+0x20/0x24)
[<c010c45c>] (show_stack) from [<c04cc0d4>] (dump_stack+0x20/0x28)
[<c04cc0d4>] (dump_stack) from [<c01324ac>] (__warn+0xec/0x108)
[<c01324ac>] (__warn) from [<c0132598>] (warn_slowpath_null+0x30/0x38)
[<c0132598>] (warn_slowpath_null) from [<c021ccb8>]
(__alloc_pages_nodemask+0x1b0/0xde4)
[<c021ccb8>] (__alloc_pages_nodemask) from [<c023b888>]
(kmalloc_order+0x2c/0x48)
[<c023b888>] (kmalloc_order) from [<c023b8d0>] (kmalloc_order_trace+0x2c/0xd4)
[<c023b8d0>] (kmalloc_order_trace) from [<c0261c24>] (__kmalloc+0x40/0x264)
[<c0261c24>] (__kmalloc) from [<bf039bc4>] (ffs_epfile_io+0x13c/0x570
[usb_f_fs])
[<bf039bc4>] (ffs_epfile_io [usb_f_fs]) from [<bf03a0c0>]
(ffs_epfile_write_iter+0xc8/0x120 [usb_f_fs])
[<bf03a0c0>] (ffs_epfile_write_iter [usb_f_fs]) from [<c02734bc>]
(new_sync_write+0xc8/0xec)
[<c02734bc>] (new_sync_write) from [<c027351c>] (__vfs_write+0x3c/0x48)
[<c027351c>] (__vfs_write) from [<c02749a0>] (vfs_write+0xcc/0x158)
[<c02749a0>] (vfs_write) from [<c02756ac>] (SyS_write+0x50/0x88)
[<c02756ac>] (SyS_write) from [<c0107a20>] (ret_fast_syscall+0x0/0x54)
---[ end trace fe5f79fe415b9881 ]---

and write ends up with: write /run/ffs/ep1: cannot allocate memory

When checked free command there should be plenty of available memory.
Is there some limitation when writing to endpoint? We tried to split
buffer to e.g. 3M and sent it and this works but looks like there is
penalty when sending bigger files (100MB file received in 5secs whicle
sending back it took 2minutes). Thanks for ideas and hints.

BR,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: usb raw gadget impossible to sent buffer bigger than 3MB
  2020-05-28  6:19 usb raw gadget impossible to sent buffer bigger than 3MB Belisko Marek
@ 2020-05-28  9:06 ` Felipe Balbi
  2020-05-28  9:10   ` Belisko Marek
  2020-05-28 11:17 ` Peter Chen
  1 sibling, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2020-05-28  9:06 UTC (permalink / raw)
  To: Belisko Marek, Linux USB Mailing List

[-- Attachment #1: Type: text/plain, Size: 2472 bytes --]


Hi,

Belisko Marek <marek.belisko@gmail.com> writes:
> we're using USB RAW gadget for communicating with PC application. We
> have created loopback test which send file (any size) from PC to
> device and then same data are sent back to PC to verify roundtrip time
> (using bulk data transfer). Everything works fine up to 3MB file size.
> If we sent bigger file like e.g. 5M we can receive file on device but
> when we want to write to output endpoint we got:
>
> WARNING: CPU: 0 PID: 12299 at /kernel-source//mm/page_alloc.c:3725
> __alloc_pages_nodemask+0x1b0/0xde4
> [<c010fa08>] (unwind_backtrace) from [<c010c45c>] (show_stack+0x20/0x24)
> [<c010c45c>] (show_stack) from [<c04cc0d4>] (dump_stack+0x20/0x28)
> [<c04cc0d4>] (dump_stack) from [<c01324ac>] (__warn+0xec/0x108)
> [<c01324ac>] (__warn) from [<c0132598>] (warn_slowpath_null+0x30/0x38)
> [<c0132598>] (warn_slowpath_null) from [<c021ccb8>]
> (__alloc_pages_nodemask+0x1b0/0xde4)
> [<c021ccb8>] (__alloc_pages_nodemask) from [<c023b888>]
> (kmalloc_order+0x2c/0x48)
> [<c023b888>] (kmalloc_order) from [<c023b8d0>] (kmalloc_order_trace+0x2c/0xd4)
> [<c023b8d0>] (kmalloc_order_trace) from [<c0261c24>] (__kmalloc+0x40/0x264)
> [<c0261c24>] (__kmalloc) from [<bf039bc4>] (ffs_epfile_io+0x13c/0x570
> [usb_f_fs])
> [<bf039bc4>] (ffs_epfile_io [usb_f_fs]) from [<bf03a0c0>]
> (ffs_epfile_write_iter+0xc8/0x120 [usb_f_fs])
> [<bf03a0c0>] (ffs_epfile_write_iter [usb_f_fs]) from [<c02734bc>]
> (new_sync_write+0xc8/0xec)
> [<c02734bc>] (new_sync_write) from [<c027351c>] (__vfs_write+0x3c/0x48)
> [<c027351c>] (__vfs_write) from [<c02749a0>] (vfs_write+0xcc/0x158)
> [<c02749a0>] (vfs_write) from [<c02756ac>] (SyS_write+0x50/0x88)
> [<c02756ac>] (SyS_write) from [<c0107a20>] (ret_fast_syscall+0x0/0x54)
> ---[ end trace fe5f79fe415b9881 ]---
>
> and write ends up with: write /run/ffs/ep1: cannot allocate memory
>
> When checked free command there should be plenty of available memory.
> Is there some limitation when writing to endpoint? We tried to split
> buffer to e.g. 3M and sent it and this works but looks like there is
> penalty when sending bigger files (100MB file received in 5secs whicle
> sending back it took 2minutes). Thanks for ideas and hints.

that's trying to allocate a 5MiB buffer in kernel space. It just goes
over max allocation size, I'm assuming. Which kernel version are you
using? Which gadget controller are you using?

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: usb raw gadget impossible to sent buffer bigger than 3MB
  2020-05-28  9:06 ` Felipe Balbi
@ 2020-05-28  9:10   ` Belisko Marek
  2020-05-29  6:27     ` Felipe Balbi
  0 siblings, 1 reply; 7+ messages in thread
From: Belisko Marek @ 2020-05-28  9:10 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Linux USB Mailing List

Hi,
On Thu, May 28, 2020 at 11:06 AM Felipe Balbi <balbi@kernel.org> wrote:
>
>
> Hi,
>
> Belisko Marek <marek.belisko@gmail.com> writes:
> > we're using USB RAW gadget for communicating with PC application. We
> > have created loopback test which send file (any size) from PC to
> > device and then same data are sent back to PC to verify roundtrip time
> > (using bulk data transfer). Everything works fine up to 3MB file size.
> > If we sent bigger file like e.g. 5M we can receive file on device but
> > when we want to write to output endpoint we got:
> >
> > WARNING: CPU: 0 PID: 12299 at /kernel-source//mm/page_alloc.c:3725
> > __alloc_pages_nodemask+0x1b0/0xde4
> > [<c010fa08>] (unwind_backtrace) from [<c010c45c>] (show_stack+0x20/0x24)
> > [<c010c45c>] (show_stack) from [<c04cc0d4>] (dump_stack+0x20/0x28)
> > [<c04cc0d4>] (dump_stack) from [<c01324ac>] (__warn+0xec/0x108)
> > [<c01324ac>] (__warn) from [<c0132598>] (warn_slowpath_null+0x30/0x38)
> > [<c0132598>] (warn_slowpath_null) from [<c021ccb8>]
> > (__alloc_pages_nodemask+0x1b0/0xde4)
> > [<c021ccb8>] (__alloc_pages_nodemask) from [<c023b888>]
> > (kmalloc_order+0x2c/0x48)
> > [<c023b888>] (kmalloc_order) from [<c023b8d0>] (kmalloc_order_trace+0x2c/0xd4)
> > [<c023b8d0>] (kmalloc_order_trace) from [<c0261c24>] (__kmalloc+0x40/0x264)
> > [<c0261c24>] (__kmalloc) from [<bf039bc4>] (ffs_epfile_io+0x13c/0x570
> > [usb_f_fs])
> > [<bf039bc4>] (ffs_epfile_io [usb_f_fs]) from [<bf03a0c0>]
> > (ffs_epfile_write_iter+0xc8/0x120 [usb_f_fs])
> > [<bf03a0c0>] (ffs_epfile_write_iter [usb_f_fs]) from [<c02734bc>]
> > (new_sync_write+0xc8/0xec)
> > [<c02734bc>] (new_sync_write) from [<c027351c>] (__vfs_write+0x3c/0x48)
> > [<c027351c>] (__vfs_write) from [<c02749a0>] (vfs_write+0xcc/0x158)
> > [<c02749a0>] (vfs_write) from [<c02756ac>] (SyS_write+0x50/0x88)
> > [<c02756ac>] (SyS_write) from [<c0107a20>] (ret_fast_syscall+0x0/0x54)
> > ---[ end trace fe5f79fe415b9881 ]---
> >
> > and write ends up with: write /run/ffs/ep1: cannot allocate memory
> >
> > When checked free command there should be plenty of available memory.
> > Is there some limitation when writing to endpoint? We tried to split
> > buffer to e.g. 3M and sent it and this works but looks like there is
> > penalty when sending bigger files (100MB file received in 5secs whicle
> > sending back it took 2minutes). Thanks for ideas and hints.
>
> that's trying to allocate a 5MiB buffer in kernel space. It just goes
> over max allocation size, I'm assuming. Which kernel version are you
> using? Which gadget controller are you using?
We' using mainline 4.12 kernel and gadget is raw gadget using ffs +
composite drivers.
>
> --
> balbi

Thanks and BR,

marek



-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: usb raw gadget impossible to sent buffer bigger than 3MB
  2020-05-28  6:19 usb raw gadget impossible to sent buffer bigger than 3MB Belisko Marek
  2020-05-28  9:06 ` Felipe Balbi
@ 2020-05-28 11:17 ` Peter Chen
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Chen @ 2020-05-28 11:17 UTC (permalink / raw)
  To: Belisko Marek; +Cc: Linux USB Mailing List

On 20-05-28 08:19:46, Belisko Marek wrote:
> Hi,
> 
> we're using USB RAW gadget for communicating with PC application. We
> have created loopback test which send file (any size) from PC to
> device and then same data are sent back to PC to verify roundtrip time
> (using bulk data transfer). Everything works fine up to 3MB file size.
> If we sent bigger file like e.g. 5M we can receive file on device but
> when we want to write to output endpoint we got:
> 
> WARNING: CPU: 0 PID: 12299 at /kernel-source//mm/page_alloc.c:3725
> __alloc_pages_nodemask+0x1b0/0xde4
> [<c010fa08>] (unwind_backtrace) from [<c010c45c>] (show_stack+0x20/0x24)
> [<c010c45c>] (show_stack) from [<c04cc0d4>] (dump_stack+0x20/0x28)
> [<c04cc0d4>] (dump_stack) from [<c01324ac>] (__warn+0xec/0x108)
> [<c01324ac>] (__warn) from [<c0132598>] (warn_slowpath_null+0x30/0x38)
> [<c0132598>] (warn_slowpath_null) from [<c021ccb8>]
> (__alloc_pages_nodemask+0x1b0/0xde4)
> [<c021ccb8>] (__alloc_pages_nodemask) from [<c023b888>]
> (kmalloc_order+0x2c/0x48)
> [<c023b888>] (kmalloc_order) from [<c023b8d0>] (kmalloc_order_trace+0x2c/0xd4)
> [<c023b8d0>] (kmalloc_order_trace) from [<c0261c24>] (__kmalloc+0x40/0x264)
> [<c0261c24>] (__kmalloc) from [<bf039bc4>] (ffs_epfile_io+0x13c/0x570
> [usb_f_fs])
> [<bf039bc4>] (ffs_epfile_io [usb_f_fs]) from [<bf03a0c0>]
> (ffs_epfile_write_iter+0xc8/0x120 [usb_f_fs])
> [<bf03a0c0>] (ffs_epfile_write_iter [usb_f_fs]) from [<c02734bc>]
> (new_sync_write+0xc8/0xec)
> [<c02734bc>] (new_sync_write) from [<c027351c>] (__vfs_write+0x3c/0x48)
> [<c027351c>] (__vfs_write) from [<c02749a0>] (vfs_write+0xcc/0x158)
> [<c02749a0>] (vfs_write) from [<c02756ac>] (SyS_write+0x50/0x88)
> [<c02756ac>] (SyS_write) from [<c0107a20>] (ret_fast_syscall+0x0/0x54)
> ---[ end trace fe5f79fe415b9881 ]---
> 
> and write ends up with: write /run/ffs/ep1: cannot allocate memory
> 
> When checked free command there should be plenty of available memory.
> Is there some limitation when writing to endpoint? We tried to split
> buffer to e.g. 3M and sent it and this works but looks like there is
> penalty when sending bigger files (100MB file received in 5secs whicle
> sending back it took 2minutes). Thanks for ideas and hints.
> 

Although you see there are plenty of available memory, but the block number
for the size(eg 64KB) you request may be zero. Since you use old
kernel, the f_fs doesn't support scatter list. To fix it, you may use
small buffer at use space, eg: 16KB per transfer.

-- 

Thanks,
Peter Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: usb raw gadget impossible to sent buffer bigger than 3MB
  2020-05-28  9:10   ` Belisko Marek
@ 2020-05-29  6:27     ` Felipe Balbi
  2020-05-29  7:31       ` Belisko Marek
  0 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2020-05-29  6:27 UTC (permalink / raw)
  To: Belisko Marek; +Cc: Linux USB Mailing List

[-- Attachment #1: Type: text/plain, Size: 3039 bytes --]

Belisko Marek <marek.belisko@gmail.com> writes:

> Hi,
> On Thu, May 28, 2020 at 11:06 AM Felipe Balbi <balbi@kernel.org> wrote:
>>
>>
>> Hi,
>>
>> Belisko Marek <marek.belisko@gmail.com> writes:
>> > we're using USB RAW gadget for communicating with PC application. We
>> > have created loopback test which send file (any size) from PC to
>> > device and then same data are sent back to PC to verify roundtrip time
>> > (using bulk data transfer). Everything works fine up to 3MB file size.
>> > If we sent bigger file like e.g. 5M we can receive file on device but
>> > when we want to write to output endpoint we got:
>> >
>> > WARNING: CPU: 0 PID: 12299 at /kernel-source//mm/page_alloc.c:3725
>> > __alloc_pages_nodemask+0x1b0/0xde4
>> > [<c010fa08>] (unwind_backtrace) from [<c010c45c>] (show_stack+0x20/0x24)
>> > [<c010c45c>] (show_stack) from [<c04cc0d4>] (dump_stack+0x20/0x28)
>> > [<c04cc0d4>] (dump_stack) from [<c01324ac>] (__warn+0xec/0x108)
>> > [<c01324ac>] (__warn) from [<c0132598>] (warn_slowpath_null+0x30/0x38)
>> > [<c0132598>] (warn_slowpath_null) from [<c021ccb8>]
>> > (__alloc_pages_nodemask+0x1b0/0xde4)
>> > [<c021ccb8>] (__alloc_pages_nodemask) from [<c023b888>]
>> > (kmalloc_order+0x2c/0x48)
>> > [<c023b888>] (kmalloc_order) from [<c023b8d0>] (kmalloc_order_trace+0x2c/0xd4)
>> > [<c023b8d0>] (kmalloc_order_trace) from [<c0261c24>] (__kmalloc+0x40/0x264)
>> > [<c0261c24>] (__kmalloc) from [<bf039bc4>] (ffs_epfile_io+0x13c/0x570
>> > [usb_f_fs])
>> > [<bf039bc4>] (ffs_epfile_io [usb_f_fs]) from [<bf03a0c0>]
>> > (ffs_epfile_write_iter+0xc8/0x120 [usb_f_fs])
>> > [<bf03a0c0>] (ffs_epfile_write_iter [usb_f_fs]) from [<c02734bc>]
>> > (new_sync_write+0xc8/0xec)
>> > [<c02734bc>] (new_sync_write) from [<c027351c>] (__vfs_write+0x3c/0x48)
>> > [<c027351c>] (__vfs_write) from [<c02749a0>] (vfs_write+0xcc/0x158)
>> > [<c02749a0>] (vfs_write) from [<c02756ac>] (SyS_write+0x50/0x88)
>> > [<c02756ac>] (SyS_write) from [<c0107a20>] (ret_fast_syscall+0x0/0x54)
>> > ---[ end trace fe5f79fe415b9881 ]---
>> >
>> > and write ends up with: write /run/ffs/ep1: cannot allocate memory
>> >
>> > When checked free command there should be plenty of available memory.
>> > Is there some limitation when writing to endpoint? We tried to split
>> > buffer to e.g. 3M and sent it and this works but looks like there is
>> > penalty when sending bigger files (100MB file received in 5secs whicle
>> > sending back it took 2minutes). Thanks for ideas and hints.
>>
>> that's trying to allocate a 5MiB buffer in kernel space. It just goes
>> over max allocation size, I'm assuming. Which kernel version are you
>> using? Which gadget controller are you using?
> We' using mainline 4.12 kernel and gadget is raw gadget using ffs +

that's old. Really, really old. You should ask for support from whoever
gave you that kernel. An alternative, upgrade to v5.6 latest stable or
latest v5.7-rc.

> composite drivers.

Right, and which UDC controller?

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: usb raw gadget impossible to sent buffer bigger than 3MB
  2020-05-29  6:27     ` Felipe Balbi
@ 2020-05-29  7:31       ` Belisko Marek
  2020-07-01  6:57         ` Felipe Balbi
  0 siblings, 1 reply; 7+ messages in thread
From: Belisko Marek @ 2020-05-29  7:31 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Linux USB Mailing List

Hi,

On Fri, May 29, 2020 at 8:27 AM Felipe Balbi <balbi@kernel.org> wrote:
>
> Belisko Marek <marek.belisko@gmail.com> writes:
>
> > Hi,
> > On Thu, May 28, 2020 at 11:06 AM Felipe Balbi <balbi@kernel.org> wrote:
> >>
> >>
> >> Hi,
> >>
> >> Belisko Marek <marek.belisko@gmail.com> writes:
> >> > we're using USB RAW gadget for communicating with PC application. We
> >> > have created loopback test which send file (any size) from PC to
> >> > device and then same data are sent back to PC to verify roundtrip time
> >> > (using bulk data transfer). Everything works fine up to 3MB file size.
> >> > If we sent bigger file like e.g. 5M we can receive file on device but
> >> > when we want to write to output endpoint we got:
> >> >
> >> > WARNING: CPU: 0 PID: 12299 at /kernel-source//mm/page_alloc.c:3725
> >> > __alloc_pages_nodemask+0x1b0/0xde4
> >> > [<c010fa08>] (unwind_backtrace) from [<c010c45c>] (show_stack+0x20/0x24)
> >> > [<c010c45c>] (show_stack) from [<c04cc0d4>] (dump_stack+0x20/0x28)
> >> > [<c04cc0d4>] (dump_stack) from [<c01324ac>] (__warn+0xec/0x108)
> >> > [<c01324ac>] (__warn) from [<c0132598>] (warn_slowpath_null+0x30/0x38)
> >> > [<c0132598>] (warn_slowpath_null) from [<c021ccb8>]
> >> > (__alloc_pages_nodemask+0x1b0/0xde4)
> >> > [<c021ccb8>] (__alloc_pages_nodemask) from [<c023b888>]
> >> > (kmalloc_order+0x2c/0x48)
> >> > [<c023b888>] (kmalloc_order) from [<c023b8d0>] (kmalloc_order_trace+0x2c/0xd4)
> >> > [<c023b8d0>] (kmalloc_order_trace) from [<c0261c24>] (__kmalloc+0x40/0x264)
> >> > [<c0261c24>] (__kmalloc) from [<bf039bc4>] (ffs_epfile_io+0x13c/0x570
> >> > [usb_f_fs])
> >> > [<bf039bc4>] (ffs_epfile_io [usb_f_fs]) from [<bf03a0c0>]
> >> > (ffs_epfile_write_iter+0xc8/0x120 [usb_f_fs])
> >> > [<bf03a0c0>] (ffs_epfile_write_iter [usb_f_fs]) from [<c02734bc>]
> >> > (new_sync_write+0xc8/0xec)
> >> > [<c02734bc>] (new_sync_write) from [<c027351c>] (__vfs_write+0x3c/0x48)
> >> > [<c027351c>] (__vfs_write) from [<c02749a0>] (vfs_write+0xcc/0x158)
> >> > [<c02749a0>] (vfs_write) from [<c02756ac>] (SyS_write+0x50/0x88)
> >> > [<c02756ac>] (SyS_write) from [<c0107a20>] (ret_fast_syscall+0x0/0x54)
> >> > ---[ end trace fe5f79fe415b9881 ]---
> >> >
> >> > and write ends up with: write /run/ffs/ep1: cannot allocate memory
> >> >
> >> > When checked free command there should be plenty of available memory.
> >> > Is there some limitation when writing to endpoint? We tried to split
> >> > buffer to e.g. 3M and sent it and this works but looks like there is
> >> > penalty when sending bigger files (100MB file received in 5secs whicle
> >> > sending back it took 2minutes). Thanks for ideas and hints.
> >>
> >> that's trying to allocate a 5MiB buffer in kernel space. It just goes
> >> over max allocation size, I'm assuming. Which kernel version are you
> >> using? Which gadget controller are you using?
> > We' using mainline 4.12 kernel and gadget is raw gadget using ffs +
>
> that's old. Really, really old. You should ask for support from whoever
> gave you that kernel. An alternative, upgrade to v5.6 latest stable or
> latest v5.7-rc.
We're in the process of kernel bump (we really have no vendor kernel
we use mainline with few patches on top)
>
> > composite drivers.
>
> Right, and which UDC controller?
Not sure if it is right but those options are enabled:
EHCI support for OMAP3 and later chips
OHCI support for OMAP3 and later chips
>
> --
> balbi

Thanks and BR,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: usb raw gadget impossible to sent buffer bigger than 3MB
  2020-05-29  7:31       ` Belisko Marek
@ 2020-07-01  6:57         ` Felipe Balbi
  0 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2020-07-01  6:57 UTC (permalink / raw)
  To: Belisko Marek; +Cc: Linux USB Mailing List

[-- Attachment #1: Type: text/plain, Size: 3596 bytes --]


Hi,

Belisko Marek <marek.belisko@gmail.com> writes:
>> >> Belisko Marek <marek.belisko@gmail.com> writes:
>> >> > we're using USB RAW gadget for communicating with PC application. We
>> >> > have created loopback test which send file (any size) from PC to
>> >> > device and then same data are sent back to PC to verify roundtrip time
>> >> > (using bulk data transfer). Everything works fine up to 3MB file size.
>> >> > If we sent bigger file like e.g. 5M we can receive file on device but
>> >> > when we want to write to output endpoint we got:
>> >> >
>> >> > WARNING: CPU: 0 PID: 12299 at /kernel-source//mm/page_alloc.c:3725
>> >> > __alloc_pages_nodemask+0x1b0/0xde4
>> >> > [<c010fa08>] (unwind_backtrace) from [<c010c45c>] (show_stack+0x20/0x24)
>> >> > [<c010c45c>] (show_stack) from [<c04cc0d4>] (dump_stack+0x20/0x28)
>> >> > [<c04cc0d4>] (dump_stack) from [<c01324ac>] (__warn+0xec/0x108)
>> >> > [<c01324ac>] (__warn) from [<c0132598>] (warn_slowpath_null+0x30/0x38)
>> >> > [<c0132598>] (warn_slowpath_null) from [<c021ccb8>]
>> >> > (__alloc_pages_nodemask+0x1b0/0xde4)
>> >> > [<c021ccb8>] (__alloc_pages_nodemask) from [<c023b888>]
>> >> > (kmalloc_order+0x2c/0x48)
>> >> > [<c023b888>] (kmalloc_order) from [<c023b8d0>] (kmalloc_order_trace+0x2c/0xd4)
>> >> > [<c023b8d0>] (kmalloc_order_trace) from [<c0261c24>] (__kmalloc+0x40/0x264)
>> >> > [<c0261c24>] (__kmalloc) from [<bf039bc4>] (ffs_epfile_io+0x13c/0x570
>> >> > [usb_f_fs])
>> >> > [<bf039bc4>] (ffs_epfile_io [usb_f_fs]) from [<bf03a0c0>]
>> >> > (ffs_epfile_write_iter+0xc8/0x120 [usb_f_fs])
>> >> > [<bf03a0c0>] (ffs_epfile_write_iter [usb_f_fs]) from [<c02734bc>]
>> >> > (new_sync_write+0xc8/0xec)
>> >> > [<c02734bc>] (new_sync_write) from [<c027351c>] (__vfs_write+0x3c/0x48)
>> >> > [<c027351c>] (__vfs_write) from [<c02749a0>] (vfs_write+0xcc/0x158)
>> >> > [<c02749a0>] (vfs_write) from [<c02756ac>] (SyS_write+0x50/0x88)
>> >> > [<c02756ac>] (SyS_write) from [<c0107a20>] (ret_fast_syscall+0x0/0x54)
>> >> > ---[ end trace fe5f79fe415b9881 ]---
>> >> >
>> >> > and write ends up with: write /run/ffs/ep1: cannot allocate memory
>> >> >
>> >> > When checked free command there should be plenty of available memory.
>> >> > Is there some limitation when writing to endpoint? We tried to split
>> >> > buffer to e.g. 3M and sent it and this works but looks like there is
>> >> > penalty when sending bigger files (100MB file received in 5secs whicle
>> >> > sending back it took 2minutes). Thanks for ideas and hints.
>> >>
>> >> that's trying to allocate a 5MiB buffer in kernel space. It just goes
>> >> over max allocation size, I'm assuming. Which kernel version are you
>> >> using? Which gadget controller are you using?
>> > We' using mainline 4.12 kernel and gadget is raw gadget using ffs +
>>
>> that's old. Really, really old. You should ask for support from whoever
>> gave you that kernel. An alternative, upgrade to v5.6 latest stable or
>> latest v5.7-rc.
> We're in the process of kernel bump (we really have no vendor kernel
> we use mainline with few patches on top)
>>
>> > composite drivers.
>>
>> Right, and which UDC controller?
> Not sure if it is right but those options are enabled:
> EHCI support for OMAP3 and later chips
> OHCI support for OMAP3 and later chips

those are host controllers :-) Are you running on OMAP3? If that's the
case, then you're using MUSB. Still, please give it a whirl with
something more recent just to rule out the possibility that the problem
hasn't already been fixed.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-01  6:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28  6:19 usb raw gadget impossible to sent buffer bigger than 3MB Belisko Marek
2020-05-28  9:06 ` Felipe Balbi
2020-05-28  9:10   ` Belisko Marek
2020-05-29  6:27     ` Felipe Balbi
2020-05-29  7:31       ` Belisko Marek
2020-07-01  6:57         ` Felipe Balbi
2020-05-28 11:17 ` Peter Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.