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>] [day] [month] [year] [list]
Message-Id: <1316072080-20497-1-git-send-email-gilad@benyossef.com>
Date:	Thu, 15 Sep 2011 10:34:40 +0300
From:	Gilad Ben-Yossef <gilad@...yossef.com>
To:	linux-kernel@...r.kernel.org
Cc:	Gilad Ben-Yossef <gilad@...yossef.com>,
	Jiri Kosina <trivial@...nel.org>,
	Randy Dunlap <rdunlap@...otime.net>
Subject: [PATCH v2][Trivial] Match on_each_cpu behaviour on UP to SMP

The comment in the SMP implementation of on_each_cpu says:
 "May be used during early boot while
  early_boot_irqs_disabled is set.  Use local_irq_save/restore() instead
  of local_irq_disable/enable()."

but the existing UP macro version uses local_irq_disable/enable().

Do the safe thing - make the UP version match the SMP one.

Signed-off-by: Gilad Ben-Yossef <gilad@...yossef.com>
CC: Jiri Kosina <trivial@...nel.org>
CC: Randy Dunlap <rdunlap@...otime.net>

---

This version fixes the silly typo from the previous version.

I boot tested it on x86 UP (with PREEMPT).

---
 include/linux/smp.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8cc38d3..ecbce67 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -127,9 +127,10 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
 			(up_smp_call_function(func, info))
 #define on_each_cpu(func,info,wait)		\
 	({					\
-		local_irq_disable();		\
+		unsigned long __flags;		\
+		local_irq_save(__flags);	\
 		func(info);			\
-		local_irq_enable();		\
+		local_irq_restore(__flags);	\
 		0;				\
 	})
 static inline void smp_send_reschedule(int cpu) { }
-- 
1.7.0.4

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