All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: "David S. Miller" <davem@redhat.com>
Cc: Chris Wedgwood <cw@f00f.org>,
	Jeff Garzik <jgarzik@mandrakesoft.com>,
	bjornw@axis.com, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org
Subject: Re: Missing cache flush.
Date: Tue, 05 Jun 2001 09:46:09 +0100	[thread overview]
Message-ID: <25587.991730769@redhat.com> (raw)
In-Reply-To: <15132.22933.859130.119059@pizda.ninka.net>

davem@redhat.com said:
> Chris Wedgwood writes:
> > What if the memory is erased underneath the CPU being aware of
> > this? In such a way ig generates to bus traffic...

> This doesn't happen on x86.  The processor snoops all transactions
> done by other agents to/from main memory.  The processor caches are
> always up to date. 

No. My original mail presented two situations in which this assumption is 
false.

1. Bank-switched RAM. You want to force a writeback before switching pages.
   I _guarantee_ you that the CPU isn't snooping my access to the I/O port
   which sets the latch that drives the upper few address bits of the RAM 
   chips.

2. Flash. A few writes of magic data to magic addresses and a whole erase
   block suddenly contains 0xFF. The CPU doesn't notice that either.

What I want is a function like simon_says_flush_page_to_ram(). In this 
case, I _do_ know better than the CPU. It is _not_ coherent with these 
devices.

I'm actually working on a MIPS box at the moment - the particular problems
with doing it on i386 don't interest me too much. To be honest, I could do
it by sticking asm instructions inside ifdefs in what is otherwise
arch-independent code. I'd rather not do it like that, though. 

Surely stuff like that should be exported by the arch-specific code or
include files somehow. Possibly with a #define or function I can use to tell
whether a selective flush is actually available on the current CPU. If it's
not possible to flush the dcache selectively, then the cost of doing a full
flush probably outweighs the benefit¹ of running the flash cached in the
first place. But it should still be possible to do it from arch-independent
code without manually inserting asm instructions to do it.

--
dwmw2

¹ The _assumed_ benefit, admittedly. I should get some benchmarks to back up
the comment about molasses in arch/cris/drivers/axisflashmap.c

WARNING: multiple messages have this Message-ID (diff)
From: David Woodhouse <dwmw2@infradead.org>
To: "David S. Miller" <davem@redhat.com>
Cc: Chris Wedgwood <cw@f00f.org>,
	Jeff Garzik <jgarzik@mandrakesoft.com>,
	bjornw@axis.com, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org
Subject: Re: Missing cache flush.
Date: Tue, 05 Jun 2001 09:46:09 +0100	[thread overview]
Message-ID: <25587.991730769@redhat.com> (raw)
In-Reply-To: <15132.22933.859130.119059@pizda.ninka.net>
In-Reply-To: <15132.22933.859130.119059@pizda.ninka.net>  <13942.991696607@redhat.com> <3B1C1872.8D8F1529@mandrakesoft.com> <15132.15829.322534.88410@pizda.ninka.net> <20010605155550.C22741@metastasis.f00f.org>


davem@redhat.com said:
> Chris Wedgwood writes:
> > What if the memory is erased underneath the CPU being aware of
> > this? In such a way ig generates to bus traffic...

> This doesn't happen on x86.  The processor snoops all transactions
> done by other agents to/from main memory.  The processor caches are
> always up to date. 

No. My original mail presented two situations in which this assumption is 
false.

1. Bank-switched RAM. You want to force a writeback before switching pages.
   I _guarantee_ you that the CPU isn't snooping my access to the I/O port
   which sets the latch that drives the upper few address bits of the RAM 
   chips.

2. Flash. A few writes of magic data to magic addresses and a whole erase
   block suddenly contains 0xFF. The CPU doesn't notice that either.

What I want is a function like simon_says_flush_page_to_ram(). In this 
case, I _do_ know better than the CPU. It is _not_ coherent with these 
devices.

I'm actually working on a MIPS box at the moment - the particular problems
with doing it on i386 don't interest me too much. To be honest, I could do
it by sticking asm instructions inside ifdefs in what is otherwise
arch-independent code. I'd rather not do it like that, though. 

Surely stuff like that should be exported by the arch-specific code or
include files somehow. Possibly with a #define or function I can use to tell
whether a selective flush is actually available on the current CPU. If it's
not possible to flush the dcache selectively, then the cost of doing a full
flush probably outweighs the benefit¹ of running the flash cached in the
first place. But it should still be possible to do it from arch-independent
code without manually inserting asm instructions to do it.

--
dwmw2

¹ The _assumed_ benefit, admittedly. I should get some benchmarks to back up
the comment about molasses in arch/cris/drivers/axisflashmap.c



  reply	other threads:[~2001-06-05  8:42 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-04 23:16 Missing cache flush David Woodhouse
2001-06-04 23:23 ` Jeff Garzik
2001-06-04 23:29   ` David Woodhouse
2001-06-04 23:29     ` David Woodhouse
2001-06-05  2:04     ` David S. Miller
2001-06-05  2:04       ` David S. Miller
2001-06-05  2:03   ` David S. Miller
2001-06-05  2:03     ` David S. Miller
2001-06-05  3:55     ` Chris Wedgwood
2001-06-05  4:01       ` David S. Miller
2001-06-05  4:01         ` David S. Miller
2001-06-05  8:46         ` David Woodhouse [this message]
2001-06-05  8:46           ` David Woodhouse
2001-06-05  8:50           ` David S. Miller
2001-06-05  8:50             ` David S. Miller
2001-06-05  9:05             ` David Woodhouse
2001-06-05  9:05               ` David Woodhouse
2001-06-05  9:11               ` David S. Miller
2001-06-05  9:11                 ` David S. Miller
2001-06-05 12:42                 ` David Woodhouse
2001-06-05 12:42                   ` David Woodhouse
2001-06-05 12:48                   ` David S. Miller
2001-06-05 12:48                     ` David S. Miller
2001-06-05 12:52                     ` David Woodhouse
2001-06-05 12:52                       ` David Woodhouse
2001-06-06  8:32                     ` Albert D. Cahalan
2001-06-06 19:48               ` Pavel Machek
2001-06-05 17:01             ` Jamie Lokier
2001-06-05 23:24               ` Chris Wedgwood
2001-06-06  8:43                 ` James Sutherland
2001-06-05  9:29           ` kira brown
2001-06-05  9:29             ` kira brown
2001-06-05 17:16             ` Alan Cox
2001-06-06 19:44               ` Earyly Cyrix CPUs was " Pavel Machek
2001-06-08 16:00                 ` Alan Cox
2001-06-05  9:43           ` Johan Adolfsson
2001-06-05  5:28       ` Linus Torvalds
2001-06-05  6:49         ` Alan Cox
2001-06-05  8:29         ` Ingo Molnar
2001-06-05 15:10           ` Ralf Baechle
2001-06-05  9:17 ` Bjorn Wesen
2001-06-05 12:57   ` Chris Wedgwood
2001-06-05 15:17     ` Ralf Baechle
2001-06-05 17:41     ` Daniel Phillips
2001-06-05 14:22   ` Vipin Malik
2001-06-05 14:40     ` Chris Wedgwood

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=25587.991730769@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=bjornw@axis.com \
    --cc=cw@f00f.org \
    --cc=davem@redhat.com \
    --cc=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.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.