Skip to contentSkip to conversation

vm86 patch updated to 2.5.67 / oops in blank_screen()?

DISCUSSION Antonino Daplas 2 participants 2 messages Apr 13, 2003 – Apr 14, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I believe I've seen that "oops" tracing before. It is due to console blanking routines calling a lot of functions (fb_blank, fb_setcolreg, etc), all of which are done when "sleeping" is not allowed. However, /dev/vm86 will always sleep, and this causes the oops.

Calling fb_blank via an ioctl is pretty safe though (ie, when xfree86 uses fb_blank ioctls for XFree86 DPMS).

I worked around this by doing deferred execution of fb_blank (also using a workqueue), and differentiating if fb_blank() was called from fbcon_blank() or from fb_ioctl(). I think I've also included these fixes in vm86d-0.1.tar.gz (md5sum 10fa0ad4647ea6a8a002998196ce6cd9)

Anyway, as a quick workaround, you can make vbe_blank() in vbe.c return 0 always. This will not blank the screen, but it will at least prevent the oops.

Tony

------------------ Reply Separator -------------------- Originally From: Jurriaan <[email protected]>
Subject: [Linux-fbdev-devel] vm86 patch updated to 2.5.67 / oops in blank_screen()?
Date: 04/12/2003 02:55pm

I've been playing with Antonino Daplas' vm86 patch.

First of all, the /dev/vm86 device should read:

crw------- 1 root root 10, 201 Apr 10 07:07 /dev/vm86

Then, I split the patch in a vm86 and a edid-vbe patch, and dropped all
refereces to the non-vesa framebuffers. There were a number of other changes in the patch which made it difficult to port since it affected all other framebuffers.

The resulting patches worked quite well, I'm testing here on a single CPU system with linux-2.5.67 and a Matrox G450 video-card. Once I'm satisfied it works, I hope to get my Elsa GeForce 3 Ti500 working with vesa framebuffer and nvidia proprietary drivers.

But, while I was away for some lunch, the computer decided to spoil the
general good feeling; it oopsed.

The backtrace was like this:

sys_sched_yield
vm86_exec
vbe_writedac
vbe_setcolreg
fb_set_cmap
fb_blank
timer_do_blank
blank_screen

Could anyone look at the patch (I've appended my version below) and tell
me what's going on? I'm no expert in locking in linux. I've tried adding
a disable_preempt() calls in vm86_exec(), but that got me lots of 'scheduling while atomic' backtraces.

I suspect this routine isn't quite good:

/**
* vm86_exec - execute instructions
* @request: pointer to instruction request data
* @buffer: 1024-byte min sized buffer for extra data
*
* ON ENTRY: @buffer must point to a valid buffer (1024 bytes).
* ON EXIT: @request contains results of x86 instructions. @request-

Quoted 1 line

buffer

* may contain additional data, depending on the code. Check
* @request->buf_len.
* WARNING:
* Will sleep
*/
int vm86_exec(struct vm86_request *request, void *buffer)

{
        int len;

        if (!info || !info->enabled)
                return -ENODEV;

        if (request->flags & VM86_TEST)
                return 0;

        len = sizeof(struct vm86_request) + request->buf_len;
        if (len > 1024)
                return -EINVAL;

        down(&vm86_sem);

        info->request = *request;
        info->buffer = buffer;
        info->error = 0;
        info->event = 1;
        info->poll_mask = POLLIN | POLLRDNORM;
        kill_fasync(&info->async_queue, SIGIO, POLL_IN);  /* send 

signal */

        wake_up(&vm86_wait);
        while (info->event)
                yield();

        info->request.flags = (info->error) ?
                VM86_FAILED : VM86_SUCCESS;
        *request = info->request;

        up(&vm86_sem);

        return 0;
}

The call to yield() seems not to happen to often in the kernel, but I don't know how to change this.

The patch below is against linux-2.5.67 (vanilla). There's some residual
printk's in there, btw.

I appreciate your help!

Thanks,
Jurriaan

Signature · 11 lines
Debian (Unstable) GNU/Linux 2.5.67-ac1 1970 bogomips load av: 0.04 
0.32 0.33




-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
#1 lore raw

From: Antonino Daplas <[email protected]>
Date: Sun, Apr 13, 2003 at 04:14:08AM -0400

Quoted 5 lines

I believe I've seen that "oops" tracing before. It is due to console blanking routines calling a lot of functions (fb_blank, fb_setcolreg, etc), all of which are done when "sleeping" is not allowed. However, /dev/vm86 will always sleep, and this causes the oops.

Quoted 7 lines

Calling fb_blank via an ioctl is pretty safe though (ie, when xfree86 uses fb_blank ioctls for XFree86 DPMS).

I worked around this by doing deferred execution of fb_blank (also using a workqueue), and differentiating if fb_blank() was called from fbcon_blank() or from fb_ioctl(). I think I've also included these fixes in vm86d-0.1.tar.gz (md5sum 10fa0ad4647ea6a8a002998196ce6cd9)

I don't think it's in that patch.

Quoted 5 lines

Anyway, as a quick workaround, you can make vbe_blank() in vbe.c return 0 always. This will not blank the screen, but it will at least prevent the oops.

Anyway, here is your patch, split in a vm86-patch and an edid-patch, and all other changes removed. In this form, there patches apply against 2.5.67, against 2.5.67-ac1 and against 2.5.67-bk5.

They also work (tested with 2.5.67).

Kind regards,
Jurriaan

Signature · 4 lines
However, the things that surprise Emacs users are very different from
the things that surprise users of lesser operating systems.
	Per Abrahamsen in news.software.readers
Debian (Unstable) GNU/Linux 2.5.67 3940 bogomips 5 users load av: 0.15 0.14 0.07
drivers/video/Makefile +1 -1
diff -urN -X dontdiff linux-2.5.67/drivers/video/Makefile linux-2.5.67-vm86/drivers/video/Makefile
@@ -7,7 +7,7 @@
 obj-$(CONFIG_VT)		  += console/
 obj-$(CONFIG_LOGO)		  += logo/
 
-obj-$(CONFIG_FB)                  += fbmem.o fbmon.o fbcmap.o modedb.o softcursor.o
+obj-$(CONFIG_FB)                  += fbmem.o fbmon.o fbcmap.o modedb.o vbe.o softcursor.o
 # Only include macmodes.o if we have FB support and are PPC
 ifeq ($(CONFIG_FB),y)
 obj-$(CONFIG_PPC)                 += macmodes.o
drivers/video/edid.h +138 -0

138 lines not on this page · raw message

drivers/video/fbmon.c +739 -164

1,016 lines not on this page · raw message

drivers/video/modedb.c +105 -0

114 lines not on this page · raw message

drivers/video/vbe.c +685 -0

685 lines not on this page · raw message

drivers/video/vbe.h +126 -0

126 lines not on this page · raw message

drivers/video/vesafb.c +1 -0
diff -urN -X dontdiff linux-2.5.67/drivers/video/vesafb.c linux-2.5.67-vm86/drivers/video/vesafb.c
@@ -356,6 +356,7 @@
 	fb_info.flags = FBINFO_FLAG_DEFAULT;
 
 	fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
+	vbe_init(&fb_info);
 
 	if (register_framebuffer(&fb_info)<0)
 		return -EINVAL;
include/linux/fb.h +46 -18

116 lines not on this page · raw message

drivers/char/Kconfig +0 -0
diff -urN -X dontdiff linux-2.5.67/drivers/char/Kconfig linux-2.5.67-vm86/drivers/char/Kconfig

+config VM86
+ bool "VM86 Interface"
+ depends on X86
+ help

+	  The VM86 interface is an interface between the kernel and
+	  a user-mode daemon (vm86d) that provides 16-bit BIOS services.
+	  At the moment, this is only used for the VESA framebuffer
+	  driver as a way to change refresh-rates and get information
+	  from the monitor and the card. You also need the user-mode
+	  daemon at http://i810fb.sourceforge.net,

+
endmenu

drivers/char/Makefile +1 -0
diff -urN -X dontdiff linux-2.5.67/drivers/char/Makefile linux-2.5.67-vm86/drivers/char/Makefile
@@ -78,6 +78,7 @@
 obj-$(CONFIG_IPMI_HANDLER) += ipmi/
 
 obj-$(CONFIG_HANGCHECK_TIMER) += hangcheck-timer.o
+obj-$(CONFIG_VM86) += vm86.o
 
 # Files generated that shall be removed upon make clean
 clean-files := consolemap_deftbl.c defkeymap.c qtronixmap.c
drivers/char/vm86.c +271 -0

271 lines not on this page · raw message

include/linux/miscdevice.h +1 -0
diff -urN -X dontdiff linux-2.5.67/include/linux/miscdevice.h linux-2.5.67-vm86/include/linux/miscdevice.h
@@ -35,6 +35,7 @@
 #define SGI_USEMACLONE	     151
 
 #define TUN_MINOR	     200
+#define VM86_MINOR           201
 
 extern int misc_init(void);
 
include/linux/vm86.h +47 -0

47 lines not on this page · raw message