Re: [RFC] x86: Switch apm to unlocked_kernel

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Alan Cox <alan@...>
Cc: <mingo@...>, <linux-kernel@...>, Stephen Rothwell <sfr@...>
Date: Saturday, May 24, 2008 - 2:59 pm

Kevin Winchester wrote:

(Added Stephen to cc as he is the maintainer here)

After looking at this for a while to figure out the necessary locking, I 
discovered drivers/char/apm_emulation.c, which has very similar 
structures to arch/x86/kernel/apm_32.c, and has much more locking (e.g. 
A state_lock mutex, a user_list_lock rwsem) and it uses a list_head for 
the apm_user_list instead of an open coded doubly linked list.

This brought up the following question:

- Should I just copy the locking from apm_emulation to apm?  Another 
patch from Alan moved the BKL down into the apm_emulation ioctl method, 
but it seems pretty well locked as it is - so that BKL can probably just 
be removed there.

Also - as far as I can tell, the two files both do the exact same thing 
from the point of view of the kapmd thread and /dev/apm_bios file, but 
the real apm makes actual bios calls to perform the suspend/standby 
operations, and apm_emulation just uses pm methods like pm_suspend().

- Thus, shouldn't the two files share code from a common third file?

If so, I could take on the task of that refactoring, if I were given an 
idea of where I should put the new file (where does an x86 and 
drivers/char common file go?).

Possible reasons this may not be worth it include:

- The APM code is possibly fragile, and not often used anymore.  If this 
is the case, then perhaps just adding the same locking from the 
emulation file to the true apm file would be a good idea.
- There are subtle differences I am not seeing that requires the code to 
be quite separate.  If so, please let me know.


Thank you for any comments,

-- 
Kevin Winchester
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] x86: Switch apm to unlocked_kernel, Alan Cox, (Thu May 22, 4:22 pm)
Re: [PATCH] x86: Switch apm to unlocked_kernel, Kevin Winchester, (Fri May 23, 7:36 am)
Re: [RFC] x86: Switch apm to unlocked_kernel, Kevin Winchester, (Sat May 24, 2:59 pm)
Re: [PATCH] x86: Switch apm to unlocked_kernel, Stephen Rothwell, (Thu May 22, 9:03 pm)
Re: [PATCH] x86: Switch apm to unlocked_kernel, Alan Cox, (Fri May 23, 7:06 am)
Re: [PATCH] x86: Switch apm to unlocked_kernel, Stephen Rothwell, (Fri May 23, 9:23 am)
Re: [PATCH] x86: Switch apm to unlocked_kernel, Andrew Morton, (Fri May 23, 1:25 pm)