Skip to contentSkip to conversation

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

PATCH Jurriaan 1 participant 1 message Apr 12, 2003

Subsystems (2)
lore
Share & tools
lore

Jurriaan

author
#0 lore raw

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->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 · 1 line
Debian (Unstable) GNU/Linux 2.5.67-ac1 1970 bogomips load av: 0.04 0.32 0.33
drivers/char/Kconfig +4 -0
diff -urN -X dontdiff linux-2.5.67/drivers/char/Kconfig linux-2.5.67-vm86/drivers/char/Kconfig
@@ -980,5 +980,9 @@
 	  out to lunch past a certain margin.  It can reboot the system
 	  or merely print a warning.
 
+config VM86
+	bool "VM86 Interface"
+	depends on X86
+
 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 +268 -0

268 lines not on this page · raw message

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 +731 -164

1,002 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 +689 -0

689 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

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