From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8A6CC433DB for ; Tue, 16 Feb 2021 19:29:10 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 764AF64ED0 for ; Tue, 16 Feb 2021 19:29:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 764AF64ED0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jtDhV8N0V0hprQ/BdnFawglrjajnA4kSI8rbfvvcjVY=; b=gESuRmavcqcYm5C1z+d2Yril3 SXlChCuXA7Kn5XibCysaAQ/EHdCfstqKo4L9oSbjDiKtAtyjQpLF5uR+eRclfCMiHavSwDfBZo9pM BfjIzOO6hvDAa6firH2GEKnyysN9dB6llWjQABKNm1xGaeN2i+lEJZQCE+o3CgccXEmlZGcRBU0KJ mOdOsmS5qJvpfXn0sfoDz46pFZlDtOTT1W+3gn2GOSHiKQ8tjy5mXC5HgAwqcqHO39UvaDXfgZwEZ RVdWRgXo4zX9SeMiqTBevqqNCtmYJB5+ZzwH/zeNyYtOCPwigtG++g5T+UK8y/dXlC8aYuy/3/bTA mFBEBFQfA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lC60Q-00053g-DR; Tue, 16 Feb 2021 19:27:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lC60O-00053F-8u for linux-arm-kernel@lists.infradead.org; Tue, 16 Feb 2021 19:27:29 +0000 Received: from archlinux (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A079F64ED0; Tue, 16 Feb 2021 19:27:23 +0000 (UTC) Date: Tue, 16 Feb 2021 19:27:20 +0000 From: Jonathan Cameron To: William Breathitt Gray Subject: Re: [PATCH v8 21/22] counter: 104-quad-8: Replace mutex with spinlock Message-ID: <20210216192720.75082d22@archlinux> In-Reply-To: References: <20210214181946.1d2f7e78@archlinux> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210216_142728_416731_97D39637 X-CRM114-Status: GOOD ( 21.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, gwendal@chromium.org, a.fatoum@pengutronix.de, david@lechnology.com, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, linux-kernel@vger.kernel.org, o.rempel@pengutronix.de, kernel@pengutronix.de, fabrice.gasnier@st.com, syednwaris@gmail.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, alexandre.torgue@st.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 16 Feb 2021 11:16:03 +0900 William Breathitt Gray wrote: > On Sun, Feb 14, 2021 at 06:19:46PM +0000, Jonathan Cameron wrote: > > On Fri, 12 Feb 2021 21:13:45 +0900 > > William Breathitt Gray wrote: > > > > > This patch replaces the mutex I/O lock with a spinlock. This is in > > > preparation for a subsequent patch adding IRQ support for 104-QUAD-8 > > > devices; we can't sleep in an interrupt context, so we'll need to use a > > > spinlock instead. > > > > > > Cc: Syed Nayyar Waris > > > Signed-off-by: William Breathitt Gray > > > > Why do these need to be raw_spin_locks? > > Normally only need to do that if in code related to interrupt chips etc, > > not their use. > > > > Jonathan > > This lock can be taken in an interrupt context in a subsequent patch: > counter_push_event() called by quad8_irq_handler() can end up calling > the Counter component callbacks which take this lock. We can't use a > mutex nor a regular spinlock because those can sleep on RT setups [1] But on RT setups the interrupts become threads and are preemptable etc, so that shouldn't matter. There are a few corner cases that cause trouble, but in most normal drivers you should be fine with a spin_lock. Jonathan > which would result in a deadlock due to the interrupt context here -- so > therefore we're left with using raw_spin_lock. > > [1] https://lwn.net/Articles/367219/ > > William Breathitt Gray _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel