All of lore.kernel.org
 help / color / mirror / Atom feed
* ep93xx/ts72xx: Kernel 2.6.36 problems introduced with commit 5bc23d32d
@ 2010-10-31 18:21 Petr Štetiar
  2010-10-31 18:31 ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Štetiar @ 2010-10-31 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I'm so far happy user of 2.6.34.7 on ts72xx(mach-ep93xx) and few days ago I've
rebased the patchset[1](kernel config[2]) against 2.6.36. All seems to work
fine, except my WiFi USB dongle, which is Belkin F6D4050v2 with Ralink rt3070
chipset. To compile the WiFi driver on 2.6.36 I've to patch it little bit,
because there was some rename of the usb_buffer_* functions in 2.6.35, so
here's my patch for 2.6.36:

+/* see http://kerneltrap.org/mailarchive/git-commits-head/2010/4/30/32383 */
+#ifndef usb_buffer_alloc
+#define usb_buffer_alloc usb_alloc_coherent
+#define usb_buffer_free usb_free_coherent
+#endif
+

Now when I try to ifup the ra0 interface on 2.6.36 the driver fails to
allocate four USB TX ring buffers (using usb_alloc_coherent), which are
actually about 200kB each. It fails all the time just at allocation of the
last, 4th buffer, it can allocate the 3 previous buffers without any problem.
It's the same behaviour always, I can reproduce it 100%. The allocation fails
at arch/arm/mm/vmregion.c:

 [...]

 37 struct arm_vmregion *
 38 arm_vmregion_alloc(struct arm_vmregion_head *head, size_t size, gfp_t gfp)

 [...]

 56         list_for_each_entry(c, &head->vm_list, vm_list) {
 57                 if ((addr + size) < addr)
 58                         goto nospc;
 59                 if ((addr + size) <= c->vm_start)
 60                         goto found;
 61                 addr = c->vm_end;
 62                 if (addr > end)
 63                         goto nospc;
 64         }

The allocation of the 4th buffer fails here and goes to nospc label. When I've
reverted commit mentioned in the subject:

    Revert "ARM: DMA coherent allocator: align remapped addresses"
    
    This reverts commit 5bc23d32d86a132b5636a48dca0fa2528ef69ff9.

the driver can now allocate the buffers and seems to work on 2.6.36. How to
proceed now? I know, that the driver is pile of crap, but it works for me(tm)
quite well on 2.6.34.7, so I don't know how to fix this. Thank you for any
suggestions.

-- ynezz

1. http://github.com/ynezz/linux-2.6/tree/ts72xx-2.6.36.y
2. http://github.com/ynezz/linux-2.6/commit/780f7c8dbe52c06c7a4610de8d09fd91f572fa56

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

* ep93xx/ts72xx: Kernel 2.6.36 problems introduced with commit 5bc23d32d
  2010-10-31 18:21 ep93xx/ts72xx: Kernel 2.6.36 problems introduced with commit 5bc23d32d Petr Štetiar
@ 2010-10-31 18:31 ` Russell King - ARM Linux
  2010-10-31 19:00   ` Petr Štetiar
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2010-10-31 18:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Oct 31, 2010 at 07:21:57PM +0100, Petr ?tetiar wrote:
> The allocation of the 4th buffer fails here and goes to nospc label. When I've
> reverted commit mentioned in the subject:
> 
>     Revert "ARM: DMA coherent allocator: align remapped addresses"
>     
>     This reverts commit 5bc23d32d86a132b5636a48dca0fa2528ef69ff9.
> 
> the driver can now allocate the buffers and seems to work on 2.6.36. How to
> proceed now? I know, that the driver is pile of crap, but it works for me(tm)
> quite well on 2.6.34.7, so I don't know how to fix this. Thank you for any
> suggestions.

It might be worth adding a printk to find out what entries get allocated
and freed from the vmregion.

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

