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: <alpine.DEB.2.00.1011261038360.13524@router.home>
Date:	Fri, 26 Nov 2010 10:40:53 -0600 (CST)
From:	Christoph Lameter <cl@...ux.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
cc:	mingo@...hat.com, hpa@...or.com, linux-kernel@...r.kernel.org,
	a.p.zijlstra@...llo.nl, heiko.carstens@...ibm.com,
	tglx@...utronix.de, mingo@...e.hu
Subject: Re: [PATCH] printk: use this_cpu_{read|write} api on
 printk_pending

On Fri, 26 Nov 2010, Eric Dumazet wrote:

> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -1074,17 +1074,17 @@ static DEFINE_PER_CPU(int, printk_pending);
>
>  void printk_tick(void)
>  {
> -	if (__get_cpu_var(printk_pending)) {
> -		__get_cpu_var(printk_pending) = 0;
> +	if (__this_cpu_read(printk_pending)) {
> +		__this_cpu_write(printk_pending, 0);
>  		wake_up_interruptible(&log_wait);
>  	}
>  }

The above looks ok.

>  int printk_needs_cpu(int cpu)
>  {
> -	if (unlikely(cpu_is_offline(cpu)))
> +	if (cpu_is_offline(cpu))
>  		printk_tick();
> -	return per_cpu(printk_pending, cpu);
> +	return __this_cpu_read(printk_pending);
>  }

This only works if printk_needs_cpu is always passed the current cpu. The
check for cpu_is_offline suggests that the function is also used for other
cpus. The __this_cpu_read() will then get the printk_pending stat for the
current cpu and not for the specified cpu.


--
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