linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Linux 2.6.x  :  cpm_dpalloc alignment bug perhaps not fully resolved
  2006-01-25 16:14 Misunderstanding with function cpm_dpalloc in Linux 2.6.x Pantelis Antoniou
@ 2006-07-04 15:37 ` Laurent Lagrange
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Lagrange @ 2006-07-04 15:37 UTC (permalink / raw)
  To: pantelis; +Cc: linuxppc-embedded


Hello Pantelis,

Few months ago (25 January 2006), I sent a mail about an alignment bug in
cpm_dpalloc.
I applied and verified the provided patch. I was very satisfied with the
result.

Today I port a driver from Linux 2.4 to Linux 2.6 and I have strange
results.

The driver allocates rx and tx bds (8 bytes aligned) in the module_init for
4 SCC ports.
That is always right. Then one port is opened by an application and a user
configuration
is set via an ioctl (set_conf).

This ioctl first frees the old bds :
	cpm_dpfree(chan->rx_bd_offset);
	cpm_dpfree(chan->tx_bd_offset);
then allocates the new ones :
	chan->rx_bd_offset = cpm_dpalloc(sizeof(cbd_t) * chan->conf.rx_bufnbr, 8);
	chan->tx_bd_offset = cpm_dpalloc(sizeof(cbd_t) * chan->conf.tx_bufnbr, 8);
with rx_bufnbr == 8 and tx_bufnbr == 2

module_init
SCC1 rx_bd_offset=160
SCC1 tx_bd_offset=1a8
SCC2 rx_bd_offset=1c0
SCC2 tx_bd_offset=208
SCC3 rx_bd_offset=220
SCC3 tx_bd_offset=260
SCC4 rx_bd_offset=278
SCC4 tx_bd_offset=2c0
set_conf
SCC1 rx_bd_offset=160
SCC1 tx_bd_offset=1a4	-> ???

module_init
SCC1 rx_bd_offset=160
SCC1 tx_bd_offset=1a8
SCC2 rx_bd_offset=1c0
SCC2 tx_bd_offset=208
SCC3 rx_bd_offset=220
SCC3 tx_bd_offset=260
SCC4 rx_bd_offset=278
SCC4 tx_bd_offset=2c0
set_conf
SCC2 rx_bd_offset=1c0
SCC2 tx_bd_offset=202	-> ???

module_init
SCC1 rx_bd_offset=160
SCC1 tx_bd_offset=1a8
SCC2 rx_bd_offset=1c0
SCC2 tx_bd_offset=208
SCC3 rx_bd_offset=220
SCC3 tx_bd_offset=260
SCC4 rx_bd_offset=278
SCC4 tx_bd_offset=2c0
set_conf
SCC3 rx_bd_offset=220
SCC3 tx_bd_offset=260	-> ok

module_init
SCC1 rx_bd_offset=160
SCC1 tx_bd_offset=1a8
SCC2 rx_bd_offset=1c0
SCC2 tx_bd_offset=208
SCC3 rx_bd_offset=220
SCC3 tx_bd_offset=260
SCC4 rx_bd_offset=278
SCC4 tx_bd_offset=2c0
set_conf
SCC4 rx_bd_offset=278
SCC4 tx_bd_offset=2c0	-> ok

WARNING : if I only uses the SCC1 port without allocating bds for the other
ports,
I can free and reallocate the bds for the SCC1 port as many times I want.

module_init
SCC1 rx_bd_offset=160
SCC1 tx_bd_offset=1a8
set_conf
SCC1 rx_bd_offset=160
SCC1 tx_bd_offset=1a8	-> ok

Really, I don't understand how this can arise.
Any idea ?

Thanks
Laurent

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

* RE: Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved
  2006-07-05  2:32 Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully r esolved Li Yang-r58472
@ 2006-07-05  8:25 ` Laurent Lagrange
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Lagrange @ 2006-07-05  8:25 UTC (permalink / raw)
  To: 'Li Yang-r58472', pantelis; +Cc: linuxppc-embedded