* ep93xx/ts72xx: Kernel 2.6.36 problems introduced with commit 5bc23d32d
  2010-10-31 18:31 ` Russell King - ARM Linux
@ 2010-10-31 19:00   ` Petr Štetiar
  2010-10-31 19:08     ` Petr Štetiar
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Štetiar @ 2010-10-31 19:00 UTC (permalink / raw)
  To: linux-arm-kernel

Russell King - ARM Linux <linux@arm.linux.org.uk> [2010-10-31 18:31:40]:

> On Sun, Oct 31, 2010 at 07:21:57PM +0100, Petr ?tetiar wrote:
> > The allocation of the 4th buffer fails here and goes to nospc label. When I've
> > reverted commit mentioned in the subject:
> > 
> >     Revert "ARM: DMA coherent allocator: align remapped addresses"
> >     
> >     This reverts commit 5bc23d32d86a132b5636a48dca0fa2528ef69ff9.
> > 
> > the driver can now allocate the buffers and seems to work on 2.6.36. How to
> > proceed now? I know, that the driver is pile of crap, but it works for me(tm)
> > quite well on 2.6.34.7, so I don't know how to fix this. Thank you for any
> > suggestions.
> 
> It might be worth adding a printk to find out what entries get allocated
> and freed from the vmregion.

Patch:

diff --git a/arch/arm/mm/vmregion.c b/arch/arm/mm/vmregion.c
index 19e09bd..1150335 100644
--- a/arch/arm/mm/vmregion.c
+++ b/arch/arm/mm/vmregion.c
@@ -47,6 +47,8 @@ arm_vmregion_alloc(struct arm_vmregion_head *head, size_t size, gfp_t gfp)
                goto out;
        }
 
+       printk("arm_vmregion_alloc() size: %x\n", size);
+
        new = kmalloc(sizeof(struct arm_vmregion), gfp);
        if (!new)
                goto out;
@@ -71,11 +73,14 @@ arm_vmregion_alloc(struct arm_vmregion_head *head, size_t size, gfp_t gfp)
        new->vm_start = addr;
        new->vm_end = addr + size;
        new->vm_active = 1;
+       printk("arm_vmregion_alloc() found: start: %lu end: %lu size: %x\n",
+              new->vm_start, new->vm_end, size);
 
        spin_unlock_irqrestore(&head->vm_lock, flags);
        return new;
 
  nospc:
+       printk("arm_vmregion_alloc() no space!\n");
        spin_unlock_irqrestore(&head->vm_lock, flags);
        kfree(new);
  out:
@@ -124,6 +129,10 @@ void arm_vmregion_free(struct arm_vmregion_head *head, struct arm_vmregion *c)
        unsigned long flags;
 
        spin_lock_irqsave(&head->vm_lock, flags);
+
+       printk("arm_vmregion_free() start: %lu end: %lu size: %lu\n",
+              c->vm_start, c->vm_end, c->vm_end-c->vm_start);
+
        list_del(&c->vm_list);
        spin_unlock_irqrestore(&head->vm_lock, flags);

Without the revert:

	root at ts72xx:~# ifup ra0
	WPA: Configuring Interface
	[   30.900000] arm_vmregion_alloc() size: 33000
	[   30.910000] arm_vmregion_alloc() found: start: 4291297280 end: 4291506176 size: 33000
	[   30.920000] arm_vmregion_alloc() size: 33000
	[   30.930000] arm_vmregion_alloc() found: start: 4291821568 end: 4292030464 size: 33000
	[   30.940000] arm_vmregion_alloc() size: 33000
	[   30.950000] arm_vmregion_alloc() found: start: 4292345856 end: 4292554752 size: 33000
	[   30.960000] arm_vmregion_alloc() size: 33000
	[   30.970000] arm_vmregion_alloc() no space!
	[   30.970000] <-- ERROR in Alloc TX TxContext[3] HTTX_BUFFER !!

With revert:

	root at ts72xx:~# ifup ra0
	WPA: Configuring Interface
	[   31.740000] arm_vmregion_alloc() size: 33000
	[   31.740000] arm_vmregion_alloc() found: start: 4290789376 end: 4290998272 size: 33000
	[   31.760000] arm_vmregion_alloc() size: 33000
	[   31.760000] arm_vmregion_alloc() found: start: 4290998272 end: 4291207168 size: 33000
	[   31.780000] arm_vmregion_alloc() size: 33000
	[   31.780000] arm_vmregion_alloc() found: start: 4291207168 end: 4291416064 size: 33000
	[   31.790000] arm_vmregion_alloc() size: 33000
	[   31.810000] arm_vmregion_alloc() found: start: 4291416064 end: 4291624960 size: 33000
	[   31.820000] arm_vmregion_alloc() size: 1000
	[   31.820000] arm_vmregion_alloc() found: start: 4291624960 end: 4291629056 size: 1000
	[   31.820000] arm_vmregion_alloc() size: 1000
	[   31.840000] arm_vmregion_alloc() found: start: 4291629056 end: 4291633152 size: 1000
	[   31.840000] arm_vmregion_alloc() size: 1000
	[   31.860000] arm_vmregion_alloc() found: start: 4291633152 end: 4291637248 size: 1000
	[   31.870000] arm_vmregion_alloc() size: 1000
	[   31.870000] arm_vmregion_alloc() found: start: 4291637248 end: 4291641344 size: 1000
	[   31.880000] arm_vmregion_alloc() size: 1000
	[   31.880000] arm_vmregion_alloc() found: start: 4291641344 end: 4291645440 size: 1000
	[   31.900000] arm_vmregion_alloc() size: 6000
	[   31.900000] arm_vmregion_alloc() found: start: 4291645440 end: 4291670016 size: 6000
	[   31.920000] arm_vmregion_alloc() size: 6000
	[   31.930000] arm_vmregion_alloc() found: start: 4291670016 end: 4291694592 size: 6000
	[   31.940000] arm_vmregion_alloc() size: 6000
	[   31.940000] arm_vmregion_alloc() found: start: 4291694592 end: 4291719168 size: 6000
	[   31.950000] arm_vmregion_alloc() size: 6000
	[   31.950000] arm_vmregion_alloc() found: start: 4291719168 end: 4291743744 size: 6000
	[   31.970000] arm_vmregion_alloc() size: 6000
	[   31.970000] arm_vmregion_alloc() found: start: 4291743744 end: 4291768320 size: 6000
	[   31.990000] arm_vmregion_alloc() size: 6000
	[   32.000000] arm_vmregion_alloc() found: start: 4291768320 end: 4291792896 size: 6000
	[   32.010000] arm_vmregion_alloc() size: 6000
	[   32.010000] arm_vmregion_alloc() found: start: 4291792896 end: 4291817472 size: 6000
	[   32.020000] arm_vmregion_alloc() size: 6000
	[   32.020000] arm_vmregion_alloc() found: start: 4291817472 end: 4291842048 size: 6000

	$ ifdown ra0

	root@ts72xx:~# ifdown ra0
	[  102.080000] ---> RTMPFreeTxRxRingMemory
	[  102.080000] arm_vmregion_free() start: 4291645440 end: 4291670016 size: 24576
	[  102.090000] arm_vmregion_free() start: 4291670016 end: 4291694592 size: 24576
	[  102.100000] arm_vmregion_free() start: 4291694592 end: 4291719168 size: 24576
	[  102.110000] arm_vmregion_free() start: 4291719168 end: 4291743744 size: 24576
	[  102.120000] arm_vmregion_free() start: 4291743744 end: 4291768320 size: 24576
	[  102.130000] arm_vmregion_free() start: 4291768320 end: 4291792896 size: 24576
	[  102.140000] arm_vmregion_free() start: 4291792896 end: 4291817472 size: 24576
	[  102.150000] arm_vmregion_free() start: 4291817472 end: 4291842048 size: 24576
	[  102.160000] arm_vmregion_free() start: 4291641344 end: 4291645440 size: 4096
	[  102.170000] arm_vmregion_free() start: 4291633152 end: 4291637248 size: 4096
	[  102.180000] arm_vmregion_free() start: 4291637248 end: 4291641344 size: 4096
	[  102.190000] arm_vmregion_free() start: 4291624960 end: 4291629056 size: 4096
	[  102.200000] arm_vmregion_free() start: 4291629056 end: 4291633152 size: 4096
	[  102.210000] arm_vmregion_free() start: 4290789376 end: 4290998272 size: 208896
	[  102.220000] arm_vmregion_free() start: 4290998272 end: 4291207168 size: 208896
	[  102.230000] arm_vmregion_free() start: 4291207168 end: 4291416064 size: 208896
	[  102.240000] arm_vmregion_free() start: 4291416064 end: 4291624960 size: 208896

-- ynezz

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

* ep93xx/ts72xx: Kernel 2.6.36 problems introduced with commit 5bc23d32d
  2010-10-31 19:00   ` Petr Štetiar
