public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Joakim Tjernlund <Joakim.Tjernlund@lumentis.se>
Cc: linux-mtd@lists.infradead.org
Subject: Re: point()/unpoint() questions + small cfi_cmdset_0001.c patch
Date: Mon, 17 Jun 2002 10:56:36 +0100	[thread overview]
Message-ID: <20561.1024307796@redhat.com> (raw)
In-Reply-To: <200206170924.g5H9OXJJ003077@blooper.utfors.se>


Joakim.Tjernlund@lumentis.se said:
> 1)  There is no point()/unpoint() function pointers in struct
> map_info, so I wounder where one should
>      add the point()/unpoint() functions?

> 2)  It is not clear to me how the semantics for point()/unpoint()
> works, is the following sequence legal: 

The point()/unpoint() methods date back to about 1997, and were never used
or properly defined.

The idea was to return a pointer directly into the flash chip, and to lock 
the chip state machine so that it can't be removed from read mode until the 
corresponding unpoint(). Flash drivers would either have to keep track of 
multiple point() requests or disallow subsequent point() calls when one was 
outstanding. 

Any code with a point() call outstanding would need to take care not to do 
anything which would deadlock, of course.

These methods would be implemented in the flash chip driver -- the map 
driver would only need to provide the physical (or virtual) address to look 
at, in the common case where the flash isn't paged. I'd argue that we don't 
want to allow point() to happen in the case where the flash _is_ paged -- 
and hence even read requests outside the region of the point() request 
could deadlock.

The thing is; I'm not convinced I like the potential for deadlock. I've 
been tempted to use this kind of hack for mounting JFFS2 without multiple 
out of line read calls, but haven't actually got round to even hacking up 
the code to test how fast it would be, by replacing the jffs2_flash_read() 
in scan.c with a memcpy from a hard-coded address.

For execute in place, we need something similar, but more sophisticated. The
plan for that, which Linus approved at the time, was to provide a new mmzone
-- and array of 'struct page's, which can be added into the page cache on
demand by the XIP-aware file system. When a given (logical) page from a file
moves from one location to another, or when the chip is temporarily in a
mode other than read mode, we have to mark those pages invalid, and
subsequent faults on those pages must sleep until the chip is back in read
mode.

The RMAP VM helps us a lot here -- until we could find all the virtual 
mappings of a given physical page, it was just about impossible to do what 
we need. 

Note that using AMD chips instead of Intel chips seems to be particularly 
sensible if you want XIP -- with Intel chips, the whole chip goes into 
status mode when you're doing things with it. Yet I believe that with AMD 
chips, only the block to which you're actually writing returns status bits, 
and all other erase blocks remain readable during the operation.

Anyway, to get back to the point... given that I don't like the possibility 
of deadlock with the naïve point/unpoint routines, and that I think we will 
need to do the page-based thing for XIP anyway, I suspect we should just 
use the suggested XIP setup for doing what you want in kernel space.

So if you're looking at letting JFFS2 read directly from the flash, it 
would call a chip driver method akin to ioremap(), which would return a 
kernel virtual address from which all the flash can be read. The chip 
driver then marks pages absent as an when necessary -- for kernel mappings 
we can do that even without the rmap VM. We can probably also mark these 
pages as cacheable, to let burst reads work.

Comments?

--
dwmw2

  reply	other threads:[~2002-06-17  9:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-12 12:14 Cache mappings and invalidate Joakim Tjernlund
2001-11-12 17:44 ` Joakim Tjernlund
2001-12-17 13:08 ` Burst read and other improvements Joakim Tjernlund
2002-03-11  8:56   ` compr_zlib.c Joakim Tjernlund
2002-03-19 12:03   ` compr_zlib.c Joakim Tjernlund
2002-03-19 12:24     ` compr_zlib.c David Woodhouse
2002-01-04  8:59 ` CLEANMARKER question Joakim Tjernlund
2002-01-04  9:42   ` David Woodhouse
2002-01-04 10:33     ` Joakim Tjernlund
2002-01-04 10:41       ` David Woodhouse
2002-01-29 10:33   ` MTD/CFI probe broken? Joakim Tjernlund
2002-01-29 18:09     ` Joakim Tjernlund
2002-02-14 14:05     ` cfi_cmdset0001.c: bug fixes and new features Joakim Tjernlund
2002-02-26 13:42     ` scan.c & ACCURATE Joakim Tjernlund
2002-02-26 15:52       ` David Woodhouse
2002-02-27  7:34         ` Joakim Tjernlund
2002-02-27  8:17           ` David Woodhouse
2002-02-27 12:29             ` Joakim Tjernlund
2002-02-26 15:53       ` David Woodhouse
2002-02-27  7:43         ` Joakim Tjernlund
2002-06-17  9:24       ` point()/unpoint() questions + small cfi_cmdset_0001.c patch Joakim Tjernlund
2002-06-17  9:56         ` David Woodhouse [this message]
2002-06-17 13:37           ` David Woodhouse
2002-06-17 15:41           ` Joakim Tjernlund
2002-06-17 15:56             ` David Woodhouse
2002-06-17 16:22               ` Joakim Tjernlund
2002-06-18 14:11                 ` David Woodhouse
2002-06-17  9:48       ` [PATCH] scan.c Joakim Tjernlund
2002-06-17  9:54       ` Joakim Tjernlund
2002-06-17 10:15         ` David Woodhouse
2002-06-17 12:16           ` Joakim Tjernlund
2002-06-17 12:45             ` David Woodhouse
2002-06-17 15:12               ` Joakim Tjernlund
2002-06-17 16:00                 ` David Woodhouse
2002-06-17 16:51                   ` Joakim Tjernlund
2002-06-17 22:59                     ` David Woodhouse

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=20561.1024307796@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=Joakim.Tjernlund@lumentis.se \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox