All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>,
	Andrew Morton <akpm@linuxfoundation.org>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
	Neil Brown <neilb@suse.com>
Subject: Re: [patch V3 01/10] rslib: Add GFP aware init function
Date: Wed, 25 Apr 2018 11:16:17 +1000	[thread overview]
Message-ID: <20180425111617.2f4dc127@canb.auug.org.au> (raw)
In-Reply-To: <20180422162512.363154748@linutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2173 bytes --]

Hi Thomas,

On Sun, 22 Apr 2018 18:23:46 +0200 Thomas Gleixner <tglx@linutronix.de> wrote:
>
> The rslib usage in dm/verity_fec is broken because init_rs() can nest in
> GFP_NOIO mempool allocations as init_rs() is invoked from the mempool alloc
> callback.
> 
> Provide a variant which takes gfp_t flags as argument.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Cc: Alasdair Kergon <agk@redhat.com>
> Cc: Neil Brown <neilb@suse.com>
> ---
>  include/linux/rslib.h           |   26 +++++++++++++++++++++++---
>  lib/reed_solomon/reed_solomon.c |   36 ++++++++++++++++++++----------------
>  2 files changed, 43 insertions(+), 19 deletions(-)
> 
> --- a/include/linux/rslib.h
> +++ b/include/linux/rslib.h
> @@ -77,10 +77,30 @@ int decode_rs16(struct rs_control *rs, u
>  #endif
>  
>  /* Create or get a matching rs control structure */
> -struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim,
> -			   int nroots);
> +struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim,
> +			       int nroots, gfp_t gfp);
> +
> +/**
> + * init_rs - Create a RS control struct and initialize it
> + *  @symsize:	the symbol size (number of bits)
> + *  @gfpoly:	the extended Galois field generator polynomial coefficients,
> + *		with the 0th coefficient in the low order bit. The polynomial
> + *		must be primitive;
> + *  @fcr:	the first consecutive root of the rs code generator polynomial
> + *		in index form
> + *  @prim:	primitive element to generate polynomial roots
> + *  @nroots:	RS code generator polynomial degree (number of roots)
> + *
> + * Allocations use GFP_KERNEL.
> + */
> +static inline struct rs_control *init_rs(int symsize, int gfpoly, int fcr,
> +					 int prim, int nroots)
> +{
> +	return init_rs_gfp(symsize, gfpoly, fcr, prim, nroots, GFP_KERNEL);
> +}
> +

The version of this patch that Kees has committed to his kspp tree in linux-next has

#include <linux/slab.h>

why not just

#include <linux/types.h>	/* for gpf_t */
#include <linux/gpf.h>		/* for GFP_KERNEL */

?
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-04-25  1:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-22 16:23 [patch V3 00/10] rslib: Cleanup and VLA removal Thomas Gleixner
2018-04-22 16:23 ` [patch V3 01/10] rslib: Add GFP aware init function Thomas Gleixner
2018-04-25  1:16   ` Stephen Rothwell [this message]
2018-04-25  2:45     ` Kees Cook
2018-04-25  8:59       ` Thomas Gleixner
2018-04-22 16:23 ` [patch V3 02/10] dm/verity_fec: Use GFP aware reed solomon init Thomas Gleixner
2018-04-22 16:23 ` [patch V3 03/10] rslib: Cleanup whitespace damage Thomas Gleixner
2018-04-22 16:23 ` [patch V3 04/10] rslib: Cleanup top level comments Thomas Gleixner
2018-04-22 16:23 ` [patch V3 05/10] rslib: Add SPDX identifiers Thomas Gleixner
2018-04-22 16:23 ` [patch V3 06/10] rslib: Remove GPL boilerplate Thomas Gleixner
2018-04-22 16:23 ` [patch V3 07/10] rslib: Simplify error path Thomas Gleixner
2018-04-22 16:23 ` [patch V3 08/10] rslib: Split rs control struct Thomas Gleixner
2018-04-22 16:23 ` [patch V3 09/10] mtd: rawnand: diskonchip: Allocate rs control per instance Thomas Gleixner
2018-04-22 16:23 ` [patch V3 10/10] rslib: Allocate decoder buffers to avoid VLAs Thomas Gleixner
2018-04-24 16:42 ` [patch V3 00/10] rslib: Cleanup and VLA removal Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180425111617.2f4dc127@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=agk@redhat.com \
    --cc=akpm@linuxfoundation.org \
    --cc=anton@enomsg.org \
    --cc=boris.brezillon@free-electrons.com \
    --cc=ccross@android.com \
    --cc=dwmw2@infradead.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=richard@nod.at \
    --cc=segher@kernel.crashing.org \
    --cc=snitzer@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.