Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751914Ab0L2Jqr (ORCPT ); Wed, 29 Dec 2010 04:46:47 -0500 Received: from mail-iy0-f194.google.com ([209.85.210.194]:37416 "EHLO mail-iy0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750758Ab0L2Jqq (ORCPT ); Wed, 29 Dec 2010 04:46:46 -0500 MIME-Version: 1.0 X-Originating-IP: [93.172.188.89] In-Reply-To: References: <1292870624-25450-1-git-send-email-felipe.contreras@nokia.com> <1293452486-notmuch-felipe.contreras@nokia.com> From: Ohad Ben-Cohen Date: Wed, 29 Dec 2010 11:46:25 +0200 Message-ID: Subject: Re: [PATCH v2] staging: tidspbridge: protect dmm_map properly To: Felipe Contreras Cc: Felipe Contreras , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, greg@kroah.com, omar.ramirez@ti.com, fernando.lugo@ti.com, nm@ti.com, ameya.palande@nokia.com, h-kanigeri2@ti.com Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1649 Lines: 40 On Wed, Dec 29, 2010 at 11:39 AM, Felipe Contreras wrote: > On Tue, Dec 28, 2010 at 2:37 PM, Ohad Ben-Cohen wrote: >> On Tue, Dec 28, 2010 at 2:24 PM, Felipe Contreras >> wrote: >>> user-space crashed, not kernel-space; the code would continue to run >>> and eventually release the lock. >> >> So you'll have to be more specific about the scenario you are describing. >> >> If there's a user thread that is still running the proc_*_dma() >> function, and we agree that this thread keeps running until completion >> and then returns to user space, what's the problem ? > > The problem is if the user-space process crashes exactly in the middle > of it, *before* completing. With locks there's no problem, as > proc_un_map() would wait for the lock in my patch. In your patch it > would not wait, just return -EBUSY. We have two threads. One called proc_un_map(), and one called proc_begin_dma(). The first crashed, but the second didn't. it still holds the bridge device open. When it will exit, and release the device, then drv_remove_all_resources() will be called, and all the map_obj's will be cleaned. > >> If that user thread will crash, drv_remove_all_resources() will clean >> up all map_obj's. > > Not if a proc_*_dma() is still running. It will be called after it will return, and its thread will exit (or crash). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/