From: "Gregory Haskins" <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
To: "Davide Libenzi" <davidel-AhlLAIvw+VEjIGhXcJzhZg@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 05/10] KVM: Adds ability to signal userspace using a file-descriptor
Date: Mon, 14 May 2007 16:18:59 -0400 [thread overview]
Message-ID: <46488BCD.BA47.005A.0@novell.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0705141207070.19682-GPJ85BhbkB8RepQJljzAVbITYcZ0+W3JAL8bYrjMMd8@public.gmane.org>
>>> On Mon, May 14, 2007 at 3:12 PM, in message
<Pine.LNX.4.64.0705141207070.19682-GPJ85BhbkB8RepQJljzAVbITYcZ0+W3JAL8bYrjMMd8@public.gmane.org>, Davide Libenzi
<davidel-AhlLAIvw+VEjIGhXcJzhZg@public.gmane.org> wrote:
> On Mon, 14 May 2007, Gregory Haskins wrote:
>
>> >>> On Mon, May 14, 2007 at 1:23 PM, in message <46489B12.8030807-atKUWr5tajBWk0Htik3J/w@public.gmane.org>,
>> Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
>> >
>> >> Do you close the signaled fd after receiving the signal/event? If you
>> >> don't close it, eventfd will always return ready (POLLIN).
>> >>
>> >
>> > We don't. Anyway, that's what we thought. Thanks for the confirmation.
>> >
>>
>> And plus I just finished converting to Davide's eventfd, so its moot ;)
>>
>> On that topic, I could use some advice:
>>
>> I was originally planning on adding a new ioctl like KVM_VCPU_CREATE_EVENTFD
> which would allocate a new eventfd and return it. However, I soon realized
> that the only method to create an eventfd is sys_eventfd(), which is not
> exported by the eventfd.h headerfile (presumably this must be a new system
> call).
>>
>> So based on that, I figured I would change the model so that the usermode
> app should call the eventfd open() call on its own, and then they could
> register the fd with me. So KVM_VCPU_CREATE_EVENTFD becomes
> KVM_VCPU_SET_EVENTFD (where - 1 "unregisters" it).
>>
>> Does this sound like a reasonable approach? If so, how does the usermode
> app actually open the eventfd today? Is there a new glibc that I need to get
> the new system call? Or can the app use open() somehow? If open(), what is
> the path that should be specified?
>>
>> Conversely, if my first approach was the right one how do I invoke the
> sys_eventfd()? Is there a way to invoke system calls in kernel mode? A
> better way?
>>
>> Any advice appreciated.
>
> The eventfd syscall is defined in include/linux/syscalls.h
> From userspace, till glibc aligns:
>
> #include <sys/syscall.h>
>
> #ifndef __NR_eventfd
> #if defined(__x86_64__)
> #define __NR_eventfd 283
> #elif defined(__i386__)
> #define __NR_eventfd 323
> #else
> #error Cannot detect your architecture!
> #endif
> #endif
>
> static int eventfd(int count) {
>
> return syscall(__NR_eventfd, count);
> }
>
>
> If the kernel side receives an fd from userspace, it must use:
>
> file = eventfd_fget(fd);
> if (IS_ERR(file))
> ....
> eventfd_signal(file, 1);
> fput(file);
>
>
>
> - Davide
Thanks Davide,
That is very helpful. Is there any reason why we can't export eventfd_signal() and eventfd_fget() to modules?
-Greg
-------------------------------------------------------------------------
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/
next prev parent reply other threads:[~2007-05-14 20:18 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-10 12:46 [PATCH 00/10] in-kernel APIC v3 (kernel side) Gregory Haskins
[not found] ` <20070510123831.10200.4769.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-10 12:46 ` [PATCH 01/10] KVM: Adds support for in-kernel mmio handlers Gregory Haskins
2007-05-10 12:46 ` [PATCH 02/10] KVM: VMX - fix interrupt checking on light-exit Gregory Haskins
2007-05-10 12:46 ` [PATCH 03/10] KVM: Add irqdevice object Gregory Haskins
2007-05-10 12:47 ` [PATCH 04/10] KVM: Adds ability to preempt an executing VCPU Gregory Haskins
2007-05-10 12:47 ` [PATCH 05/10] KVM: Adds ability to signal userspace using a file-descriptor Gregory Haskins
[not found] ` <20070510124706.10200.68571.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-13 13:00 ` Avi Kivity
[not found] ` <46470BF7.5080108-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 12:15 ` Gregory Haskins
[not found] ` <46481A61.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-14 12:22 ` Avi Kivity
[not found] ` <46485488.2010608-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 14:00 ` Gregory Haskins
[not found] ` <46483320.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-14 14:42 ` Avi Kivity
[not found] ` <4648756D.5040001-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 17:18 ` Gregory Haskins
2007-05-14 16:52 ` Davide Libenzi
[not found] ` <Pine.LNX.4.64.0705140948150.19682-GPJ85BhbkB8RepQJljzAVbITYcZ0+W3JAL8bYrjMMd8@public.gmane.org>
2007-05-14 17:12 ` Avi Kivity
[not found] ` <4648986B.9090403-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 17:15 ` Davide Libenzi
[not found] ` <Pine.LNX.4.64.0705141013310.19682-GPJ85BhbkB8RepQJljzAVbITYcZ0+W3JAL8bYrjMMd8@public.gmane.org>
2007-05-14 17:23 ` Avi Kivity
[not found] ` <46489B12.8030807-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 19:01 ` Gregory Haskins
[not found] ` <464879A3.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-14 19:12 ` Davide Libenzi
[not found] ` <Pine.LNX.4.64.0705141207070.19682-GPJ85BhbkB8RepQJljzAVbITYcZ0+W3JAL8bYrjMMd8@public.gmane.org>
2007-05-14 20:18 ` Gregory Haskins [this message]
[not found] ` <46488BCD.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-14 21:32 ` Davide Libenzi
2007-05-10 12:47 ` [PATCH 06/10] KVM: Add support for in-kernel LAPIC model Gregory Haskins
2007-05-10 12:47 ` [PATCH 07/10] KVM: Adds support for real NMI injection on VMX processors Gregory Haskins
2007-05-10 12:47 ` [PATCH 08/10] KVM: Adds basic plumbing to support TPR shadow features Gregory Haskins
2007-05-10 12:47 ` [PATCH 09/10] KVM: Add statistics from interrupt subsystem Gregory Haskins
[not found] ` <20070510124726.10200.53053.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-14 11:17 ` Avi Kivity
2007-05-10 12:47 ` [PATCH 10/10] KVM: Adds support for TPR shadowing under VMX processors Gregory Haskins
2007-05-10 13:07 ` [PATCH 00/10] in-kernel APIC v3 (kernel side) Dor Laor
[not found] ` <64F9B87B6B770947A9F8391472E032160BBA66AF-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-05-10 13:20 ` Gregory Haskins
[not found] ` <4642E39D.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-13 8:00 ` Dor Laor
[not found] ` <64F9B87B6B770947A9F8391472E032160BC745D3-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-05-13 13:59 ` Gregory Haskins
[not found] ` <4646E16D.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-13 14:06 ` Dor Laor
[not found] ` <64F9B87B6B770947A9F8391472E032160BC74642-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-05-14 12:37 ` Gregory Haskins
[not found] ` <46481FC0.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-14 13:04 ` Dor Laor
2007-05-13 12:38 ` Avi Kivity
[not found] ` <464706BF.6000808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 11:59 ` Gregory Haskins
[not found] ` <464816AB.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-14 12:05 ` Dor Laor
2007-05-14 12:14 ` Avi Kivity
2007-05-10 13:32 ` Gregory Haskins
2007-05-13 13:10 ` Avi Kivity
[not found] ` <46470E58.2040208-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 12:23 ` Gregory Haskins
[not found] ` <46481C4B.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-14 12:24 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46488BCD.BA47.005A.0@novell.com \
--to=ghaskins-et1tbqhtxzrqt0dzr+alfa@public.gmane.org \
--cc=davidel-AhlLAIvw+VEjIGhXcJzhZg@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox