All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, hverkuil@xs4all.nl, mchehab@kernel.org
Subject: Re: [PATCH 3/3] videobuf2-core.h: Document the alloc memop size argument as page aligned
Date: Thu, 13 Dec 2018 15:08:32 +0200	[thread overview]
Message-ID: <1577929.OiQQvTjWSZ@avalon> (raw)
In-Reply-To: <20181213130203.jzjltl6hxlwlp5wk@paasikivi.fi.intel.com>

Hi Sakari,

On Thursday, 13 December 2018 15:02:03 EET Sakari Ailus wrote:
> On Thu, Dec 13, 2018 at 02:59:50PM +0200, Laurent Pinchart wrote:
> > On Thursday, 13 December 2018 12:40:06 EET Sakari Ailus wrote:
> > > The size argument of the alloc memop, which allocates buffer memory, is
> > > page aligned. Document it as such, as code elsewhere has not taken this
> > > into account.
> > > 
> > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > > ---
> > > 
> > >  include/media/videobuf2-core.h | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/include/media/videobuf2-core.h
> > > b/include/media/videobuf2-core.h index e86981d615ae4..68b9fe660e4f1
> > > 100644
> > > --- a/include/media/videobuf2-core.h
> > > +++ b/include/media/videobuf2-core.h
> > > @@ -54,7 +54,8 @@ struct vb2_threadio_data;
> > >   *		will then be passed as @buf_priv argument to other ops in this
> > >   *		structure. Additional gfp_flags to use when allocating the
> > >   *		are also passed to this operation. These flags are from the
> > > - *		gfp_flags field of vb2_queue.
> > > + *		gfp_flags field of vb2_queue. The size argument to this function
> > > + *		shall be *page aligned*.
> > >   * @put:	inform the allocator that the buffer will no longer be used;
> > >   *		usually will result in the allocator freeing the buffer (if
> > >   *		no other users of this buffer are present); the @buf_priv
> > 
> > I wonder if a WARN_ON() to ensure this would make sense. In any case,
> 
> There's a single place where the alloc() op is called. I thought it'd be
> silly to put a check after the line of code that performs the alignment.

I was thinking about WARN_ON in the memory allocators, but if it's called from 
a single place, I agree it may not be needed. A comment in the dma-sg 
allocator would be useful though.

> Perhaps a comment right there?
> 
> I'm open to other ideas that don't seem silly. :-)

Stop calling my ideas silly :-)

> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

-- 
Regards,

Laurent Pinchart




      reply	other threads:[~2018-12-13 13:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 10:40 [PATCH 0/3] Videobuf2 corner case fixes Sakari Ailus
2018-12-13 10:40 ` [PATCH 1/3] videobuf2-core: Prevent size alignment wrapping buffer size to 0 Sakari Ailus
2018-12-13 11:22   ` Hans Verkuil
2018-12-13 12:49   ` Laurent Pinchart
2018-12-13 13:06     ` Sakari Ailus
2018-12-13 10:40 ` [PATCH 2/3] videobuf2-dma-sg: Prevent size from overflowing Sakari Ailus
2018-12-13 11:24   ` Hans Verkuil
2018-12-13 12:57   ` Laurent Pinchart
2018-12-13 13:00     ` Sakari Ailus
2018-12-13 13:03       ` Laurent Pinchart
2018-12-13 13:07         ` Sakari Ailus
2018-12-13 10:40 ` [PATCH 3/3] videobuf2-core.h: Document the alloc memop size argument as page aligned Sakari Ailus
2018-12-13 11:25   ` Hans Verkuil
2018-12-13 12:59   ` Laurent Pinchart
2018-12-13 13:02     ` Sakari Ailus
2018-12-13 13:08       ` Laurent Pinchart [this message]

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=1577929.OiQQvTjWSZ@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.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.