From: Tejun Heo <tj@kernel.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Amit Shah <amit.shah@redhat.com>,
netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH RFC] virtio_net: fix refill related races
Date: Wed, 14 Dec 2011 15:54:12 -0800 [thread overview]
Message-ID: <20111214235412.GA29835@google.com> (raw)
In-Reply-To: <87iplltd0g.fsf@rustcorp.com.au>
Hello, Rusty.
On Tue, Dec 13, 2011 at 01:05:11PM +1030, Rusty Russell wrote:
> Both places where we call:
>
> cancel_delayed_work_sync(&vi->refill);
>
> Do not actually guarantee that vi->refill isn't running, because it
> can requeue itself. A 'bool no_more_refill' field seems like the
> simplest fix for this, but I don't think it's sufficient.
>
> Tejun, is this correct? What's the correct way to synchronously stop a
> delayed_work which can "schedule_delayed_work(&vi->refill, HZ/2);" on
> itself?
cancel_delayed_work_sync() itself should be good enough. It first
steals the pending state and then waits for it to finish if in-flight.
Queueing itself afterwards becomes noop.
Thanks.
--
tejun
WARNING: multiple messages have this Message-ID (diff)
From: Tejun Heo <tj@kernel.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Amit Shah <amit.shah@redhat.com>,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] virtio_net: fix refill related races
Date: Wed, 14 Dec 2011 15:54:12 -0800 [thread overview]
Message-ID: <20111214235412.GA29835@google.com> (raw)
In-Reply-To: <87iplltd0g.fsf@rustcorp.com.au>
Hello, Rusty.
On Tue, Dec 13, 2011 at 01:05:11PM +1030, Rusty Russell wrote:
> Both places where we call:
>
> cancel_delayed_work_sync(&vi->refill);
>
> Do not actually guarantee that vi->refill isn't running, because it
> can requeue itself. A 'bool no_more_refill' field seems like the
> simplest fix for this, but I don't think it's sufficient.
>
> Tejun, is this correct? What's the correct way to synchronously stop a
> delayed_work which can "schedule_delayed_work(&vi->refill, HZ/2);" on
> itself?
cancel_delayed_work_sync() itself should be good enough. It first
steals the pending state and then waits for it to finish if in-flight.
Queueing itself afterwards becomes noop.
Thanks.
--
tejun
next prev parent reply other threads:[~2011-12-14 23:54 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 15:21 [PATCH RFC] virtio_net: fix refill related races Michael S. Tsirkin
2011-12-07 15:21 ` Michael S. Tsirkin
2011-12-08 4:37 ` Rusty Russell
2011-12-08 4:37 ` Rusty Russell
2011-12-08 4:37 ` Rusty Russell
2011-12-11 14:44 ` Michael S. Tsirkin
2011-12-11 14:44 ` Michael S. Tsirkin
2011-12-11 22:55 ` Rusty Russell
2011-12-11 22:55 ` Rusty Russell
2011-12-12 11:54 ` Michael S. Tsirkin
2011-12-12 11:54 ` Michael S. Tsirkin
2011-12-13 2:35 ` Rusty Russell
2011-12-13 2:35 ` Rusty Russell
2011-12-14 23:54 ` Tejun Heo [this message]
2011-12-14 23:54 ` Tejun Heo
2011-12-20 19:09 ` Michael S. Tsirkin
2011-12-20 19:09 ` Michael S. Tsirkin
2011-12-20 19:09 ` Tejun Heo
2011-12-20 19:09 ` Tejun Heo
2011-12-20 19:30 ` Michael S. Tsirkin
2011-12-20 19:30 ` Michael S. Tsirkin
2011-12-20 19:31 ` Tejun Heo
2011-12-20 19:31 ` Tejun Heo
2011-12-20 19:45 ` Michael S. Tsirkin
2011-12-20 19:45 ` Michael S. Tsirkin
2011-12-20 23:43 ` Rusty Russell
2011-12-20 23:43 ` Rusty Russell
2011-12-21 9:06 ` Michael S. Tsirkin
2011-12-21 9:06 ` Michael S. Tsirkin
2011-12-22 3:53 ` Rusty Russell
2011-12-22 3:53 ` Rusty Russell
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=20111214235412.GA29835@google.com \
--to=tj@kernel.org \
--cc=amit.shah@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.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.