From: felipe.contreras@gmail.com (Felipe Contreras)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: allow, but warn, when issuing ioremap() on RAM
Date: Sat, 9 Oct 2010 13:28:19 +0300 [thread overview]
Message-ID: <AANLkTimtdV8THgnQL1RxaqLzCUwO27AZSMPi=UtgpML7@mail.gmail.com> (raw)
In-Reply-To: <20101009092127.GB20975@n2100.arm.linux.org.uk>
On Sat, Oct 9, 2010 at 12:21 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Sat, Oct 09, 2010 at 03:56:23AM +0300, Felipe Contreras wrote:
>> 2010/10/9 Russell King - ARM Linux <linux@arm.linux.org.uk>:
>> > On Fri, Oct 08, 2010 at 04:25:39PM -0700, Greg KH wrote:
>> >> Also, how can we fix this in a driver, what is the proper steps to do
>> >> so?
>> >
>> > On April 23rd:
>> > | I think a viable safe solution is to set aside some RAM at boot (which
>> > | the kernel doesn't manage at all) and then use ioremap on that; that
>> > | approach will still work with this patch in place.
>> >
>> > On April 30th when discussing the omapfb driver:
>> > | There's really one option for this - in the machine's fixup handler, you
>> > | can walk the meminfo array and kick out some memory from that. ?This will
>> > | prevent the kernel mapping that memory and make pfn_valid() fail for that
>> > | memory range. ?Another advantage of this is that it won't break when we
>> > | switch to LMB.
>>
>> These are not solutions, these are pointers to find the solutions.
>>
>> How do you set aside some RAM at boot for that? Is there anything like
>> memblock to do that? Or do you expect to set aside some memory with
>> mem=X, and manually specify the address in the .config?
>
> Which bit of "walk the meminfo array and kick out some memory from that"
> says "use memblock" or "use mem=X" ?
>
> static unsigned long reserve_mem(struct meminfo *mi, unsigned long size)
> {
> ? ? ? ?unsigned long addr = ~0;
> ? ? ? ?int i;
>
> ? ? ? ?for (i = mi->nr_banks - 1; i >= 0; i--)
> ? ? ? ? ? ? ? ?if (mi->bank[i].size >= size) {
> ? ? ? ? ? ? ? ? ? ? ? ?mi->bank[i].size -= size;
> ? ? ? ? ? ? ? ? ? ? ? ?addr = mi->bank[i].start + mi->bank[i].size;
> ? ? ? ? ? ? ? ? ? ? ? ?break;
> ? ? ? ? ? ? ? ?}
>
> ? ? ? ?return addr;
> }
>
> static void __init my_fixup(struct machine_desc *desc, struct tag *tags,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ?char **cmdline, struct meminfo *mi)
> {
> ? ? ? ?omapfb_buffer_phys = reserve_mem(mi, 32*1048576);
> ? ? ? ?if (omapfb_buffer_phys == ~0)
> ? ? ? ? ? ? ? ?pr_warn("Unable to allocate omapfb buffer\n");
> }
>
> Then later:
>
> ? ? ? ?omapfb_buffer = ioremap(omapfb_buffer_phys, 32*1048576);
>
> That's a damned simple and direct implementation of exactly what I
> described, and results in something which is much more architecturally
> correct than what's going on today.
This is only for omapfb, isn't it? Or is this a generic solution?
If it's a generic solution can we put this into arch/arm/mm? What is
simple and direct for you is something that would take a long long
time for other people to come with (if ever).
>> > Unfortunately, what I fear is that nothing will happen because people
>> > want the ioremap-on-system-RAM to just work, and then we'll hit this
>> > exact same issue again in three months time.
>>
>> Nobody has ever said, or suggested anything like that.
>>
>> What people want is:
>> 1) A solution in place
>> 2) Time to implement that solution in their drivers
>
> Six months, and by your own emails, everyone reverting the change rather
> than fixing producing their drivers. ?That says it all about what kind
> of attitude driver writers have towards architectural issues.
>
> If they've been reverting the change, then they _do_ know about the issue,
> so why have there been _zero_ patches from these people who are reverting
> the change? ?Maybe you should be asking these people why they haven't done
> any work to fix the drivers when one of the solutions starts off as about
> 15 lines of code.
No, I said people _will_ revert the patch. I'm pretty sure the vast
majority of people haven't even realized this change yet.
What you should have done IMO is only warn first. This would have had
no problem getting into 2.6.35, as it doesn't break anything, then
most people would have noticed this by now.
Also, what do you think is the right attitude? Do you think *all*
driver writers should follow each and every patch on the mailing list
or always try release candidates? Even if they all did (some do),
there's no generic solution, so they all are scratching their heads
about how to solve this. It might be crystal clear for you how such
generic solution could be implemented, or perhaps how some of these
drivers can be fixed individually, if so, why don't you come with a
proposal to mitigate the pain of fixing such drivers.
If you don't have time to write such a generic solution, that's fine,
that's why my proposal is to only warn for now.
I think saying "hey, it turns out you were using the API wrongly, I am
officially totally breaking you all, and I'm not bothering with
providing an example of what you should be doing instead, also, you
should follow all the patches in linux-arm-kernel, and try the release
candidates, because you should expect to get broken at any time" is
the wrong attitude.
>> And since you did, let me say what I fear: that many more people will
>> find drivers totally broken on 2.6.36.
>
> I've reverted the change, so now you can go back to violating the
> requirements of the architecture and have your data silently corrupted.
This is unreasonable, we need the warning at least on one release.
--
Felipe Contreras
next prev parent reply other threads:[~2010-10-09 10:28 UTC|newest]
Thread overview: 101+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 9:44 [PATCH] ARM: allow, but warn, when issuing ioremap() on RAM Felipe Contreras
2010-10-07 11:51 ` Baruch Siach
2010-10-07 12:29 ` [PATCH v2] " Felipe Contreras
2010-10-07 18:00 ` Uwe Kleine-König
2010-10-07 19:22 ` [PATCH] " Russell King - ARM Linux
2010-10-08 9:32 ` Felipe Contreras
2010-10-08 17:53 ` Russell King - ARM Linux
2010-10-08 19:37 ` Felipe Contreras
2010-10-08 23:04 ` Russell King - ARM Linux
2010-10-08 23:25 ` Greg KH
2010-10-08 23:44 ` Russell King - ARM Linux
2010-10-09 0:00 ` Greg KH
2010-10-09 0:25 ` Russell King - ARM Linux
2010-10-09 0:54 ` Greg KH
2010-10-09 2:41 ` Nicolas Pitre
2010-10-09 3:04 ` Greg KH
2010-10-09 9:32 ` Felipe Contreras
2010-10-11 10:05 ` Catalin Marinas
2010-10-11 10:39 ` Felipe Contreras
2010-10-11 10:52 ` Russell King - ARM Linux
2010-10-11 11:23 ` Catalin Marinas
2010-10-11 12:03 ` Felipe Contreras
2010-10-11 12:30 ` Catalin Marinas
2010-10-11 22:53 ` Nicolas Pitre
2010-10-14 15:02 ` Felipe Contreras
2010-10-14 17:18 ` Catalin Marinas
2010-10-14 17:44 ` Felipe Contreras
2010-10-11 11:01 ` Pawel Moll
2010-10-11 11:03 ` Catalin Marinas
2010-10-16 2:39 ` Benjamin Herrenschmidt
2010-10-16 9:43 ` Felipe Contreras
2010-10-09 0:10 ` Russell King - ARM Linux
2010-10-09 0:56 ` Felipe Contreras
2010-10-09 9:21 ` Russell King - ARM Linux
2010-10-09 10:28 ` Felipe Contreras [this message]
2010-10-09 11:11 ` Arnd Bergmann
2010-10-09 11:43 ` Dave Airlie
2010-10-09 11:55 ` Christoph Hellwig
2010-10-09 12:17 ` Felipe Contreras
2010-10-09 12:10 ` Felipe Contreras
2010-10-09 14:37 ` Russell King - ARM Linux
2010-10-09 16:18 ` Felipe Contreras
2010-10-09 11:44 ` Uwe Kleine-König
2010-10-09 12:05 ` Russell King - ARM Linux
2010-10-09 11:59 ` Felipe Contreras
2010-10-09 14:43 ` Arnd Bergmann
2010-10-09 18:59 ` Guennadi Liakhovetski
2010-10-10 1:52 ` Felipe Contreras
2010-10-11 8:35 ` Uwe Kleine-König
2010-10-11 9:02 ` Russell King - ARM Linux
2010-10-11 9:24 ` Uwe Kleine-König
2010-10-11 10:08 ` Felipe Contreras
2010-10-11 10:15 ` Russell King - ARM Linux
2010-10-11 15:25 ` Russell King - ARM Linux
2010-10-14 14:47 ` Felipe Contreras
2010-10-19 8:13 ` Colin Cross
2010-10-19 18:12 ` Russell King - ARM Linux
2010-10-19 19:21 ` Russell King - ARM Linux
2010-11-23 9:43 ` [PATCH] ARM: mx3/pcm037: properly allocate memory for mx3-camera Uwe Kleine-König
2010-11-23 10:12 ` Russell King - ARM Linux
2010-11-23 10:26 ` Uwe Kleine-König
2010-11-23 14:08 ` Alberto Panizzo
2010-11-23 14:17 ` Uwe Kleine-König
2010-11-24 8:02 ` Uwe Kleine-König
2010-12-06 8:33 ` Uwe Kleine-König
2010-12-06 10:14 ` Alberto Panizzo
2010-12-06 10:26 ` Russell King - ARM Linux
2010-12-06 11:37 ` Alberto Panizzo
2010-12-06 11:46 ` Russell King - ARM Linux
2010-12-06 14:09 ` Alberto Panizzo
2010-12-06 14:34 ` Russell King - ARM Linux
2010-12-06 14:54 ` Alberto Panizzo
2010-12-06 16:54 ` Alberto Panizzo
2010-11-23 10:39 ` About multi-line printk and the need (not) to repeat loglevel markers [Was: Re: [PATCH] ARM: mx3/pcm037: properly allocate memory for mx3-camera] Uwe Kleine-König
2010-11-23 10:58 ` Uwe Kleine-König
2010-11-23 22:16 ` Linus Torvalds
2010-11-23 22:33 ` Russell King - ARM Linux
2010-11-23 23:23 ` Joe Perches
2010-11-24 8:17 ` Uwe Kleine-König
2010-11-24 9:09 ` Michał Mirosław
2010-11-23 22:54 ` [PATCH] ARM: mx3/pcm037: properly allocate memory for mx3-camera Guennadi Liakhovetski
2010-10-09 0:45 ` [PATCH] ARM: allow, but warn, when issuing ioremap() on RAM Felipe Contreras
2010-10-09 8:56 ` Russell King - ARM Linux
2010-10-08 23:19 ` Greg KH
2010-10-09 3:36 ` Nicolas Pitre
2010-10-09 10:00 ` Felipe Contreras
2010-10-09 17:38 ` Nicolas Pitre
2010-10-09 20:16 ` Felipe Contreras
2010-10-13 16:17 ` Woodruff, Richard
2010-10-14 13:48 ` Felipe Contreras
2010-10-14 15:29 ` Woodruff, Richard
2010-10-16 2:36 ` Benjamin Herrenschmidt
2010-10-17 13:05 ` Woodruff, Richard
2010-10-17 23:17 ` Benjamin Herrenschmidt
2010-10-08 19:58 ` Andrew Morton
2010-10-09 13:52 ` Russell King - ARM Linux
2010-10-09 16:07 ` Felipe Contreras
2010-10-09 16:45 ` Russell King - ARM Linux
2010-10-09 19:25 ` Felipe Contreras
2010-10-10 14:23 ` Pedanekar, Hemant
2010-10-11 9:26 ` Catalin Marinas
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='AANLkTimtdV8THgnQL1RxaqLzCUwO27AZSMPi=UtgpML7@mail.gmail.com' \
--to=felipe.contreras@gmail.com \
--cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).