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=-5.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 E803CC433E0 for ; Thu, 18 Feb 2021 10:17:38 +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 8C64764E85 for ; Thu, 18 Feb 2021 10:17:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C64764E85 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LiVnUALkAFs28bSN/iClJfSA4Q6KtiKL/F28JsUEugE=; b=abwjOqAHKA+Ks1oHnKBZAwn2a 2qNqQ3auBHF9URRt0IdF8njQW2pwwCVgZ42eVp6gwGsvu7afWw1AQjzkyqQfh5P5aCzrIxqPMJACQ 1Cghgxj88xjjFJtFJSHQtDFNOqp6QEoVpVLF9MHS/vmOLm7KUxqjuSbS/+diHqwVY73Jdl1aLykdn vESeZhXmjI/gHYzdD+C8khouOdH0ZIr2CiRR38qhl3K2KHZMcsAQ64R2/pQufD+KscsAHY20Yduvn SvVnJUM44FhtU+pWLlztBkYB5CizRqb0eQRdgHSyL/wbTNvTfx2QbpJJGYBFf8yQy1ea8TSsc5aNx 3+G5eyKYA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCgMA-0001lW-VF; Thu, 18 Feb 2021 10:16:23 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCgM8-0001kP-1q for linux-arm-kernel@lists.infradead.org; Thu, 18 Feb 2021 10:16:21 +0000 Received: by mail-qk1-x72d.google.com with SMTP id v206so1546259qkb.3 for ; Thu, 18 Feb 2021 02:16:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HqYkgCpjSPW+7F/Sy105/jMqMoKMqyjH6uBkL+9+REE=; b=bjHLCgEvzSj1u5NBEHNFSvRURMSBA4NFzeJ0zvH7t4X/PKfX7qN1JrT6++1lT0JoWJ LmEcbURYbtwaqEE4L2B7KodzoBozVMmIpnDfLqFdaQcr+31EeeryX2MK/SJixTVmnsIN 4i2LYzoQNoIzJZpEHmbGcpkw4xJcAPSWy2Wg/KDKP/LYgDrP20fk3GNMOdmEBaUaRUTW bjWNVnO3HUAaNZzZJXPn9miGyjJswC7r8OWuzBweHmqOgGjSuiyjU164ExByIH7agxLh HbwZ0wpm28/Iyn67JrpBVzb2bIEeEiGpraeSIvW0EK+CZMg8gjIsUjboZh6eYIFdcoP7 9eTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HqYkgCpjSPW+7F/Sy105/jMqMoKMqyjH6uBkL+9+REE=; b=QW40CSYMrStRvDYHTYAN1vSo3oZm2cNREVM2cYdcH3yDiRlPltxDzEjzOY5SRrIqPR TCePNGGROKmQ8t8odTfouLaBIKlzGMyN3GTbfgGoDhClt/LwW08k4TLAw3tv/a/2FcB0 TySoRM6IisBVqkzBq0RmLoknnPjzqm1NRSWHNCfeBugbEKPLEE8NiOazAG978PDIv/XE n9opt2TvDqKOcViTWGzjNp30lQWvfJbUPlNCVMuK3POV75LRDZreawD8OvTmKhlkU2DD /9rx8JgvjN4vF2vhsmR8+6iROTgoobqI5QomG7RN3TBOsbaz5I1WJOLDO+jzs1raMONV xE2g== X-Gm-Message-State: AOAM532+7JDrMsapNoqEqqZOIv7JLVAbYTuAvUJ2EyjPO5SuyqtzCD9t eg8ygoGJ9mtCqwRvlhp32F4= X-Google-Smtp-Source: ABdhPJzwf7tAcl8J6SrMTdWQ+bTkREFQjQqdIE9c2m4MIc3VhuWvChczJlBaGH4qxdL06pPohfbyHQ== X-Received: by 2002:a37:4fd2:: with SMTP id d201mr3494806qkb.232.1613643376916; Thu, 18 Feb 2021 02:16:16 -0800 (PST) Received: from shinobu ([193.27.12.132]) by smtp.gmail.com with ESMTPSA id v1sm3757790qki.49.2021.02.18.02.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 02:16:15 -0800 (PST) Date: Thu, 18 Feb 2021 19:16:08 +0900 From: William Breathitt Gray To: Jonathan Cameron Subject: Re: [PATCH v8 21/22] counter: 104-quad-8: Replace mutex with spinlock Message-ID: References: <20210214181946.1d2f7e78@archlinux> <20210216192720.75082d22@archlinux> MIME-Version: 1.0 In-Reply-To: <20210216192720.75082d22@archlinux> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210218_051620_135732_708E640B X-CRM114-Status: GOOD ( 24.41 ) 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: multipart/mixed; boundary="===============3071163836208303377==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3071163836208303377== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+eKruDaQgZ0deyTo" Content-Disposition: inline --+eKruDaQgZ0deyTo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 16, 2021 at 07:27:20PM +0000, Jonathan Cameron wrote: > On Tue, 16 Feb 2021 11:16:03 +0900 > William Breathitt Gray wrote: >=20 > > 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: > > > =20 > > > > 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 u= se a > > > > spinlock instead. > > > >=20 > > > > Cc: Syed Nayyar Waris > > > > Signed-off-by: William Breathitt Gray =20 > > >=20 > > > Why do these need to be raw_spin_locks? > > > Normally only need to do that if in code related to interrupt chips e= tc, > > > not their use. > > >=20 > > > Jonathan =20 > >=20 > > 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] >=20 > 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. >=20 > Jonathan Thinking this over again I realize you're probably right. A simple spin_lock should be fine for these drivers, so I'll switch over to that instead of the raw_spin_lock for this driver and the Counter interface code. William Breathitt Gray > > which would result in a deadlock due to the interrupt context here -- so > > therefore we're left with using raw_spin_lock. > >=20 > > [1] https://lwn.net/Articles/367219/ > >=20 > > William Breathitt Gray >=20 --+eKruDaQgZ0deyTo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAmAuPmcACgkQhvpINdm7 VJJlQQ//TGIj8Nm+JA1eSMPG5CK4MXy5g1jHCLnb9hf2L7kuuE6Szwnsth3IQ6Ds QHYkyzTiZt1SIAZ/x1cJPyg7sI09H5KUo9mkh+pPqqDodvOynZVDrvCqp/nhIkKx ued5CyWx9illXCF/Myj9ARoknDxK/k0MEEFHBhdbRaTavauIWrEN4W+tKpw0JMom OXlssOmPeJ51evjd9YwwUUZgoVhrYneaOqx8NCC6Hv4CXIT9wQLnQsXrg6T8zKb7 FbrITR46MkXZyh5iibbDe7am8rIMYindyEjRQiMitYsOgNFYwdsnHfeNGDvKLmYB l5bPIfyIzjnfANGKvPfXTaS3umavlkdjbOmpD0dgXoW1XqU8Jk2tsul3Ou3ooqSG DkxRfRxVk5aRgjoONGJgZPP4kOLGZ4/BV/GABasSXmyXpZ26h/+J39kDg9AHKVH+ CHEf+RVbx3QbXO7UgBC0jK1BdpclRpwJWWgJOUWdn1SNYiTN7mEZUAQMj3AU8PGQ q3UyIkM/Zd5te/XsfuxVa2GucgRizIRs4WYw/Njmz32gJyVMTiCrskEkFywlA4ZY HntEfYNJop/zzyCblaLp8/0qEfqDfUg/MpUILqZEobE9+oI2gTJ8HVCLvwUVWN8g /RgD9t6Gl8LvUZCMAOwswLcZGreYIjO7h0m8jfbUYakB3Y5bYCs= =enNp -----END PGP SIGNATURE----- --+eKruDaQgZ0deyTo-- --===============3071163836208303377== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3071163836208303377==--