public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] ignore ,keep for efi earlyprintk
       [not found] ` <20140424093658.GA7158-je1gSBvt1Tc/CGXRbJeUwh/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
@ 2014-04-25 11:53   ` Matt Fleming
       [not found]     ` <20140425115345.GC26088-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Fleming @ 2014-04-25 11:53 UTC (permalink / raw)
  To: Dave Young
  Cc: matt.fleming-ral2JQCrhuEAvxtiuMwx3w, hpa-YMNOUZJC4hwAvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, x86-DgEjT+Ai2ygdnm+yROfE0A,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-efi-u79uwXL29TY76Z2rM5mHXA

On Thu, 24 Apr, at 05:36:58PM, Dave Young wrote:
> earlyprint=efi,keep results a kernel hang after "Freeing unused kernel memory"
 
Are you sure it hangs and it's not just that nothing is output to the
console after that point?

> Actually efi earlyprintk is using __init functions such as early_ioremap etc.
> Thus efi earlyconsole can not be kept.
 
Urgh, good point, that's a bug. However I'm sure I've had this working
in the past and have in fact used it to debug stuff.

Could you try and fix this up so it works with 'keep'?

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ignore ,keep for efi earlyprintk
       [not found]     ` <20140425115345.GC26088-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
@ 2014-04-26  7:28       ` Dave Young
       [not found]         ` <20140426072821.GA2286-4/PLUo9XfK/1wF9wiOj0lkEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Young @ 2014-04-26  7:28 UTC (permalink / raw)
  To: Matt Fleming
  Cc: matt.fleming-ral2JQCrhuEAvxtiuMwx3w, hpa-YMNOUZJC4hwAvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, x86-DgEjT+Ai2ygdnm+yROfE0A,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-efi-u79uwXL29TY76Z2rM5mHXA

On 04/25/14 at 12:53pm, Matt Fleming wrote:
> On Thu, 24 Apr, at 05:36:58PM, Dave Young wrote:
> > earlyprint=efi,keep results a kernel hang after "Freeing unused kernel memory"
>  
> Are you sure it hangs and it's not just that nothing is output to the
> console after that point?

There's other kernel messages without appending ,keep.

Also console=ttyS0 does not work with earlyprintk=efi,keep, removing ,keep it works well.

> 
> > Actually efi earlyprintk is using __init functions such as early_ioremap etc.
> > Thus efi earlyconsole can not be kept.
>  
> Urgh, good point, that's a bug. However I'm sure I've had this working
> in the past and have in fact used it to debug stuff.
> 
> Could you try and fix this up so it works with 'keep'?

Will do. I want use ioremap when it is available but it's hard to decide
where to add the code.

I'm thinking to do below:
1. ioremap the whole framebuffer like: efi_fb = ioremap(lfb_base, lfb_size) in the
   function efi_enter_virtual_mode because ioremap should be usable then.

2. add two functions for earlyprintk use (scrollup, write, etc.) 
__init_refok void * get_vaddr(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);
}

__init_refok void put_vaddr(void *addr, unsigned long len)
{
	if (!efi_fb)
		early_iounmap(addr, len);
}

But it does not sound good to add the ioremap in enter virtual mode funtion.   

Please help if you have any other better idea.

Thanks
Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ignore ,keep for efi earlyprintk
       [not found]         ` <20140426072821.GA2286-4/PLUo9XfK/1wF9wiOj0lkEOCMrvLtNR@public.gmane.org>
@ 2014-04-29  9:45           ` Matt Fleming
       [not found]             ` <20140429094539.GD26088-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Fleming @ 2014-04-29  9:45 UTC (permalink / raw)
  To: Dave Young
  Cc: matt.fleming-ral2JQCrhuEAvxtiuMwx3w, hpa-YMNOUZJC4hwAvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, x86-DgEjT+Ai2ygdnm+yROfE0A,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-efi-u79uwXL29TY76Z2rM5mHXA

On Sat, 26 Apr, at 03:28:21PM, Dave Young wrote:
> 
> There's other kernel messages without appending ,keep.
> 
> Also console=ttyS0 does not work with earlyprintk=efi,keep, removing
> ,keep it works well.

Try console=efi

> > > Actually efi earlyprintk is using __init functions such as early_ioremap etc.
> > > Thus efi earlyconsole can not be kept.
> >  
> > Urgh, good point, that's a bug. However I'm sure I've had this working
> > in the past and have in fact used it to debug stuff.
> > 
> > Could you try and fix this up so it works with 'keep'?
> 
> Will do. I want use ioremap when it is available but it's hard to decide
> where to add the code.
> 
> I'm thinking to do below:
> 1. ioremap the whole framebuffer like: efi_fb = ioremap(lfb_base, lfb_size) in the
>    function efi_enter_virtual_mode because ioremap should be usable then.
> 
> 2. add two functions for earlyprintk use (scrollup, write, etc.) 
> __init_refok void * get_vaddr(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);
> }
> 
> __init_refok void put_vaddr(void *addr, unsigned long len)
> {
> 	if (!efi_fb)
> 		early_iounmap(addr, len);
> }
> 
> But it does not sound good to add the ioremap in enter virtual mode funtion.   
> 
> Please help if you have any other better idea.

I would just replace the existing calls to early_ioremap() with
efi_ioremap() and implement it like so (all in
arch/x86/platform/efi/early_printk.c),

static void *efi_ioremap(resource_size_t phys_addr, unsigned long size)
{
	if (system_state == SYSTEM_BOOTING)
		return early_ioremap(phys_addr, size);

	return ioremap(phys_addr, size);
}

At least I think SYSTEM_BOOTING is the correct way to figure out when to
use early_ioremap(), I'm open to other suggestions though.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ignore ,keep for efi earlyprintk
       [not found]             ` <20140429094539.GD26088-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
@ 2014-04-29 10:03               ` Dave Young
  2014-04-29 10:21               ` Thomas Gleixner
  1 sibling, 0 replies; 6+ messages in thread
From: Dave Young @ 2014-04-29 10:03 UTC (permalink / raw)
  To: Matt Fleming
  Cc: matt.fleming-ral2JQCrhuEAvxtiuMwx3w, hpa-YMNOUZJC4hwAvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, x86-DgEjT+Ai2ygdnm+yROfE0A,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-efi-u79uwXL29TY76Z2rM5mHXA

On 04/29/14 at 10:45am, Matt Fleming wrote:
> On Sat, 26 Apr, at 03:28:21PM, Dave Young wrote:
> > 
> > There's other kernel messages without appending ,keep.
> > 
> > Also console=ttyS0 does not work with earlyprintk=efi,keep, removing
> > ,keep it works well.
> 
> Try console=efi

With console=efi, it also hangs the screen is not readable. When I add both console=efi
and console=ttyS0, in serial console output looks like it hangs while mounting rootfs. 
On screen it's same as console=efi only case.

I justed tested on qemu.

> 
> > > > Actually efi earlyprintk is using __init functions such as early_ioremap etc.
> > > > Thus efi earlyconsole can not be kept.
> > >  
> > > Urgh, good point, that's a bug. However I'm sure I've had this working
> > > in the past and have in fact used it to debug stuff.
> > > 
> > > Could you try and fix this up so it works with 'keep'?
> > 
> > Will do. I want use ioremap when it is available but it's hard to decide
> > where to add the code.
> > 
> > I'm thinking to do below:
> > 1. ioremap the whole framebuffer like: efi_fb = ioremap(lfb_base, lfb_size) in the
> >    function efi_enter_virtual_mode because ioremap should be usable then.
> > 
> > 2. add two functions for earlyprintk use (scrollup, write, etc.) 
> > __init_refok void * get_vaddr(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);
> > }
> > 
> > __init_refok void put_vaddr(void *addr, unsigned long len)
> > {
> > 	if (!efi_fb)
> > 		early_iounmap(addr, len);
> > }
> > 
> > But it does not sound good to add the ioremap in enter virtual mode funtion.   
> > 
> > Please help if you have any other better idea.
> 
> I would just replace the existing calls to early_ioremap() with
> efi_ioremap() and implement it like so (all in
> arch/x86/platform/efi/early_printk.c),
> 
> static void *efi_ioremap(resource_size_t phys_addr, unsigned long size)
> {
> 	if (system_state == SYSTEM_BOOTING)
> 		return early_ioremap(phys_addr, size);
> 
> 	return ioremap(phys_addr, size);
> }
> 
> At least I think SYSTEM_BOOTING is the correct way to figure out when to
> use early_ioremap(), I'm open to other suggestions though.

I also thought about this before, but I remember it hangs before system state
changing.

The flow is like below, I added some debug printk, only the ones before free_initmem()
shows in log. Thus I guess this will not work. But I can have a try. 
        kernel_init_freeable();
        /* need to finish all async __init code before freeing the memory */
        async_synchronize_full();
        free_initmem();
        mark_rodata_ro();
        system_state = SYSTEM_RUNNING; 

Thanks
Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ignore ,keep for efi earlyprintk
       [not found]             ` <20140429094539.GD26088-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
  2014-04-29 10:03               ` Dave Young
@ 2014-04-29 10:21               ` Thomas Gleixner
       [not found]                 ` <alpine.DEB.2.02.1404291217380.6261-3cz04HxQygjZikZi3RtOZ1XZhhPuCNm+@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2014-04-29 10:21 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Dave Young, matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
	hpa-YMNOUZJC4hwAvxtiuMwx3w, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	x86-DgEjT+Ai2ygdnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-efi-u79uwXL29TY76Z2rM5mHXA

On Tue, 29 Apr 2014, Matt Fleming wrote:
> I would just replace the existing calls to early_ioremap() with
> efi_ioremap() and implement it like so (all in
> arch/x86/platform/efi/early_printk.c),
> 
> static void *efi_ioremap(resource_size_t phys_addr, unsigned long size)
> {
> 	if (system_state == SYSTEM_BOOTING)
> 		return early_ioremap(phys_addr, size);
> 
> 	return ioremap(phys_addr, size);
> }
> 
> At least I think SYSTEM_BOOTING is the correct way to figure out when to
> use early_ioremap(), I'm open to other suggestions though.

ioremap() is available after paging_init() has been called.

Just x86 has this extra bits so you can use early_ioremap/unmap
_AFTER_ paging_init(). No idea why, but probably to cope with some
brilliant init calls which run pre and post paging_init().

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ignore ,keep for efi earlyprintk
       [not found]                 ` <alpine.DEB.2.02.1404291217380.6261-3cz04HxQygjZikZi3RtOZ1XZhhPuCNm+@public.gmane.org>
@ 2014-04-30  1:12                   ` Dave Young
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Young @ 2014-04-30  1:12 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Matt Fleming, matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
	hpa-YMNOUZJC4hwAvxtiuMwx3w, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	x86-DgEjT+Ai2ygdnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-efi-u79uwXL29TY76Z2rM5mHXA

On 04/29/14 at 12:21pm, Thomas Gleixner wrote:
> On Tue, 29 Apr 2014, Matt Fleming wrote:
> > I would just replace the existing calls to early_ioremap() with
> > efi_ioremap() and implement it like so (all in
> > arch/x86/platform/efi/early_printk.c),
> > 
> > static void *efi_ioremap(resource_size_t phys_addr, unsigned long size)
> > {
> > 	if (system_state == SYSTEM_BOOTING)
> > 		return early_ioremap(phys_addr, size);
> > 
> > 	return ioremap(phys_addr, size);
> > }
> > 
> > At least I think SYSTEM_BOOTING is the correct way to figure out when to
> > use early_ioremap(), I'm open to other suggestions though.
> 
> ioremap() is available after paging_init() has been called.
> 
> Just x86 has this extra bits so you can use early_ioremap/unmap
> _AFTER_ paging_init(). No idea why, but probably to cope with some
> brilliant init calls which run pre and post paging_init().

Good idea, will use an initcall function for this purpose.
Thanks a lot.
Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-30  1:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20140424093658.GA7158@dhcp-16-198.nay.redhat.com>
     [not found] ` <20140424093658.GA7158-je1gSBvt1Tc/CGXRbJeUwh/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2014-04-25 11:53   ` [PATCH] ignore ,keep for efi earlyprintk Matt Fleming
     [not found]     ` <20140425115345.GC26088-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-04-26  7:28       ` Dave Young
     [not found]         ` <20140426072821.GA2286-4/PLUo9XfK/1wF9wiOj0lkEOCMrvLtNR@public.gmane.org>
2014-04-29  9:45           ` Matt Fleming
     [not found]             ` <20140429094539.GD26088-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-04-29 10:03               ` Dave Young
2014-04-29 10:21               ` Thomas Gleixner
     [not found]                 ` <alpine.DEB.2.02.1404291217380.6261-3cz04HxQygjZikZi3RtOZ1XZhhPuCNm+@public.gmane.org>
2014-04-30  1:12                   ` Dave Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox