Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jul 2001 18:27:52 +0200
From:      Tor.Egge@fast.no
To:        juriy@aviaport.ru
Cc:        freebsd-current@FreeBSD.ORG, peter@FreeBSD.ORG
Subject:   Re: kernel with SSE is unstable
Message-ID:  <200107151627.SAA01763@midten.fast.no>
In-Reply-To: Your message of "Sun, 15 Jul 2001 01:01:47 %2B0400"
References:  <20010715010147.A892@aviaport.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Sun_Jul_15_18:27:48_2001)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> In my system kernel(WITH SSE) falls when I use commands netstat and swapinfo.
> kernel without SSE works fine.

I got a very similar panic when trying an UP kernel with SSE enabled.

mi_switch() sets curproc->p_oncpu to NOCPU before calling
cpu_switch().  cpu_switch() might call npxsave() which calls fpusave
with NOCPU as the 'oncpu' argument.

A suggested patch is enclosed.

- Tor Egge


----Next_Part(Sun_Jul_15_18:27:48_2001)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Index: sys/i386/isa/npx.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/npx.c,v
retrieving revision 1.104
diff -u -r1.104 npx.c
--- sys/i386/isa/npx.c	2001/07/12 12:21:53	1.104
+++ sys/i386/isa/npx.c	2001/07/15 16:23:02
@@ -160,8 +160,8 @@
 #endif
 static	int	npx_probe	__P((device_t dev));
 static	int	npx_probe1	__P((device_t dev));
-static	void	fpusave		__P((union savefpu *, u_char));
-static	void	fpurstor	__P((union savefpu *, u_char));
+static	void	fpusave		__P((union savefpu *));
+static	void	fpurstor	__P((union savefpu *));
 #ifdef I586_CPU_XXX
 static	long	timezero	__P((const char *funcname,
 				     void (*func)(void *buf, size_t len)));
@@ -579,7 +579,7 @@
 	stop_emulating();
 	fldcw(&control);
 	if (PCPU_GET(curpcb) != NULL)
-		fpusave(&PCPU_GET(curpcb)->pcb_save, curproc->p_oncpu);
+		fpusave(&PCPU_GET(curpcb)->pcb_save);
 	start_emulating();
 	critical_exit(savecrit);
 }
@@ -881,7 +881,7 @@
 	 * fnsave are broken, so our treatment breaks fnclex if it is the
 	 * first FPU instruction after a context switch.
 	 */
-	fpurstor(&PCPU_GET(curpcb)->pcb_save, curproc->p_oncpu);
+	fpurstor(&PCPU_GET(curpcb)->pcb_save);
 	critical_exit(s);
 
 	return (1);
@@ -916,18 +916,18 @@
 {
 
 	stop_emulating();
-	fpusave(addr, curproc->p_oncpu);
+	fpusave(addr);
 
 	start_emulating();
 	PCPU_SET(npxproc, NULL);
 }
 
 static void
-fpusave(addr, oncpu)
+fpusave(addr)
 	union savefpu *addr;
-	u_char oncpu;
 {
 	static struct savexmm svxmm[MAXCPU];
+	u_char oncpu = PCPU_GET(cpuid);
 	
 	if (!cpu_fxsr)
 		fnsave(addr);
@@ -938,11 +938,11 @@
 }
 
 static void
-fpurstor(addr, oncpu)
+fpurstor(addr)
 	union savefpu *addr;
-	u_char oncpu;
 {
 	static struct savexmm svxmm[MAXCPU];
+	u_char oncpu = PCPU_GET(cpuid);
 
 	if (!cpu_fxsr)
 		frstor(addr);

----Next_Part(Sun_Jul_15_18:27:48_2001)----

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107151627.SAA01763>