Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1211015 > unrolled thread

Re: omapdss: Division by zero in kernel

Started byPali Rohár <pali.rohar@gmail.com>
First post2015-08-21 10:50 +0200
Last post2015-08-26 12:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: omapdss: Division by zero in kernel Pali Rohár <pali.rohar@gmail.com> - 2015-08-21 10:50 +0200
    Re: omapdss: Division by zero in kernel Tomi Valkeinen <tomi.valkeinen@ti.com> - 2015-08-21 11:20 +0200
      Re: omapdss: Division by zero in kernel Pali Rohár <pali.rohar@gmail.com> - 2015-08-26 12:20 +0200

#1211015 — Re: omapdss: Division by zero in kernel

FromPali Rohár <pali.rohar@gmail.com>
Date2015-08-21 10:50 +0200
SubjectRe: omapdss: Division by zero in kernel
Message-ID<pZQbn-6VO-3@gated-at.bofh.it>
On Friday 21 August 2015 11:42:14 Tomi Valkeinen wrote:
> 
> 
> On 24/07/15 19:03, Pali Rohár wrote:
> > Hello,
> > 
> > when on N900 (real HW or qemu) I run this command
> > 
> > / # echo 0 > /sys/devices/platform/omapdss/overlay0/enabled && echo 0 > /sys/class/graphics/fb0/size
> > 
> > then kernel crash with this error message
> > 
> > / # [   29.904113] Division by zero in kernel.
> 

Hi! Thanks for explaining.

> The problem is that fb console uses the kernel mmapped framebuffer, but
> omapfb is not aware of the fb console. So the above commands free the
> framebuffer, as omapfb thinks no one is using it, and then fb console
> tries to touch the fb.
> 

What about refusing those calls from fb console? So fb console will not
know about this problem and omapfb will just ignore drawn functions?

> omapfb tracks mmaps from userspace, and refuses to free a fb it it's
> mmapped.
> 
> I don't know how to fix it straight away. Maybe there's a way for omapfb
> to check if the fbcon uses the fb in question, and if so, refuses to
> release/resize the memory.
> 
>  Tomi
> 

Maemo userspace (on Nokia N900) uses above commands to initialize
graphic and Xserver. So it would be nice if disabling framebuffer would
work even if fbcon.ko is loaded (or compiled directly into zImage).

-- 
Pali Rohár
pali.rohar@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1211038

FromTomi Valkeinen <tomi.valkeinen@ti.com>
Date2015-08-21 11:20 +0200
Message-ID<pZQEr-7Jq-19@gated-at.bofh.it>
In reply to#1211015

[Multipart message — attachments visible in raw view] — view raw

On 21/08/15 11:48, Pali Rohár wrote:
> On Friday 21 August 2015 11:42:14 Tomi Valkeinen wrote:
>>
>>
>> On 24/07/15 19:03, Pali Rohár wrote:
>>> Hello,
>>>
>>> when on N900 (real HW or qemu) I run this command
>>>
>>> / # echo 0 > /sys/devices/platform/omapdss/overlay0/enabled && echo 0 > /sys/class/graphics/fb0/size
>>>
>>> then kernel crash with this error message
>>>
>>> / # [   29.904113] Division by zero in kernel.
>>
> 
> Hi! Thanks for explaining.
> 
>> The problem is that fb console uses the kernel mmapped framebuffer, but
>> omapfb is not aware of the fb console. So the above commands free the
>> framebuffer, as omapfb thinks no one is using it, and then fb console
>> tries to touch the fb.
>>
> 
> What about refusing those calls from fb console? So fb console will not
> know about this problem and omapfb will just ignore drawn functions?

Hmm, I'm not sure I understand what you mean... omapfb is not drawing
anything, fbcon is doing the drawing independently to the fb. And the fb
suddenly disappears without fbcon realizing that.

>> omapfb tracks mmaps from userspace, and refuses to free a fb it it's
>> mmapped.
>>
>> I don't know how to fix it straight away. Maybe there's a way for omapfb
>> to check if the fbcon uses the fb in question, and if so, refuses to
>> release/resize the memory.
>>
>>  Tomi
>>
> 
> Maemo userspace (on Nokia N900) uses above commands to initialize
> graphic and Xserver. So it would be nice if disabling framebuffer would
> work even if fbcon.ko is loaded (or compiled directly into zImage).

Ok. And N900 has fbcon enabled? I wonder how it survives...

fbcon can be unbound from userspace with something like:

echo 0 > /sys/class/vtconsole/vtcon1/bind

After that I think the memory can be freed.

But obviously the kernel should not crash here, no question about that.

 Tomi

[toc] | [prev] | [next] | [standalone]


#1213717

FromPali Rohár <pali.rohar@gmail.com>
Date2015-08-26 12:20 +0200
Message-ID<q1FYd-2Ly-17@gated-at.bofh.it>
In reply to#1211038
On Friday 21 August 2015 12:17:41 Tomi Valkeinen wrote:
> 
> 
> On 21/08/15 11:48, Pali Rohár wrote:
> > On Friday 21 August 2015 11:42:14 Tomi Valkeinen wrote:
> >>
> >>
> >> On 24/07/15 19:03, Pali Rohár wrote:
> >>> Hello,
> >>>
> >>> when on N900 (real HW or qemu) I run this command
> >>>
> >>> / # echo 0 > /sys/devices/platform/omapdss/overlay0/enabled && echo 0 > /sys/class/graphics/fb0/size
> >>>
> >>> then kernel crash with this error message
> >>>
> >>> / # [   29.904113] Division by zero in kernel.
> >>
> > 
> > Hi! Thanks for explaining.
> > 
> >> The problem is that fb console uses the kernel mmapped framebuffer, but
> >> omapfb is not aware of the fb console. So the above commands free the
> >> framebuffer, as omapfb thinks no one is using it, and then fb console
> >> tries to touch the fb.
> >>
> > 
> > What about refusing those calls from fb console? So fb console will not
> > know about this problem and omapfb will just ignore drawn functions?
> 
> Hmm, I'm not sure I understand what you mean... omapfb is not drawing
> anything, fbcon is doing the drawing independently to the fb. And the fb
> suddenly disappears without fbcon realizing that.
> 
> >> omapfb tracks mmaps from userspace, and refuses to free a fb it it's
> >> mmapped.
> >>
> >> I don't know how to fix it straight away. Maybe there's a way for omapfb
> >> to check if the fbcon uses the fb in question, and if so, refuses to
> >> release/resize the memory.
> >>
> >>  Tomi
> >>
> > 
> > Maemo userspace (on Nokia N900) uses above commands to initialize
> > graphic and Xserver. So it would be nice if disabling framebuffer would
> > work even if fbcon.ko is loaded (or compiled directly into zImage).
> 
> Ok. And N900 has fbcon enabled? I wonder how it survives...
> 

Depends on compiled kernel. Original stock Nokia kernel 2.6.28 has it
disabled, but when I recompiled it with fbcon (either static linked into
zImage or external fbcon.ko) it works and I do not see any problem.

So I think it survives...

> fbcon can be unbound from userspace with something like:
> 
> echo 0 > /sys/class/vtconsole/vtcon1/bind
> 
> After that I think the memory can be freed.
> 
> But obviously the kernel should not crash here, no question about that.
> 
>  Tomi
> 

Maybe just adding that test for zero to prevent division by zero?

-- 
Pali Rohár
pali.rohar@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web