From: Dave Young <dyoung@redhat.com>
To: Matt Fleming <matt@console-pimps.org>
Cc: matt.fleming@intel.com, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com, akpm@linux-foundation.org,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] earlyprintk=efi,keep fix
Date: Thu, 1 May 2014 21:17:55 +0800 [thread overview]
Message-ID: <20140501131755.GC2677@darkstar.redhat.com> (raw)
In-Reply-To: <20140501101220.GP26088@console-pimps.org>
On 05/01/14 at 11:12am, Matt Fleming wrote:
> On Wed, 30 Apr, at 10:13:03AM, Dave Young wrote:
> >
> > earlyprintk=efi,keep will cause kernel hangs while freeing initmem like below:
> > [ 2.826089] VFS: Mounted root (ext4 filesystem) readonly on device 254:2.
> > [ 2.846592] devtmpfs: mounted
> > [ 2.856974] Freeing unused kernel memory: 880K (ffffffff817d4000 - ffffffff818b0000)
> >
> > It is caused by efi earlyprintk use __init function which will be freed later.
> > Such as early_efi_write is marked as __init, also it will use early_ioremap
> > which is init function as well.
> >
> > To fix this issue, I added one early initcall efi_ioremap_fb which will map the whole
> > efi fb for later use. OTOH, adding a wrapper function efi_ioremap which will call
> > early_ioremap before ioremap is available.
> >
> > With this patch applied efi boot ok with earlyprintk=efi,keep console=efi
> >
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > ---
> > arch/x86/platform/efi/early_printk.c | 54 +++++++++++++++++++++++++++--------
> > 1 file changed, 42 insertions(+), 12 deletions(-)
>
> Thanks Dave, good catch. I've got a few comments below.
>
> > +static __init int efi_ioremap_fb(void)
> > +{
> > + unsigned long base, size;
> > +
> > + base = boot_params.screen_info.lfb_base;
> > + size = boot_params.screen_info.lfb_size;
> > + efi_fb = ioremap(base, size);
> > +
> > + return efi_fb ? 0 : -ENOMEM;
> > +}
> > +early_initcall(efi_ioremap_fb);
>
> So, here you're actually ioremap'ing the framebuffer irrespective of
> whether anyone passed earlyprintk=efi,keep on the command line.
> Furthermore, you'll perform the ioremap() even if some error was
> encountered in early_efi_setup().
>
> You need a way to figure out whether the ioremap() is actually needed.
>
> Please document this function to explain why we need to ioremap() the
> framebuffer from an early_initcall().
>
> Oh and as a side note, please prefix functions in this file with
> early_efi_*. Yeah, I realise that I suggested efi_ioremap() as a name -
> my bad.
>
> > +static __init_refok void *efi_ioremap(unsigned long start, unsigned long len)
> > +{
> > + unsigned long base;
> > +
> > + base = boot_params.screen_info.lfb_base;
> > + if (efi_fb)
> > + return (efi_fb + start - base);
> > + else
> > + return early_ioremap(start, len);
> > +}
>
> Adding .lfb_base in the caller and then subtracting here seems
> needlessly complicated. Instead I'd suggest making early_efi_map() take
> an offset and a length, and document when each framebuffer is used.
Matt, thanks for the comments. I have sent out an update patch which addressed
the comments except the last one "and document when each framebuffer is used"
I added comment before function early_efi_map, not sure if it's what you want.
Thanks
Dave
prev parent reply other threads:[~2014-05-01 13:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 2:13 [PATCH] earlyprintk=efi,keep fix Dave Young
2014-04-30 19:52 ` Andrew Morton
2014-04-30 19:57 ` Matt Fleming
2014-05-01 10:12 ` Matt Fleming
2014-05-01 13:17 ` Dave Young [this message]
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=20140501131755.GC2677@darkstar.redhat.com \
--to=dyoung@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@intel.com \
--cc=matt@console-pimps.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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