Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: "Anoop P.A." <Anoop_P.A@pmc-sierra.com>
Cc: linux-mips <linux-mips@linux-mips.org>
Subject: Re: file corruption with highmem kernel
Date: Thu, 5 Aug 2010 19:25:47 +0100	[thread overview]
Message-ID: <20100805182547.GB1382@linux-mips.org> (raw)
In-Reply-To: <A7DEA48C84FD0B48AAAE33F328C02014052700A1@BBY1EXM11.pmc_nt.nt.pmc-sierra.bc.ca>

On Thu, Aug 05, 2010 at 06:43:50AM -0700, Anoop P.A. wrote:

> With a slightly modified patched (copied below) I have reached a point
> where I am no more seeing errors like segmentation fault, bus error
> (which was due to memory corruption I believe).
> How ever I am still seeing some kind of file corruption. 
> 
> I believe this file corruption happening because cache is not getting
> invalidated before a highmem dma. I am not sure which routine to call to
> invalidate cache for a highmem address. 

Since you're running on an RM9000 class CPU, why don't just use a 64-bit
kernel?  Highmem is just so f*cking insane that you want to avoid it like
French kisses from a zombie suffering ebola.  If you have DMA restrictions
then you may consider reusing ZONE_DMA.

That said, a word on the history of the MIPS highmem code.  It was written
for a company who in the early stages of the 64-bit kernel didn't want to
be the first through the minefield in 2001.  That CPU had full coherency
and no cache aliases so arch/mips/mm/dma-*.c did not need any code to
support it at all and for many years after that everybody either had a
small 32-bit system that didn't need highmem or went 64-bit right away so
the gaps in the code while well known were never fixed up ...

I'm a bit surprised that the patch posted actually made things work better
for you since it entirely avoids flushing of highmem pages.  The code as it
was originally written using page_address() will perform cacheflushes
for highmem pages as well - but only for highmem pages are actually are
mapped.  That is your code will flush less pages than the existing code.

  Ralf

  reply	other threads:[~2010-08-05 18:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 13:29 file corruption with highmem kernel Anoop P.A.
2010-08-05 13:43 ` Anoop P.A.
2010-08-05 18:25   ` Ralf Baechle [this message]
2010-08-06 10:12     ` Anoop P.A.

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=20100805182547.GB1382@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=Anoop_P.A@pmc-sierra.com \
    --cc=linux-mips@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