public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Parag Warudkar <kernel-stuff@comcast.net>
To: Andrew Morton <akpm@osdl.org>
Cc: bcollins@debian.org, linux-kernel@vger.kernel.org,
	linux1394-devel@lists.sourceforge.net
Subject: Re: [PATCH] ohci1394: dma_pool_destroy while in_atomic() && irqs_disabled()
Date: Sun, 30 Jan 2005 17:49:28 -0500	[thread overview]
Message-ID: <41FD6478.9040404@comcast.net> (raw)
In-Reply-To: <20050130131723.781991d3.akpm@osdl.org>

Andrew Morton wrote:

>yup.  But what happens if someone removes the module while
>ohci_free_dma_work_fn() is still pending?
>
>Suggestions:
>
>- The work_struct cannot be on the stack.  The code as you have it will
>  read gunk from the stack when the delayed work executes.  The work_struct
>  needs to be placed into some ohci data structure which has the appropriate
>  lifetime.  That might be struct ti_ohci.  Or not.
>  
>
Ok, got it.

>- We'll need a flush_workqueue() in the teardown function for that data
>  structure to ensure that any pending callbacks have completed before we
>  free the storage.
>  
>
By saying flush_workqueue did you intend to suggest using separate work 
queue for ohci1394? I think that might be the way to go since otherwise 
ohci1394 would have to wait on all other irrelevant work elements in the 
global queue to be finished. This will help in solving the other problem 
of dma_pool_create as well - we could then schedule_work for all 
create_pools and just do a flush_workqueue before starting to actually 
use the device. (Might help in reducing those sound skips when I attach 
my camcorder :) Error handling has to change a good amount (right now 
the init function returns ENOMEM if dma_pool_create fails and all is 
done. With this approach  of asynch  alloc , init function will not know 
if the allocation failed / succeeded. All other functions (like say 
resulting from sys_read) will have to explicitly check and return error 
to user if the pool create had failed.)

>  Care needs to be taken to ensure that the work_struct is suitably
>  initialised so that the flush_workqueue() will work OK even if the
>  callback has never been scheduled.
>  
>
Didn't understand this one  - Is this about properly NULL'ing elements 
in work queue so flush_workqueue doesn't touch them? Can you elaborate 
please?

>- You have several typecasts between struct pci_pool* and void*.  These
>  defeat typechecking.  It's better to leave these casts out.
>  
>
Will leave them out.

Thanks

Parag

  reply	other threads:[~2005-01-30 22:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-30 20:54 [PATCH] ohci1394: dma_pool_destroy while in_atomic() && irqs_disabled() Parag Warudkar
2005-01-30 21:17 ` Andrew Morton
2005-01-30 22:49   ` Parag Warudkar [this message]
2005-01-30 23:02     ` Andrew Morton
2005-01-31  1:19       ` Parag Warudkar
2005-01-31 23:26         ` Parag Warudkar
2005-02-11 15:35         ` Dan Dennedy
2005-02-11 18:43           ` Jody McIntyre
2005-02-12  3:54             ` Parag Warudkar
2005-02-18 15:32               ` Dan Dennedy
2005-02-18 15:42                 ` Parag Warudkar
2005-02-19  6:36                   ` Jody McIntyre
2005-02-19 15:06                     ` Parag Warudkar
  -- strict thread matches above, loose matches on Subject: below --
2005-02-19 19:36 David Brownell
2005-02-19 20:50 ` Parag Warudkar
2005-02-19 21:13   ` David Brownell
2005-02-19 22:55 ` Jody McIntyre

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=41FD6478.9040404@comcast.net \
    --to=kernel-stuff@comcast.net \
    --cc=akpm@osdl.org \
    --cc=bcollins@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox