From owner-freebsd-sparc64@FreeBSD.ORG Mon Sep 20 10:40:13 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 741F216A4CE for ; Mon, 20 Sep 2004 10:40:13 +0000 (GMT) Received: from ns.kt-is.co.kr (ns.kt-is.co.kr [211.218.149.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id E540A43D4C for ; Mon, 20 Sep 2004 10:40:12 +0000 (GMT) (envelope-from yongari@kt-is.co.kr) Received: from michelle.kt-is.co.kr (ns2.kt-is.co.kr [220.76.118.193]) (authenticated bits=128) by ns.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i8KAdHAh010702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 20 Sep 2004 19:39:17 +0900 (KST) Received: from michelle.kt-is.co.kr (localhost.kt-is.co.kr [127.0.0.1]) by michelle.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i8KAe734002160 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Sep 2004 19:40:07 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Received: (from yongari@localhost) by michelle.kt-is.co.kr (8.12.10/8.12.10/Submit) id i8KAe6bv002159; Mon, 20 Sep 2004 19:40:06 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Date: Mon, 20 Sep 2004 19:40:06 +0900 From: Pyun YongHyeon To: dhaigh@gatorzone.com Message-ID: <20040920104006.GA1905@kt-is.co.kr> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Filter-Version: 1.11a (ns.kt-is.co.kr) cc: sparc64@freebsd.org Subject: Re: PR sparc64/71729 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: yongari@kt-is.co.kr List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2004 10:40:13 -0000 --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Sep 17, 2004 at 09:29:41AM -0400, Doug Haigh wrote: > My emails & problem report follow-ups from my gatorzone.com domain seem to > be failing. Hopefully this will reach you... > > Doug Haigh > > -----Original Message----- > From: cd [mailto:cd_freebsd@gatorzone.com] > Sent: Thursday, September 16, 2004 2:54 PM > To: 'freebsd-sparc64@FreeBSD.org' > Subject: PR sparc64/71729 > > > I am not sure if the PR got updated, but I wanted to let you know that the > printf in a kernel thread only fails if you are on a SMP machine. It appears > that if you printf on a CPU other than CPU #0, it will panic the kernel. > After reading your mail, I made a small test program which creates a kernel thread and ran it on AXe(UP) and U2(SMP). Under AXe it worked as expected but it paniced on U2. So it seems that there is some issues in OF console. Backtrace for the panic is somthing like: openfirmware + 0x18 OF_write + 0x1c ofw_cons_putc + 0x34 cnputc + 0x44 putchar + 0xbc kvprintf + 0x4c printf + 0x4c I've attached simple test program used. I vaguely guess it may be related with Kris' problem on his U30. Regards, Pyun YongHyeon -- Pyun YongHyeon --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=Makefile # .PATH: ${.CURDIR} KMOD= kthread SRCS= kthread.c .include --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kthread.c" #include #include #include #include #include #include #include #include struct foo_struct { int term; struct mtx lock; }; struct foo_struct foo_struct; #define FOO_LOCK() mtx_lock(&foo_struct.lock) #define FOO_UNLOCK() mtx_unlock(&foo_struct.lock) static void foo_thread(void *arg) { int i = 0; FOO_LOCK(); do { printf("foo_thread : %d\n", i++); msleep(&foo_struct, &foo_struct.lock, PWAIT, "twait1", 2*hz); } while(foo_struct.term == 0); printf("foo_thread termination request\n"); foo_struct.term = 2; FOO_UNLOCK(); kthread_exit(0); } static int foo_alloc(void) { int error; bzero(&foo_struct, sizeof(foo_struct)); mtx_init(&foo_struct.lock, "foo mtx", NULL, MTX_DEF); error = kthread_create(foo_thread, NULL, NULL, 0, 0, "foo_thr"); if (error != 0) { printf("kthread_create returned %d\n", error); return (1); } return (0); } static void foo_free(void) { FOO_LOCK(); foo_struct.term = 1; wakeup(&foo_struct); printf("waiting for thread termination\n"); msleep(&foo_struct, &foo_struct.lock, PWAIT, "twait2", 2*hz); FOO_UNLOCK(); mtx_destroy(&foo_struct.lock); } static int ktread_modevent(module_t mod, int type, void *data) { int err = 0; switch(type) { case MOD_LOAD: foo_alloc(); break; case MOD_UNLOAD: foo_free(); break; default: err = EINVAL; break; } return (err); } static moduledata_t kthread_alloc = { "kthread", ktread_modevent, 0 }; DECLARE_MODULE(kthread, kthread_alloc, SI_SUB_PSEUDO, SI_ORDER_FIRST); MODULE_VERSION(kthread, 1); --a8Wt8u1KmwUX3Y2C--