Hi Leo,

Thanks for the reply.

The patch, I already applied, comes directly from Pantelis
and is the same code as found at
http://patchwork.ozlabs.org/linuxppc/patch?id=3484

What do you mean by the alignment patch ?

I suspect a problem in the cpm_dpfree function,
not in the cpm_dpalloc function.

I'll try to give more details.

Best regards
Laurent



> -----Message d'origine-----
> De : Li Yang-r58472 [mailto:LeoLi@freescale.com]
> Envoyé : mer. 5 juillet 2006 03:32
> À : Laurent Lagrange; pantelis@embeddedalley.com
> Cc : linuxppc-embedded@ozlabs.org
> Objet : RE: Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully
> resolved
>
>
> Did you apply the alignment patch too?  AFAIK, the problem is
> never fixed in
> mainstream trees.
>
> Best Regards,
> Leo
>

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

* RE: Linux 2.6.x  :  cpm_dpalloc alignment bug perhaps not fully r esolved
@ 2006-07-05  8:35 Li Yang-r58472
  2006-07-05  9:11 ` Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved Laurent Lagrange
  0 siblings, 1 reply; 6+ messages in thread
From: Li Yang-r58472 @ 2006-07-05  8:35 UTC (permalink / raw)
  To: Laurent Lagrange, pantelis; +Cc: linuxppc-embedded

> -----Original Message-----
> From: Laurent Lagrange [mailto:lagrange@fr.oleane.com]
> Sent: Wednesday, July 05, 2006 4:26 PM
> To: Li Yang-r58472; pantelis@embeddedalley.com
> Cc: linuxppc-embedded@ozlabs.org
> Subject: RE: Linux 2.6.x : cpm_dpalloc alignment bug perhaps not =
fully resolved
>=20
> Hi Leo,
>=20
> Thanks for the reply.
>=20
> The patch, I already applied, comes directly from Pantelis
> and is the same code as found at
> http://patchwork.ozlabs.org/linuxppc/patch?id=3D3484

Sure, it is the patch I mentioned.  Also be noted that the patch only =
fixes rheap in arch/ppc/.  If you are using latest 2.6 source, you are =
most probably using code under arch/powerpc/.
>=20
> What do you mean by the alignment patch ?
>=20
> I suspect a problem in the cpm_dpfree function,
> not in the cpm_dpalloc function.
>=20
> I'll try to give more details.
>=20
> Best regards
> Laurent
>=20
>=20
>=20
> > -----Message d'origine-----
> > De : Li Yang-r58472 [mailto:LeoLi@freescale.com]
> > Envoy=E9 : mer. 5 juillet 2006 03:32
> > =C0 : Laurent Lagrange; pantelis@embeddedalley.com
> > Cc : linuxppc-embedded@ozlabs.org
> > Objet : RE: Linux 2.6.x : cpm_dpalloc alignment bug perhaps not =
fully
> > resolved
> >
> >
> > Did you apply the alignment patch too?  AFAIK, the problem is
> > never fixed in
> > mainstream trees.
> >
> > Best Regards,
> > Leo
> >

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

* RE: Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved
  2006-07-05  8:35 Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully r esolved Li Yang-r58472
@ 2006-07-05  9:11 ` Laurent Lagrange
  2006-07-05  9:38   ` Pantelis Antoniou
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Lagrange @ 2006-07-05  9:11 UTC (permalink / raw)
  To: 'Li Yang-r58472', pantelis; +Cc: linuxppc-embedded



> -----Message d'origine-----
> De : Li Yang-r58472 [mailto:LeoLi@freescale.com]
> Envoyé : mer. 5 juillet 2006 09:36
> À : Laurent Lagrange; pantelis@embeddedalley.com
> >
> > The patch, I already applied, comes directly from Pantelis
> > and is the same code as found at
> > http://patchwork.ozlabs.org/linuxppc/patch?id=3484
>
> Sure, it is the patch I mentioned.  Also be noted that the
> patch only fixes rheap in arch/ppc/.  If you are using latest
> 2.6 source, you are most probably using code under arch/powerpc/.
> >
I use a Linux 2.6.9 for MPC8260 and the arch/ppc/lib/rheap.c file.
I have no arch/powerpc tree in this kernel.

Before applying the patch, I was not able to get a right aligned area
with cpm_dpalloc. After applying it, cpm_dpalloc seems to be right
until I use cpm_dpfree and then cpm_dpalloc on the same area.

Another idea ?
Thanks
Laurent

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

* Re: Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved
  2006-07-05  9:11 ` Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved Laurent Lagrange
