From: Doug Thompson <norsk5@yahoo.com>
To: Andrew Morton <akpm@linux-foundation.org>, dougthompson@xmission.com
Cc: greg@kroah.com, ralf@linux-mips.org, egor@pasemi.com,
alan@lxorguk.ukuu.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] include asm-mips add missing edac h file
Date: Thu, 26 Jul 2007 08:19:33 -0700 (PDT) [thread overview]
Message-ID: <975861.36218.qm@web50103.mail.re2.yahoo.com> (raw)
In-Reply-To: <20070725222500.e537531d.akpm@linux-foundation.org>
--- Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 25 Jul 2007 14:55:01 -0600 dougthompson@xmission.com wrote:
>
> > --- /dev/null
> > +++ linux-2.6.23-rc1/include/asm-mips/edac.h
> > @@ -0,0 +1,35 @@
> > +#ifndef ASM_EDAC_H
> > +#define ASM_EDAC_H
> > +
> > +/* ECC atomic, DMA, SMP and interrupt safe scrub function */
> > +
> > +static __inline__ void atomic_scrub(void *va, u32 size)
>
> Please don't use __inline__ or __inline. Good old "inline" will do.
ok, thanks.
I have to admit, since I don't know MIPS assembly, the guys at Sicortex.com developed
this function.
>
> <cc's the checkpatch maintainer>
>
> <edits the diff>
thanks
>
> > +{
> > + unsigned long *virt_addr = va;
> > + unsigned long temp;
> > + u32 i;
> > +
> > + for (i = 0; i < size / sizeof(unsigned long); i++, virt_addr++) {
> > +
> > + /*
> > + * Very carefully read and write to memory atomically
> > + * so we are interrupt, DMA and SMP safe.
> > + *
> > + * Intel: asm("lock; addl $0, %0"::"m"(*virt_addr));
> > + */
> > +
> > + __asm__ __volatile__ (
> > + " .set mips3 \n"
> > + "1: ll %0, %1 # atomic_add \n"
> > + " ll %0, %1 # atomic_add \n"
> > + " addu %0, $0 \n"
> > + " sc %0, %1 \n"
> > + " beqz %0, 1b \n"
> > + " .set mips0 \n"
> > + : "=&r" (temp), "=m" (*virt_addr)
> > + : "m" (*virt_addr));
> > +
> > + }
> > +}
>
> hm, I'd have thought that we could us plain old atomic_add() for this.
This code is used as a primitive to perform software memory scrubbing.
We (many people as I remember) had a discussion a couple of years ago on lkml on this,
so this is where this implementation pattern came from.
It might be that your thought just could be correct now after some more research.
doug t
prev parent reply other threads:[~2007-07-26 15:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-25 20:55 [PATCH 3/4] include asm-mips add missing edac h file dougthompson
2007-07-26 5:25 ` Andrew Morton
2007-07-26 15:19 ` Doug Thompson [this message]
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=975861.36218.qm@web50103.mail.re2.yahoo.com \
--to=norsk5@yahoo.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=dougthompson@xmission.com \
--cc=egor@pasemi.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ralf@linux-mips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox