linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugeniu Rosca <erosca@de.adit-jv.com>
To: Balasubramani Vivekanandan 
	<balasubramani_vivekanandan@mentor.com>,
	<linux-renesas-soc@vger.kernel.org>
Cc: <fweisbec@gmail.com>, <tglx@linutronix.de>, <mingo@kernel.org>,
	<erosca@de.adit-jv.com>, <linux-kernel@vger.kernel.org>,
	Eugeniu Rosca <roscaeugeniu@gmail.com>
Subject: Re: [PATCH V1 0/1] tick: broadcast-hrtimer: Fix a race in bc_set_next
Date: Fri, 20 Sep 2019 12:58:11 +0200	[thread overview]
Message-ID: <20190920105811.GA16527@vmlxhi-102.adit-jv.com> (raw)
In-Reply-To: <20190918144138.24839-1-balasubramani_vivekanandan@mentor.com>

+linux-renesas-soc

In hope that the issue reported in [1] was seen by other members of
Renesas community.

[1] https://lkml.org/lkml/2019/9/18/711

On Wed, Sep 18, 2019 at 04:41:37PM +0200, Balasubramani Vivekanandan wrote:
> I was investigating a rcu stall warning on ARM64 Renesas Rcar3
> platform. On analysis I found that rcu stall warning was because the
> rcu_preempt kthread was starved of cpu time. rcu_preempt was blocked in
> the function schedule_timeout() and never woken up. On further
> investigation I found that local timer interrupts were not happening on
> the cpu where the rcu_preempt kthread was blocked. So the rcu_preempt
> was not woken up after timeout.
> I continued my analysis to debug why the timer failed on the cpu. I
> found that when cpu goes through idle state cycle, the timer failure
> happens. When the cpu enters the idle state it subscribes to the tick
> broadcast clock and shutsdown the local timer. Then on exit from idle
> state the local timer is programmed to fire interrupts. But I found that
> the during the error scenario, cpu fails to program the local timer on
> exit from idle state. The below code in
> __tick_broadcast_oneshot_control() is where the idle code exit path goes
> through and fails to program the timer hardware
> 
> now = ktime_get();
> if (dev->next_event <= now) {
> 	cpumask_set_cpu(cpu, tick_broadcast_force_mask);
> 		goto out;
> }
> 
> The value in next_event will be earlier than current time because the
> tick broadcast clock did not wake up the cpu on its subcribed
> timeout. Later when the cpu is woken up due to some other event this
> condition will arise. After the cpu woken up, any further timeout
> requests by any task on the cpu might fail to program the timer
> hardware because the value in next_event will be earlier than the
> current time.
> Then I focussed on why the tick broadcast clock failed to wake up the
> cpu. I noticed a race condition in the hrtimer based tick broadcast
> clock. The race condition results in a condition where the tick
> broadcast hrtimer is never restarted. I have created a patch to fix the
> race condition. Please review 
> 
> Balasubramani Vivekanandan (1):
>   tick: broadcast-hrtimer: Fix a race in bc_set_next
> 
>  kernel/time/tick-broadcast-hrtimer.c | 58 ++++++++++++++++++++++------
>  kernel/time/tick-broadcast.c         |  2 +
>  2 files changed, 48 insertions(+), 12 deletions(-)
> 
> -- 
> 2.17.1
> 

-- 
Best Regards,
Eugeniu

       reply	other threads:[~2019-09-20 10:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190918144138.24839-1-balasubramani_vivekanandan@mentor.com>
2019-09-20 10:58 ` Eugeniu Rosca [this message]
     [not found] ` <20190918144138.24839-2-balasubramani_vivekanandan@mentor.com>
     [not found]   ` <alpine.DEB.2.21.1909232041080.1934@nanos.tec.linutronix.de>
2019-09-24 17:14     ` [PATCH V1 1/1] tick: broadcast-hrtimer: Fix a race in bc_set_next Eugeniu Rosca
     [not found]     ` <20190925115541.1170-1-balasubramani_vivekanandan@mentor.com>
2019-09-25 13:32       ` [PATCH V2 " Balasubramani Vivekanandan
2019-09-25 14:20       ` Balasubramani Vivekanandan
2019-09-25 14:20         ` Balasubramani Vivekanandan
2019-09-26 10:01           ` Thomas Gleixner
2019-09-26 13:51             ` [PATCH V3 " Balasubramani Vivekanandan
2019-09-26 13:51               ` Balasubramani Vivekanandan
2019-09-26 15:43                 ` Eugeniu Rosca

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=20190920105811.GA16527@vmlxhi-102.adit-jv.com \
    --to=erosca@de.adit-jv.com \
    --cc=balasubramani_vivekanandan@mentor.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=roscaeugeniu@gmail.com \
    --cc=tglx@linutronix.de \
    /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).