Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [patch] simulate_ll and simulate_sc(resend)
@ 2003-03-03 10:21 Yoichi Yuasa
  2003-03-04 12:07 ` Ralf Baechle
  2003-03-04 20:36 ` Ralf Baechle
  0 siblings, 2 replies; 5+ messages in thread
From: Yoichi Yuasa @ 2003-03-03 10:21 UTC (permalink / raw)
  To: ralf; +Cc: yoichi_yuasa, linux-mips, jsun

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

Hi Ralf,

I found a bug in simulate_ll and simulate_sc.
The board that uses ll/sc emulation is not started.

When send_sig in these, in order not to operate the value of EPC correctly,
simulate_* happens continuously.

The previous patches were not perfect, I changed more.
Please apply these patches to CVS tree.

Thanks,

Yoichi

[-- Attachment #2: llsc-v24-0303.diff --]
[-- Type: text/plain, Size: 722 bytes --]

diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/arch/mips/kernel/traps.c linux/arch/mips/kernel/traps.c
--- linux.orig/arch/mips/kernel/traps.c	Tue Feb 11 07:50:48 2003
+++ linux/arch/mips/kernel/traps.c	Mon Mar  3 17:52:16 2003
@@ -140,6 +140,7 @@
 	return;
 
 sig:
+	compute_return_epc(regs);
 	send_sig(signal, current, 1);
 }
 
@@ -172,18 +173,19 @@
 	}
 	if (ll_bit == 0 || ll_task != current) {
 		regs->regs[reg] = 0;
-		goto sig;
 	}
 
-	if (put_user(regs->regs[reg], vaddr))
+	if (put_user(regs->regs[reg], vaddr)) {
 		signal = SIGSEGV;
-	else
+		goto sig;
+	} else
 		regs->regs[reg] = 1;
 
 	compute_return_epc(regs);
 	return;
 
 sig:
+	compute_return_epc(regs);
 	send_sig(signal, current, 1);
 }
 

[-- Attachment #3: llsc-v25-0303.diff --]
[-- Type: text/plain, Size: 722 bytes --]

diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/arch/mips/kernel/traps.c linux/arch/mips/kernel/traps.c
--- linux.orig/arch/mips/kernel/traps.c	Wed Feb 12 13:26:43 2003
+++ linux/arch/mips/kernel/traps.c	Mon Mar  3 17:48:11 2003
@@ -135,6 +135,7 @@
 	return;
 
 sig:
+	compute_return_epc(regs);
 	send_sig(signal, current, 1);
 }
 
@@ -167,18 +168,19 @@
 	}
 	if (ll_bit == 0 || ll_task != current) {
 		regs->regs[reg] = 0;
-		goto sig;
 	}
 
-	if (put_user(regs->regs[reg], vaddr))
+	if (put_user(regs->regs[reg], vaddr)) {
 		signal = SIGSEGV;
-	else
+		goto sig;
+	} else
 		regs->regs[reg] = 1;
 
 	compute_return_epc(regs);
 	return;
 
 sig:
+	compute_return_epc(regs);
 	send_sig(signal, current, 1);
 }
 

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

* Re: [patch] simulate_ll and simulate_sc(resend)
  2003-03-03 10:21 [patch] simulate_ll and simulate_sc(resend) Yoichi Yuasa
@ 2003-03-04 12:07 ` Ralf Baechle
  2003-03-04 20:36 ` Ralf Baechle
  1 sibling, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2003-03-04 12:07 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips, jsun

On Mon, Mar 03, 2003 at 07:21:37PM +0900, Yoichi Yuasa wrote:

>  sig:
> +	compute_return_epc(regs);
>  	send_sig(signal, current, 1);

In the error case you can't advance the epc ..

It's an old bug already but the signal should be sent with force_sig,
not send_sig.

  Ralf

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

* Re: [patch] simulate_ll and simulate_sc(resend)
  2003-03-03 10:21 [patch] simulate_ll and simulate_sc(resend) Yoichi Yuasa
  2003-03-04 12:07 ` Ralf Baechle
@ 2003-03-04 20:36 ` Ralf Baechle
  2003-03-06  7:53   ` Yoichi Yuasa
  1 sibling, 1 reply; 5+ messages in thread
From: Ralf Baechle @ 2003-03-04 20:36 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips, jsun

On Mon, Mar 03, 2003 at 07:21:37PM +0900, Yoichi Yuasa wrote:

> I found a bug in simulate_ll and simulate_sc.
> The board that uses ll/sc emulation is not started.
> 
> When send_sig in these, in order not to operate the value of EPC correctly,
> simulate_* happens continuously.
> 
> The previous patches were not perfect, I changed more.
> Please apply these patches to CVS tree.

As previously mentioned there were some problems with your fix, so I
wrote an alternative fix which is attached below.  It's untested because
I don't have any ll/sc-less test platform.

  Ralf

Index: arch/mips/kernel/traps.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/traps.c,v
retrieving revision 1.99.2.41
diff -u -r1.99.2.41 traps.c
--- arch/mips/kernel/traps.c	10 Feb 2003 22:50:48 -0000	1.99.2.41
+++ arch/mips/kernel/traps.c	4 Mar 2003 20:32:10 -0000
@@ -134,13 +134,14 @@
 		ll_bit = 0;
 	}
 	ll_task = current;
+
 	regs->regs[(opcode & RT) >> 16] = value;
 
 	compute_return_epc(regs);
 	return;
 
 sig:
-	send_sig(signal, current, 1);
+	force_sig(signal, current);
 }
 
 static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
@@ -172,19 +173,21 @@
 	}
 	if (ll_bit == 0 || ll_task != current) {
 		regs->regs[reg] = 0;
-		goto sig;
+		return;
 	}
 
-	if (put_user(regs->regs[reg], vaddr))
+	if (put_user(regs->regs[reg], vaddr)) {
 		signal = SIGSEGV;
-	else
-		regs->regs[reg] = 1;
+		goto sig;
+	}
+
+	regs->regs[reg] = 1;
 
 	compute_return_epc(regs);
 	return;
 
 sig:
-	send_sig(signal, current, 1);
+	force_sig(signal, current);
 }
 
 /*

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

* Re: [patch] simulate_ll and simulate_sc(resend)
  2003-03-04 20:36 ` Ralf Baechle
@ 2003-03-06  7:53   ` Yoichi Yuasa
  2003-03-10  3:41     ` Yoichi Yuasa
  0 siblings, 1 reply; 5+ messages in thread
From: Yoichi Yuasa @ 2003-03-06  7:53 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: yoichi_yuasa, linux-mips, jsun

Hi Ralf,

On Tue, 4 Mar 2003 21:36:05 +0100
Ralf Baechle <ralf@linux-mips.org> wrote:

> On Mon, Mar 03, 2003 at 07:21:37PM +0900, Yoichi Yuasa wrote:
> 
> > I found a bug in simulate_ll and simulate_sc.
> > The board that uses ll/sc emulation is not started.
> > 
> > When send_sig in these, in order not to operate the value of EPC correctly,
> > simulate_* happens continuously.
> > 
> > The previous patches were not perfect, I changed more.
> > Please apply these patches to CVS tree.
> 
> As previously mentioned there were some problems with your fix, so I
> wrote an alternative fix which is attached below.  It's untested because
> I don't have any ll/sc-less test platform.

I tested ll/sc simulate.
Furthermore, the following patch is also needed.

Thanks,

Yoichi

diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/arch/mips/kernel/traps.c linux/arch/mips/kernel/traps.c
--- linux.orig/arch/mips/kernel/traps.c Wed Mar  5 12:05:00 2003
+++ linux/arch/mips/kernel/traps.c      Thu Mar  6 16:37:40 2003
@@ -173,6 +173,7 @@
        }
        if (ll_bit == 0 || ll_task != current) {
                regs->regs[reg] = 0;
+               compute_return_epc(regs);
                return;
        }



