From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 5/9] KVM: Adds ability to signal userspace using a file-descriptor Date: Wed, 16 May 2007 15:00:41 +0300 Message-ID: <464AF269.7030402@qumranet.com> References: <20070515031217.9382.44999.stgit@novell1.haskins.net> <20070515031536.9382.16826.stgit@novell1.haskins.net> <4649650E.2070102@qumranet.com> <464968D6.BA47.005A.0@novell.com> <4649A4E1.BA47.005A.0@novell.com> <20070515162249.GA19238@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Christoph Hellwig , kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Davide Libenzi Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Davide Libenzi wrote: > On Tue, 15 May 2007, Christoph Hellwig wrote: > > >> On Tue, May 15, 2007 at 12:18:17PM -0400, Gregory Haskins wrote: >> >>>>>> On Tue, May 15, 2007 at 11:40 AM, in message >>>>>> >>> , Davide Libenzi >>> wrote: >>> >>>> I don't know how critical is the path where you will be doing check. The >>>> eventfd_fget() is pretty fast, so if you're not looking at a performance >>>> critical path, I'd suggest that. Otherwise you can do an early >>>> eventfd_get, and keep the file*. If you have no the ways to know if the >>>> userspace disconnected, an atomic_read(&file- >f_count)==1 will tell you >>>> that you're the only owner of the file* (that is, userspace closed the >>>> eventfd descriptor). I'd give preference to the former option though. >>>> >>> Thanks for the insight, Davide. It sounds like we can probably stay with the way I have it for now, and keep the file->f_count idea in our back pocket should a performance problem arise. >>> >> accessing file->f_count is not allowed for drivers. It took us quite a >> bit of effort to clean up all users a while ago, and it turned out most >> of them were rather buggy. >> > > Right, you could use the file_count() macro :) > Seriuosly, if this (doing an eventfd_fget+fput) becomes a problem, I can > have the check done in eventfd_signal() and return a proper error code. > > IMO doing eventfd_fget() asap is best. I much prefer refcounted pointers to handles in the kernel: it's easier to see what things point to, and there is to context needed for dereferencing. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/