@ 2010-10-31 19:08     ` Petr Štetiar
  2010-10-31 20:52       ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Štetiar @ 2010-10-31 19:08 UTC (permalink / raw)
  To: linux-arm-kernel

Petr ?tetiar <ynezz@true.cz> [2010-10-31 20:00:34]:

> 	root at ts72xx:~# ifup ra0
> 	WPA: Configuring Interface
> 	[   30.900000] arm_vmregion_alloc() size: 33000
> 	[   30.910000] arm_vmregion_alloc() found: start: 4291297280 end: 4291506176 size: 33000
> 	[   30.920000] arm_vmregion_alloc() size: 33000
> 	[   30.930000] arm_vmregion_alloc() found: start: 4291821568 end: 4292030464 size: 33000
> 	[   30.940000] arm_vmregion_alloc() size: 33000
> 	[   30.950000] arm_vmregion_alloc() found: start: 4292345856 end: 4292554752 size: 33000
> 	[   30.960000] arm_vmregion_alloc() size: 33000
> 	[   30.970000] arm_vmregion_alloc() no space!
> 	[   30.970000] <-- ERROR in Alloc TX TxContext[3] HTTX_BUFFER !!

Adding vmregion allocs in boot:

[    2.270000] Registering the dns_resolver key type
[    2.780000] arm_vmregion_alloc() size: 1000
[    2.780000] arm_vmregion_alloc() found: start: 4290772992 end: 4290777088 size: 1000
[    3.810000] IP-Config: Guessing netmask 255.255.255.0
[    3.810000] IP-Config: Complete:
[    3.810000]      device=eth0, addr=192.168.1.10, mask=255.255.255.0, gw=255.255.255.255,
[    3.830000]      host=192.168.1.10, domain=, nis-domain=(none),
[    3.840000]      bootserver=255.255.255.255, rootserver=192.168.1.90, rootpath=
[    3.850000] Looking up port of RPC 100003/2 on 192.168.1.90
[    3.860000] Looking up port of RPC 100005/1 on 192.168.1.90
[    3.870000] VFS: Mounted root (nfs filesystem) on device 0:13.
[    3.890000] devtmpfs: mounted
[    3.890000] Freeing init memory: 112K
[    4.210000] PHY: 0:01 - Link is Up - 100/Full
INIT: version 2.86 booting
Please wait: booting...
Starting udev
[    7.040000] udevd (48): /proc/48/oom_adj is deprecated, please use /proc/48/oom_score_adj instead.
[   11.080000] ep93xx-rtc ep93xx-rtc: rtc core: registered ep93xx-rtc as rtc0
[   12.840000] rtc-m48t86 rtc-m48t86: rtc core: registered m48t86 as rtc1
[   12.950000] rtc-m48t86 rtc-m48t86: battery ok
[   14.410000] usbcore: registered new interface driver usbfs
[   14.410000] usbcore: registered new interface driver hub
[   14.470000] usbcore: registered new device driver usb
[   14.560000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   14.580000] ep93xx-ohci ep93xx-ohci: EP93xx OHCI
[   14.580000] ep93xx-ohci ep93xx-ohci: new USB bus registered, assigned bus number 1
[   14.600000] ep93xx-ohci ep93xx-ohci: irq 56, io mem 0x80020000
[   14.610000] arm_vmregion_alloc() size: 1000
[   14.610000] arm_vmregion_alloc() found: start: 4290781184 end: 4290785280 size: 1000
[   14.680000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
[   14.690000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   14.690000] usb usb1: Product: EP93xx OHCI
[   14.710000] usb usb1: Manufacturer: Linux 2.6.36+ ohci_hcd
[   14.710000] usb usb1: SerialNumber: ep93xx
[   14.720000] hub 1-0:1.0: USB hub found
[   14.730000] hub 1-0:1.0: 3 ports detected
[   15.070000] usb 1-1: new full speed USB device using ep93xx-ohci and address 2
[   15.070000] arm_vmregion_alloc() size: 1000
[   15.070000] arm_vmregion_alloc() found: start: 4290789376 end: 4290793472 size: 1000
[   15.070000] arm_vmregion_alloc() size: 1000
[   15.070000] arm_vmregion_alloc() found: start: 4290797568 end: 4290801664 size: 1000
Remounting root file system...

-- ynezz

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

* ep93xx/ts72xx: Kernel 2.6.36 problems introduced with commit 5bc23d32d
  2010-10-31 19:08     ` Petr Štetiar
