netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eliezer Tamir <eliezer.tamir@linux.intel.com>
To: David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	willemb@google.com, erdnetdev@gmail.com, andi@firstfloor.org,
	hpa@zytor.com, devel-lists@codyps.com, eliezer@tamir.org.il
Subject: Re: [PATCH net-next 0/2] net: lls cleanup patches
Date: Tue, 02 Jul 2013 11:45:29 +0300	[thread overview]
Message-ID: <51D29329.4060004@linux.intel.com> (raw)
In-Reply-To: <51D2919F.7050007@linux.intel.com>

On 02/07/2013 11:38, Eliezer Tamir wrote:
> On 02/07/2013 00:08, David Miller wrote:
>> From: Eliezer Tamir <eliezer.tamir@linux.intel.com>
>> Date: Fri, 28 Jun 2013 15:59:18 +0300
>>
>>> Here are two cleanup patches.
>>>
>>> 1. fix warning from debug_smp_processor_id().
>>> - reported by Cody P Schafer.
>>>
>
>> Applied, but like Ben said perhaps you want to remember the last cpu you
>> got the sched_clock() measurement from and abort the ll poll if it
>> changes
>> on you instead of using a comparison between two cpus.
>>
>> But then again, since preemption is enabled, the cpu could change
>> back and forth during the sched_clock() call, so you wouldn't be able
>> to reliably detect this anyways.
>>
>> In the grand scheme of things all of this probably doesn't matter at
>> all.
>
> The only thing that really worries me, is the possibility of time
> on the new cpu to be completely random, then we could be back in the
> range where time_after() will be false again and end up polling for
> another year.
>
> A simple way to limit the damage would be to use time_in_range()
> instead of time_after(), then if we have a completely random time we
> would be out of the range and fail safely.
>
> would something like this be an acceptable solution?
>
> ---

actually, this code has a bug.

> -static inline bool can_poll_ll(u64 end_time)
> +static inline bool can_poll_ll(u64 start_time, u64 run_time)
>   {
> -    return !time_after64(ll_sched_clock(), end_time);
> +    return time_in_range64(ll_sched_clock(), start_time,
> +                   start_time + run_time);
>   }
>
this will call sched_clock() twice.

I will send a fix after I test it.

-Eliezer

  reply	other threads:[~2013-07-02  8:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 12:59 [PATCH net-next 0/2] net: lls cleanup patches Eliezer Tamir
2013-06-28 12:59 ` [PATCH net-next 1/2] net: fix LLS debug_smp_processor_id() warning Eliezer Tamir
2013-06-28 16:51   ` Using sched_clock() for polling time limit Ben Hutchings
2013-06-29 18:50     ` Eliezer Tamir
2013-07-01 19:48       ` Ben Hutchings
2013-06-28 12:59 ` [PATCH net-next 2/2] net: avoid calling sched_clock when LLS is off Eliezer Tamir
2013-06-28 14:38   ` Andi Kleen
2013-06-28 14:54     ` Eliezer Tamir
2013-07-01 21:08 ` [PATCH net-next 0/2] net: lls cleanup patches David Miller
2013-07-02  8:38   ` Eliezer Tamir
2013-07-02  8:45     ` Eliezer Tamir [this message]
2013-07-02  9:49       ` [PATCH v2 net-next] net: convert lls to use time_in_range() Eliezer Tamir
2013-07-02 19:56         ` David Miller
2013-07-02 20:10         ` Ben Hutchings
2013-07-02 20:28           ` Eliezer Tamir
2013-07-02 20:42             ` Ben Hutchings
2013-07-03  7:00               ` Eliezer Tamir

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=51D29329.4060004@linux.intel.com \
    --to=eliezer.tamir@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=davem@davemloft.net \
    --cc=devel-lists@codyps.com \
    --cc=eliezer@tamir.org.il \
    --cc=erdnetdev@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.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).