Skip to contentSkip to conversation

fix: y2038: itimer: change implementation to timespec64 (v5.5)

PATCH New Michael Jeanson 2 participants 5 messages Dec 10, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 fix: y2038: itimer: change implementation to timespec64 (v5.5)

See upstream commit:

commit bd40a175769d411b2a37e1c087082ac7ee2c15bb
Author: Arnd Bergmann <[email protected]>
Date: Thu Nov 7 15:27:39 2019 +0100

y2038: itimer: change implementation to timespec64

There is no 64-bit version of getitimer/setitimer since that is not actually needed. However, the implementation is built around the deprecated 'struct timeval' type.

Change the code to use timespec64 internally to reduce the dependencies on timeval and associated helper functions.

Minor adjustments in the code are needed to make the native and compat version work the same way, and to keep the range check working after the conversion.

---
 instrumentation/events/lttng-module/timer.h | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
instrumentation/events/lttng-module/timer.h +20 -1
index 997084f..1a45d82 100644
@@ -294,7 +294,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(timer_hrtimer_class, hrtimer_cancel,
  *		zero, otherwise it is started
  * @expires:	the itimers expiry time
  */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT_MAP(itimer_state,
+
+	timer_itimer_state,
+
+	TP_PROTO(int which, const struct itimerspec64 *const value,
+		 unsigned long long expires),
+
+	TP_ARGS(which, value, expires),
+
+	TP_FIELDS(
+		ctf_integer(int, which, which)
+		ctf_integer(unsigned long long, expires, expires)
+		ctf_integer(long, value_sec, value->it_value.tv_sec)
+		ctf_integer(long, value_nsec, value->it_value.tv_nsec)
+		ctf_integer(long, interval_sec, value->it_interval.tv_sec)
+		ctf_integer(long, interval_nsec, value->it_interval.tv_nsec)
+	)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
 LTTNG_TRACEPOINT_EVENT_MAP(itimer_state,
 
 	timer_itimer_state,
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/1 fix: btrfs: tracepoints: constify all pointers (v5.5)

In reply to a message not in the archive

See upstream commit:

commit 1d2e7c7c3ed73cc510a4dc093df2a935092ff5ad
Author: David Sterba <[email protected]>
Date: Thu Oct 17 13:28:57 2019 +0200

btrfs: tracepoints: constify all pointers

We don't modify the data passed to tracepoints, some of the declarations are already const, add it to the rest.

---
 instrumentation/events/lttng-module/btrfs.h | 39 +++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)
instrumentation/events/lttng-module/btrfs.h +37 -2
index c548cf2..59b668c 100644
@@ -286,7 +286,26 @@ LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
 
 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_handle_em_exist,
+
+	TP_PROTO(const struct btrfs_fs_info *fs_info,
+		const struct extent_map *existing, const struct extent_map *map,
+		u64 start, u64 len),
+
+	TP_ARGS(fs_info, existing, map, start, len),
+
+	TP_FIELDS(
+		ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+		ctf_integer(u64, e_start, existing->start)
+		ctf_integer(u64, e_len, existing->len)
+		ctf_integer(u64, map_start, map->start)
+		ctf_integer(u64, map_len, map->len)
+		ctf_integer(u64, start, start)
+		ctf_integer(u64, len, len)
+	)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
 LTTNG_TRACEPOINT_EVENT(btrfs_handle_em_exist,
 
 	TP_PROTO(struct btrfs_fs_info *fs_info,
@@ -1620,7 +1639,23 @@ LTTNG_TRACEPOINT_EVENT(btrfs_cow_block,
 )
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_space_reservation,
+
+	TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val,
+		 u64 bytes, int reserve),
+
+	TP_ARGS(fs_info, type, val, bytes, reserve),
+
+	TP_FIELDS(
+		ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+		ctf_string(type, type)
+		ctf_integer(u64, val, val)
+		ctf_integer(u64, bytes, bytes)
+		ctf_integer(int, reserve, reserve)
+	)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
Signature · 1 line
2.17.1
#3 lore raw

PATCH 1/1 fix: btrfs block group struct refactor (v5.5)

In reply to a message not in the archive

See upstream commits:

commit 32da5386d9a4fd5c1155cecf703df104d918954c
Author: David Sterba <[email protected]>
Date: Tue Oct 29 19:20:18 2019 +0100

btrfs: rename btrfs_block_group_cache

The type name is misleading, a single entry is named 'cache' while this normally means a collection of objects. Rename that everywhere. Also the identifier was quite long, making function prototypes harder to format.

commit b3470b5dbe1300dea94191ae4b7d070be9a5cdc9
Author: David Sterba <[email protected]>
Date: Wed Oct 23 18:48:22 2019 +0200

btrfs: add dedicated members for start and length of a block group

The on-disk format of block group item makes use of the key that stores the offset and length. This is further used in the code, although this makes thing harder to understand. The key is also packed so the offset/length is not properly aligned as u64.

Add start (key.objectid) and length (key.offset) members to block group and remove the embedded key. When the item is searched or written, a local variable for key is used.

commit bf38be65f3703d5ef3661c0a2802bc28e76b8f19
Author: David Sterba <[email protected]>
Date: Wed Oct 23 18:48:11 2019 +0200

btrfs: move block_group_item::used to block group

For unknown reasons, the member 'used' in the block group struct is stored in the b-tree item and accessed everywhere using the special accessor helper. Let's unify it and make it a regular member and only update the item before writing it to the tree.

The item is still being used for flags and chunk_objectid, there's some duplication until the item is removed in following patches.

---
 instrumentation/events/lttng-module/btrfs.h | 125 +++++++++++++++++++-
 1 file changed, 121 insertions(+), 4 deletions(-)
instrumentation/events/lttng-module/btrfs.h +121 -4
index 59b668c..b4f2fe7 100644
@@ -20,8 +20,12 @@ struct btrfs_delayed_ref_node;
 struct btrfs_delayed_tree_ref;
 struct btrfs_delayed_data_ref;
 struct btrfs_delayed_ref_head;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+struct btrfs_block_group;
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
 struct btrfs_block_group_cache;
+#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
 struct btrfs_free_cluster;
 #endif
 struct map_lookup;
@@ -679,7 +683,25 @@ LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs,
 )
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_add_block_group,
+
+	TP_PROTO(const struct btrfs_fs_info *fs_info,
+		 const struct btrfs_block_group *block_group, int create),
+
+	TP_ARGS(fs_info, block_group, create),
+
+	TP_FIELDS(
+		ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+		ctf_integer(u64, offset, block_group->start)
+		ctf_integer(u64, size, block_group->length)
+		ctf_integer(u64, flags, block_group->flags)
+		ctf_integer(u64, bytes_used, block_group->used)
+		ctf_integer(u64, bytes_super, block_group->bytes_super)
+		ctf_integer(int, create, create)
+	)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
@@ -1812,7 +1834,57 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_f
 
 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
+
+	btrfs_find_free_extent,
+
+	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
+		 u64 data),
+
+	TP_ARGS(fs_info, num_bytes, empty_size, data),
+
+	TP_FIELDS(
+		ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+		ctf_integer(u64, num_bytes, num_bytes)
+		ctf_integer(u64, empty_size, empty_size)
+		ctf_integer(u64, data, data)
+	)
+)
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
+
+	TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
+		 u64 len),
+
+	TP_ARGS(block_group, start, len),
+
+	TP_FIELDS(
+		ctf_array(u8, fsid, block_group->lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+		ctf_integer(u64, bg_objectid, block_group->start)
+		ctf_integer(u64, flags, block_group->flags)
+		ctf_integer(u64, start, start)
+		ctf_integer(u64, len, len)
+	)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
+
+	TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
+		 u64 len),
+
+	TP_ARGS(block_group, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
+
+	TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
+		 u64 len),
+
+	TP_ARGS(block_group, start, len)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
 LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
 
 	btrfs_find_free_extent,
