From: Ralf Baechle DL5RB <ralf@linux-mips.org>
To: Vaishali Thakkar <vthakkar1994@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
linux-hams@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH] net: rose: Use mod_timer
Date: Sat, 6 Jun 2015 10:02:30 +0200 [thread overview]
Message-ID: <20150606080230.GB16240@linux-mips.org> (raw)
In-Reply-To: <20150606042234.GA15542@vaishali-Ideapad-Z570>
Hi Vaishali,
On Sat, Jun 06, 2015 at 09:52:34AM +0530, Vaishali Thakkar wrote:
> Use mod_timer instead of del_timer followed by add_timer to update
> the expire field of the active timer.
>
> The semantic patch that performs this transformation is as follows:
>
> @change@
> expression e1, e2, e3, e4;
> @@
>
> - del_timer(&e1);
> ... when != e1 = e3
> - e1.expires = e2;
> ... when != e1 = e4
> - add_timer (&e1);
> + mod_timer (&e1, e2);
This isn't quite right. All the instances of this pattern in the ROSE
stack also modify the timer's data and function fields which if the timer
is still running and expiring while being fiddled with, might result in
a race condition, that is the old function but new data field being used
in combination or something like that.
For some of the timers (maybe all?) it should be possible to proof that
always the same values for data and function are being used. These
initializations could then be used elsewhere and the code could then
indeed be switched to mod_timer.
Ralf
prev parent reply other threads:[~2015-06-06 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-06 4:22 [PATCH] net: rose: Use mod_timer Vaishali Thakkar
2015-06-06 8:02 ` Ralf Baechle DL5RB [this message]
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=20150606080230.GB16240@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=davem@davemloft.net \
--cc=julia.lawall@lip6.fr \
--cc=linux-hams@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vthakkar1994@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).