From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: [PATCH v2 2/7] iommu: IOMMU Groups Date: Thu, 21 Jun 2012 10:07:34 +1000 Message-ID: <1340237254.28143.201.camel@pasglop> References: <20120530201424.31527.33142.stgit@bling.home> <20120530201852.31527.23265.stgit@bling.home> <1340186501.28143.158.camel@pasglop> <1340210921.5076.76.camel@bling.home> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1340210921.5076.76.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Alex Williamson Cc: aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, liuj97-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Wed, 2012-06-20 at 10:48 -0600, Alex Williamson wrote: > Yes, I was assuming the caller held a reference to the struct device to > prevent such a race, looks like I forgot to document that in the > comments. I'll have to think about if we can fix the ordering problem. > We can re-order the list_add vs notification, but then we just risk > dropping the remove. Perhaps we need to extend the lock or add another > to group {list add, notify add}, {list lookup, remove, notify remove}. > I'm not even sure this race is possible though w/ a device reference. Or we put the burden on the callers not to racily add & remove, including full completion of related notifiers. Might not even be hard (ie might already be the case). Cheers, Ben.