@@ -2080,7 +2152,52 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
 
 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_find_cluster,
+
+	TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
+		 u64 bytes, u64 empty_size, u64 min_bytes),
+
+	TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
+
+	TP_FIELDS(
+		ctf_integer(u64, bg_objectid, block_group->start)
+		ctf_integer(u64, flags, block_group->flags)
+		ctf_integer(u64, start, start)
+		ctf_integer(u64, bytes, bytes)
+		ctf_integer(u64, empty_size, empty_size)
+		ctf_integer(u64, min_bytes, min_bytes)
+	)
+)
+
+LTTNG_TRACEPOINT_EVENT(btrfs_failed_cluster_setup,
+
+	TP_PROTO(const struct btrfs_block_group *block_group),
+
+	TP_ARGS(block_group),
+
+	TP_FIELDS(
+		ctf_integer(u64, bg_objectid, block_group->start)
+	)
+)
+
+LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster,
+
+	TP_PROTO(const struct btrfs_block_group *block_group,
+		 const struct btrfs_free_cluster *cluster, u64 size, int bitmap),
+
+	TP_ARGS(block_group, cluster, size, bitmap),
+
+	TP_FIELDS(
+		ctf_integer(u64, bg_objectid, block_group->start)
+		ctf_integer(u64, flags, block_group->flags)
+		ctf_integer(u64, start, cluster->window_start)
+		ctf_integer(u64, max_size, cluster->max_size)
+		ctf_integer(u64, size, size)
+		ctf_integer(int, bitmap, bitmap)
+	)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
 	LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
