From owner-freebsd-hackers Mon Dec 14 17:10:59 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA13519 for freebsd-hackers-outgoing; Mon, 14 Dec 1998 17:10:59 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from dingo.cdrom.com (goldfish.pht.co.jp [210.171.55.12]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA13510 for ; Mon, 14 Dec 1998 17:10:56 -0800 (PST) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (localhost [127.0.0.1]) by dingo.cdrom.com (8.9.1/8.8.8) with ESMTP id DAA00554; Mon, 14 Dec 1998 03:26:43 -0800 (PST) (envelope-from mike@dingo.cdrom.com) Message-Id: <199812141126.DAA00554@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: Reinier Bezuidenhout cc: freebsd-hackers@FreeBSD.ORG Subject: Re: kernel and ioctl call to kernel function In-reply-to: Your message of "Tue, 08 Dec 1998 11:40:01 +0100." <199812081040.LAA08899@borg.kryptokom.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 14 Dec 1998 03:26:43 -0800 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > We have implemented a funtion in the kernel that does some > operations on data given to the function. This function > can be called from within the kernel AND from user level > via a ioctl call. Can it be called at interrupt time? > What will happen if the kernel calls this function after > the user level process also called this function via > the ioctl or vice versa. Does the one wait for the > other before the function is entered ??? There is only one thread of execution inside the kernel (at the moment; if/when the SMP kernel locks are pushed down this may change), so unless you call this function from an interrupt context it will never be reentered. > I see some strange behaviour where the user level process > never seems to hang (no characters are echo'd to the screen > anymore, I can still swap vertual screens, but to character > input and the num-lock still worlks :) ). This is consistent with a corruption of the interrupt mask, usually caused by a bug in interrupt-masking code, or kernel code in eg. a system call that is spinning without completing and returning to user mode. > How is this "simultanious" call to the same function handled ?? The kernel is just a big program, and interrupts are like signal handlers; you are required to call interrupt-safe functions from inside interrupt handlers, and to perform interrupt-related locking when you want to manipulate data in an atomic fashion. Just what you need to do here isn't possible to determine, as you haven't provided enough information, but my guess is that your function is either not reentrant but is being reentered (probably called from an interrupt handler as well as the ioctl), or you are manipulating one or more datastructures in an unsafe fashion. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message