All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: Strange transmit corruption in jsm driver on geode sc1200 system
Date: Fri, 25 Aug 2006 17:57:24 -0400	[thread overview]
Message-ID: <20060825215724.GI13641@csclub.uwaterloo.ca> (raw)
In-Reply-To: <20060825212441.GC2246@martell.zuzino.mipt.ru>

On Sat, Aug 26, 2006 at 01:24:41AM +0400, Alexey Dobriyan wrote:
> But you can check. Insert something like this in right place:
> 
> 	printk("%p\n", buffer);

It would be 1/4 of the time given the code is this:

memcpy_toio(&ch->ch_neo_uart->txrxburst, ch->ch_wqueue + tail, s);

tail is the offset in the write queue in the jsm driver, which can be
any offset whatsoever.  So sometimes it is 32bit aligned, but often it
isn't.

The txrxburst of course is 32bit alligned.  Receiving works fine when
copying from the alligned buffer in hardware to wherever in the receiver
queue.

Of course given the __memcpy assembly seems to work fine unalligned on a
pentium4, and probably most othe systems, what could make it not work
correctly on a geode SC1200?

This is the chunk of assembly in use:

static __always_inline void * __memcpy(void * to, const void * from, size_t n)
{
int d0, d1, d2;
__asm__ __volatile__(
        "rep ; movsl\n\t"
        "movl %4,%%ecx\n\t"
        "andl $3,%%ecx\n\t"
#if 1   /* want to pay 2 byte penalty for a chance to skip microcoded rep? */
        "jz 1f\n\t"
#endif
        "rep ; movsb\n\t"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n/4), "g" (n), "1" ((long) to), "2" ((long) from)
        : "memory");
return (to);
}

I am affraid I don't know the rep instruction on x86, so it really
doesn't make sense to me.

I suppose if nothing else works, I can do one byte at a time until the
tail is 32bit alligned, and then do the rest of the transfer as a block
and see if that makes it work, or whether it is broken no matter what
the allignement of the buffer is.

--
Len Sorensen

  reply	other threads:[~2006-08-25 21:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-25 20:30 Strange transmit corruption in jsm driver on geode sc1200 system Lennart Sorensen
2006-08-25 21:20 ` Alan Cox
2006-08-25 21:03   ` Lennart Sorensen
2006-08-25 21:24     ` Alexey Dobriyan
2006-08-25 21:57       ` Lennart Sorensen [this message]
2006-08-28 17:30         ` Lennart Sorensen
2006-08-28 18:11         ` Lennart Sorensen
2006-08-28 19:09           ` Alan Cox
2006-08-28 19:18             ` Lennart Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060825215724.GI13641@csclub.uwaterloo.ca \
    --to=lsorense@csclub.uwaterloo.ca \
    --cc=adobriyan@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.