Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1357148

Re: [PATCH] media: add GFP flag to media_*() that could get called in atomic context

From Sakari Ailus <sakari.ailus@iki.fi>
Newsgroups linux.kernel
Subject Re: [PATCH] media: add GFP flag to media_*() that could get called in atomic context
Date 2016-03-14 12:00 +0100
Message-ID <rcyo9-2Ex-5@gated-at.bofh.it> (permalink)
References <rc3kl-6OU-5@gated-at.bofh.it> <rcv6W-DY-25@gated-at.bofh.it> <rcxLr-2p3-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Mauro,

On Mon, Mar 14, 2016 at 07:13:58AM -0300, Mauro Carvalho Chehab wrote:
> Em Mon, 14 Mar 2016 09:22:37 +0200
> Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> 
> > Hi Shuah,
> > 
> > On Sat, Mar 12, 2016 at 06:48:09PM -0700, Shuah Khan wrote:
> > > Add GFP flags to media_create_pad_link(), media_create_intf_link(),
> > > media_devnode_create(), and media_add_link() that could get called
> > > in atomic context to allow callers to pass in the right flags for
> > > memory allocation.
> > > 
> > > tree-wide driver changes for media_*() GFP flags change:
> > > Change drivers to add gfpflags to interffaces, media_create_pad_link(),
> > > media_create_intf_link() and media_devnode_create().
> > > 
> > > Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> > > Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>  
> > 
> > What's the use case for calling the above functions in an atomic context?
> > 
> 
> ALSA code seems to do a lot of stuff at atomic context. That's what
> happens on my test machine when au0828 gets probed before
> snd-usb-audio:
> 	http://pastebin.com/LEX5LD5K
> 
> It seems that ALSA USB probe routine (usb_audio_probe) happens in
> atomic context.

usb_audio_probe() grabs a mutex (register_mutex) on its own. It certainly
cannot be called in atomic context.

In the above log, what I did notice, though, was that because *we* grab
mdev->lock spinlock in media_device_register_entity(), we may not sleep
which is what the notify() callback implementation in au0828 driver does
(for memory allocation).

Could we instead replace mdev->lock by a mutex?

If there is no pressing need to implement atomic memory allocation I simply
wouldn't do it, especially in device initialisation where an allocation
failure will lead to probe failure as well.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] media: add GFP flag to media_*() that could get called  in atomic context Sakari Ailus <sakari.ailus@iki.fi> - 2016-03-14 08:30 +0100
  Re: [PATCH] media: add GFP flag to media_*() that could get called  in atomic context Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-03-14 11:20 +0100
    Re: [PATCH] media: add GFP flag to media_*() that could get called in atomic context Takashi Iwai <tiwai@suse.de> - 2016-03-14 11:40 +0100
    Re: [PATCH] media: add GFP flag to media_*() that could get called  in atomic context Sakari Ailus <sakari.ailus@iki.fi> - 2016-03-14 12:00 +0100
      Re: [PATCH] media: add GFP flag to media_*() that could get called  in atomic context Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-03-14 12:50 +0100
        Re: [PATCH] media: add GFP flag to media_*() that could get called  in atomic context Sakari Ailus <sakari.ailus@iki.fi> - 2016-03-14 13:10 +0100
          Re: [PATCH] media: add GFP flag to media_*() that could get called  in atomic context Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-03-15 17:00 +0100
            Re: [PATCH] media: add GFP flag to media_*() that could get called  in atomic context Sakari Ailus <sakari.ailus@iki.fi> - 2016-03-16 09:30 +0100
              Re: [PATCH] media: add GFP flag to media_*() that could get called  in atomic context Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-03-16 13:10 +0100

csiph-web