All of lore.kernel.org
 help / color / mirror / Atom feed
* Get console sem on fbdev ioctls
@ 2004-01-06  0:25 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2004-01-06  0:25 UTC (permalink / raw)
  To: James Simmons; +Cc: Linux Fbdev development list, Linux Kernel list



Along with my VT race fixes I sent earlier, this is a patch (that may
need to be applied manually, I hacked the patch file a bit since my
tree is so different from yours at this point). It takes the console
semaphore on userland initiated mode change, pan display, ... ioctls.

Maybe more are required... This is the basics for at least fbset operations
to be "safe" (vs. printk/blanking and vs. the console resize code).

Note that with that and the VT fixes, I can properly now call vc_resize
instead of fbcon_resize in fbcon when getting a mode changed callback,
and that works really better.

I basically do that if cols and rows are seen to have changed:

	vc_resize(vc->vc_num, cols, rows);
	if (CON_IS_VISIBLE(vc)) {
		accel_clear_margins(vc, info, 0);
		update_screen(vc->vc_num);
	}

Though for stty to work fine, I also had to do proper mode selection/validation
for which I added this FB_ACTIVATE_FIND option (see my other email on the subject)
along with proper support in radeonfb.


diff -urN linux-2.5/drivers/video/fbmem.c linuxppc-2.5-benh/drivers/video/fbmem.c
--- linux-2.5/drivers/video/fbmem.c	2004-01-06 10:05:18.708660576 +1100
+++ linuxppc-2.5-benh/drivers/video/fbmem.c	2003-12-31 12:38:25.000000000 +1100
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/linux_logo.h>
 #include <linux/proc_fs.h>
+#include <linux/console.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -984,7 +995,9 @@
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
+		acquire_console_sem();
 		i = fb_set_var(info, &var);
+		release_console_sem();
 		if (i) return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1003,7 +1016,10 @@
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i = fb_pan_display(info, &var)))
+		acquire_console_sem();
+		i = fb_pan_display(info, &var);
+		release_console_sem();
+		if (i)
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1039,7 +1055,10 @@
 		return 0;
 #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
 	case FBIOBLANK:
-		return fb_blank(info, arg);
+		acquire_console_sem();
+		i = fb_blank(info, arg);
+		release_console_sem();
+		return i;
 	default:
 		if (fb->fb_ioctl == NULL)
 			return -EINVAL;


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

* Get console sem on fbdev ioctls
@ 2004-01-06  0:25 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2004-01-06  0:25 UTC (permalink / raw)
  To: James Simmons; +Cc: Linux Fbdev development list, Linux Kernel list



Along with my VT race fixes I sent earlier, this is a patch (that may
need to be applied manually, I hacked the patch file a bit since my
tree is so different from yours at this point). It takes the console
semaphore on userland initiated mode change, pan display, ... ioctls.

Maybe more are required... This is the basics for at least fbset operations
to be "safe" (vs. printk/blanking and vs. the console resize code).

Note that with that and the VT fixes, I can properly now call vc_resize
instead of fbcon_resize in fbcon when getting a mode changed callback,
and that works really better.

I basically do that if cols and rows are seen to have changed:

	vc_resize(vc->vc_num, cols, rows);
	if (CON_IS_VISIBLE(vc)) {
		accel_clear_margins(vc, info, 0);
		update_screen(vc->vc_num);
	}

Though for stty to work fine, I also had to do proper mode selection/validation
for which I added this FB_ACTIVATE_FIND option (see my other email on the subject)
along with proper support in radeonfb.


diff -urN linux-2.5/drivers/video/fbmem.c linuxppc-2.5-benh/drivers/video/fbmem.c
--- linux-2.5/drivers/video/fbmem.c	2004-01-06 10:05:18.708660576 +1100
+++ linuxppc-2.5-benh/drivers/video/fbmem.c	2003-12-31 12:38:25.000000000 +1100
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/linux_logo.h>
 #include <linux/proc_fs.h>
+#include <linux/console.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -984,7 +995,9 @@
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
+		acquire_console_sem();
 		i = fb_set_var(info, &var);
+		release_console_sem();
 		if (i) return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1003,7 +1016,10 @@
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i = fb_pan_display(info, &var)))
+		acquire_console_sem();
+		i = fb_pan_display(info, &var);
+		release_console_sem();
+		if (i)
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1039,7 +1055,10 @@
 		return 0;
 #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
 	case FBIOBLANK:
-		return fb_blank(info, arg);
+		acquire_console_sem();
+		i = fb_blank(info, arg);
+		release_console_sem();
+		return i;
 	default:
 		if (fb->fb_ioctl == NULL)
 			return -EINVAL;

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

* Re: Get console sem on fbdev ioctls
  2004-01-06  0:25 ` Benjamin Herrenschmidt
  (?)
@ 2004-01-06 16:59 ` Otto Solares
  -1 siblings, 0 replies; 8+ messages in thread
From: Otto Solares @ 2004-01-06 16:59 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Linux Fbdev development list

Hmm, i had the idea of having seen this mail before...

-solca


On Tue, Jan 06, 2004 at 11:25:12AM +1100, Benjamin Herrenschmidt wrote:
> 
> 
> Along with my VT race fixes I sent earlier, this is a patch (that may
> need to be applied manually, I hacked the patch file a bit since my
> tree is so different from yours at this point). It takes the console
> semaphore on userland initiated mode change, pan display, ... ioctls.
> 
> Maybe more are required... This is the basics for at least fbset operations
> to be "safe" (vs. printk/blanking and vs. the console resize code).
> 
> Note that with that and the VT fixes, I can properly now call vc_resize
> instead of fbcon_resize in fbcon when getting a mode changed callback,
> and that works really better.
> 
> I basically do that if cols and rows are seen to have changed:
> 
> 	vc_resize(vc->vc_num, cols, rows);
> 	if (CON_IS_VISIBLE(vc)) {
> 		accel_clear_margins(vc, info, 0);
> 		update_screen(vc->vc_num);
> 	}
> 
> Though for stty to work fine, I also had to do proper mode selection/validation
> for which I added this FB_ACTIVATE_FIND option (see my other email on the subject)
> along with proper support in radeonfb.
> 
> 
> diff -urN linux-2.5/drivers/video/fbmem.c linuxppc-2.5-benh/drivers/video/fbmem.c
> --- linux-2.5/drivers/video/fbmem.c	2004-01-06 10:05:18.708660576 +1100
> +++ linuxppc-2.5-benh/drivers/video/fbmem.c	2003-12-31 12:38:25.000000000 +1100
> @@ -27,6 +27,7 @@
>  #include <linux/init.h>
>  #include <linux/linux_logo.h>
>  #include <linux/proc_fs.h>
> +#include <linux/console.h>
>  #ifdef CONFIG_KMOD
>  #include <linux/kmod.h>
>  #endif
> @@ -984,7 +995,9 @@
>  	case FBIOPUT_VSCREENINFO:
>  		if (copy_from_user(&var, (void *) arg, sizeof(var)))
>  			return -EFAULT;
> +		acquire_console_sem();
>  		i = fb_set_var(info, &var);
> +		release_console_sem();
>  		if (i) return i;
>  		if (copy_to_user((void *) arg, &var, sizeof(var)))
>  			return -EFAULT;
> @@ -1003,7 +1016,10 @@
>  	case FBIOPAN_DISPLAY:
>  		if (copy_from_user(&var, (void *) arg, sizeof(var)))
>  			return -EFAULT;
> -		if ((i = fb_pan_display(info, &var)))
> +		acquire_console_sem();
> +		i = fb_pan_display(info, &var);
> +		release_console_sem();
> +		if (i)
>  			return i;
>  		if (copy_to_user((void *) arg, &var, sizeof(var)))
>  			return -EFAULT;
> @@ -1039,7 +1055,10 @@
>  		return 0;
>  #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
>  	case FBIOBLANK:
> -		return fb_blank(info, arg);
> +		acquire_console_sem();
> +		i = fb_blank(info, arg);
> +		release_console_sem();
> +		return i;
>  	default:
>  		if (fb->fb_ioctl == NULL)
>  			return -EINVAL;
> 
> -
> 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/
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
> Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click

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