@ 2010-10-31 20:52       ` Russell King - ARM Linux
  2010-10-31 22:30         ` Petr Štetiar
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2010-10-31 20:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Oct 31, 2010 at 08:08:33PM +0100, Petr ?tetiar wrote:
> Petr ?tetiar <ynezz@true.cz> [2010-10-31 20:00:34]:
> 
> > 	root at ts72xx:~# ifup ra0
> > 	WPA: Configuring Interface
> > 	[   30.900000] arm_vmregion_alloc() size: 33000
> > 	[   30.910000] arm_vmregion_alloc() found: start: 4291297280 end: 4291506176 size: 33000
> > 	[   30.920000] arm_vmregion_alloc() size: 33000
> > 	[   30.930000] arm_vmregion_alloc() found: start: 4291821568 end: 4292030464 size: 33000
> > 	[   30.940000] arm_vmregion_alloc() size: 33000
> > 	[   30.950000] arm_vmregion_alloc() found: start: 4292345856 end: 4292554752 size: 33000
> > 	[   30.960000] arm_vmregion_alloc() size: 33000
> > 	[   30.970000] arm_vmregion_alloc() no space!
> > 	[   30.970000] <-- ERROR in Alloc TX TxContext[3] HTTX_BUFFER !!

It's being a little too over-cautious.  In arch/arm/mm/dma-mapping.c
__dma_alloc_remap, remove the + 1 from "bit = fls(size - 1) + 1;".

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

