Subject: Re: CVS commit: src/sys/dev/ata
To: Cherry G. Mathew <cherry@sdf.lonestar.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 04/05/2006 23:40:19
[ dropping port-macppc because it's not macppc-specific at all ]

On Wed, Apr 05, 2006 at 06:24:12PM +0530, Cherry G. Mathew wrote:
> 
>     Manuel> No, it's not a macppc specific thing, I think all systems
>     Manuel> with IDE disks could benefit from this (it's possible that
>     Manuel> PC systems with ACPI also don't sleep the drive before
>     Manuel> power off). This has to be done in the shutdown hook, but
>     Manuel> the shutdown hook needs more informations to work
>     Manuel> properly.  I suspect this could benefit others drivers
>     Manuel> using shutdown hooks too.
> 
> 
> I'm trying to imagine what that would look like.
> Would it be overkill if we introduced a 'payload' or 'in' variable in
> struct hook_desk;
> 
> /*
>  * A generic linear hook.
>  */
> struct hook_desc {
> 	LIST_ENTRY(hook_desc) hk_list;
> 	void	(*hk_fn)(void *);
> 	void	*hk_arg;
> +       hookflag_t flag;
> };
> 
> 
> or would it be best for the flag to be global ?

Well, I have no ideas on this. I just can say that when I looked at
it, I saw it would touch a lot of code and said "I'll do it later" :)

Would the generic hook subsystem be more usefull if the caller could pass
an opaque argument to the callees ? The overhead is probably not a problem
here, it's not a critical path.

I have another issue with the way shutdown hooks work currently (mostly
related to raidframe, but other drivers could probably have the same issue).
In short, some subsystems want a powerhook to be called from valid kernel
thread context, before interrupts are blocked, to be able to stop
operations in progress that need a callback from a lower subsystem
to complete. This could be a second set of powerhooks, or the same powerhook
list called with 2 different parameters.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--