* Get console sem on fbdev ioctls
@ 2004-03-29 15:45 Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2004-03-29 15:45 UTC (permalink / raw)
  To: Administrator; +Cc: Linux Fbdev development list, Linux Kernel list



Along with my VT race fixes I sent earlier, this is a patch (that may
need to be applied manually, I hacked the patch file a bit since my
tree is so different from yours at this point). It takes the console
semaphore on userland initiated mode change, pan display, ... ioctls.

Maybe more are required... This is the basics for at least fbset operations
to be "safe" (vs. printk/blanking and vs. the console resize code).

Note that with that and the VT fixes, I can properly now call vc_resize
instead of fbcon_resize in fbcon when getting a mode changed callback,
and that works really better.

I basically do that if cols and rows are seen to have changed:

	vc_resize(vc->vc_num, cols, rows);
	if (CON_IS_VISIBLE(vc)) {
		accel_clear_margins(vc, info, 0);
		update_screen(vc->vc_num);
	}

Though for stty to work fine, I also had to do proper mode selection/validation
for which I added this FB_ACTIVATE_FIND option (see my other email on the subject)
along with proper support in radeonfb.


diff -urN linux-2.5/drivers/video/fbmem.c linuxppc-2.5-benh/drivers/video/fbmem.c
--- linux-2.5/drivers/video/fbmem.c	2004-01-06 10:05:18.708660576 +1100
+++ linuxppc-2.5-benh/drivers/video/fbmem.c	2003-12-31 12:38:25.000000000 +1100
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/linux_logo.h>
 #include <linux/proc_fs.h>
+#include <linux/console.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -984,7 +995,9 @@
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
+		acquire_console_sem();
 		i = fb_set_var(info, &var);
+		release_console_sem();
 		if (i) return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1003,7 +1016,10 @@
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i = fb_pan_display(info, &var)))
+		acquire_console_sem();
+		i = fb_pan_display(info, &var);
+		release_console_sem();
+		if (i)
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1039,7 +1055,10 @@
 		return 0;
 #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
 	case FBIOBLANK:
-		return fb_blank(info, arg);
+		acquire_console_sem();
+		i = fb_blank(info, arg);
+		release_console_sem();
+		return i;
 	default:
 		if (fb->fb_ioctl == NULL)
 			return -EINVAL;

-
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/




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

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

* Get console sem on fbdev ioctls
@ 2004-03-29 15:45 Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2004-03-29 15:45 UTC (permalink / raw)
  To: Administrator; +Cc: Linux Fbdev development list, Linux Kernel list


Along with my VT race fixes I sent earlier, this is a patch (that may
need to be applied manually, I hacked the patch file a bit since my
tree is so different from yours at this point). It takes the console
semaphore on userland initiated mode change, pan display, ... ioctls.

Maybe more are required... This is the basics for at least fbset operations
to be "safe" (vs. printk/blanking and vs. the console resize code).

Note that with that and the VT fixes, I can properly now call vc_resize
instead of fbcon_resize in fbcon when getting a mode changed callback,
and that works really better.

I basically do that if cols and rows are seen to have changed:

	vc_resize(vc->vc_num, cols, rows);
	if (CON_IS_VISIBLE(vc)) {
		accel_clear_margins(vc, info, 0);
		update_screen(vc->vc_num);
	}

Though for stty to work fine, I also had to do proper mode selection/validation
for which I added this FB_ACTIVATE_FIND option (see my other email on the subject)
along with proper support in radeonfb.


diff -urN linux-2.5/drivers/video/fbmem.c linuxppc-2.5-benh/drivers/video/fbmem.c
--- linux-2.5/drivers/video/fbmem.c	2004-01-06 10:05:18.708660576 +1100
+++ linuxppc-2.5-benh/drivers/video/fbmem.c	2003-12-31 12:38:25.000000000 +1100
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/linux_logo.h>
 #include <linux/proc_fs.h>
+#include <linux/console.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -984,7 +995,9 @@
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
+		acquire_console_sem();
 		i = fb_set_var(info, &var);
