From: "Michael S. Tsirkin" <mst@redhat.com>
To: Paolo Bonzini <bonzini@gnu.org>
Cc: davidel@xmailserver.org, avi@redhat.com, gleb@redhat.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] eventfd: reorganize the code to simplify new flags
Date: Thu, 27 Aug 2009 14:58:24 +0300 [thread overview]
Message-ID: <20090827115824.GA21882@redhat.com> (raw)
In-Reply-To: <4A9672A5.60004@gnu.org>
On Thu, Aug 27, 2009 at 01:48:53PM +0200, Paolo Bonzini wrote:
> On 08/20/2009 05:57 PM, Michael S. Tsirkin wrote:
>> +static inline int eventfd_writeable(struct eventfd_ctx *ctx, u64 n)
>> +{
>> + return ULLONG_MAX - n> ctx->count;
>> +}
>> +
>> +static inline void eventfd_dowrite(struct eventfd_ctx *ctx, u64 ucnt)
>> +{
>> + if (eventfd_writeable(ctx, ucnt))
>> + ucnt = ULLONG_MAX - ctx->count;
>> +
>> + ctx->count += ucnt;
>
> In any case, this usage of eventfd_writeable is wrong: the code was like
> this:
>
> - if (ULLONG_MAX - ctx->count < n)
> - n = (int) (ULLONG_MAX - ctx->count);
> - ctx->count += n;
> + eventfd_dowrite(ctx, n);
>
> and so it should be !eventfd_writable. (This smelled when I was editing
> patch 2, so I went back and checked patch 1).
>
> Paolo
Right, patch 2 actually fixed this back. The best thing is to open-code
it actually, since we handle it in a way that only applies to a counter,
anyway. Will post a fixed v1.
--
MST
next prev parent reply other threads:[~2009-08-27 12:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1250783333.git.mst@redhat.com>
2009-08-20 15:57 ` [PATCH 1/2] eventfd: reorganize the code to simplify new flags Michael S. Tsirkin
2009-08-27 11:48 ` Paolo Bonzini
2009-08-27 11:58 ` Michael S. Tsirkin [this message]
2009-08-27 12:02 ` Michael S. Tsirkin
2009-08-20 15:57 ` [PATCH 2/2] eventfd: EFD_STATE flag 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=20090827115824.GA21882@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=bonzini@gnu.org \
--cc=davidel@xmailserver.org \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 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.