From: Heiko Schocher <hs@denx.de>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linux Fbdev development list <linux-fbdev@vger.kernel.org>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Subject: Re: [RFC PATCH] video/logo: introduce new system state for checking if logos are freed
Date: Tue, 26 May 2015 07:29:54 +0000 [thread overview]
Message-ID: <556420F2.7020909@denx.de> (raw)
In-Reply-To: <55641D89.5020103@ti.com>
Hello Tomi, Geert,
Am 26.05.2015 09:15, schrieb Tomi Valkeinen:
>
>
> On 26/05/15 10:08, Geert Uytterhoeven wrote:
>> On Tue, May 26, 2015 at 8:54 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
>>> On 26/05/15 06:56, Heiko Schocher wrote:
>>>>> Without locking, the initmem may be freed while fb_find_logo() is
>>>>> running.
>>
>> Or afterwards. Drivers may keep the pointer around indefinitely.
>>
>>>> Yes, you are right, that must be added ... but has such a change a
>>>> chance to go in mainline?
>>>
>>> I don't know. To be honest, this whole thing feels a bit like hackery. I
>>> think initdata should only be accessed from initcalls, never asynchronously.
>>>
>>>> BTW: Could this not be currently a problem on multicore systems?
>>>> If lets say core 2 just draws the logo, another core 1 calls
>>>> fb_logo_late_init() and later core 1 free_initmem(), while the core 2
>>>> still draws it?
>>>
>>> Yes, I think so...
>>
>> I don't think that can happen. All initcalls should complete before initmem
>> is freed.
>
> Ah, true, the question was only about the initcalls. I was answering to
> what actually can happen with the logo code as a whole.
>
> The whole problem started when I fixed an issue where the logos were
> accessed from a workqueue. I don't remember the details, but I think drm
> always (?) sets up some console stuff via workthread. In that case we
> could have the workthread accessing the logos, while initmem is being freed.
>
>>> So, maybe it would be better to not even try to go forward with the
>>> current approach. Two approaches come to my mind:
>>>
>>> 1) Keep the logos in the memory, and don't even try to free them. I
>>> don't know many bytes they are in total, though.
>>
>> m68k/allmodconfig:
>>
>> $ size drivers/video/logo/logo*o
>> text data bss dec hex filename
>> 24 6961 0 6985 1b49 drivers/video/logo/logo_linux_clut224.o
>> 24 800 0 824 338 drivers/video/logo/logo_linux_mono.o
>> 24 3200 0 3224 c98 drivers/video/logo/logo_linux_vga16.o
>> 24 6955 0 6979 1b43 drivers/video/logo/logo_mac_clut224.o
>> 161 4 2 167 a7 drivers/video/logo/logo.o
>>
>> Not that bad... Custom logos may be larger, though.
>
> I wonder how much a simple RLE would cut down the sizes...
>
>>> 2) Make a copy of the logos to a kmalloced area at some early boot
>>> stage. Then manually free the logos at some point (after the first
>>> access to the logos? after a certain time (urgh...)?).
>>
>> 3) Draw the logos from an initcall on all frame buffers that exist at that
>> point in time. Yes, this will destroy (part of) the content that's
>> currently shown.
>
> Isn't that almost the same as now? The problem is that the fb probes are
> deferred to a very late stage, so we would not have the fbs when the
> suggested initcall would be called.
Yes, exactly, this is my problem. DRM gets probed early and returns with
EPROBE_DEFER, as the display needs a spi init sequence, but spi is not
running yet ... later, when spi is up, DRM probes again, and all is
fine, but the logo is not drawn, as fb_logo_late_init() is called before,
which prevents drawing the logo.
We maybe could call fb_logo_late_init() directly from init/main.c
before calling free_initmem() ? But here again the question, could
it be possible that another core just draws the logo?
Or does async_synchronize_full() helps us here?
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
WARNING: multiple messages have this Message-ID (diff)
From: Heiko Schocher <hs@denx.de>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linux Fbdev development list <linux-fbdev@vger.kernel.org>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Subject: Re: [RFC PATCH] video/logo: introduce new system state for checking if logos are freed
Date: Tue, 26 May 2015 09:29:54 +0200 [thread overview]
Message-ID: <556420F2.7020909@denx.de> (raw)
In-Reply-To: <55641D89.5020103@ti.com>
Hello Tomi, Geert,
Am 26.05.2015 09:15, schrieb Tomi Valkeinen:
>
>
> On 26/05/15 10:08, Geert Uytterhoeven wrote:
>> On Tue, May 26, 2015 at 8:54 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
>>> On 26/05/15 06:56, Heiko Schocher wrote:
>>>>> Without locking, the initmem may be freed while fb_find_logo() is
>>>>> running.
>>
>> Or afterwards. Drivers may keep the pointer around indefinitely.
>>
>>>> Yes, you are right, that must be added ... but has such a change a
>>>> chance to go in mainline?
>>>
>>> I don't know. To be honest, this whole thing feels a bit like hackery. I
>>> think initdata should only be accessed from initcalls, never asynchronously.
>>>
>>>> BTW: Could this not be currently a problem on multicore systems?
>>>> If lets say core 2 just draws the logo, another core 1 calls
>>>> fb_logo_late_init() and later core 1 free_initmem(), while the core 2
>>>> still draws it?
>>>
>>> Yes, I think so...
>>
>> I don't think that can happen. All initcalls should complete before initmem
>> is freed.
>
> Ah, true, the question was only about the initcalls. I was answering to
> what actually can happen with the logo code as a whole.
>
> The whole problem started when I fixed an issue where the logos were
> accessed from a workqueue. I don't remember the details, but I think drm
> always (?) sets up some console stuff via workthread. In that case we
> could have the workthread accessing the logos, while initmem is being freed.
>
>>> So, maybe it would be better to not even try to go forward with the
>>> current approach. Two approaches come to my mind:
>>>
>>> 1) Keep the logos in the memory, and don't even try to free them. I
>>> don't know many bytes they are in total, though.
>>
>> m68k/allmodconfig:
>>
>> $ size drivers/video/logo/logo*o
>> text data bss dec hex filename
>> 24 6961 0 6985 1b49 drivers/video/logo/logo_linux_clut224.o
>> 24 800 0 824 338 drivers/video/logo/logo_linux_mono.o
>> 24 3200 0 3224 c98 drivers/video/logo/logo_linux_vga16.o
>> 24 6955 0 6979 1b43 drivers/video/logo/logo_mac_clut224.o
>> 161 4 2 167 a7 drivers/video/logo/logo.o
>>
>> Not that bad... Custom logos may be larger, though.
>
> I wonder how much a simple RLE would cut down the sizes...
>
>>> 2) Make a copy of the logos to a kmalloced area at some early boot
>>> stage. Then manually free the logos at some point (after the first
>>> access to the logos? after a certain time (urgh...)?).
>>
>> 3) Draw the logos from an initcall on all frame buffers that exist at that
>> point in time. Yes, this will destroy (part of) the content that's
>> currently shown.
>
> Isn't that almost the same as now? The problem is that the fb probes are
> deferred to a very late stage, so we would not have the fbs when the
> suggested initcall would be called.
Yes, exactly, this is my problem. DRM gets probed early and returns with
EPROBE_DEFER, as the display needs a spi init sequence, but spi is not
running yet ... later, when spi is up, DRM probes again, and all is
fine, but the logo is not drawn, as fb_logo_late_init() is called before,
which prevents drawing the logo.
We maybe could call fb_logo_late_init() directly from init/main.c
before calling free_initmem() ? But here again the question, could
it be possible that another core just draws the logo?
Or does async_synchronize_full() helps us here?
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
next prev parent reply other threads:[~2015-05-26 7:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-06 7:09 [RFC PATCH] video/logo: introduce new system state for checking if logos are freed Heiko Schocher
2015-05-06 7:09 ` Heiko Schocher
2015-05-25 5:57 ` Tomi Valkeinen
2015-05-25 5:57 ` Tomi Valkeinen
2015-05-26 3:56 ` Heiko Schocher
2015-05-26 3:56 ` Heiko Schocher
2015-05-26 6:54 ` Tomi Valkeinen
2015-05-26 6:54 ` Tomi Valkeinen
2015-05-26 7:08 ` Geert Uytterhoeven
2015-05-26 7:08 ` Geert Uytterhoeven
2015-05-26 7:15 ` Tomi Valkeinen
2015-05-26 7:15 ` Tomi Valkeinen
2015-05-26 7:23 ` Geert Uytterhoeven
2015-05-26 7:23 ` Geert Uytterhoeven
2015-05-26 7:29 ` Heiko Schocher [this message]
2015-05-26 7:29 ` Heiko Schocher
2015-05-26 7:17 ` Heiko Schocher
2015-05-26 7:17 ` Heiko Schocher
2015-05-26 7:25 ` Geert Uytterhoeven
2015-05-26 7:25 ` Geert Uytterhoeven
2015-05-26 7:35 ` Heiko Schocher
2015-05-26 7:35 ` Heiko Schocher
2015-05-26 7:41 ` Geert Uytterhoeven
2015-05-26 7:41 ` Geert Uytterhoeven
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=556420F2.7020909@denx.de \
--to=hs@denx.de \
--cc=geert@linux-m68k.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
--cc=tomi.valkeinen@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.