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: <1626747709-34013-2-git-send-email-linyunsheng@huawei.com>
Date:   Tue, 20 Jul 2021 10:21:46 +0800
From:   Yunsheng Lin <linyunsheng@...wei.com>
To:     <davem@...emloft.net>, <kuba@...nel.org>, <mst@...hat.com>,
        <jasowang@...hat.com>
CC:     <nickhu@...estech.com>, <green.hu@...il.com>,
        <deanbo422@...il.com>, <akpm@...ux-foundation.org>,
        <yury.norov@...il.com>, <andriy.shevchenko@...ux.intel.com>,
        <ojeda@...nel.org>, <ndesaulniers@...ogle.com>, <joe@...ches.com>,
        <linux-kernel@...r.kernel.org>,
        <virtualization@...ts.linux-foundation.org>,
        <netdev@...r.kernel.org>, <linuxarm@...neuler.org>
Subject: [PATCH v2 1/4] tools headers UAPI: add cache aligning related macro

____cacheline_aligned_in_smp macro is needed to avoid
cache bouncing in SMP system, which is used in ptr_ring
lib.

So add the related macro in order to bulid ptr_ring from
user space.

As SMP_CACHE_BYTES is 64 bytes for arm64 and most of x86
system, so use 64 bytes as the default SMP_CACHE_BYTES if
SMP_CACHE_BYTES is not defined.

Signed-off-by: Yunsheng Lin <linyunsheng@...wei.com>
---
 tools/include/linux/cache.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 tools/include/linux/cache.h

diff --git a/tools/include/linux/cache.h b/tools/include/linux/cache.h
new file mode 100644
index 0000000..df04307
--- /dev/null
+++ b/tools/include/linux/cache.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __TOOLS_LINUX__CACHE_H
+#define __TOOLS_LINUX__CACHE_H
+
+#ifndef CONFIG_SMP
+#define CONFIG_SMP	1
+#endif
+
+#ifndef SMP_CACHE_BYTES
+#define SMP_CACHE_BYTES	64
+#endif
+
+#ifndef ____cacheline_aligned
+#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
+#endif
+
+#ifndef ____cacheline_aligned_in_smp
+#ifdef CONFIG_SMP
+#define ____cacheline_aligned_in_smp ____cacheline_aligned
+#else
+#define ____cacheline_aligned_in_smp
+#endif /* CONFIG_SMP */
+#endif
+
+#endif /* __LINUX_CACHE_H */
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