From: Tejun Heo <htejun@gmail.com>
To: James Steward <james.steward@dynamicratings.com>
Cc: "'linux-ide@vger.kernel.org'" <linux-ide@vger.kernel.org>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
rmk+lkml@arm.linux.org.uk
Subject: Re: Execute from CF causes segmentation faults
Date: Tue, 20 Dec 2005 21:52:25 +0900 [thread overview]
Message-ID: <43A7FE89.4040909@gmail.com> (raw)
In-Reply-To: <9DA102EC128AD511BED000306E0766C70180487A@WTCNT4GW>
James Steward wrote:
> G'day all,
>
> The message below is a response from Russell King on the arm
> linux mailing lists regarding a problem I encountered, and as
> it turns out has been encountered before. I'm not sure if anyone
> from the IDE development group is working on this but as it is
> more ide specific it may be best handled by some clever guru
> from this mail list.
>
> The symptom I see is that executing code from a CF disk causes
> SEGVs and other nasties. The workaround is to add a kernel
> command line arg "cachepolicy=writethrough". This is seen as a
> bit of a bandaid and not a "good" solution.
>
> Could someone please take a look?
>
> Regards,
> James.
>
>
> On Thu, Dec 01, 2005 at 01:44:59PM +1300, Charles Manning wrote:
>
>>Something that confuses me lightly is why this problem should exist at
>>all.
>>
>>It seems that the problem is caused by stale data in the cache.
>>Surely cache data should never be stale (ie. Anything in the cache
>>should be current).
>
>
> No. I think what is happening is:
> * the page we submit to the block layer has some cache lines already
> associated with the kernel mapping.
> * the IDE driver uses PIO to read from CF and hits these cache lines
> making them dirty.
> * the page is then mapped into userspace via a page fault.
> * userspace reads the page. Because some of the data is sitting in
> the cache corresponding with the kernel mapping of the page,
> userspace doesn't see the up to date data until later.
>
>
>>It also seems odd to me that this requires fixes at the block driver
>>level. I'd have thought this would get resolved at the page cache
>>level, or fs level at absolute lowest.
>
>
> If you do it there, you hurt DMA performance. The DMA model ensures
> cache coherency. The IDE PIO IO model does not.
>
> Basically, the problem stems from IDE PIO IO not providing the same
> cache guarantees as other block device drivers do.
[CC'ing Bartlomiej and Russell King]
Hello, all.
kmap/kunmap are to PIO what dma_map/unmap are to DMA. dma_map/unmap do
the following two things.
1. make the pages accessible to the DMA'ing device
2. take care of cache consistency
kmap/unmap currently performs the counterpart of #1.
1. make the pages accessible to the accessing device (CPU)
So, adding cache consistency handling to kmap/unmap seems more logical
solution than handling cache consistency in all places where PIO occurs
(there are quite a few and some are buried pretty deep).
Hmmm... I'm not really sure whether the places where cache consistency
handling is needed coincides with kmap/unmap. Would the said scheme
unnecessrily perform cache consistency operations in some places and
thus degrade performance?
Thanks.
--
tejun
next prev parent reply other threads:[~2005-12-20 12:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-19 0:47 Execute from CF causes segmentation faults James Steward
2005-12-20 12:52 ` Tejun Heo [this message]
2005-12-20 16:23 ` Bartlomiej Zolnierkiewicz
2005-12-21 9:48 ` Tejun Heo
2005-12-21 14:00 ` [PATCH] ide: add dcache flushing after PIO Tejun Heo
2005-12-21 14:03 ` Russell King
2005-12-21 14:43 ` Tejun Heo
2005-12-21 15:57 ` Bartlomiej Zolnierkiewicz
2005-12-21 16:00 ` Tejun Heo
2005-12-21 17:54 ` Russell King
2006-01-07 17:06 ` Russell King
2006-01-07 20:17 ` Bartlomiej Zolnierkiewicz
2006-01-07 21:22 ` Russell King
2006-01-07 22:41 ` Bartlomiej Zolnierkiewicz
2006-01-08 0:50 ` james
2006-01-09 9:08 ` Russell King
2006-01-09 9:16 ` Tejun Heo
2005-12-21 15:01 ` Execute from CF causes segmentation faults Russell King
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=43A7FE89.4040909@gmail.com \
--to=htejun@gmail.com \
--cc=bzolnier@gmail.com \
--cc=james.steward@dynamicratings.com \
--cc=linux-ide@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).