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]
Date:   Mon, 20 Mar 2023 00:18:13 +0100
From:   Andi Shyti <andi.shyti@...ux.intel.com>
To:     Andrzej Hajda <andrzej.hajda@...el.com>
Cc:     Jani Nikula <jani.nikula@...ux.intel.com>,
        Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
        Rodrigo Vivi <rodrigo.vivi@...el.com>,
        Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>, netdev@...r.kernel.org,
        intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org,
        Chris Wilson <chris@...is-wilson.co.uk>,
        Eric Dumazet <edumazet@...gle.com>,
        Chris Wilson <chris.p.wilson@...el.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [Intel-gfx] [PATCH v4 03/10] lib/ref_tracker: add printing to
 memory buffer

Hi Andrzej,

This looks also good, just few questions.

On Mon, Mar 06, 2023 at 05:31:59PM +0100, Andrzej Hajda wrote:
> In case one wants to show stats via debugfs.

shall I say it? I'll say it... you can do better with the log
here. It's not a typo fix :)

> Signed-off-by: Andrzej Hajda <andrzej.hajda@...el.com>

[...]

> +void __ref_tracker_dir_print(struct ref_tracker_dir *dir,
> +			   unsigned int display_limit)
> +{
> +	struct ostream os = {};
> +
> +	__ref_tracker_dir_pr_ostream(dir, display_limit, &os);
> +}
>  EXPORT_SYMBOL(__ref_tracker_dir_print);
>  
>  void ref_tracker_dir_print(struct ref_tracker_dir *dir,
> @@ -114,6 +141,19 @@ void ref_tracker_dir_print(struct ref_tracker_dir *dir,
>  }
>  EXPORT_SYMBOL(ref_tracker_dir_print);
>  
> +int ref_tracker_dir_snprint(struct ref_tracker_dir *dir, char *buf, size_t size)

nit: snprintf is normally referred to its variable parameter
counterpart... I would choose a different name... how about
ref_tracker_dir_fetch_print()?

> +{
> +	struct ostream os = { .buf = buf, .size = size };
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&dir->lock, flags);
> +	__ref_tracker_dir_pr_ostream(dir, 16, &os);
> +	spin_unlock_irqrestore(&dir->lock, flags);

What are you trying to protect with this spinlock? what if
the caller has already locked here? do we need a _locked()
version?

Thanks,
Andi

> +	return os.used;
> +}
> +EXPORT_SYMBOL(ref_tracker_dir_snprint);
> +
>  void ref_tracker_dir_exit(struct ref_tracker_dir *dir)
>  {
>  	struct ref_tracker *tracker, *n;
> 
> -- 
> 2.34.1

Powered by blists - more mailing lists