* ep93xx/ts72xx: Kernel 2.6.36 problems introduced with commit 5bc23d32d
  2010-10-31 20:52       ` Russell King - ARM Linux
@ 2010-10-31 22:30         ` Petr Štetiar
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Štetiar @ 2010-10-31 22:30 UTC (permalink / raw)
  To: linux-arm-kernel

Russell King - ARM Linux <linux@arm.linux.org.uk> [2010-10-31 20:52:10]:

> It's being a little too over-cautious.  In arch/arm/mm/dma-mapping.c
> __dma_alloc_remap, remove the + 1 from "bit = fls(size - 1) + 1;".

Hm, that was really fast :-) It works now, thank you!

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 4bc43e5..7012105 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -198,7 +198,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t
gfp, pgprot_t prot)
         * fragmentation of the DMA space, and also prevents allocations
         * smaller than a section from crossing a section boundary.
         */
-       bit = fls(size - 1) + 1;
+       bit = fls(size - 1);
        if (bit > SECTION_SHIFT)
                bit = SECTION_SHIFT;
        align = 1 << bit;

-- ynezz

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

end of thread, other threads:[~2010-10-31 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-31 18:21 ep93xx/ts72xx: Kernel 2.6.36 problems introduced with commit 5bc23d32d Petr Štetiar
2010-10-31 18:31 ` Russell King - ARM Linux
2010-10-31 19:00   ` Petr Štetiar
2010-10-31 19:08     ` Petr Štetiar
2010-10-31 20:52       ` Russell King - ARM Linux
2010-10-31 22:30         ` Petr Štetiar

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.