Re: [linux-sh:03224] SH SCI output weirdness...

Stuart MENEFY <[email protected]> Tue, 4 May 2004 21:48:55 +0100
Newsgroups gmane.linux.ports.sh.devel,gmane.linux.ports.sh.general
Organization STMicroelectronics (Bristol)
Message-ID <20040504214855.4a3a4dfc@ocelot>
On Tue, 04 May 2004 18:08:46 +0100 Alex Bennee <[email protected]> wrote:

> Hi,
> 
> I'm giving the 2.6 kernel a spin on my ST40 based hardware and I'm
> seeing some weird output from the serial port. The following output
> comes from straight boot, however if I step though the initialisation
> via gdb the output comes out ok. My initial suspicion was a buffer
> overflow for the serial driver. However a 2.4 boot has a similar amount
> of diags and gives no such problems. also I'm running at 57600 so its
> hard to imagine the diags being overrun.
> 
> Has anyone else seen any output like this? I'm hoping so otherwise its
> likely some sort of weird memory corruption..... 

Yes, I've seen it, and much head scratching it caused.

The problem is the idle loop has been modified to call cpu_relax(), and
cpu_relax() now includes a "sleep" instruction. The hlt_counter, although
still present, is ignored.

On the ST40, with the default power management configuration, this appears
to try and power down or reduce the clock speed of the serial port. So any
data still in the FIFO gets corrupted.

Personally I think doing a "sleep" in the middle of cpu_relax() is wrong,
as it is typically used in busy loops like spinlocks where there is no
guarantee that there will be something to wake you back up. It also has an
overhead which you may not want. Using it in the idle loop is more
appropriate, as typically worth while going to sleep there, and you can
take appropriate measures to make sure it is safe.

However, for the moment I've simply got back to the 2.4 version of the code.

Stuart
signature.asc (application/pgp-signature, 185 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (SunOS)

iD8DBQFAmAG461BlSKQGbXkRAo5hAJ40HAuCqzMqlTXps+He5wRAQYi+gQCdGkbg
3qa/GxQdmU5Sp0EXA2tftXw=
=GFBk
-----END PGP SIGNATURE-----