From: Davidlohr Bueso Date: Wed, 11 Sep 2013 21:26:26 +0000 (-0700) Subject: ipc: document general ipc locking scheme X-Git-Tag: upstream/snapshot3+hdmi~4342^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05603c44a7627793219b0bd9a7b236099dc9cd9d;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git ipc: document general ipc locking scheme As suggested by Andrew, add a generic initial locking scheme used throughout all sysv ipc mechanisms. Documenting the ids rwsem, how rcu can be enough to do the initial checks and when to actually acquire the kern_ipc_perm.lock spinlock. I found that adding it to util.c was generic enough. Signed-off-by: Davidlohr Bueso Tested-by: Sedat Dilek Cc: Rik van Riel Cc: Manfred Spraul Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/ipc/util.c b/ipc/util.c index 9a1d779..1ddadcf 100644 --- a/ipc/util.c +++ b/ipc/util.c @@ -15,6 +15,14 @@ * Jun 2006 - namespaces ssupport * OpenVZ, SWsoft Inc. * Pavel Emelianov + * + * General sysv ipc locking scheme: + * when doing ipc id lookups, take the ids->rwsem + * rcu_read_lock() + * obtain the ipc object (kern_ipc_perm) + * perform security, capabilities, auditing and permission checks, etc. + * acquire the ipc lock (kern_ipc_perm.lock) throught ipc_lock_object() + * perform data updates (ie: SET, RMID, LOCK/UNLOCK commands) */ #include