lkml.org 
[lkml]   [2009]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/2] eventfd: new EFD_STATE flag
On Thu, Aug 27, 2009 at 07:38:46AM -0700, Davide Libenzi wrote:
> On Thu, 27 Aug 2009, Michael S. Tsirkin wrote:
>
> > On Thu, Aug 27, 2009 at 07:21:49AM -0700, Davide Libenzi wrote:
> > > On Thu, 27 Aug 2009, Paolo Bonzini wrote:
> > >
> > > > > Ok, so why not using the eventfd counter as state?
> > > > > On the device side:
> > > > >
> > > > > void write_state(int sfd, int state) {
> > > > > u64 cnt;
> > > > >
> > > > > /* Clear the current state, sfd is in non-blocking mode */
> > > > > read(sfd,&cnt, sizeof(cnt));
> > > > > /* Writes new state */
> > > > > cnt = 1 + !!state;
> > > > > write(sfd,&cnt, sizeof(cnt));
> > > > > }
> > > >
> > > > It's interesting [no sarcasm intended, mind] that EFD_SEMAPHORE was
> > > > added exactly to avoid a read+write combination for the case of
> > > > decrementing a value.
> > >
> > > Like I repeated 25 times already, EFD_SEMAPHORE was added, because a
> > > *semaphore* is a pretty widely known and used abstraction.
> >
> > what about an atomic variable, btw? does it make sense to implement
> > write that does compare and exchange?
>
> It is surprising to me, that is front of a workable solution w/out any
> use-once additions, yet you want to try to add optimizations and new
> ad-hoc abstractions to user visible interfaces.
> Now, you tell me what an atomic variable has to do with an eventfd.
>
>
> - Davide
>

Oh, I stopped pushing EFD_STATE since we have a solution.
I am just trying to grok what does and what does not consititute a
use-once addition, in your mind, and what does and what does not
belong in eventfd. The reason atomic does not belong there and
semaphore does is because one waits on semaphore but not
on atomic? Is that it?

--
MST


\
 
 \ /
  Last update: 2009-08-27 16:53    [W:0.433 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site