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: <20111202103921.GA29180@tiehlicka.suse.cz>
Date:	Fri, 2 Dec 2011 11:39:21 +0100
From:	Michal Hocko <mhocko@...e.cz>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
Cc:	"Artem S. Tashkinov" <t.artem@...os.com>, pomac@...or.com,
	linux-kernel@...r.kernel.org, tino.keitel@...ei.de,
	Len Brown <lenb@...nel.org>
Subject: Re: [REGRESSION] [Linux 3.2] top/htop and all other CPU usage

On Thu 01-12-11 15:07:49, Michal Hocko wrote:
[...]
> While implementation is not race free (we better not use locks in that
> path...) so we might race:
> 
> E.g.
> 
> CPU1			CPU2
> now = ktime_get
> 			tick_nohz_start_idle
> 				ts->idle_entrytime = now;
> if (ts->idle_active)
> 				ts->idle_active = 1
> [...]
> return idle_sleeptime
> 
> But this is OK because sleeptime will be more or less accurate. We just
> skip few ticks.
> 
> It would be worse if we had a race like:
> CPU1			CPU2
> now = ktime_get
> 			tick_nohz_start_idle
> 				now = ktime_get
> 				update_ts_time_stats()
> 				ts->idle_entrytime = now;
> 				ts->idle_active = 1
> if (ts->idle_active)
> 	delta = ktime_sub(now, idle_entrytime)
> 	ktime_add(idle_sleeptime, delta)
> 
> In this case we might get an overflow from ktime_sub but AFAIU the
> ktime_* magic the overflow should cause to get smaller idle_sleeptime
> in the end after ktime_add (we do not add a small number but rather
> subtract it), right?

Scratch that. Dunno why but I thought that ktime_t has unsigned values
but it is apparently not true (tv64 is s64). Anyway the above races should
be safe.

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