@ 2006-07-05  9:38   ` Pantelis Antoniou
  2006-07-05 10:03     ` Laurent Lagrange
  0 siblings, 1 reply; 6+ messages in thread
From: Pantelis Antoniou @ 2006-07-05  9:38 UTC (permalink / raw)
  To: Laurent Lagrange; +Cc: linuxppc-embedded

On Wednesday 05 July 2006 12:11, Laurent Lagrange wrote:
>=20
> > -----Message d'origine-----
> > De : Li Yang-r58472 [mailto:LeoLi@freescale.com]
> > Envoy=E9 : mer. 5 juillet 2006 09:36
> > =C0 : Laurent Lagrange; pantelis@embeddedalley.com
> > >
> > > The patch, I already applied, comes directly from Pantelis
> > > and is the same code as found at
> > > http://patchwork.ozlabs.org/linuxppc/patch?id=3D3484
> >
> > Sure, it is the patch I mentioned.  Also be noted that the
> > patch only fixes rheap in arch/ppc/.  If you are using latest
> > 2.6 source, you are most probably using code under arch/powerpc/.
> > >
> I use a Linux 2.6.9 for MPC8260 and the arch/ppc/lib/rheap.c file.
> I have no arch/powerpc tree in this kernel.
>=20
> Before applying the patch, I was not able to get a right aligned area
> with cpm_dpalloc. After applying it, cpm_dpalloc seems to be right
> until I use cpm_dpfree and then cpm_dpalloc on the same area.
>=20
> Another idea ?
> Thanks
> Laurent
>=20
>=20
>=20

Should be a bug at the free. I'll take a look at it when I have a few
spare cycles.

Pantelis

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

* RE: Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved
  2006-07-05  9:38   ` Pantelis Antoniou
@ 2006-07-05 10:03     ` Laurent Lagrange
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Lagrange @ 2006-07-05 10:03 UTC (permalink / raw)
  To: 'Pantelis Antoniou'; +Cc: linuxppc-embedded



> -----Message d'origine-----
> De : Pantelis Antoniou [mailto:pantelis@embeddedalley.com]
> Envoyé : mer. 5 juillet 2006 10:38
> À : Laurent Lagrange
> Cc : 'Li Yang-r58472'; linuxppc-embedded@ozlabs.org
> Objet : Re: Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully
> resolved
>
> Should be a bug at the free. I'll take a look at it when I have a few
> spare cycles.
>
> Pantelis
>
Yes, I think so.
I'll try to get more details if I can help you.
Best regards
Laurent

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

end of thread, other threads:[~2006-07-05 10:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-05  8:35 Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully r esolved Li Yang-r58472
2006-07-05  9:11 ` Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved Laurent Lagrange
2006-07-05  9:38   ` Pantelis Antoniou
2006-07-05 10:03     ` Laurent Lagrange
  -- strict thread matches above, loose matches on Subject: below --
2006-07-05  2:32 Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully r esolved Li Yang-r58472
2006-07-05  8:25 ` Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved Laurent Lagrange
2006-01-25 16:14 Misunderstanding with function cpm_dpalloc in Linux 2.6.x Pantelis Antoniou
2006-07-04 15:37 ` Linux 2.6.x : cpm_dpalloc alignment bug perhaps not fully resolved Laurent Lagrange

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).