mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Miguel Ojeda" <maxextreme@gmail.com>
Cc: Franck <vagabon.xyz@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH update6] drivers: add LCD support
Date: Thu, 2 Nov 2006 11:13:11 -0800	[thread overview]
Message-ID: <20061102111311.1b2648c3.akpm@osdl.org> (raw)
In-Reply-To: <653402b90611020644m57dac018r443fc91bccf6db0c@mail.gmail.com>

On Thu, 2 Nov 2006 14:44:56 +0000
"Miguel Ojeda" <maxextreme@gmail.com> wrote:

> > Sorry for the short/fast question. I'm wondering how does the cache
> > behave here. You have 2 virtual addresses that point to the same
> > location in physical RAM: kernel frame buffer which has a kernel
> > virtual address and the vma you're returning when an application mmap
> > the device. This last address is a user virtual address and is
> > different from the first one.
> >
> > Now let's say that some of the kernel frame buffer data are in the
> > data cache and never be invalidate during this example. The
> 
> Sorry, I don't understand what do you mean with this sentence.

Some CPU architectures experience what Documentation/cachetlb.txt calls
"virtual aliasing in the data cache".

If you map the same physical page at virtual address A1 and also at another
virtual address A2 then writes to address A1 do not necessarily appear
correctly at address A2.  This because the write to A1 is stuck in the CPU
cache and the CPU hardware doesn't know that read from A2 is accessing the
same page.

The solutions to this are:

a) add lots of flushing everywhere (see Documentation/cachetlb.txt, I
   guess) (this documentation is maddening: it uses the term "flush" for
   both writeback and for invalidation.  In this context,
   flush==writeback).

b) If you select the correct virtual addresses for A1 and A2 (ie: ensure
   that the mmap() handler returns an address which correlates with the
   page's kernel address) then apparently the aliasing goes away.

   So, for example, if the kernel's view of the page is at 0xd0102000
   then you make sure that userspace's address for the page is at
   0xnnn02000 (for some length of nnn).

   I don't know what the mmap handler has to do to arrange for this to
   happen.

c) add `depends on x86' to your Kconfig ;)


davem and rmk are (amongst others) the guys for this stuff.  afaik it isn't
documented anywhere.


  reply	other threads:[~2006-11-02 19:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-01  1:40 Miguel Ojeda Sandonis
2006-11-02  8:51 ` Franck Bui-Huu
2006-11-02 13:44   ` Miguel Ojeda
2006-11-02 14:26     ` Franck Bui-Huu
2006-11-02 14:44       ` Miguel Ojeda
2006-11-02 19:13         ` Andrew Morton [this message]
2006-11-02 19:33           ` Miguel Ojeda
2006-11-02 20:04             ` Andrew Morton
2006-11-03  0:00               ` David Miller
2006-11-03  6:45                 ` Miguel Ojeda

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=20061102111311.1b2648c3.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxextreme@gmail.com \
    --cc=vagabon.xyz@gmail.com \
    /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

all inboxes | Powered by JetHome®