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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877cbb99xm.ffs@tglx>
Date: Mon, 16 Sep 2024 12:20:37 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Jeff Layton <jlayton@...nel.org>, John Stultz <jstultz@...gle.com>,
 Stephen Boyd <sboyd@...nel.org>, Alexander Viro <viro@...iv.linux.org.uk>,
 Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, Steven
 Rostedt <rostedt@...dmis.org>, Masami Hiramatsu <mhiramat@...nel.org>,
 Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Jonathan Corbet
 <corbet@....net>, Chandan Babu R <chandan.babu@...cle.com>, "Darrick J.
 Wong" <djwong@...nel.org>, Theodore Ts'o <tytso@....edu>, Andreas Dilger
 <adilger.kernel@...ger.ca>, Chris Mason <clm@...com>, Josef Bacik
 <josef@...icpanda.com>, David Sterba <dsterba@...e.com>, Hugh Dickins
 <hughd@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>, Chuck Lever
 <chuck.lever@...cle.com>, Vadim Fedorenko <vadim.fedorenko@...ux.dev>
Cc: Randy Dunlap <rdunlap@...radead.org>, linux-kernel@...r.kernel.org,
 linux-fsdevel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
 linux-doc@...r.kernel.org, linux-xfs@...r.kernel.org,
 linux-ext4@...r.kernel.org, linux-btrfs@...r.kernel.org,
 linux-nfs@...r.kernel.org, linux-mm@...ck.org, Jeff Layton
 <jlayton@...nel.org>
Subject: Re: [PATCH v8 06/11] fs: add percpu counters for significant
 multigrain timestamp events

On Sat, Sep 14 2024 at 13:07, Jeff Layton wrote:
>  fs/inode.c                         | 76 ++++++++++++++++++++++++++++++++++++--
>  include/linux/timekeeping.h        |  1 +
>  kernel/time/timekeeping.c          |  3 +-
>  kernel/time/timekeeping_debug.c    | 12 ++++++
>  kernel/time/timekeeping_internal.h |  3 ++

So the subject says 'fs:'. This is not how it works.

Provide the timekeeping changes in a separate patch and then add the fs
voodoo. Documentation is pretty clear about this, no?

> diff --git a/kernel/time/timekeeping_debug.c b/kernel/time/timekeeping_debug.c
> index b73e8850e58d..9a3792072762 100644
> --- a/kernel/time/timekeeping_debug.c
> +++ b/kernel/time/timekeeping_debug.c
> @@ -17,6 +17,9 @@
>  
>  #define NUM_BINS 32
>  
> +/* incremented every time mg_floor is updated */

Sentences start with a uppercase letter.

> +DEFINE_PER_CPU(long, mg_floor_swaps);

Why is this long? This is a counter which always counts up..

>  static unsigned int sleep_time_bin[NUM_BINS] = {0};
>  
>  static int tk_debug_sleep_time_show(struct seq_file *s, void *data)
> @@ -53,3 +56,12 @@ void tk_debug_account_sleep_time(const struct timespec64 *t)
>  			   (s64)t->tv_sec, t->tv_nsec / NSEC_PER_MSEC);
>  }
>  
> +long get_mg_floor_swaps(void)

Can we please have a proper subsystem prefix and not this get_*()
notation. It's horrible to grep for. timekeeping_mg_get_...() makes it
clear where this function belongs to, no?

> +{
> +	int i;
> +	long sum = 0;

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#variable-declarations

Also please use 'cpu' instead of 'i'. Self explanatory variable names
have a value.

> +	for_each_possible_cpu(i)
> +		sum += per_cpu(mg_floor_swaps, i);

This needs annotation for kcsan as this is a racy access.

> +	return sum < 0 ? 0 : sum;
> +}
> diff --git a/kernel/time/timekeeping_internal.h b/kernel/time/timekeeping_internal.h
> index 4ca2787d1642..2b49332b45a5 100644
> --- a/kernel/time/timekeeping_internal.h
> +++ b/kernel/time/timekeeping_internal.h
> @@ -11,8 +11,11 @@
>   */
>  #ifdef CONFIG_DEBUG_FS
>  extern void tk_debug_account_sleep_time(const struct timespec64 *t);
> +DECLARE_PER_CPU(long, mg_floor_swaps);
> +#define mgtime_counter_inc(__var)	this_cpu_inc(__var)

Please use static inlines for this.

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