linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier.adi@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: David Howells <dhowells@redhat.com>,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>,
	uclinux-dist-devel <uclinux-dist-devel@blackfin.uclinux.org>
Subject: Re: userspace firmware loader, vmap, and nommu
Date: Tue, 6 Oct 2009 00:56:19 -0400	[thread overview]
Message-ID: <8bd0f97a0910052156o7aeb704cpf72586ca2e196277@mail.gmail.com> (raw)
In-Reply-To: <1254803939.14541.49.camel@macbook.infradead.org>

On Tue, Oct 6, 2009 at 00:38, David Woodhouse wrote:
> On Tue, 2009-10-06 at 00:25 -0400, Mike Frysinger wrote:
>>  the firmware loader used to work before this
>> change because it would handle the realloc steps itself (allocate
>> larger contiguous memory, copy over older data, release older memory)
>> and vmalloc() on nommu is simply kmalloc().
>>
>> this could be handled transparently on nommu systems by moving this
>> scatter gathering of pages into vmap:
>> void *vmap(struct page **pages, unsigned int count, unsigned long
>> flags, pgprot_t prot)
>> {
>>     unsigned int i;
>>     void *new_map, *page_data;
>>
>>     new_map = kmalloc(count << PAGE_SHIFT, GFP_KERNEL);
>>     if (!new_map)
>>         return NULL;
>>
>>     for (i = 0; i < count; ++i) {
>>         page_data = kmap(pages[i]);
>>         memcpy(new_map + (i << PAGE_SHIFT), page_data, PAGE_SIZE);
>>         kunmap(page_data);
>>     }
>>
>>     return new_map;
>
> I wouldn't necessarily want to do that for _all_ vmap() calls,

there arent any vmap() callers currently on nommu systems since the
functions currently BUG().  looking at lxr for 2.6.31 indicates that
there are very few relevant vmap() callers in general.

> but doing
> it just for the firmware loader might make some sense. It does mean you
> have to have _twice_ as much memory available as the size of the
> firmware in question. And you have to have a contiguous chunk even
> _after_ allocating it once piecemeal.

yes, but this is how it worked before and no one complained ;).
firmware files after all tend to be on the "small" side, so getting a
small physically contiguous mapping isnt that hard.

>> void vunmap(const void *addr)
>> {
>>     kfree(addr);
>> }
>>
>> or we could add nommu-specific code to the firmware loader to not use
>> vmap().  how would you like to go David (Howells) ?
>
> Or we could add _generic_ code not to use vmap(). Just teach the users
> that you don't get a virtually contiguous blob back from
> request_firmware(); you get an array of pages instead.

wouldnt that non-trivially increase the code work for callers of the
firmware functions ?  seems like a hefty penalty for a minority
(nommu) to impose on the majority (mmu).
-mike

  reply	other threads:[~2009-10-06  5:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06  4:25 userspace firmware loader, vmap, and nommu Mike Frysinger
2009-10-06  4:38 ` David Woodhouse
2009-10-06  4:56   ` Mike Frysinger [this message]
2009-12-21 16:44 ` [PATCH] nommu: implement vmap/vunmap with kmalloc Mike Frysinger
2010-01-07  6:49   ` [uClinux-dev] " Mike Frysinger
2010-03-09 16:11   ` [PATCH v2] NOMMU: " Mike Frysinger
2010-03-31 17:11   ` David Howells
2010-03-31 19:54     ` Mike Frysinger
2010-03-31 23:06     ` David Howells
2010-03-31 23:07     ` David Howells
2010-03-31 23:10       ` Mike Frysinger
2010-01-16 15:57 ` [PATCH] nommu: " David Howells

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=8bd0f97a0910052156o7aeb704cpf72586ca2e196277@mail.gmail.com \
    --to=vapier.adi@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.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).