> 
>   Ralf
> 
> Index: arch/mips/kernel/traps.c
> ===================================================================
> RCS file: /home/cvs/linux/arch/mips/kernel/traps.c,v
> retrieving revision 1.99.2.41
> diff -u -r1.99.2.41 traps.c
> --- arch/mips/kernel/traps.c	10 Feb 2003 22:50:48 -0000	1.99.2.41
> +++ arch/mips/kernel/traps.c	4 Mar 2003 20:32:10 -0000
> @@ -134,13 +134,14 @@
>  		ll_bit = 0;
>  	}
>  	ll_task = current;
> +
>  	regs->regs[(opcode & RT) >> 16] = value;
>  
>  	compute_return_epc(regs);
>  	return;
>  
>  sig:
> -	send_sig(signal, current, 1);
> +	force_sig(signal, current);
>  }
>  
>  static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
> @@ -172,19 +173,21 @@
>  	}
>  	if (ll_bit == 0 || ll_task != current) {
>  		regs->regs[reg] = 0;
> -		goto sig;
> +		return;
>  	}
>  
> -	if (put_user(regs->regs[reg], vaddr))
> +	if (put_user(regs->regs[reg], vaddr)) {
>  		signal = SIGSEGV;
> -	else
> -		regs->regs[reg] = 1;
> +		goto sig;
> +	}
> +
> +	regs->regs[reg] = 1;
>  
>  	compute_return_epc(regs);
>  	return;
>  
>  sig:
> -	send_sig(signal, current, 1);
> +	force_sig(signal, current);
>  }
>  
>  /*
> 
> 


-- 
Yoichi Yuasa
Montavista Software Japan, Inc.
e-mail: yoichi_yuasa@montavista.co.jp
http://www.montavista.co.jp
PHONE: 03-5469-8840 FAX: 03-5469-8841

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

* Re: [patch] simulate_ll and simulate_sc(resend)
  2003-03-06  7:53   ` Yoichi Yuasa
@ 2003-03-10  3:41     ` Yoichi Yuasa
  0 siblings, 0 replies; 5+ messages in thread
From: Yoichi Yuasa @ 2003-03-10  3:41 UTC (permalink / raw)
  To: ralf; +Cc: yoichi_yuasa, linux-mips, jsun

[-- Attachment #1: Type: text/plain, Size: 3187 bytes --]

Hi Ralf,

In addition to your change, this patch is still more required.
I tested simulate_ll/sc operation with this patch, it doesn't have a problem.

Please apply this patch.

Thanks,

Yoichi

On Thu, 6 Mar 2003 16:53:51 +0900
Yoichi Yuasa <yoichi_yuasa@montavista.co.jp> wrote:

> Hi Ralf,
> 
> On Tue, 4 Mar 2003 21:36:05 +0100
> Ralf Baechle <ralf@linux-mips.org> wrote:
> 
> > On Mon, Mar 03, 2003 at 07:21:37PM +0900, Yoichi Yuasa wrote:
> > 
> > > I found a bug in simulate_ll and simulate_sc.
> > > The board that uses ll/sc emulation is not started.
> > > 
> > > When send_sig in these, in order not to operate the value of EPC correctly,
> > > simulate_* happens continuously.
> > > 
> > > The previous patches were not perfect, I changed more.
> > > Please apply these patches to CVS tree.
> > 
> > As previously mentioned there were some problems with your fix, so I
> > wrote an alternative fix which is attached below.  It's untested because
> > I don't have any ll/sc-less test platform.
> 
> I tested ll/sc simulate.
> Furthermore, the following patch is also needed.
> 
> Thanks,
> 
> Yoichi
> 
> diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/arch/mips/kernel/traps.c linux/arch/mips/kernel/traps.c
> --- linux.orig/arch/mips/kernel/traps.c Wed Mar  5 12:05:00 2003
> +++ linux/arch/mips/kernel/traps.c      Thu Mar  6 16:37:40 2003
> @@ -173,6 +173,7 @@
>         }
>         if (ll_bit == 0 || ll_task != current) {
>                 regs->regs[reg] = 0;
> +               compute_return_epc(regs);
>                 return;
>         }
> 
> 
> 
> > 
> >   Ralf
> > 
> > Index: arch/mips/kernel/traps.c
> > ===================================================================
> > RCS file: /home/cvs/linux/arch/mips/kernel/traps.c,v
> > retrieving revision 1.99.2.41
> > diff -u -r1.99.2.41 traps.c
> > --- arch/mips/kernel/traps.c	10 Feb 2003 22:50:48 -0000	1.99.2.41
> > +++ arch/mips/kernel/traps.c	4 Mar 2003 20:32:10 -0000
> > @@ -134,13 +134,14 @@
> >  		ll_bit = 0;
> >  	}
> >  	ll_task = current;
> > +
> >  	regs->regs[(opcode & RT) >> 16] = value;
> >  
> >  	compute_return_epc(regs);
> >  	return;
> >  
> >  sig:
> > -	send_sig(signal, current, 1);
> > +	force_sig(signal, current);
> >  }
> >  
> >  static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
> > @@ -172,19 +173,21 @@
> >  	}
> >  	if (ll_bit == 0 || ll_task != current) {
> >  		regs->regs[reg] = 0;
> > -		goto sig;
> > +		return;
> >  	}
> >  
> > -	if (put_user(regs->regs[reg], vaddr))
> > +	if (put_user(regs->regs[reg], vaddr)) {
> >  		signal = SIGSEGV;
> > -	else
> > -		regs->regs[reg] = 1;
> > +		goto sig;
> > +	}
> > +
> > +	regs->regs[reg] = 1;
> >  
> >  	compute_return_epc(regs);
> >  	return;
> >  
> >  sig:
> > -	send_sig(signal, current, 1);
> > +	force_sig(signal, current);
> >  }
> >  
> >  /*
> > 
> > 
> 
> 
> -- 
> Yoichi Yuasa
> Montavista Software Japan, Inc.
> e-mail: yoichi_yuasa@montavista.co.jp
> http://www.montavista.co.jp
> PHONE: 03-5469-8840 FAX: 03-5469-8841
> 
> 


-- 
Yoichi Yuasa
Montavista Software Japan, Inc.
e-mail: yoichi_yuasa@montavista.co.jp
http://www.montavista.co.jp
PHONE: 03-5469-8840 FAX: 03-5469-8841

[-- Attachment #2: simulate_llsc.diff --]
[-- Type: text/plain, Size: 375 bytes --]

diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/arch/mips/kernel/traps.c linux/arch/mips/kernel/traps.c
--- linux.orig/arch/mips/kernel/traps.c	Wed Mar  5 12:05:00 2003
+++ linux/arch/mips/kernel/traps.c	Thu Mar  6 16:37:40 2003
@@ -173,6 +173,7 @@
 	}
 	if (ll_bit == 0 || ll_task != current) {
 		regs->regs[reg] = 0;
+		compute_return_epc(regs);
 		return;
 	}
 

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

end of thread, other threads:[~2003-03-10  3:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-03 10:21 [patch] simulate_ll and simulate_sc(resend) Yoichi Yuasa
2003-03-04 12:07 ` Ralf Baechle
2003-03-04 20:36 ` Ralf Baechle
2003-03-06  7:53   ` Yoichi Yuasa
2003-03-10  3:41     ` Yoichi Yuasa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox