Re: [linux-fbdev] [PATCH] mdacon SMP fix

From: ferret@phonewave.net
Date: Mon Oct 16 2000 - 15:53:10 EST


I will test this soon, hopefully. I move tomorrow, and will be bringing my
X environment and my audio environment into my dual P200 machine. This is
against which kernel? 2.4.0-test10 prepatch, or?

On Mon, 16 Oct 2000, James Simmons wrote:

>
> ANyone with a MDA card on a SMP or even UP machione please test this
> patch. This patch should fix any SMP deadlocks that could happen with
> a MDA card. Thank you.
>
> --- mdacon.c.orig Wed Oct 11 18:09:01 2000
> +++ mdacon.c Wed Oct 11 18:14:18 2000
> @@ -37,6 +37,7 @@
> #include <linux/vt_kern.h>
> #include <linux/vt_buffer.h>
> #include <linux/selection.h>
> +#include <linux/spinlock.h>
> #include <linux/ioport.h>
> #include <linux/delay.h>
> #include <linux/init.h>
> @@ -44,6 +45,7 @@
> #include <asm/io.h>
> #include <asm/vga.h>
>
> +static spinlock_t mda_lock = SPIN_LOCK_UNLOCKED;
>
> /* description of the hardware layout */
>
> @@ -80,7 +82,6 @@
> MODULE_PARM(mda_last_vc, "1-255i");
> #endif
>
> -
> /* MDA register values
> */
>
> @@ -110,23 +111,24 @@
> {
> unsigned long flags;
>
> - save_flags(flags); cli();
> + spin_lock_irqsave(&mda_lock, flags);
>
> outb_p(reg, mda_index_port);
> outb_p(val, mda_value_port);
>
> - restore_flags(flags);
> + spin_unlock_irqrestore(&mda_lock, flags);
> }
>
> static void write_mda_w(unsigned int val, unsigned char reg)
> {
> unsigned long flags;
>
> - save_flags(flags); cli();
> + spin_lock_irqsave(&mda_lock, flags);
>
> outb_p(reg, mda_index_port); outb_p(val >> 8, mda_value_port);
> outb_p(reg+1, mda_index_port); outb_p(val & 0xff, mda_value_port);
>
> + spin_unlock_irqrestore(&mda_lock, flags);
> restore_flags(flags);
> }
>
> @@ -134,15 +136,14 @@
> {
> unsigned long flags;
>
> - save_flags(flags); cli();
> + spin_lock_irqsave(&mda_lock, flags);
>
> outb_p(reg, mda_index_port);
> outb (val, mda_value_port);
>
> udelay(20); val = (inb_p(mda_value_port) == val);
>
> - restore_flags(flags);
> -
> + spin_unlock_irqrestore(&mda_lock, flags);
> return val;
> }
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:10 EST