From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 21 14:24:09 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A495106566B for ; Wed, 21 Sep 2011 14:24:09 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id BC1828FC0C for ; Wed, 21 Sep 2011 14:24:08 +0000 (UTC) Received: by gxk26 with SMTP id 26so468536gxk.13 for ; Wed, 21 Sep 2011 07:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=mwsH2AOsLygs2/Jo9mNjf3PlYADuhiE861deIDaEFo0=; b=HmsZMe4JJ4mRYUIvhNIP7tgL1m5jHzSPBJE8fokMfWY2tU0dRN42ibYu6E4kAQPqPe iCaUulb80mAnWPeSTdT8IPy0F7bkDVgzqaN7LHcNGE70OfCSQyLuaO8D4idJhQhtdSBl gL48x9EDAKY7Wyw95WMEUzvsHRzRCnusS8zaQ= Received: by 10.101.148.13 with SMTP id a13mr810850ano.44.1316615048131; Wed, 21 Sep 2011 07:24:08 -0700 (PDT) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.100.43.9 with HTTP; Wed, 21 Sep 2011 07:23:28 -0700 (PDT) In-Reply-To: References: From: Ivan Voras Date: Wed, 21 Sep 2011 16:23:28 +0200 X-Google-Sender-Auth: RoXF_X7jA0ydKSXBk3d0yDl36QU Message-ID: To: geoffrey levand Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: Re[2]: Sharing device driver between kernel and user space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 14:24:09 -0000 On 21 September 2011 16:09, geoffrey levand wrote= : > Sure i can use the synchronization primitives, the problem is that the re= sponse to a request sent to PS3 VUART port is not > available immediately, and i have to disallow kernel access to the PS3 VU= ART while i'm waiting for the response in user > space. I send request with write syscall from user space and wait for res= ponse with read syscall. In the period of time > between sending request and receiving response i could receive some other= packets from VUART port, e.g. some kind of > event notification, =C2=A0i have to skip them. But kernel should not inte= rfer until i get my response. > So i would need to lock out the kernel during this time. I think i found = a good solution for this problem, just use a IOCTL > which tells kernel device driver to stop processing kernel requests and e= vents, something like SET_USER_MODE. > After that i can use it in user space. Have you read sema(9)? Or if returning EBUSY is acceptable when the resource is in use by $whatever, maybe you just need a boolean variable.