[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtXKLOJDzin6LeRA@smile.fi.intel.com>
Date: Tue, 19 Jul 2022 00:01:32 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Yury Norov <yury.norov@...il.com>
Cc: linux-kernel@...r.kernel.org,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Alexei Starovoitov <ast@...nel.org>,
Alexey Klimov <aklimov@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrii Nakryiko <andrii@...nel.org>,
Ben Segall <bsegall@...gle.com>,
Christoph Lameter <cl@...ux.com>,
Dan Williams <dan.j.williams@...el.com>,
Daniel Borkmann <daniel@...earbox.net>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Dennis Zhou <dennis@...nel.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Eric Dumazet <edumazet@...gle.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Guenter Roeck <linux@...ck-us.net>,
Ingo Molnar <mingo@...hat.com>,
Isabella Basso <isabbasso@...eup.net>,
John Fastabend <john.fastabend@...il.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Juergen Gross <jgross@...e.com>,
Juri Lelli <juri.lelli@...hat.com>,
KP Singh <kpsingh@...nel.org>,
Kees Cook <keescook@...omium.org>,
Martin KaFai Lau <kafai@...com>,
Mel Gorman <mgorman@...e.de>, Miroslav Benes <mbenes@...e.cz>,
Nathan Chancellor <nathan@...nel.org>,
"Paul E . McKenney" <paulmck@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Song Liu <songliubraving@...com>,
Steven Rostedt <rostedt@...dmis.org>,
Tejun Heo <tj@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Valentin Schneider <vschneid@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Vlastimil Babka <vbabka@...e.cz>, Yonghong Song <yhs@...com>,
linux-mm@...ck.org, netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH 01/16] lib/bitmap: add bitmap_check_params()
On Mon, Jul 18, 2022 at 12:28:29PM -0700, Yury Norov wrote:
> bitmap_check_params() takes all arguments passed into bitmap functions
> and runs sanity checks. bitmap_check(), bitmap_check_op() and
> bitmap_check_move() are convenient wrappers for frequent cases.
>
> The following patches of this series clear all warnings found with
> bitmap_check_params() for x86_64, arm64 and powerpc64.
>
> The last patch introduces CONFIG_DEBUG_BITMAP option to let user enable
> bitmap_check_params().
>
> No functional changes for existing kernel users, and for the following
> functions inline parameters checks removed:
> - bitmap_pos_to_ord;
> - bitmap_remap;
> - bitmap_onto;
> - bitmap_fold.
...
> +#define bitmap_check_params(b1, b2, b3, nbits, start, off, flags) \
> + do { \
> + if (__bitmap_check_params((b1), (b2), (b3), (nbits), \
> + (start), (off), (flags))) { \
> + pr_warn("Bitmap: parameters check failed"); \
> + pr_warn("%s [%d]: %s\n", __FILE__, __LINE__, __func__); \
> + } \
> + } while (0)
Why printk() and not trace points?
Also, try to avoid WARN() / etc in the generic code, it may be easily converted
to the BUG() (by kernel command line option, no recompilation needed), and
hence make all WARN() effectively reboot machine. Can you guarantee that in all
cases the functionality is critical to continue only with correct parameters?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists