All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: davidel@xmailserver.org, gleb@redhat.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH-RFC 2/2] eventfd: EFD_STATE flag
Date: Mon, 03 Aug 2009 18:29:36 +0300	[thread overview]
Message-ID: <4A770260.5000507@redhat.com> (raw)
In-Reply-To: <20090803151426.GA3630@redhat.com>

On 08/03/2009 06:14 PM, Michael S. Tsirkin wrote:
> On Mon, Aug 03, 2009 at 06:09:38PM +0300, Avi Kivity wrote:
>    
>> On 07/28/2009 08:55 PM, Michael S. Tsirkin wrote:
>>      
>>> This implements a new EFD_STATE flag for eventfd.
>>> When set, this flag changes eventfd behaviour in the following way:
>>> - write simply stores the value written, and is always non-blocking
>>> - read unblocks when the value written changes, and
>>>     returns the value written
>>>
>>> Motivation: we'd like to use eventfd in qemu to pass interrupts from
>>> (emulated or assigned) devices to guest. For level interrupts, the
>>> counter supported currently by eventfd is not a good match: we really
>>> need to set interrupt to a level, typically 0 or 1, and give the guest
>>> ability to see the last value written.
>>>
>>>
>>> @@ -31,37 +31,59 @@ struct eventfd_ctx {
>>>    	 * issue a wakeup.
>>>    	 */
>>>    	__u64 count;
>>> +	/*
>>> +	 * When EF_STATE flag is set, eventfd behaves differently:
>>> +	 * value written gets stored in "count", read will copy
>>> +	 * "count" to "state".
>>> +	 */
>>> +	__u64 state;
>>>    	unsigned int flags;
>>>    };
>>>
>>>        
>> Why not write the new value into ->count directly?
>>      
>
> That's what it says. state is ther to detect that value was changed
> after last read. Makes sense?
>    

Why not do it at the point of the write?

     if (value != ctx->count) {
         ctx->count = value;
         wake_things_up();
     }

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2009-08-03 15:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1248803500.git.mst@redhat.com>
2009-07-28 17:54 ` [PATCH-RFC 1/2] eventfd: reorganize the code to simplify new flags Michael S. Tsirkin
2009-07-28 17:55 ` [PATCH-RFC 2/2] eventfd: EFD_STATE flag Michael S. Tsirkin
2009-08-03 15:09   ` Avi Kivity
2009-08-03 15:14     ` Michael S. Tsirkin
2009-08-03 15:29       ` Avi Kivity [this message]
2009-08-03 16:57         ` Michael S. Tsirkin
2009-08-04  8:53           ` Avi Kivity
2009-08-04  8:54             ` Michael S. Tsirkin
2009-08-04  9:17               ` Avi Kivity
2009-08-04  9:17                 ` Gleb Natapov
2009-08-04  9:25                   ` Avi Kivity
2009-08-04  9:23                     ` Gleb Natapov
2009-08-04  9:30                       ` Avi Kivity
2009-08-04  9:26                         ` Michael S. Tsirkin
2009-08-04 10:06                           ` Avi Kivity
2009-08-04  9:33                 ` Michael S. Tsirkin

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=4A770260.5000507@redhat.com \
    --to=avi@redhat.com \
    --cc=davidel@xmailserver.org \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.