From: Andrew Morton <akpm@linux-foundation.org>
To: Ilya Loginov <isloginov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
linux-kernel@vger.kernel.org, Peter Horton <phorton@bitbox.co.uk>,
"Ed L. Cashin" <ecashin@coraid.com>,
Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH] mtd: fix mtd_blkdevs problem with caches on some architectures (2.6.31)
Date: Sat, 21 Nov 2009 09:54:29 -0800 [thread overview]
Message-ID: <20091121095429.1378828c.akpm@linux-foundation.org> (raw)
In-Reply-To: <20091121170437.0839daef.isloginov@gmail.com>
On Sat, 21 Nov 2009 17:04:37 +0300 Ilya Loginov <isloginov@gmail.com> wrote:
> On Fri, 20 Nov 2009 16:37:51 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > Your patch fixes bascially the same problem in MTD as we have in AOE.
> > And it introduces the same problem as well - pointless empty
> > cache-thrashing loops on architectures for which flush_dcache_page() is
> > a no-op.
> >
> > What would be better here would be for block core to add a new
> > rq_flush_dcache_pages() and bio_flush_dcache_pages() which the drivers
> > can call. Those functions would be a no-op on architectures which
> > don't need them.
>
> Do you mean something like this?
>
> in include/linux/bio.h
>
> #ifdef SOMETHING_LIKE_CONFIG_CPU_HAS_DCACHE_ALIAS
> extern void bio_flush_dcache_pages(struct bio *bi);
> #else
> static inline void bio_flush_dcache_pages(struct bio *bi)
> {
> }
> #endif /* SOMETHING_LIKE_CONFIG_CPU_HAS_DCACHE_ALIAS */
>
> in fs/bio.c
>
> void bio_flush_dcache_pages(struct bio *bi)
> {
> int i;
> struct bio_vec* bvec;
>
> rq_for_each_segment(bvec, bio, i)
> flush_dcache_page(bvec->bv_page);
> }
>
> in include/linux/blkdev.h
>
> #ifdef SOMETHING_LIKE_CONFIG_CPU_HAS_DCACHE_ALIAS
> extern void rq_flush_dcache_pages(struct request *rq);
> #else
> static inline void rq_flush_dcache_pages(struct request *rq)
> {
> }
> #endif
>
> in block/blk-core.c
>
> void rq_flush_dcache_pages(struct request *rq)
> {
> struct req_iterator iter;
> struct bio_vec* bvec;
>
> rq_for_each_segment(bvec, bio, iter)
> flush_dcache_page(bvec->bv_page);
> }
>
> And SOMETHING_LIKE_CONFIG_CPU_HAS_DCACHE_ALIAS should be defined
> in Kconfigs for each architecture that requires this fix.
yep, that would work.
The one somewhat fragile thing is that we'll end up in a situation
where an architecture could implement a real flush_dcache_page(), but
would forget to set SOMETHING_LIKE_CONFIG_CPU_HAS_DCACHE_ALIAS. Or
vice versa. To make things reliable it would be good to cause a
compilation failure in that case.
One way of addressing this is to
- change every arch/*/include/asm/cacheflush.h to include asm-generic/cacheflush.h
- put #ifndef SOMETHING_LIKE_CONFIG_CPU_HAS_DCACHE_ALIAS wrappers around all content
in asm-generic/cacheflush
So it the above mistake happens, we'll get lots of duplicated
definitions, or no definitions at all (I think).
> I think
> this is good solution and if you think the same I can create the
> patch.
Thanks.
next prev parent reply other threads:[~2009-11-21 17:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 14:08 [PATCH] mtd: fix mtd_blkdevs problem with caches on some architectures (2.6.31) Ilya Loginov
2009-11-21 0:37 ` Andrew Morton
2009-11-21 14:04 ` Ilya Loginov
2009-11-21 17:54 ` Andrew Morton [this message]
2009-11-21 23:11 ` Ilya Loginov
2009-11-21 23:26 ` Andrew Morton
2009-11-21 23:36 ` Ilya Loginov
2009-11-22 9:46 ` Ilya Loginov
2009-11-22 9:53 ` David Woodhouse
2009-11-22 18:49 ` Ilya Loginov
2009-11-22 13:29 ` Ingo Molnar
2009-11-22 13:55 ` Ilya Loginov
2009-11-22 18:48 ` Andrew Morton
2009-11-22 19:18 ` Ilya Loginov
2009-11-22 19:51 ` Andrew Morton
2009-11-22 20:55 ` Ilya Loginov
2009-11-24 20:48 ` Andrew Morton
2009-11-25 1:01 ` Ilya Loginov
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=20091121095429.1378828c.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=ecashin@coraid.com \
--cc=isloginov@gmail.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=phorton@bitbox.co.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