+		release_console_sem();
 		if (i) return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1003,7 +1016,10 @@
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i = fb_pan_display(info, &var)))
+		acquire_console_sem();
+		i = fb_pan_display(info, &var);
+		release_console_sem();
+		if (i)
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1039,7 +1055,10 @@
 		return 0;
 #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
 	case FBIOBLANK:
-		return fb_blank(info, arg);
+		acquire_console_sem();
+		i = fb_blank(info, arg);
+		release_console_sem();
+		return i;
 	default:
 		if (fb->fb_ioctl == NULL)
 			return -EINVAL;

-
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/




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

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

* Get console sem on fbdev ioctls
@ 2004-01-06  0:32 Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2004-01-06  0:32 UTC (permalink / raw)
  To: James Simmons; +Cc: Linux Fbdev development list


Along with my VT race fixes I sent earlier, this is a patch (that may
need to be applied manually, I hacked the patch file a bit since my
tree is so different from yours at this point). It takes the console
semaphore on userland initiated mode change, pan display, ... ioctls.

Maybe more are required... This is the basics for at least fbset operations
to be "safe" (vs. printk/blanking and vs. the console resize code).

Note that with that and the VT fixes, I can properly now call vc_resize
instead of fbcon_resize in fbcon when getting a mode changed callback,
and that works really better.

I basically do that if cols and rows are seen to have changed:

	vc_resize(vc->vc_num, cols, rows);
	if (CON_IS_VISIBLE(vc)) {
		accel_clear_margins(vc, info, 0);
		update_screen(vc->vc_num);
	}

Though for stty to work fine, I also had to do proper mode selection/validation
for which I added this FB_ACTIVATE_FIND option (see my other email on the subject)
along with proper support in radeonfb.


diff -urN linux-2.5/drivers/video/fbmem.c linuxppc-2.5-benh/drivers/video/fbmem.c
--- linux-2.5/drivers/video/fbmem.c	2004-01-06 10:05:18.708660576 +1100
+++ linuxppc-2.5-benh/drivers/video/fbmem.c	2003-12-31 12:38:25.000000000 +1100
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/linux_logo.h>
 #include <linux/proc_fs.h>
+#include <linux/console.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -984,7 +995,9 @@
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
+		acquire_console_sem();
 		i = fb_set_var(info, &var);
+		release_console_sem();
 		if (i) return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1003,7 +1016,10 @@
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i = fb_pan_display(info, &var)))
+		acquire_console_sem();
+		i = fb_pan_display(info, &var);
+		release_console_sem();
+		if (i)
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1039,7 +1055,10 @@
 		return 0;
 #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
 	case FBIOBLANK:
-		return fb_blank(info, arg);
+		acquire_console_sem();
+		i = fb_blank(info, arg);
+		release_console_sem();
+		return i;
 	default:
 		if (fb->fb_ioctl == NULL)
 			return -EINVAL;
-- 
Benjamin Herrenschmidt <benh@kernel.crashing.org>



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click

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

* Get console sem on fbdev ioctls
@ 2004-01-06  0:32 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2004-01-06  0:32 UTC (permalink / raw)
  To: James Simmons; +Cc: Linux Fbdev development list, Linux Kernel list


Along with my VT race fixes I sent earlier, this is a patch (that may
need to be applied manually, I hacked the patch file a bit since my
tree is so different from yours at this point). It takes the console
semaphore on userland initiated mode change, pan display, ... ioctls.

Maybe more are required... This is the basics for at least fbset operations
to be "safe" (vs. printk/blanking and vs. the console resize code).

Note that with that and the VT fixes, I can properly now call vc_resize
instead of fbcon_resize in fbcon when getting a mode changed callback,
and that works really better.

I basically do that if cols and rows are seen to have changed:

	vc_resize(vc->vc_num, cols, rows);
	if (CON_IS_VISIBLE(vc)) {
		accel_clear_margins(vc, info, 0);
		update_screen(vc->vc_num);
	}

Though for stty to work fine, I also had to do proper mode selection/validation
for which I added this FB_ACTIVATE_FIND option (see my other email on the subject)
along with proper support in radeonfb.


diff -urN linux-2.5/drivers/video/fbmem.c linuxppc-2.5-benh/drivers/video/fbmem.c
--- linux-2.5/drivers/video/fbmem.c	2004-01-06 10:05:18.708660576 +1100
+++ linuxppc-2.5-benh/drivers/video/fbmem.c	2003-12-31 12:38:25.000000000 +1100
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/linux_logo.h>
 #include <linux/proc_fs.h>
+#include <linux/console.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -984,7 +995,9 @@
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
+		acquire_console_sem();
 		i = fb_set_var(info, &var);
+		release_console_sem();
 		if (i) return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1003,7 +1016,10 @@
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i = fb_pan_display(info, &var)))
+		acquire_console_sem();
+		i = fb_pan_display(info, &var);
+		release_console_sem();
+		if (i)
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1039,7 +1055,10 @@
 		return 0;
 #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
 	case FBIOBLANK:
-		return fb_blank(info, arg);
+		acquire_console_sem();
+		i = fb_blank(info, arg);
+		release_console_sem();
+		return i;
 	default:
 		if (fb->fb_ioctl == NULL)
 			return -EINVAL;


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

* Get console sem on fbdev ioctls
@ 2004-01-06  0:32 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2004-01-06  0:32 UTC (permalink / raw)
  To: James Simmons; +Cc: Linux Fbdev development list, Linux Kernel list


Along with my VT race fixes I sent earlier, this is a patch (that may
need to be applied manually, I hacked the patch file a bit since my
tree is so different from yours at this point). It takes the console
semaphore on userland initiated mode change, pan display, ... ioctls.

Maybe more are required... This is the basics for at least fbset operations
to be "safe" (vs. printk/blanking and vs. the console resize code).

Note that with that and the VT fixes, I can properly now call vc_resize
instead of fbcon_resize in fbcon when getting a mode changed callback,
and that works really better.

I basically do that if cols and rows are seen to have changed:

	vc_resize(vc->vc_num, cols, rows);
	if (CON_IS_VISIBLE(vc)) {
		accel_clear_margins(vc, info, 0);
		update_screen(vc->vc_num);
	}

Though for stty to work fine, I also had to do proper mode selection/validation
for which I added this FB_ACTIVATE_FIND option (see my other email on the subject)
along with proper support in radeonfb.


diff -urN linux-2.5/drivers/video/fbmem.c linuxppc-2.5-benh/drivers/video/fbmem.c
--- linux-2.5/drivers/video/fbmem.c	2004-01-06 10:05:18.708660576 +1100
+++ linuxppc-2.5-benh/drivers/video/fbmem.c	2003-12-31 12:38:25.000000000 +1100
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/linux_logo.h>
 #include <linux/proc_fs.h>
+#include <linux/console.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -984,7 +995,9 @@
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
+		acquire_console_sem();
 		i = fb_set_var(info, &var);
+		release_console_sem();
 		if (i) return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1003,7 +1016,10 @@
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i = fb_pan_display(info, &var)))
+		acquire_console_sem();
+		i = fb_pan_display(info, &var);
+		release_console_sem();
+		if (i)
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -1039,7 +1055,10 @@
 		return 0;
 #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
 	case FBIOBLANK:
-		return fb_blank(info, arg);
+		acquire_console_sem();
+		i = fb_blank(info, arg);
+		release_console_sem();
+		return i;
 	default:
 		if (fb->fb_ioctl == NULL)
 			return -EINVAL;

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

end of thread, other threads:[~2004-03-29 16:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-06  0:25 Get console sem on fbdev ioctls Benjamin Herrenschmidt
2004-01-06  0:25 ` Benjamin Herrenschmidt
2004-01-06 16:59 ` Otto Solares
2004-01-06  0:32 Benjamin Herrenschmidt
2004-01-06  0:32 ` Benjamin Herrenschmidt
2004-01-06  0:32 Benjamin Herrenschmidt
2004-03-29 15:45 Benjamin Herrenschmidt
2004-03-29 15:45 Benjamin Herrenschmidt

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.