Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1158462

Re: [PATCH 8/9] hrtimer: Allow hrtimer::function() to free the timer

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 8/9] hrtimer: Allow hrtimer::function() to free the timer
Date 2015-06-04 13:00 +0200
Message-ID <pxB2q-6YZ-23@gated-at.bofh.it> (permalink)
References (1 earlier) <pxhn5-2Re-41@gated-at.bofh.it> <pxjIf-6rK-39@gated-at.bofh.it> <pxoeS-4Kt-17@gated-at.bofh.it> <pxztF-4Gg-35@gated-at.bofh.it> <pxASK-6NR-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jun 04, 2015 at 12:49:02PM +0200, Peter Zijlstra wrote:
> Needs more comments at the very least, its fully of trickery.
> 
> @@ -1118,10 +1125,16 @@ static void __run_hrtimer(struct hrtimer
>  	enum hrtimer_restart (*fn)(struct hrtimer *);
>  	int restart;
>  
> -	WARN_ON(!irqs_disabled());
> +	lockdep_assert_held(&cpu_base->lock);
>  
>  	debug_deactivate(timer);
> -	base->running = timer;
> +	cpu_base->running = timer;
> +
> +	/*
> +	 * separate the ->running assignment from the ->state assignment
> +	 */
> +	write_seqcount_begin(&cpu_base->seq);

Maybe these need to be raw_write_seqcount_latch()..

> +
>  	__remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, 0);
>  	timer_stats_account_hrtimer(timer);
>  	fn = timer->function;
> @@ -1150,8 +1163,13 @@ static void __run_hrtimer(struct hrtimer
>  	    !(timer->state & HRTIMER_STATE_ENQUEUED))
>  		enqueue_hrtimer(timer, base);
>  
> -	WARN_ON_ONCE(base->running != timer);
> -	base->running = NULL;
> +	/*
> +	 * separate the ->running assignment from the ->state assignment
> +	 */
> +	write_seqcount_end(&cpu_base->seq);
> +
> +	WARN_ON_ONCE(cpu_base->running != timer);
> +	cpu_base->running = NULL;
>  }
>  
>  static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 8/9] hrtimer: Allow hrtimer::function() to free the timer Kirill Tkhai <tkhai@yandex.ru> - 2015-06-03 18:30 +0200
  Re: [PATCH 8/9] hrtimer: Allow hrtimer::function() to free the timer Peter Zijlstra <peterz@infradead.org> - 2015-06-04 12:50 +0200
    Re: [PATCH 8/9] hrtimer: Allow hrtimer::function() to free the timer Peter Zijlstra <peterz@infradead.org> - 2015-06-04 13:00 +0200
    Re: [PATCH 8/9] hrtimer: Allow hrtimer::function() to free the timer Peter Zijlstra <peterz@infradead.org> - 2015-06-04 13:00 +0200

csiph-web