From owner-freebsd-current Tue Jul 2 18:58: 2 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A380E37B400 for ; Tue, 2 Jul 2002 18:57:59 -0700 (PDT) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id E8BA543E46 for ; Tue, 2 Jul 2002 18:57:58 -0700 (PDT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id VAA17961; Tue, 2 Jul 2002 21:57:58 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.6/8.9.1) id g631vSt24433; Tue, 2 Jul 2002 21:57:28 -0400 (EDT) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15650.23048.273299.232384@grasshopper.cs.duke.edu> Date: Tue, 2 Jul 2002 21:57:28 -0400 (EDT) To: Julian Elischer Cc: freebsd-current@freebsd.org Subject: Re: KSE signal problems still In-Reply-To: References: <15650.19753.171293.625675@grasshopper.cs.duke.edu> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Julian Elischer writes: > try this: > > in tdsignal, (kern_sig.c) > take a lock on schedlock and release it again, just around the call to > forward-signal() > > forward_signal(c4445540) at forward_signal+0x1a > tdsignal(c4445540,2,2) at tdsignal+0x182 > psignal(c443d558,2) at psignal+0x3c8 > > hopefully this will not be called with the schedlock already locked > Following your suggestion, the appended patch appears to work. However, it does seem a bit silly, as we end up dropping and-reaquiring the sched lock quite a few times: mtx_unlock_spin(&sched_lock); if (td->td_state == TDS_RUNQ || td->td_state == TDS_RUNNING) { signotify(td->td_proc); /* grabs & releases sched_lock*/ #ifdef SMP if (td->td_state == TDS_RUNNING && td != curthread) { mtx_lock_spin(&sched_lock); forward_signal(td); mtx_unlock_spin(&sched_lock); } #endif } goto out; Wouldn't it be cleaner if there was a signotify_locked () that assumed you had the sched_lock held (and was called by signotify)? Drew Index: kern_sig.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_sig.c,v retrieving revision 1.171 diff -u -r1.171 kern_sig.c --- kern_sig.c 29 Jun 2002 17:26:18 -0000 1.171 +++ kern_sig.c 3 Jul 2002 01:48:35 -0000 @@ -1543,8 +1543,11 @@ td->td_state == TDS_RUNNING) { signotify(td->td_proc); #ifdef SMP - if (td->td_state == TDS_RUNNING && td != curthread) + if (td->td_state == TDS_RUNNING && td != curthread) { + mtx_lock_spin(&sched_lock); forward_signal(td); + mtx_unlock_spin(&sched_lock); + } #endif } goto out; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message