lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+HDTgSwoO+uXQ0xmmBzaDy3ViZcZ765P6_GsAmxKedRVKyY_A@mail.gmail.com>
Date:   Mon, 9 Oct 2023 14:33:30 -0400
From:   Vineeth Pillai <vineethrp@...gle.com>
To:     Joel Fernandes <joel@...lfernandes.org>
Cc:     Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        Suleiman Souhlal <suleiman@...gle.com>,
        Hsin Yi <hsinyi@...gle.com>,
        Frederic Weisbecker <frederic@...nel.org>,
        "Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH RFC] sched/fair: Avoid unnecessary IPIs for ILB

On Sun, Oct 8, 2023 at 1:35 PM Joel Fernandes <joel@...lfernandes.org> wrote:
>
[...snip...]
> > The patch does make _nohz_idle_balance() run more parallel, as previously
> > it would be generally run by the first-idle CPU in nohz.idle_cpus_mask (at
> > least for next_balance updates), but I think it's still SMP-safe, as all
> > key data structure updates are already rq-locked AFAICS.
>
> One thing I am confused about in the original code is:
>
> tick_nohz_idle_stop_tick() is what sets the nohz.idle_cpus_mask.
> However, nohz_run_idle_balance() is called before that can happen, in
> do_idle(). So it is possible that NOHZ_NEWILB_KICK is set for a CPU but it is
> not yet in the mask.
>
> So will this code in _nohz_idle_balance() really run in such a scenario?
>
>                 if (flags & NOHZ_STATS_KICK)
>                         has_blocked_load |= update_nohz_stats(rq);
>
> AFAICS, this loop may not select the CPU due to its absence from the mask:
>         for_each_cpu_wrap(balance_cpu,  nohz.idle_cpus_mask, this_cpu+1)
>
I have traced this a bit further. As Joel mentioned, the
nohz.idle_cpus_mask shouldn't contain this cpu when
nohz_run_idle_balance () is called from do_idle(), but on tracing I
have seen that it does have it mostly with HIGHRES. And I feel this is
a bug. We call nohz_balance_enter_idle() when we turn off the tick,
but we don't always call nohz_balance_exit_idle() when we turn the
tick back on. We call it only on the next tick on this cpu in
nohz_balancer_kick. If a wakeup happens on this cpu while the tick is
off, we re-enable the tick, but do not remove ourselves from the
nohz.idle_cpus_mask. So, ILB will consider this cpu to be a valid pick
until the next tick on this cpu where it gets removed. I am not sure
if this is intentional.

If this is a bug and we fix it by calling nohz_balance_exit_idle
during restart_tick, then we might not probably need NOHZ_NEWIDLE_KICK
flag and could use NOHZ_STATS_KICK as there will not be any overlap
between nohz_run_idle_balance and nohz_idle_balance.

Thanks,
Vineeth

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