From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Horman Subject: Re: [PATCH v2] Change alarm cancel function to thread-safe: Date: Tue, 30 Sep 2014 08:54:02 -0400 Message-ID: <20140930125402.GD2193@hmsreliant.think-freely.org> References: <20140926193905.GH5619@hmsreliant.think-freely.org> <2601191342CEEE43887BDE71AB9772582138410B@IRSMSX104.ger.corp.intel.com> <20140928204754.GC4012@localhost.localdomain> <2601191342CEEE43887BDE71AB977258213874C5@IRSMSX104.ger.corp.intel.com> <20140929103315.GB12072@BRICHA3-MOBL> <2601191342CEEE43887BDE71AB9772582138DE32@IRSMSX105.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: "dev-VfR2kkLFssw@public.gmane.org" To: "Ananyev, Konstantin" Return-path: Content-Disposition: inline In-Reply-To: <2601191342CEEE43887BDE71AB9772582138DE32-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On Tue, Sep 30, 2014 at 12:30:08PM +0000, Ananyev, Konstantin wrote: >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces-VfR2kkLFssw@public.gmane.org] On Behalf Of Wodkowski, Pawel= X > > Sent: Tuesday, September 30, 2014 1:05 PM > > To: Wodkowski, PawelX; Richardson, Bruce > > Cc: dev-VfR2kkLFssw@public.gmane.org > > Subject: Re: [dpdk-dev] [PATCH v2] Change alarm cancel function to th= read-safe: > >=20 > > > -----Original Message----- > > > Pawe=C5=82 > > > > > > > On Mon, Sep 29, 2014 at 10:11:38AM +0000, Wodkowski, PawelX wrote= : > > > > > > > > > > > > > > Image how you will be damned by someone that not even notic= e you > > > > change > > > > > > > and he Is managing some kind of resource based on returned = number of > > > > > > > set/canceled timers. If you suddenly start returning negati= ve values how > > > > those > > > > > > > application will behave? Silently changing returned value d= omain is evil in > > > > its > > > > > > > pure form. > > > > > > > > > > > > As I can see the impact is very limited. > > > > > > > > > > It is small impact to DPDK but can be huge to user application: > > > > > > > > This is why we traditionally have in the release-notes for each r= elease a > > > > section dedicated to calling out changes from one release to anot= her. [See > > > > http://dpdk.org/doc/intel/dpdk-release-notes-1.7.0.pdf section 5]= . Since > > > > from release-to-release there are generally only a couple of chan= ges - > > > > though our next release may be a little different - the actual ch= anges are > > > > clear enough to read about without wading through pages of docume= ntation. > > > I > > > > thinking calling out the change in both the release notes and the= API docs > > > > is sufficient even for a change like this. > > > > > > > > Basically, I wouldn't let API stability factor in too much in try= ing to get > > > > a proper fix for this issue. > > > > > > > > /Bruce > > > > > > > > > > Summarizing all proposed solutions and to be able to produce final = patch - what > > > Is desired behavior after fix? > > > > > > 1. do we leave as is in Patch v2: > > > 1.1 if canceling from other thread - if one of the alarms is execut= ing, wait to > > > finish its execution and then cancel any rearmed alarms. > > > 1.2 if canceling from alarm handler and one of the alarms to cancel= is this > > > executing callback do no wait for it to finish and cancel anythin= g else. > > > > > > in both cases return number of canceled callbacks. > > > > > > 2. Do exactly like in 1. but return -EINPROGRESS instead of cancele= d alarms > > > if one of the alarms to cancel is currently executing callback fr= om alarm thread > > > (information about number of canceled alarms will be lost). > >=20 > > Or instead of returning -EINPROGRESS set errno to EINPROGRESS (replac= e > > returning error value by setting errno and function can always return= number > > of canceled callbacks - in error condition 0)? >=20 > Yes that's looks like a better option.=20 > As I remember, inside DPDK we have our own rte_errno, that we can proba= bly use here. > My vote would be for that approach. >=20 You'll want to document that interface to make sure callers understand th= at a non-zero return code doesn't automatically mean complete success, but yes= , in this case that seems like a pretty reasonable solution. Neil > Konstantin >=20 > >=20 > > > > > > 3. refuse to cancel anything if canceling currently executing alarm= from alarm > > > callback and return -EINPROGRESS otherwise do like in 1.1. > > > > > > 4. Implement behaviour 1/2/3 (which?) and add API call to interroga= te list of > > > alarms and retrun state of given alarms(s). > > > > > > 5. other solutions? > > > > > > Pawel >=20