From 5b04d4cea291b8d816a3a8d880004506fbf2b390 Mon Sep 17 00:00:00 2001 From: He Zhe Date: Tue, 17 Jan 2023 20:13:18 +0800 Subject: lttng-modules: update 2.13.7 -> 2.13.8 Drop backported 0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch 0009-Rename-genhd-wrapper-to-blkdev.patch is present only on the master branch and not on 2.13 branch, so keep it in the recipe. Signed-off-by: He Zhe Signed-off-by: Luca Ceresoli Signed-off-by: Richard Purdie --- ..._common-drop-kmem_alloc-avoid-dereferenci.patch | 278 --------------------- meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb | 43 ---- meta/recipes-kernel/lttng/lttng-modules_2.13.8.bb | 42 ++++ 3 files changed, 42 insertions(+), 321 deletions(-) delete mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch delete mode 100644 meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb create mode 100644 meta/recipes-kernel/lttng/lttng-modules_2.13.8.bb diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch deleted file mode 100644 index 99402ea5e9..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch +++ /dev/null @@ -1,278 +0,0 @@ -From b977f96d0a414e76d4c544f65791919dde1bc57e Mon Sep 17 00:00:00 2001 -From: Michael Jeanson -Date: Mon, 17 Oct 2022 13:49:51 -0400 -Subject: [PATCH] fix: mm/slab_common: drop kmem_alloc & avoid dereferencing - fields when not using (v6.1) - -See uptream commit: - - commit 2c1d697fb8ba6d2d44f914d4268ae1ccdf025f1b - Author: Hyeonggon Yoo <42.hyeyoo@gmail.com> - Date: Wed Aug 17 19:18:24 2022 +0900 - - mm/slab_common: drop kmem_alloc & avoid dereferencing fields when not using - - Drop kmem_alloc event class, and define kmalloc and kmem_cache_alloc - using TRACE_EVENT() macro. - - And then this patch does: - - Do not pass pointer to struct kmem_cache to trace_kmalloc. - gfp flag is enough to know if it's accounted or not. - - Avoid dereferencing s->object_size and s->size when not using kmem_cache_alloc event. - - Avoid dereferencing s->name in when not using kmem_cache_free event. - - Adjust s->size to SLOB_UNITS(s->size) * SLOB_UNIT in SLOB - -Upstream-Status: Backport [commit b977f96d0a414e76d4c544f] - -Change-Id: Icd7925731ed4a737699c3746cb7bb7760a4e8009 -Signed-off-by: Michael Jeanson -Signed-off-by: Mathieu Desnoyers ---- - include/instrumentation/events/kmem.h | 156 ++++++++++++++++++-------- - 1 file changed, 111 insertions(+), 45 deletions(-) - -diff --git a/include/instrumentation/events/kmem.h b/include/instrumentation/events/kmem.h -index 219533a1..0f5bd8e6 100644 ---- a/include/instrumentation/events/kmem.h -+++ b/include/instrumentation/events/kmem.h -@@ -10,9 +10,58 @@ - #include - - #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0)) -- - #include <../../mm/slab.h> -+#endif -+ -+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,1,0)) -+LTTNG_TRACEPOINT_EVENT_MAP(kmalloc, -+ -+ kmem_kmalloc, -+ -+ TP_PROTO(unsigned long call_site, -+ const void *ptr, -+ size_t bytes_req, -+ size_t bytes_alloc, -+ gfp_t gfp_flags, -+ int node), -+ -+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node), -+ -+ TP_FIELDS( -+ ctf_integer_hex(unsigned long, call_site, call_site) -+ ctf_integer_hex(const void *, ptr, ptr) -+ ctf_integer(size_t, bytes_req, bytes_req) -+ ctf_integer(size_t, bytes_alloc, bytes_alloc) -+ ctf_integer(gfp_t, gfp_flags, gfp_flags) -+ ctf_integer(int, node, node) -+ ctf_integer(bool, accounted, (IS_ENABLED(CONFIG_MEMCG_KMEM) && -+ (gfp_flags & __GFP_ACCOUNT) ? true : false)) -+ ) -+) -+ -+LTTNG_TRACEPOINT_EVENT(kmem_cache_alloc, -+ -+ TP_PROTO(unsigned long call_site, -+ const void *ptr, -+ struct kmem_cache *s, -+ gfp_t gfp_flags, -+ int node), -+ -+ TP_ARGS(call_site, ptr, s, gfp_flags, node), - -+ TP_FIELDS( -+ ctf_integer_hex(unsigned long, call_site, call_site) -+ ctf_integer_hex(const void *, ptr, ptr) -+ ctf_integer(size_t, bytes_req, s->object_size) -+ ctf_integer(size_t, bytes_alloc, s->size) -+ ctf_integer(gfp_t, gfp_flags, gfp_flags) -+ ctf_integer(int, node, node) -+ ctf_integer(bool, accounted, IS_ENABLED(CONFIG_MEMCG_KMEM) ? -+ ((gfp_flags & __GFP_ACCOUNT) || -+ (s->flags & SLAB_ACCOUNT)) : false) -+ ) -+) -+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0)) - LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, - - TP_PROTO(unsigned long call_site, -@@ -53,18 +102,16 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc, - - TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags) - ) -- --LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, -+#else -+LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, - - TP_PROTO(unsigned long call_site, - const void *ptr, -- struct kmem_cache *s, - size_t bytes_req, - size_t bytes_alloc, -- gfp_t gfp_flags, -- int node), -+ gfp_t gfp_flags), - -- TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node), -+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags), - - TP_FIELDS( - ctf_integer_hex(unsigned long, call_site, call_site) -@@ -72,42 +119,40 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, - ctf_integer(size_t, bytes_req, bytes_req) - ctf_integer(size_t, bytes_alloc, bytes_alloc) - ctf_integer(gfp_t, gfp_flags, gfp_flags) -- ctf_integer(int, node, node) -- ctf_integer(bool, accounted, IS_ENABLED(CONFIG_MEMCG_KMEM) ? -- ((gfp_flags & __GFP_ACCOUNT) || -- (s && s->flags & SLAB_ACCOUNT)) : false) - ) - ) - --LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node, -+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc, - -- kmem_kmalloc_node, -+ kmem_kmalloc, - - TP_PROTO(unsigned long call_site, const void *ptr, -- struct kmem_cache *s, size_t bytes_req, size_t bytes_alloc, -- gfp_t gfp_flags, int node), -+ size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), - -- TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node) -+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) - ) - --LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node, -+LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc, - - TP_PROTO(unsigned long call_site, const void *ptr, -- struct kmem_cache *s, size_t bytes_req, size_t bytes_alloc, -- gfp_t gfp_flags, int node), -+ size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), - -- TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node) -+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) - ) --#else --LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, -+#endif -+ -+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0)) -+LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, - - TP_PROTO(unsigned long call_site, - const void *ptr, -+ struct kmem_cache *s, - size_t bytes_req, - size_t bytes_alloc, -- gfp_t gfp_flags), -+ gfp_t gfp_flags, -+ int node), - -- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags), -+ TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node), - - TP_FIELDS( - ctf_integer_hex(unsigned long, call_site, call_site) -@@ -115,27 +160,33 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, - ctf_integer(size_t, bytes_req, bytes_req) - ctf_integer(size_t, bytes_alloc, bytes_alloc) - ctf_integer(gfp_t, gfp_flags, gfp_flags) -+ ctf_integer(int, node, node) -+ ctf_integer(bool, accounted, IS_ENABLED(CONFIG_MEMCG_KMEM) ? -+ ((gfp_flags & __GFP_ACCOUNT) || -+ (s && s->flags & SLAB_ACCOUNT)) : false) - ) - ) - --LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc, -+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node, - -- kmem_kmalloc, -+ kmem_kmalloc_node, - - TP_PROTO(unsigned long call_site, const void *ptr, -- size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), -+ struct kmem_cache *s, size_t bytes_req, size_t bytes_alloc, -+ gfp_t gfp_flags, int node), - -- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) -+ TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node) - ) - --LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc, -+LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node, - - TP_PROTO(unsigned long call_site, const void *ptr, -- size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), -+ struct kmem_cache *s, size_t bytes_req, size_t bytes_alloc, -+ gfp_t gfp_flags, int node), - -- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) -+ TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node) - ) -- -+#else - LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, - - TP_PROTO(unsigned long call_site, -@@ -192,19 +243,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(kfree, - ctf_integer_hex(const void *, ptr, ptr) - ) - ) -- --LTTNG_TRACEPOINT_EVENT(kmem_cache_free, -- -- TP_PROTO(unsigned long call_site, const void *ptr, const char *name), -- -- TP_ARGS(call_site, ptr, name), -- -- TP_FIELDS( -- ctf_integer_hex(unsigned long, call_site, call_site) -- ctf_integer_hex(const void *, ptr, ptr) -- ctf_string(name, name) -- ) --) - #else - LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free, - -@@ -235,6 +273,34 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free, kmem_cache_free, - ) - #endif - -+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,1,0)) -+LTTNG_TRACEPOINT_EVENT(kmem_cache_free, -+ -+ TP_PROTO(unsigned long call_site, const void *ptr, const struct kmem_cache *s), -+ -+ TP_ARGS(call_site, ptr, s), -+ -+ TP_FIELDS( -+ ctf_integer_hex(unsigned long, call_site, call_site) -+ ctf_integer_hex(const void *, ptr, ptr) -+ ctf_string(name, s->name) -+ ) -+) -+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,12,0)) -+LTTNG_TRACEPOINT_EVENT(kmem_cache_free, -+ -+ TP_PROTO(unsigned long call_site, const void *ptr, const char *name), -+ -+ TP_ARGS(call_site, ptr, name), -+ -+ TP_FIELDS( -+ ctf_integer_hex(unsigned long, call_site, call_site) -+ ctf_integer_hex(const void *, ptr, ptr) -+ ctf_string(name, name) -+ ) -+) -+#endif -+ - #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,3,0)) - LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free, kmem_mm_page_free, - #else --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb b/meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb deleted file mode 100644 index d444f9ab0c..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb +++ /dev/null @@ -1,43 +0,0 @@ -SECTION = "devel" -SUMMARY = "Linux Trace Toolkit KERNEL MODULE" -DESCRIPTION = "The lttng-modules 2.0 package contains the kernel tracer modules" -HOMEPAGE = "https://lttng.org/" -LICENSE = "LGPL-2.1-only & GPL-2.0-only & MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=0464cff101a009c403cd2ed65d01d4c4" - -inherit module - -include lttng-platforms.inc - -SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \ - file://0009-Rename-genhd-wrapper-to-blkdev.patch \ - file://0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch \ - " - -# Use :append here so that the patch is applied also when using devupstream -SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch" - -SRC_URI[sha256sum] = "5a99679df7903160cbde3918fee5af90ffafc90fc96ccdefaa57cf230492b234" - -export INSTALL_MOD_DIR="kernel/lttng-modules" - -EXTRA_OEMAKE += "KERNELDIR='${STAGING_KERNEL_DIR}'" - -MODULES_MODULE_SYMVERS_LOCATION = "src" - -do_install:append() { - # Delete empty directories to avoid QA failures if no modules were built - if [ -d ${D}/${nonarch_base_libdir} ]; then - find ${D}/${nonarch_base_libdir} -depth -type d -empty -exec rmdir {} \; - fi -} - -python do_package:prepend() { - if not os.path.exists(os.path.join(d.getVar('D'), d.getVar('nonarch_base_libdir')[1:], 'modules')): - bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN')) -} - -BBCLASSEXTEND = "devupstream:target" -SRC_URI:class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.13" -SRCREV:class-devupstream = "7584cfc04914cb0842a986e9808686858b9c8630" -SRCREV_FORMAT ?= "lttng_git" diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.13.8.bb b/meta/recipes-kernel/lttng/lttng-modules_2.13.8.bb new file mode 100644 index 0000000000..542f42ae19 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules_2.13.8.bb @@ -0,0 +1,42 @@ +SECTION = "devel" +SUMMARY = "Linux Trace Toolkit KERNEL MODULE" +DESCRIPTION = "The lttng-modules 2.0 package contains the kernel tracer modules" +HOMEPAGE = "https://lttng.org/" +LICENSE = "LGPL-2.1-only & GPL-2.0-only & MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=0464cff101a009c403cd2ed65d01d4c4" + +inherit module + +include lttng-platforms.inc + +SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \ + file://0009-Rename-genhd-wrapper-to-blkdev.patch \ + " + +# Use :append here so that the patch is applied also when using devupstream +SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch" + +SRC_URI[sha256sum] = "f525d3d48ea3a475cb535339c201666d0e4c75ec8c46d29837bcf381ea02cb19" + +export INSTALL_MOD_DIR="kernel/lttng-modules" + +EXTRA_OEMAKE += "KERNELDIR='${STAGING_KERNEL_DIR}'" + +MODULES_MODULE_SYMVERS_LOCATION = "src" + +do_install:append() { + # Delete empty directories to avoid QA failures if no modules were built + if [ -d ${D}/${nonarch_base_libdir} ]; then + find ${D}/${nonarch_base_libdir} -depth -type d -empty -exec rmdir {} \; + fi +} + +python do_package:prepend() { + if not os.path.exists(os.path.join(d.getVar('D'), d.getVar('nonarch_base_libdir')[1:], 'modules')): + bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN')) +} + +BBCLASSEXTEND = "devupstream:target" +SRC_URI:class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.13" +SRCREV:class-devupstream = "7584cfc04914cb0842a986e9808686858b9c8630" +SRCREV_FORMAT ?= "lttng_git" -- cgit 1.2.3-korg