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: <20160708140139.GF30200@lerouge>
Date:	Fri, 8 Jul 2016 16:01:41 +0200
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Rik van Riel <riel@...hat.com>
Cc:	linux-kernel@...r.kernel.org, peterz@...radead.org,
	mingo@...nel.org, pbonzini@...hat.com, fweisbec@...hat.com,
	wanpeng.li@...mail.com, efault@....de, tglx@...utronix.de,
	rkrcmar@...hat.com
Subject: Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from
 irqtime_account_irq

On Fri, Jul 08, 2016 at 09:19:47AM -0400, Rik van Riel wrote:
> On Fri, 2016-07-08 at 14:30 +0200, Frederic Weisbecker wrote:
> > > +	if (irqtype == HARDIRQ_OFFSET) {
> > > +		bool leaving_hardirq = hardirq_count();
> > > +		delta = sched_clock_cpu(cpu) -
> > > __this_cpu_read(hardirq_start_time);
> > > +		__this_cpu_add(hardirq_start_time, delta);
> > > +		if (leaving_hardirq) {
> > > +			hardirq_time_write_begin();
> > > +			__this_cpu_add(cpu_hardirq_time, delta);
> > > +			hardirq_time_write_end();
> > > +		}
> > 
> > This doesn't seem to work with nesting hardirqs.
> > 
> > Thanks.
> 
> Where does it break?
> 
> enter hardirq A -> hardirq_start_time = now
> 
> enter hardirq B -> hardirq_start_time = now,
>                    account already elapsed time
> 
> leave hardirq B -> account elapsed time, set
>                    hardirq_start_time = now
> 
> leave hardirq A -> account elapsed time
> 
> What am I missing, except a softirq-style do-while
> loop to account for hardirq A being interrupted by
> hardirq B while updating the statistics?

How about:

enter hardirq A -> delta = sched_clock_cpu(cpu) - __this_cpu_read(hardirq_start_time);
   enter hardirq B -> delta = sched_clock_cpu(cpu) - __this_cpu_read(hardirq_start_time);
   __this_cpu_add(hardirq_start_time, delta);
   ...
   exit hardirq B
__this_cpu_add(hardirq_start_time, delta);

Also seqcount writers can't nest.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