Signature · 1 line
2.17.1
#4 lore raw

PATCH 1/1 fix: ext4: Reserve revoke credits for freed blocks (v5.5)

In reply to a message not in the archive

See upstream commit:

commit 83448bdfb59731c2f54784ed3f4a93ff95be6e7e
Author: Jan Kara <[email protected]>
Date: Tue Nov 5 17:44:29 2019 +0100

ext4: Reserve revoke credits for freed blocks

So far we have reserved only relatively high fixed amount of revoke credits for each transaction. We over-reserved by large amount for most cases but when freeing large directories or files with data journalling, the fixed amount is not enough. In fact the worst case estimate is inconveniently large (maximum extent size) for freeing of one extent.

We fix this by doing proper estimate of the amount of blocks that need to be revoked when removing blocks from the inode due to truncate or hole punching and otherwise reserve just a small amount of revoke credits for each transaction to accommodate freeing of xattrs block or so.

---
 instrumentation/events/lttng-module/ext4.h | 31 +++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
instrumentation/events/lttng-module/ext4.h +30 -1
index b2ca8a7..17809d2 100644
@@ -1255,7 +1255,36 @@ LTTNG_TRACEPOINT_EVENT(ext4_load_inode,
 	)
 )
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+
+LTTNG_TRACEPOINT_EVENT(ext4_journal_start,
+	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
+		 int revoke_creds, unsigned long IP),
+
+	TP_ARGS(sb, blocks, rsv_blocks, revoke_creds, IP),
+
+	TP_FIELDS(
+		ctf_integer(dev_t, dev, sb->s_dev)
+		ctf_integer(unsigned long, ip, IP)
+		ctf_integer(int, blocks, blocks)
+		ctf_integer(int, rsv_blocks, rsv_blocks)
+		ctf_integer(int, revoke_creds, revoke_creds)
+	)
+)
+
+LTTNG_TRACEPOINT_EVENT(ext4_journal_start_reserved,
+	TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),
+
+	TP_ARGS(sb, blocks, IP),
+
+	TP_FIELDS(
+		ctf_integer(dev_t, dev, sb->s_dev)
+		ctf_integer(unsigned long, ip, IP)
+		ctf_integer(int, blocks, blocks)
+	)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
 
 LTTNG_TRACEPOINT_EVENT(ext4_journal_start,
 	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
Signature · 1 line
2.17.1
#5 lore raw

Re: [PATCH lttng-modules] Update .gitignore from upstream

In reply to a message not in the archive

All merged into master, stable-2.11, stable-2.10.

Note that for stable-2.10, I had to pick up 2 extra commits for btrfs so the "constify" patch would apply cleanly:

f059ce66 fix: ext4: Reserve revoke credits for freed blocks (v5.5) 57ff707e fix: btrfs: tracepoints: constify all pointers (v5.5) 065436fd Fix: btrfs: use fs_info for btrfs_handle_em_exist tracepoint 619cabe7 Add btrfs tracepoint for em's EEXIST case
ef77ec63 fix: btrfs block group struct refactor (v5.5) b06bd5b7 fix: y2038: itimer: change implementation to timespec64 (v5.5)

Thanks,

Mathieu

Quoted 166 lines · ----- On Dec 10, 2019, at 11:41 AM, Michael Jeanson [email protected] wrote:

---
.gitignore | 110 +++++++++++++++++++++++++++++++++++++++++++----------

1 file changed, 89 insertions(+), 21 deletions(-)
.gitignore +1 -1
index 38e1684..4af69a2 100644
@@ -7,30 +7,45 @@
 # command after changing this file, to see if there are
 # any tracked files which get ignored after the change.
 #
-# Normal rules
+# Normal rules (sorted alphabetically)
 #

.*

.gitignore +22 -0
+*.a
+*.asn1.[ch]
+*.bin
+*.bz2
+*.c.[012]*.*
+*.dt.yaml
+*.dtb
+*.dtb.S
+*.dwo
+*.elf
+*.gcno
+*.gz
+*.i
+*.ko
+*.lex.c
+*.ll
+*.lst
+*.lz4
+*.lzma
+*.lzo
+*.mod
+*.mod.c

*.o
*.o.*

.gitignore +1 -1
-*.a
+*.patch

*.s
-*.ko
*.so
*.so.dbg

.gitignore +1 -3
-*.mod.c
-*.i
-*.lst
+*.su

*.symtypes

.gitignore +4 -1
-*.order
+*.tab.[ch]
+*.tar
+*.xz
+Module.symvers

modules.builtin

.gitignore +1 -8
-*.elf
-*.bin
-*.gz
-*.bz2
-*.lzma
-*.lzo
-*.gcno
-cscope.*
+modules.order

#
# Top-level generic files

.gitignore +0 -0
@@ -39,25 +54,51 @@ cscope.*

/TAGS
/linux
/vmlinux

.gitignore +2 -0
+/vmlinux.32
+/vmlinux-gdb.py

/vmlinuz
/System.map
/Module.markers

.gitignore +21 -2
+/modules.builtin.modinfo
+/modules.nsdeps
 
-# ignore across tree
-Module.symvers
+#
+# RPM spec file (make rpm-pkg)
+#
+/*.spec
+
+#
+# Debian directory (make deb-pkg)
+#
+/debian/
+
+#
+# Snap directory (make snap-pkg)
+#
+/snap/
+
+#
+# tar directory (make tar*-pkg)
+#
+/tar-install/

#

.gitignore +1 -1
-# git files that we don't want to ignore even it they are dot-files
+# We don't want to ignore the following even if they are dot-files

#
+!.clang-format
+!.cocciconfig
+!.get_maintainer.ignore
+!.gitattributes
!.gitignore
!.mailmap

#
# Generated include files
#

.gitignore +4 -3
-include/config
-include/linux/version.h
-include/generated
+/include/config/
+/include/generated/
+/include/ksym/
+/arch/*/include/generated/
# stgit generated dirs
patches-*
.gitignore +0 -0
@@ -76,8 +117,35 @@ GRTAGS

GSYMS
GTAGS

.gitignore +3 -0
+# id-utils files
+ID
+

*.orig
*~
\#*#

.gitignore +24 -0
+#
+# Leavings from module signing
+#
+extra_certificates
+signing_key.pem
+signing_key.priv
+signing_key.x509
+x509.genkey
+
+# Kconfig presets
+/all.config
+/alldef.config
+/allmod.config
+/allno.config
+/allrandom.config
+/allyes.config
+
+# Kdevelop4
+*.kdev4
+
+# Clang's compilation database file
+/compile_commands.json
+
+# lttng-modules specific

/extra_version
--
2.17.1

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com